Sha256: 23410261a0d30264eb42bfd0d51268ee5d753f4c7a49c3023bc523f9b9565103

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require 'calabash-cucumber'

module Briar
  module Bars
    def toolbar_exists? (id)
      !query("toolbar marked:'#{id}'").empty?
    end

    def should_see_toolbar (id)
      screenshot_and_raise "expected to see toolbar with id '#{id}'" unless toolbar_exists? id
    end

    def should_not_see_toolbar (id)
      screenshot_and_raise "did not expect to see toolbar with id '#{id}'" if toolbar_exists? id
    end

    def toolbar_button_exists? (name_or_id)
      query("toolbar descendant view marked:#{name_or_id}")
      ## look for text button
      #text_button_arr = query("toolbar child toolbarTextButton child button child buttonLabel", :text)
      #has_text_button = text_button_arr.index(name_or_id) != nil
      ## look for non_text button
      #toolbar_button_arr = query("toolbar child toolbarButton", :accessibilityLabel)
      #has_toolbar_button = toolbar_button_arr.index(name_or_id) != nil
      #
      #has_text_button or has_toolbar_button
    end

    def should_see_toolbar_button (name_or_id)
      res = toolbar_button_exists? name_or_id
      unless res
        screenshot_and_raise "could not see toolbar button with name '#{name_or_id}'"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
briar-0.0.7 lib/briar/bars/toolbar.rb
briar-0.0.6 lib/briar/bars/toolbar.rb
briar-0.0.5 lib/briar/bars/toolbar.rb
briar-0.0.4 lib/briar/bars/toolbar.rb