Module: AppPrism::HelperMethods
- Defined in:
- lib/app_prism/helper_methods.rb
Instance Method Summary collapse
- #android? ⇒ Boolean
- #default_wait_time ⇒ Object
- #get_element_for(identifiers) ⇒ Object
- #get_elements_for(identifiers) ⇒ Object
- #ios? ⇒ Boolean
- #platform ⇒ Object
- #wait_for(wait_time = default_wait_time) ⇒ Object
Instance Method Details
#android? ⇒ Boolean
13 14 15 |
# File 'lib/app_prism/helper_methods.rb', line 13 def android? ENV['ANDROID'] == 'true' end |
#default_wait_time ⇒ Object
33 34 35 |
# File 'lib/app_prism/helper_methods.rb', line 33 def default_wait_time AppPrism::DEFAULT_WAIT_TIME || 30 end |
#get_element_for(identifiers) ⇒ Object
25 26 27 |
# 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) ⇒ Object
29 30 31 |
# File 'lib/app_prism/helper_methods.rb', line 29 def get_elements_for(identifiers) AppPrism::Elements::ElementsCollection.new(identifiers, platform) end |
#ios? ⇒ Boolean
17 18 19 |
# File 'lib/app_prism/helper_methods.rb', line 17 def ios? ENV['IOS'] == 'true' end |
#platform ⇒ Object
21 22 23 |
# 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) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# 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 |