module Briar::Control::Button

Public Instance Methods

button_exists?(button_id) click to toggle source
# File lib/briar/control/button.rb, line 6
def button_exists? (button_id)
  not query("button marked:'#{button_id}'").empty?
end
button_is_enabled(name) click to toggle source
# File lib/briar/control/button.rb, line 18
def button_is_enabled (name)
  enabled = query("button marked:'#{name}' isEnabled:1", AI).first
  enabled.eql? name
end
should_not_see_button(button_id) click to toggle source
# File lib/briar/control/button.rb, line 14
def should_not_see_button (button_id)
  screenshot_and_raise "i should not see button marked '#{button_id}'" if button_exists?(button_id)
end
should_see_button(button_id) click to toggle source
# File lib/briar/control/button.rb, line 10
def should_see_button (button_id)
  wait_for_button button_id
end
should_see_button_with_title(name, title) click to toggle source
# File lib/briar/control/button.rb, line 23
def should_see_button_with_title(name, title)
  should_see_button 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) click to toggle source
# File lib/briar/control/button.rb, line 30
def touch_button (button_id)
  should_see_button button_id
  touch("button marked:'#{button_id}'")
end
touch_button_and_wait_for_view(button_id, view_id, timeout=BRIAR_WAIT_TIMEOUT) click to toggle source
# File lib/briar/control/button.rb, line 35
def touch_button_and_wait_for_view (button_id, view_id, timeout=BRIAR_WAIT_TIMEOUT)
  touch_button(button_id)
  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) click to toggle source
# File lib/briar/control/button.rb, line 42
def touch_button_and_wait_for_view_to_disappear (button_id, view_id, timeout=BRIAR_WAIT_TIMEOUT)
  touch_button button_id
  wait_for_view_to_disappear view_id, timeout
end
touch_button_with_title(button_id, title, timeout=BRIAR_WAIT_TIMEOUT) click to toggle source
# File lib/briar/control/button.rb, line 72
def touch_button_with_title(button_id, title, timeout=BRIAR_WAIT_TIMEOUT)
  wait_for_button_with_title button_id, title, timeout
  touch("button marked:'#{button_id}'")
end
wait_for_button(button_id, timeout=BRIAR_WAIT_TIMEOUT) click to toggle source
# File lib/briar/control/button.rb, line 48
def wait_for_button (button_id, timeout=BRIAR_WAIT_TIMEOUT)
  msg = "waited for '#{timeout}' seconds but did not see button '#{button_id}'"
  wait_for(:timeout => timeout,
           :retry_frequency => BRIAR_WAIT_RETRY_FREQ,
           :post_timeout => BRIAR_WAIT_STEP_PAUSE,
           :timeout_message => msg) do
    button_exists? button_id
  end
end
wait_for_button_with_title(button_id, title, timeout=BRIAR_WAIT_TIMEOUT) click to toggle source
# File lib/briar/control/button.rb, line 58
def wait_for_button_with_title (button_id, title, timeout=BRIAR_WAIT_TIMEOUT)
  msg = "waited for '#{timeout}' seconds but did not see button '#{button_id}' with title '#{title}'"
  wait_for(:timeout => timeout,
           :retry_frequency => BRIAR_WAIT_RETRY_FREQ,
           :post_timeout => BRIAR_WAIT_STEP_PAUSE,
           :timeout_message => msg) do
    button_exists? button_id
  end
  res = query("button descendant view {text LIKE '#{title}'")
  if res.empty?
    screenshot_and_raise "expected button '#{button_id}' to have title '#{title}'"
  end
end