Module: Briar::Control::Button
- Defined in:
- lib/briar/control/button.rb
Instance Method Summary collapse
- #button_exists?(button_id) ⇒ Boolean
- #button_is_enabled(name) ⇒ Object
- #should_not_see_button(button_id) ⇒ Object
- #should_see_button(button_id) ⇒ Object
- #should_see_button_with_title(name, title) ⇒ Object
- #touch_button(button_id) ⇒ Object
- #touch_button_and_wait_for_view(button_id, view_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
- #touch_button_and_wait_for_view_to_disappear(button_id, view_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
- #touch_button_with_title(button_id, title, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
- #wait_for_button(button_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
- #wait_for_button_with_title(button_id, title, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
Instance Method Details
#button_exists?(button_id) ⇒ Boolean
6 7 8 |
# File 'lib/briar/control/button.rb', line 6 def () not query("button marked:'#{}'").empty? end |
#button_is_enabled(name) ⇒ Object
18 19 20 21 |
# File 'lib/briar/control/button.rb', line 18 def (name) enabled = query("button marked:'#{name}' isEnabled:1", AI).first enabled.eql? name end |
#should_not_see_button(button_id) ⇒ Object
14 15 16 |
# File 'lib/briar/control/button.rb', line 14 def () screenshot_and_raise "i should not see button marked '#{}'" if () end |
#should_see_button(button_id) ⇒ Object
10 11 12 |
# File 'lib/briar/control/button.rb', line 10 def () end |
#should_see_button_with_title(name, title) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/briar/control/button.rb', line 23 def (name, title) name if query("button marked:'#{name}' child label", :text).empty? screenshot_and_raise "i do not see a button marked '#{name}' with title '#{title}'" end end |
#touch_button(button_id) ⇒ Object
30 31 32 33 |
# File 'lib/briar/control/button.rb', line 30 def () touch("button marked:'#{}'") end |
#touch_button_and_wait_for_view(button_id, view_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/briar/control/button.rb', line 35 def (, view_id, timeout=BRIAR_WAIT_TIMEOUT) () unless view_id.nil? wait_for_view view_id, timeout end end |
#touch_button_and_wait_for_view_to_disappear(button_id, view_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
42 43 44 45 |
# File 'lib/briar/control/button.rb', line 42 def (, view_id, timeout=BRIAR_WAIT_TIMEOUT) wait_for_view_to_disappear view_id, timeout end |
#touch_button_with_title(button_id, title, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
72 73 74 75 |
# File 'lib/briar/control/button.rb', line 72 def (, title, timeout=BRIAR_WAIT_TIMEOUT) , title, timeout touch("button marked:'#{}'") end |
#wait_for_button(button_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/briar/control/button.rb', line 48 def (, timeout=BRIAR_WAIT_TIMEOUT) msg = "waited for '#{timeout}' seconds but did not see button '#{}'" wait_for(:timeout => timeout, :retry_frequency => BRIAR_WAIT_RETRY_FREQ, :post_timeout => BRIAR_WAIT_STEP_PAUSE, :timeout_message => msg) do end end |
#wait_for_button_with_title(button_id, title, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/briar/control/button.rb', line 58 def (, title, timeout=BRIAR_WAIT_TIMEOUT) msg = "waited for '#{timeout}' seconds but did not see button '#{}' with title '#{title}'" wait_for(:timeout => timeout, :retry_frequency => BRIAR_WAIT_RETRY_FREQ, :post_timeout => BRIAR_WAIT_STEP_PAUSE, :timeout_message => msg) do end res = query("button descendant view {text LIKE '#{title}'") if res.empty? screenshot_and_raise "expected button '#{}' to have title '#{title}'" end end |