Sha256: 181e2480c5ab823afa70620d7e058704f614083e9d1a69611b53b8eb3e9383de

Contents?: true

Size: 1.46 KB

Versions: 43

Compression:

Stored size: 1.46 KB

Contents

require 'calabash-cucumber'

module Briar
  module ImageView
    def image_view_exists?(iv_id)
      query_str = "imageView marked:'#{iv_id}'"
      exists = !query(query_str).empty?
      if exists
        alpha = query(query_str, :alpha).first.to_i
        hidden = query(query_str, :isHidden).first.to_i
        alpha > 0 and hidden == 0
      end
    end

    def should_see_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
      wait_for_image_view iv_id, timeout
    end

    def should_not_see_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
      wait_for_image_view_to_disappear iv_id, timeout
    end

    def wait_for_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
      msg = "waited for '#{timeout}' seconds but did not see image view marked: '#{iv_id}'"
      options = {:timeout => timeout,
                 :retry_frequency => BRIAR_WAIT_RETRY_FREQ,
                 :post_timeout => BRIAR_WAIT_STEP_PAUSE,
                 :timeout_message => msg}
      wait_for(options) do
        image_view_exists? iv_id
      end
    end

    def wait_for_image_view_to_disappear(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
      msg = "waited for '#{timeout}' seconds but i still see image view marked: '#{iv_id}'"
      options = {:timeout => timeout,
                 :retry_frequency => BRIAR_WAIT_RETRY_FREQ,
                 :post_timeout => BRIAR_WAIT_STEP_PAUSE,
                 :timeout_message => msg}
      wait_for(options) do
        not image_view_exists? iv_id
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
briar-1.1.3 lib/briar/image_view.rb
briar-1.1.2 lib/briar/image_view.rb
briar-1.1.1 lib/briar/image_view.rb
briar-1.1.0 lib/briar/image_view.rb
briar-1.0.1 lib/briar/image_view.rb
briar-0.1.4 lib/briar/image_view.rb
briar-1.0.0 lib/briar/image_view.rb
briar-0.1.4.b3 lib/briar/image_view.rb
briar-0.1.4.b2 lib/briar/image_view.rb
briar-0.1.4.b1 lib/briar/image_view.rb
briar-0.1.3 lib/briar/image_view.rb
briar-0.1.3.rc1 lib/briar/image_view.rb
briar-0.1.3.b11 lib/briar/image_view.rb
briar-0.1.3.b10 lib/briar/image_view.rb
briar-0.1.3.b9 lib/briar/image_view.rb
briar-0.1.3.b8 lib/briar/image_view.rb
briar-0.1.3.b7 lib/briar/image_view.rb
briar-0.1.3.b6 lib/briar/image_view.rb
briar-0.1.3.b5 lib/briar/image_view.rb
briar-0.1.3.b4 lib/briar/image_view.rb