Class: Bucky::TestEquipment::Verifications::E2eVerification

Inherits:
AbstVerification show all
Includes:
Utils::BuckyLogger, Utils::BuckyOutput
Defined in:
lib/bucky/test_equipment/verifications/e2e_verification.rb

Constant Summary

Constants included from Utils::BuckyLogger

Utils::BuckyLogger::LogFileDir

Instance Method Summary collapse

Methods included from Utils::BuckyLogger

write

Constructor Details

#initialize(driver, pages, test_case_name) ⇒ E2eVerification

Returns a new instance of E2eVerification.



16
17
18
19
20
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 16

def initialize(driver, pages, test_case_name)
  @driver = driver
  @pages = pages
  @evidence = Bucky::TestEquipment::Evidence::E2eEvidence.new(driver: driver, test_case: test_case_name)
end

Instance Method Details

#assert_contained_attribute(**args) ⇒ Object

Check whether attribute of web element contains excepted value.

Parameters:



58
59
60
61
62
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 58

def assert_contained_attribute(**args)
  Bucky::Utils::BuckyLogger.write('assert_contained_attribute', args)
  part = @pages.get_part(args)
  verify_rescue { assert(part[args[:attribute]].include?(args[:expect]&.to_s), "Not Contain Expected Attribute.\nexpect: #{args[:expect].to_s.bg_green.black}\nactual: #{part[args[:attribute]].to_s.bg_red.black}") }
end

#assert_contained_text(**args) ⇒ Object

Check whether text of web element contains expected value

Parameters:



43
44
45
46
47
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 43

def assert_contained_text(**args)
  Bucky::Utils::BuckyLogger.write('assert_contained_text', args)
  part = @pages.get_part(args)
  verify_rescue { assert(part.text.include?(args[:expect]&.to_s), "Not Contain Expected Text.\nexpect: #{args[:expect].to_s.bg_green.black}\nactual: #{part.text.to_s.bg_red.black}") }
end

#assert_contained_url(**args) ⇒ Object

Check whether url contains excepted value

Parameters:



51
52
53
54
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 51

def assert_contained_url(**args)
  Bucky::Utils::BuckyLogger.write('assert_contained_url', args)
  verify_rescue { assert(@driver.current_url.include?(args[:expect]&.to_s), "Not Contain Expected URL.\nexpect:  #{args[:expect].to_s.bg_green.black}\nactual: #{@driver.current_url.to_s.bg_red.black}") }
end

#assert_display(**args) ⇒ Object

Check whether style property includes display:block

Parameters:



74
75
76
77
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 74

def assert_display(**args)
  Bucky::Utils::BuckyLogger.write('assert display', args)
  verify_rescue { assert_true(@pages.get_part(args).displayed?, "No display this parts.\nURL: #{@driver.current_url}\npage: #{args[:page]}\npart: #{args[:part]}") }
end

#assert_exist_part(**args) ⇒ Object

Check whether web element exists

Parameters:



81
82
83
84
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 81

def assert_exist_part(**args)
  Bucky::Utils::BuckyLogger.write('assert_exist_part', args)
  verify_rescue { assert_true(@pages.part_exist?(args), "This part is not exist.\nURL: #{@driver.current_url}\npage: #{args[:page]}\npart: #{args[:part]}") }
end

#assert_is_number(**args) ⇒ Object

Check whether text of part is number

Parameters:



66
67
68
69
70
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 66

def assert_is_number(**args)
  Bucky::Utils::BuckyLogger.write('assert is number', args)
  text = @pages.get_part(args).text.sub(',', '')
  verify_rescue { assert(text.to_i.to_s == text.to_s, "Not number.\nactual: #{text.bg_red.black}") }
end

#assert_not_exist_part(**args) ⇒ Object

Check whether web element don’t exist

Parameters:



88
89
90
91
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 88

def assert_not_exist_part(**args)
  Bucky::Utils::BuckyLogger.write('assert_not_exist_part', args)
  verify_rescue { assert_false(@pages.part_exist?(args), "This part is exist.\nURL: #{@driver.current_url}\npage: #{args[:page]}\npart: #{args[:part]}") }
end

#assert_text(**args) ⇒ Object

Check whether text of web element matches expected value

Parameters:



35
36
37
38
39
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 35

def assert_text(**args)
  Bucky::Utils::BuckyLogger.write('assert_text', args)
  part = @pages.get_part(args)
  verify_rescue { assert_equal(args[:expect]&.to_s, part.text, 'Not Expected Text.') }
end

#assert_title(**args) ⇒ Object

Check whether title of web page matches expected value

Parameters:



28
29
30
31
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 28

def assert_title(**args)
  Bucky::Utils::BuckyLogger.write('assert_title', args)
  verify_rescue { assert_equal(args[:expect]&.to_s, @driver.title, 'Not Expected Title.') }
end

#pages_getterObject



22
23
24
# File 'lib/bucky/test_equipment/verifications/e2e_verification.rb', line 22

def pages_getter
  @pages
end