module Briar::Label

Public Instance Methods

label_exists?(name) click to toggle source
# File lib/briar/label.rb, line 5
def label_exists? (name)
  !query("label marked:'#{name}'").empty?
end
label_exists_with_text?(name, text) click to toggle source
# File lib/briar/label.rb, line 16
def label_exists_with_text? (name, text)
  actual = query("label marked:'#{name}'", :text).first
  actual.eql? text
end
should_not_see_label_with_text(name, text) click to toggle source
# File lib/briar/label.rb, line 28
def should_not_see_label_with_text (name, text)
  if label_exists_with_text?(name, text)
    screenshot_and_raise "i expected that i would not see '#{text}' in label named '#{name}'"
  end
end
should_see_label(name) click to toggle source
# File lib/briar/label.rb, line 9
def should_see_label (name)
  res = label_exists?(name)
  unless res
    screenshot_and_raise "i could not find label with access id #{name}"
  end
end
should_see_label_with_text(name, text) click to toggle source
# File lib/briar/label.rb, line 21
def should_see_label_with_text (name, text)
  unless label_exists_with_text?(name, text)
    actual = query("label marked:'#{name}'", :text).first
    screenshot_and_raise "i expected to see '#{text}' in label named '#{name}' but found '#{actual}'"
  end
end
touch_label(label_id, wait_for_view_id=nil) click to toggle source
# File lib/briar/label.rb, line 44
def touch_label (label_id, wait_for_view_id=nil)
  wait_for_label label_id
  touch("label marked:'#{label_id}'")
  if wait_for_view_id != nil
    wait_for_view wait_for_view_id
  else
    step_pause
  end
end
wait_for_label(label_id, timeout=BRIAR_WAIT_TIMEOUT) click to toggle source
# File lib/briar/label.rb, line 34
def wait_for_label (label_id, timeout=BRIAR_WAIT_TIMEOUT)
  msg = "waited for '#{timeout}' seconds but did not see label '#{label_id}'"
  wait_for(:timeout => timeout,
           :retry_frequency => BRIAR_WAIT_RETRY_FREQ,
           :post_timeout => BRIAR_WAIT_STEP_PAUSE,
           :timeout_message => msg) do
    label_exists? label_id
  end
end