Class: Taf::TestSteps::Handlers::CheckBoxdata

Inherits:
Base
  • Object
show all
Defined in:
lib/taf/test_steps/handlers/base/check_boxdata.rb

Overview

Check Box Data function.

Instance Method Summary collapse

Methods inherited from Base

#initialize, #login_check, #login_process, perform, #portal_mem_word, register, #url_check

Constructor Details

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

Instance Method Details

#checkObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/taf/test_steps/handlers/base/check_boxdata.rb', line 10

def check
  @elms = %i[textarea text_field iframe]

  found_box = @elms.map do |elm|
    Taf::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

  index
end

#performObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/taf/test_steps/handlers/base/check_boxdata.rb', line 25

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

  ele.wait_until(&:exists?)

  if ele.value == @value2
    Taf::MyLog.log.info(
      "Textbox: #{@value} has correct value: #{@value2}"
    )
    true
  else
    Taf::MyLog.log.warn(
      "Textbox: got #{ele.value}, expected #{@value2}"
    )
    false
  end
end