Module: RegressyCommon::Checker
- Defined in:
- lib/regressy_common/checker.rb
Instance Method Summary collapse
- #assert_element_enabled(how, what, timeout_value = 10) ⇒ Object
- #assert_element_exists(how, what, timeout_value = 10) ⇒ Object
- #assert_element_present(how, what, timeout_value = 10) ⇒ Object
- #assert_elements_enabled(how, what, index, timeout_value = 10, **options) ⇒ Object
- #assert_elements_present(how, what, index, timeout_value = 10, **options) ⇒ Object
- #element_exists_no_assert?(how, what, timeout_value = 10) ⇒ Boolean
- #element_present_no_assert?(how, what, timeout_value = 10) ⇒ Boolean
Instance Method Details
#assert_element_enabled(how, what, timeout_value = 10) ⇒ Object
21 22 23 24 |
# File 'lib/regressy_common/checker.rb', line 21 def assert_element_enabled(how, what, timeout_value=10) = (how, what) assert_elements_enabled(how, what, 0, timeout_value, failure_message: ) end |
#assert_element_exists(how, what, timeout_value = 10) ⇒ Object
4 5 6 7 8 |
# File 'lib/regressy_common/checker.rb', line 4 def assert_element_exists(how, what, timeout_value=10) assert_with_timeout((how, what), timeout_value) do (@driver.find_element(how, what))? true : false end end |
#assert_element_present(how, what, timeout_value = 10) ⇒ Object
10 11 12 13 |
# File 'lib/regressy_common/checker.rb', line 10 def assert_element_present(how, what, timeout_value=10) = (how, what) assert_elements_present(how, what, 0, timeout_value, failure_message: ) end |
#assert_elements_enabled(how, what, index, timeout_value = 10, **options) ⇒ Object
26 27 28 29 30 |
# File 'lib/regressy_common/checker.rb', line 26 def assert_elements_enabled(how, what, index, timeout_value=10, **) = .symbolize_keys = [:failure_message] || (how, what, index) assert_elements_check_method(how, what, index, :enabled?, , timeout_value) end |
#assert_elements_present(how, what, index, timeout_value = 10, **options) ⇒ Object
15 16 17 18 19 |
# File 'lib/regressy_common/checker.rb', line 15 def assert_elements_present(how, what, index, timeout_value=10, **) = &.symbolize_keys = [:failure_message] || (how, what, index) assert_elements_check_method(how, what, index, :displayed?, , timeout_value) end |
#element_exists_no_assert?(how, what, timeout_value = 10) ⇒ Boolean
32 33 34 35 36 37 38 39 |
# File 'lib/regressy_common/checker.rb', line 32 def element_exists_no_assert?(how, what, timeout_value=10) timeout_value.times do |count| elements = @driver.find_elements(how, what) return true if (elements&.length > 0) ## success sleep 1 end false end |
#element_present_no_assert?(how, what, timeout_value = 10) ⇒ Boolean
41 42 43 44 45 46 47 48 |
# File 'lib/regressy_common/checker.rb', line 41 def element_present_no_assert?(how, what, timeout_value=10) timeout_value.times do |count| elements = @driver.find_elements(how, what) return true if (elements&.length > 0 && elements[0].displayed?) ## success sleep 1 end false end |