Class: LdsAction

Inherits:
Object
  • Object
show all
Defined in:
lib/TNR360/components/lds_action.rb

Instance Method Summary collapse

Constructor Details

#initialize(browser, action_text, idScreen = nil) ⇒ LdsAction

constructor



10
11
12
13
14
15
# File 'lib/TNR360/components/lds_action.rb', line 10

def initialize(browser,action_text,idScreen=nil)
  @browser =browser
  @action_text=action_text
  @idScreen=idScreen
  @exists
end

Instance Method Details

#clickObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/TNR360/components/lds_action.rb', line 17

def click
  action_path = @action_text.split('/')
  raise "Provide at least one level of action item" if (action_path.length < 1)
  for i in 0..(action_path.length-1)
    puts "Value of local variable is #{i}"
    case i
      when 0
        @browser.table(:id => action_path[i]).button.when_present.click
        sleep($small_wait_time)
      when 1
        @browser.a(:id=> action_path[i]).when_present.click
        sleep($small_wait_time)

      when i==action_path.length-1
        @browser.a(:id=>action_path[i]).when_present.click
        sleep($small_wait_time)
      else
        @browser.a(:id=>action_path[i]).when_present.hover
        sleep($small_wait_time)
        if i==action_path.length-1
          @browser.a(:id=>action_path[i]).when_present.click
        end
    end
  end
end

#getIdScreenObject

Getters



52
53
54
# File 'lib/TNR360/components/lds_action.rb', line 52

def getIdScreen
  @idScreen
end

#isExist?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/TNR360/components/lds_action.rb', line 56

def isExist?
  @exists
end

#to_sObject

print object



44
45
46
47
48
49
50
# File 'lib/TNR360/components/lds_action.rb', line 44

def to_s
  "\n***** Button *****"+
      "\nAction text : "+ no_null(@action_text)+
      "\nIdScreen : "+ no_null(@IdScreen) +
      "\nExists : "+ no_null(@exists.to_s)+
      "\n**********"
end