module AppPrism::HelperMethods

Public Instance Methods

android?() click to toggle source
# File lib/app_prism/helper_methods.rb, line 13
def android?
  ENV['ANDROID'] == 'true'
end
default_wait_time() click to toggle source
# File lib/app_prism/helper_methods.rb, line 33
def default_wait_time
  AppPrism::DEFAULT_WAIT_TIME || 30
end
get_element_for(identifiers) click to toggle source
# File lib/app_prism/helper_methods.rb, line 25
def get_element_for(identifiers)
  AppPrism::Elements::Element.new(identifiers, platform)
end
get_elements_for(identifiers) click to toggle source
# File lib/app_prism/helper_methods.rb, line 29
def get_elements_for(identifiers)
  AppPrism::Elements::ElementsCollection.new(identifiers, platform)
end
ios?() click to toggle source
# File lib/app_prism/helper_methods.rb, line 17
def ios?
  ENV['IOS'] == 'true'
end
platform() click to toggle source
# File lib/app_prism/helper_methods.rb, line 21
def platform
  @platform ||= AppPrism::Platforms::AppiumPlatform.new(@driver)
end
wait_for(wait_time = default_wait_time) { || ... } click to toggle source
# File lib/app_prism/helper_methods.rb, line 37
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