Sha256: 3101dde491176cb78498601f50ffb3401a4effd7c605794e906c78d902e60a21

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

# if ENV['PLATFORM'] == 'ios'
#   require 'calabash-cucumber/cucumber'
#   require_relative 'platforms/i_platform'
# elsif ENV['PLATFORM'] == 'android'
#   require 'calabash-android/cucumber'
#   require_relative 'platforms/a_platform'
# end
# require_relative '../app_prism/platforms/rm'
require_relative '../app_prism/elements/element'

module AppPrism
  module HelperMethods
    def android?
      ENV['ANDROID'] == 'true'
    end

    def ios?
      ENV['IOS'] == 'true'
    end

    def platform
      @platform ||= AppPrism::Platforms::AppiumPlatform.new(@driver)
    end

    def get_element_for(identifiers)
      AppPrism::Elements::Element.new(identifiers, platform)
    end

    def get_elements_for(identifiers)
      AppPrism::Elements::ElementsCollection.new(identifiers, platform)
    end

    def default_wait_time
      AppPrism::DEFAULT_WAIT_TIME || 30
    end

    def wait_for(wait_time = default_wait_time)
      start_time = Time.now
      loop do
        return true if yield
        break unless (Time.now - start_time) < wait_time
        sleep 0.5
      end
      raise Timeout::Error, 'Timed out while waiting for block to return true'
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
app_prism-0.1.2 lib/app_prism/helper_methods.rb
app_prism-0.1.1 lib/app_prism/helper_methods.rb
app_prism-0.1.0 lib/app_prism/helper_methods.rb
app_prism-0.0.12 lib/app_prism/helper_methods.rb
app_prism-0.0.11 lib/app_prism/helper_methods.rb
app_prism-0.0.10 lib/app_prism/helper_methods.rb
app_prism-0.0.9 lib/app_prism/helper_methods.rb
app_prism-0.0.8 lib/app_prism/helper_methods.rb
app_prism-0.0.7 lib/app_prism/helper_methods.rb
app_prism-0.0.6 lib/app_prism/helper_methods.rb
app_prism-0.0.5 lib/app_prism/helper_methods.rb
app_prism-0.0.4 lib/app_prism/helper_methods.rb
app_prism-0.0.3 lib/app_prism/helper_methods.rb
app_prism-0.0.2 lib/app_prism/helper_methods.rb