Sha256: 371b4ef7f90f5ac5aa2a8f4799ff79f4a1675c5f256915a8146db0b1a2fac9eb

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

require 'calabash-cucumber'

module Briar
  module Core
    STEP_PAUSE = (ENV['STEP_PAUSE'] || 0.4).to_f
    ANIMATION_PAUSE = (ENV['ANIMATION_PAUSE'] || 0.6).to_f

    def step_pause
      sleep(STEP_PAUSE)
    end

    def wait_for_animation
      sleep(ANIMATION_PAUSE)
    end


    def view_exists? (view_id)
      !query("view marked:'#{view_id}'").empty?
    end

    def should_see_view (view_id)
      unless view_exists? view_id
        screenshot_and_raise "should see view with id '#{view_id}'"
      end
    end

    def should_not_see_view (view_id)
      if view_exists? view_id
        screenshot_and_raise "should not see view with id '#{view_id}'"
      end
    end

    def view_exists_with_text? (text)
      element_exists("view text:'#{text}'")
    end


    def should_see_view_after_animation (view_id)
      wait_for_animation
      should_see_view view_id
    end

    def should_not_see_view_after_animation (view_id)
      wait_for_animation
      if view_exists? view_id
        screenshot_and_raise "should not see view with id '#{view_id}'"
      end
    end

    def should_see_view_with_text (text)
      res = view_exists_with_text? text
      unless res
        screenshot_and_raise "should see view with text '#{text}'"
      end
    end

    def touch_view_named(view_id)
      touch("view marked:'#{view_id}'")
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
briar-0.0.6 lib/briar/briar_core.rb