Class: TestSteps::Handlers::CheckBoxdata

Inherits:
Base
  • Object
show all
Defined in:
lib/functions/handlers/check_boxdata.rb

Overview

Check Box Data function.

Instance Method Summary collapse

Methods inherited from Base

#initialize, #login_check, #login_process, #mem_word_check, #open_url_process, perform, #portal_mem_word, register

Constructor Details

This class inherits a constructor from TestSteps::Handlers::Base

Instance Method Details

#performObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/functions/handlers/check_boxdata.rb', line 11

def perform
  elms = %i[textarea text_field iframe]

  found_box = elms.map do |elm|
    Browser.b.send(elm, "#{@locate}": @value).exists?
  end.compact

  raise 'Multiple matches' if found_box.select { |i| i }.empty?

  index = found_box.index(true)
  return unless index

  ele = Browser.b.send(elms[index], "#{@locate}": @value)

  ele.wait_until(&:exists?)
  (ele.value == @value2)
  MyLog.log.info("Textbox: #{@value} has correct value: #{value2}")
  true
rescue StandardError
  MyLog.log.warn("Textbox: #{@value} does not exist")
  false
end