class LdsColumn
Public Class Methods
new(browser, idColumn, block, orderInVisible=nil)
click to toggle source
constructor
# File lib/TNR360/components/lds_column.rb, line 14 def initialize(browser, idColumn, block, orderInVisible=nil) @browser =browser @parentBlock=block @idColumn=idColumn @orderInVisible=orderInVisible update @exists end
Public Instance Methods
changeVisibility(columnLabel ,elementTobeDisplayedLabel)
click to toggle source
# File lib/TNR360/components/lds_column.rb, line 109 def changeVisibility columnLabel ,elementTobeDisplayedLabel @current_element.hover @current_element.a(:index=>0).when_present.click @browser.a(:id, columnLabel+"change-column-visibility").hover @browser.div(:id,"Payment-change-visibility-menu").div(:class,"x-menu-list").a(:id,columnLabel+"-change-visibility-"+elementTobeDisplayedLabel).click end
displayColumns(columnLabel)
click to toggle source
# File lib/TNR360/components/lds_column.rb, line 115 def displayColumns columnLabel @current_element.hover @current_element.a(:index=>0).when_present.click @browser.a(:id, columnLabel+"change-column-visibility").hover end
findElement(idElement)
click to toggle source
method locate current element
# File lib/TNR360/components/lds_column.rb, line 51 def findElement idElement begin #if element not yet available in screen, wait for some time if @parentBlock != nil @parentBlock.getElement.div(:class,"std-fieldset-bwrap").tr(:index => 0).td(:xpath => "//td[contains(@class,'"+idElement+"')]").wait_until_present(10) @current_element=@parentBlock.getElement.div(:class,"std-fieldset-bwrap").tr(:index => 0).td(:xpath => "//td[contains(@class,'"+idElement+"')]") #@current_element=@parentBlock.getElement.div(:index => 2).tr(:index=>0).td(:class => "x-grid3-header x-grid3-hd x-grid3-cell x-grid3-td-"+idElement) end rescue raise "Column "+idElement+" Not Found" ensure #rien dans finally pour ce cas if @parentBlock == nil if @browser.td(:xpath => "//td[contains(@class,'"+idElement+"')]").wait_until_present(10) count=@browser.tds(:xpath => "//td[contains(@class,'"+idElement+"')]").length end if count==0 raise "Column "+idElement+" Not Found" else if count >1 raise "Several Elements with id "+idElement+" Found, specify block" end end @current_element=@browser.td(:xpath => "//td[contains(@class,'"+idElement+"')]").when_present end end @current_element end
getClassColumn()
click to toggle source
# File lib/TNR360/components/lds_column.rb, line 130 def getClassColumn @idColumn end
getElement()
click to toggle source
Getters
# File lib/TNR360/components/lds_column.rb, line 122 def getElement @current_element end
getIdBlock()
click to toggle source
# File lib/TNR360/components/lds_column.rb, line 126 def getIdBlock @idBlock end
getLabel()
click to toggle source
# File lib/TNR360/components/lds_column.rb, line 134 def getLabel @label end
isExist?()
click to toggle source
# File lib/TNR360/components/lds_column.rb, line 143 def isExist? @exists end
isVisible?()
click to toggle source
# File lib/TNR360/components/lds_column.rb, line 138 def isVisible? @isVisible end
refresh()
click to toggle source
refresh object status from browser
# File lib/TNR360/components/lds_column.rb, line 25 def refresh #Look for element in browser @current_element= findElement @idColumn #update other data update @exists end
sortAscending(label)
click to toggle source
# File lib/TNR360/components/lds_column.rb, line 97 def sortAscending label @current_element.hover @current_element.a(:index=>0).when_present.click @browser.a(:id, label+"sort-asc-text").when_present.click end
sortDescending(label)
click to toggle source
# File lib/TNR360/components/lds_column.rb, line 103 def sortDescending label @current_element.hover @current_element.a(:index=>0).when_present.click @browser.a(:id, label+"sort-desc-text").when_present.click end
to_s()
click to toggle source
print object
# File lib/TNR360/components/lds_column.rb, line 83 def to_s "\n***** Column *****"+ "\nIdParentBlock : "+(no_null(@parentBlock)=="" ? "" : @parentBlock.getIdBlock)+ "\nIdColumn: "+ no_null(@idColumn)+ "\nLabel : "+ no_null(@label)+ "\nIsVisible : "+ bool_no_null(@visible.to_s)+ "\nOrderInVisible :"+ no_null(@orderInVisible.to_s)+ "\n**********" end
Private Instance Methods
update()
click to toggle source
private method to update/save the status of the object
# File lib/TNR360/components/lds_column.rb, line 34 def update @exists=false #Look for element in browser @current_element||= findElement @idColumn #fill @label @label=@current_element.div(:index => 0).span(:index => 0).text #fill visible @visible=@current_element.visible? #fill idColumn #@idColumn=@current_element.class_name #everything exists #changeVisibility "Payment" ,"Reject" @exists=true end