Sha256: 4a26c6fb9fbdb41f8956dea89aa387cef24e8c3368fd3be8434a8472aeb85fc4

Contents?: true

Size: 1.56 KB

Versions: 37

Compression:

Stored size: 1.56 KB

Contents

require 'calabash-cucumber'

module Briar
  module Label
    def label_exists? (name)
      !query("label marked:'#{name}'").empty?
    end

    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

    def label_exists_with_text? (name, text)
      actual = query("label marked:'#{name}'", :text).first
      actual.eql? text
    end

    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

    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

    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

    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
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
briar-2.0.5 lib/briar/label.rb
briar-2.0.4 lib/briar/label.rb
briar-2.0.3 lib/briar/label.rb
briar-2.0.2 lib/briar/label.rb
briar-2.0.1 lib/briar/label.rb
briar-2.0.0 lib/briar/label.rb
briar-1.4.2 lib/briar/label.rb
briar-1.4.1 lib/briar/label.rb
briar-1.3.2 lib/briar/label.rb
briar-1.3.1 lib/briar/label.rb
briar-1.3.0 lib/briar/label.rb
briar-1.2.2 lib/briar/label.rb
briar-1.2.1 lib/briar/label.rb
briar-1.2.0 lib/briar/label.rb
briar-1.1.9 lib/briar/label.rb
briar-1.1.8 lib/briar/label.rb
briar-1.1.7 lib/briar/label.rb
briar-1.1.6 lib/briar/label.rb
briar-1.1.5 lib/briar/label.rb
briar-1.1.4 lib/briar/label.rb