Class: TestSteps::Handlers::WriteBoxdata
- Inherits:
-
Base
- Object
- Base
- TestSteps::Handlers::WriteBoxdata
show all
- Defined in:
- lib/functions/handlers/write_box_data.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#login_button, #login_check, #login_process, #mem_word_check, #open_url_process, perform, #portal_mem_word, register
Class Method Details
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/functions/handlers/write_box_data.rb', line 19
def self.input_value(box, text, locate)
found_box = [
Browser.b.textarea("#{locate}": box).exist?,
Browser.b.text_field("#{locate}": box).exist?,
Browser.b.iframe("#{locate}": box).exist?
]
raise 'Multiple matches' if found_box.select { |i| i }.empty?
index = found_box.index(true)
return unless index
if index.zero?
Browser.b.textarea("#{locate}": box).wait_until(&:exists?).set text
(Browser.b.textarea("#{locate}": box).text == text)
elsif index == 1
Browser.b.text_field("#{locate}": box).wait_until(&:exists?).set text
(Browser.b.text_field("#{locate}": box).text == text)
elsif index == 2
Browser.b.iframe("#{locate}": box).wait_until(&:exists?).send_keys text
end
MyLog.log.info("Textbox: #{box} has correct value: #{text}")
true
rescue StandardError
MyLog.log.warn("Textbox: #{box} has the incorrect value: #{text}")
false
rescue StandardError
MyLog.log.warn("Textbox: #{box} does not exist")
false
end
|
Instance Method Details
10
11
12
13
14
15
16
17
|
# File 'lib/functions/handlers/write_box_data.rb', line 10
def perform(step_attributes)
box = step_attributes[:testvalue]
value = step_attributes[:testvalue2]
locate = step_attributes[:locate]
text = ENV[value.to_s] || step_attributes[:testvalue2]
WriteBoxdata.input_value(box, text, locate)
end
|