unobtainium 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0149281bfd2e2da421322b38d4cb69b6d2f4f3a
4
- data.tar.gz: e7a1e1693bcf73ea35451ddb8e5ecfe4b7e7fd36
3
+ metadata.gz: 5a03cc8ff5ee6dcf02b0b2b967a32ccc3053b093
4
+ data.tar.gz: ea904b1a9f7e20fd051d74fefec4a33b9c9c21ff
5
5
  SHA512:
6
- metadata.gz: c0ea47b4d44d75a1c41b3e650a58d6d74ed222783c27c2fc97714f3052a74c29d415ebd9c07dcdeb2942814e5df22878a6ff1f635076ebda9d5cc9bb75142591
7
- data.tar.gz: 3a42c4515c5ab784905f7eab416d4f57362581054023064fbf0c375c37bd79a2514ad739d0cb8b65cf6fc43bb16968e737d8b274b2b9533705e182fc89562f76
6
+ metadata.gz: c4db733242a110f7bdb634cfe883ba3553e6b0022774800daa7b9de8058b4fbbeafcc475911d9c5eef56b9b117689fd9b8124fc27bf405b3ff5c03fdf9c0fe49
7
+ data.tar.gz: 18bc60d149c2a2856085c511fc3cf477bc6a061a125e1a96058de4bdd581cff347a8897393653a9b4a10d76ee2271eb75aad289907a343a2699bbc7d344ba125
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unobtainium (0.7.1)
4
+ unobtainium (0.8.0)
5
5
  collapsium (~> 0.4)
6
6
  collapsium-config (~> 0.2)
7
7
  ptools (~> 1.3)
@@ -19,6 +19,60 @@ module Unobtainium
19
19
  ##
20
20
  # Driver implementation wrapping the appium_lib gem.
21
21
  class Appium
22
+ ##
23
+ # Proxy for the actual Appium driver.
24
+ #
25
+ # There's an unfortunate disparity of functionality between the
26
+ # Appium::Driver class, and the Selenium::WebDriver class. For maximum
27
+ # compability, we want the latter's functionality. But for maximum
28
+ # mobile functionality, we want the former.
29
+ #
30
+ # The DriverProxy class takes this into account when forwarding
31
+ # requests.
32
+ class DriverProxy
33
+ ##
34
+ # Initialize
35
+ def initialize(driver, compatibility = true)
36
+ @appium_driver = driver
37
+ @selenium_driver = driver.start_driver
38
+
39
+ # Prioritize the two different drivers according to whether
40
+ # compatibility with Selenium is more desirable than functionality.
41
+ # Note that this only matters when both classes implement the same
42
+ # methods! Differently named methods will always be supported either
43
+ # way.
44
+ if compatibility
45
+ @drivers = [@selenium_driver, @appium_driver]
46
+ else
47
+ @drivers = [@appium_driver, @selenium_driver]
48
+ end
49
+ end
50
+
51
+ ##
52
+ # Map any missing method to the driver implementation
53
+ def respond_to_missing?(meth, include_private = false)
54
+ @drivers.each do |driver|
55
+ if not driver.nil? and driver.respond_to?(meth, include_private)
56
+ return true
57
+ end
58
+ end
59
+ return super
60
+ end
61
+
62
+ ##
63
+ # Map any missing method to the driver implementation
64
+ def method_missing(meth, *args, &block)
65
+ @drivers.each do |driver|
66
+ if not driver.nil? and driver.respond_to?(meth)
67
+ return driver.send(meth.to_s, *args, &block)
68
+ end
69
+ end
70
+ # :nocov:
71
+ return super
72
+ # :nocov:
73
+ end
74
+ end
75
+
22
76
  # Recognized labels for matching the driver
23
77
  LABELS = {
24
78
  ios: [:iphone, :ipad],
@@ -95,9 +149,14 @@ module Unobtainium
95
149
  ##
96
150
  # Create and return a driver instance
97
151
  def create(_, options)
98
- # Create the driver
99
- driver = ::Appium::Driver.new(options).start_driver
100
- return driver
152
+ # Determine compatibility option
153
+ compat = options.fetch(:webdriver_compatibility, true)
154
+ options.delete(:webdriver_compatibility)
155
+
156
+ # Create & return proxy
157
+ driver = ::Appium::Driver.new(options)
158
+ result = DriverProxy.new(driver, compat)
159
+ return result
101
160
  end
102
161
 
103
162
  private
@@ -8,5 +8,5 @@
8
8
  #
9
9
  module Unobtainium
10
10
  # The current release version
11
- VERSION = "0.7.1".freeze
11
+ VERSION = "0.8.0".freeze
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unobtainium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Finkhaeuser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-09 00:00:00.000000000 Z
11
+ date: 2016-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler