Class: Unobtainium::Drivers::Appium
- Inherits:
-
Object
- Object
- Unobtainium::Drivers::Appium
- Defined in:
- lib/unobtainium/drivers/appium.rb
Overview
Driver implementation wrapping the appium_lib gem.
Constant Summary collapse
- LABELS =
Recognized labels for matching the driver
{ appium: [], ios: [:iphone, :ipad], android: [], }.freeze
- BROWSER_MATCHES =
Browser matches for some platforms TODO: add many more matches
{ android: { chrome: { appPackage: 'com.android.chrome', appActivity: 'com.google.android.apps.chrome.Main', }, }, }.freeze
Class Method Summary collapse
-
.create(label, options) ⇒ Object
Create and return a driver instance.
-
.ensure_preconditions(_, _) ⇒ Object
Ensure that the driver’s preconditions are fulfilled.
-
.matches?(label) ⇒ Boolean
Return true if the given label matches this driver implementation, false otherwise.
Class Method Details
.create(label, options) ⇒ Object
Create and return a driver instance
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/unobtainium/drivers/appium.rb', line 53 def create(label, ) # The label specifies the platform, if no other platform is given. normalized = normalize_label(label) if not .is_a? Hash = {} end if not ['caps'].is_a? Hash ['caps'] = {} end if ['caps']['platformName'].nil? ['caps']['platformName'] = normalized.to_s end # If no app is given, but a browser is requested, we can supplement # some information = supplement_browser() # Create the driver driver = ::Appium::Driver.new().start_driver return driver end |
.ensure_preconditions(_, _) ⇒ Object
Ensure that the driver’s preconditions are fulfilled.
43 44 45 46 47 48 49 |
# File 'lib/unobtainium/drivers/appium.rb', line 43 def ensure_preconditions(_, _) require 'appium_lib' rescue LoadError => err raise LoadError, "#{err.}: you need to add "\ "'appium_lib' to your Gemfile to use this driver!", err.backtrace end |
.matches?(label) ⇒ Boolean
Return true if the given label matches this driver implementation, false otherwise.
37 38 39 |
# File 'lib/unobtainium/drivers/appium.rb', line 37 def matches?(label) return nil != normalize_label(label) end |