RDee 0.8 → 0.9

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: 172c691a21baa5997beb5d750136ed2afc72bae0
4
- data.tar.gz: 5daa937a078c5372b3936be8fb6bada94b794351
3
+ metadata.gz: '04889259fae611a4e82a6452441d2985b7aea701'
4
+ data.tar.gz: fff9ed349e53e614e59dcceb2bb3a3e274717c91
5
5
  SHA512:
6
- metadata.gz: cd0680641d78a1f83e136af89ac01104afb475a20d49421d96b6fc0b861c865731f99ce07b0a9005a5ccefbd7689abd6bd7f457ddbdc89ec899ec3b1d1dc380d
7
- data.tar.gz: 657f3528866f1f2d1aa4f79f0d2aeef1bbf35baf53b678f65f21836fb4c8cdd906196d19f090b582b2c250a6deede50a26a68d2a977e4bb7c9c0ffe8b5522915
6
+ metadata.gz: 3b612a6e7c7e96b669ce1089597c4a9f85cadb33de03b89496d7e83d00657c4dd44522964847314b04603ed249e3088c9fd9556f9d6b37d95e8a9bc160056b30
7
+ data.tar.gz: 61a8f13b4115cf55269c1b954a50099c8970de69da848cc0bba85e0869bc0a863c9b7af4bc2ddd488b1b35391d0230f8b5e621b1f3c0f909022835a0208751a9
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.4
4
- - 2.3.1
3
+ - 2.3
4
+ - 2.4
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ === Release 0.9 / 23 September 2017
2
+ * Enhancements
3
+ * Full support for all Android devices
4
+ * Ability to set additional android capabilities via configuration
5
+
1
6
  === Release 0.8 / 3 August 2017
2
7
  * Enhancements
3
8
  * Forced net-http-persistent to be less than 3.0 to fix issue with older Windows systems
data/README.md CHANGED
@@ -57,9 +57,9 @@ it will select whatever version is available. It is up to you to make sure that
57
57
  and version combination are valid.
58
58
 
59
59
  For mobile the version is the version of the OS you require replacing the
60
- dot with an underscore. For example, `:ios10_2` will use iOS 10.2. You will
61
- provide the additional information like the device type as additional
62
- values. See below.
60
+ dot with an underscore. For example, `:ios10_2` will use iOS 10.2 and `:android4_4`
61
+ will use Android 4.4. You will provide the additional information like the device type as
62
+ additional values. See below.
63
63
 
64
64
  Following the version there is an underscore followed by the host os. This value is also
65
65
  optional. Currently the following host os values are available:
@@ -79,6 +79,7 @@ optional. Currently the following host os values are available:
79
79
  | sierra | macOS 10.12 |
80
80
  | linux | Linux |
81
81
  | ios | 'iOS' |
82
+ | android | 'Android' |
82
83
 
83
84
  The host os value is typically used when running the tests on a Selenium Grid. It is up to
84
85
  you to ensure that the host and requested browser combination exist on your grid.
@@ -95,11 +96,12 @@ sent to a specific type of browser when it is used. Here are examples:
95
96
  RDee.configure do | config |
96
97
  config.url = 'http://path.to.selenium.grid/wd/hub'
97
98
  config.persistent_http = true
98
- config.chrome_options = { :switches => %w[--disable-extensions]}
99
- config.firefox_options = { :switches => %w[--disable-popups]}
100
- config.ie_options = { :switches => %w[--disable-popups]}
101
- config.safari_options = { :switches => %w[--disable-popups]}
102
- config.ios_options = { :switches => %w[--disable-popups]}
99
+ config.chrome_options = { :switches => %w[--disable-extensions] }
100
+ config.firefox_options = { :switches => %w[--disable-popups] }
101
+ config.ie_options = { :switches => %w[--disable-popups] }
102
+ config.safari_options = { :switches => %w[--disable-popups] }
103
+ config.ios_options = { :switches => %w[--disable-popups] }
104
+ config.android_options = { :switches => %w[--disable-popups] }
103
105
  end
104
106
  ````
105
107
 
@@ -110,13 +112,25 @@ Here is an example:
110
112
 
111
113
  ````ruby
112
114
  mobile_capabilities = {
113
- appiumVersion: '1.6.3',
115
+ appiumVersion: '1.6.4',
114
116
  deviceName: 'iPhone Simulator',
115
117
  deviceOrientation: 'portrait'
116
118
  }
117
119
  RDee.watir_browser(target = :ios10_2, desired_capabilities: mobile_capabilities)
118
120
  ````
119
121
 
122
+ For Android it is extremely simular:
123
+
124
+ ````ruby
125
+ mobile_capabilities = {
126
+ appiumVersion: '1.6.4',
127
+ deviceName: 'Google Nexus 7 HD Emulator',
128
+ deviceOrientation: 'portrait'
129
+ }
130
+ RDee.watir_browser(target = :android4_4, desired_capabilities: mobile_capabilities)
131
+ ````
132
+
133
+
120
134
  Another way to specify these additional capabilities is to specify them in the configure
121
135
  block like this:
122
136
 
@@ -124,10 +138,15 @@ block like this:
124
138
  RDee.configure do | config |
125
139
  config.url = 'http://path.to.selenium.grid/wd/hub'
126
140
  config.ios_capabilities = {
127
- appiumVersion: '1.6.3',
141
+ appiumVersion: '1.6.4',
128
142
  deviceName: 'iPhone Simulator',
129
143
  deviceOrientation: 'portrait'
130
144
  }
145
+ config.android_capabilities = {
146
+ appiumVersion: '1.6.4',
147
+ deviceName: 'Google Nexus 7 HD Emulator',
148
+ deviceOrientation: 'portrait'
149
+ }
131
150
  end
132
151
  ````
133
152
 
@@ -137,14 +156,18 @@ Using the config allows us to set the values via environment variables without c
137
156
  RDee.configure do | config |
138
157
  config.url = 'http://path.to.selenium.grid/wd/hub'
139
158
  config.ios_capabilities = {
140
- appiumVersion: ENV['appiumVersion'],
141
- deviceName: ENV['deviceName'],
142
- deviceOrientation: ENV['deviceOrientation']
159
+ appiumVersion: ENV['ios_appiumVersion'],
160
+ deviceName: ENV['ios_deviceName'],
161
+ deviceOrientation: ENV['ios_deviceOrientation']
162
+ }
163
+ config.android_capabilities = {
164
+ appiumVersion: ENV['android_appiumVersion'],
165
+ deviceName: ENV['android_deviceName'],
166
+ deviceOrientation: ENV['android_deviceOrientation']
143
167
  }
144
168
  end
145
169
  ````
146
170
 
147
-
148
171
  To see what options you should use please look at the
149
172
  [Sauce Labs Configurator](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/).
150
173
 
@@ -41,3 +41,10 @@ Feature: RDee should work well with mobile devices on a remote selenium grid
41
41
  And I go to the cheezyworld site
42
42
  And I select the first title link
43
43
  Then I should see the text from the first heading
44
+
45
+ @mobile
46
+ Scenario: Creating an Android browser on android 4.4
47
+ When I establish a mobile android browser for android4_4 on the remote machine using Watir
48
+ And I go to the cheezyworld site
49
+ And I select the first title link
50
+ Then I should see the text from the first heading
@@ -38,6 +38,18 @@ When(/^I establish an? mobile browser for (.+) on the remote machine using (.+)$
38
38
  url: 'http://rdee:730071ad-7331-4d65-bd56-ec3ebfdd8232@ondemand.saucelabs.com:80/wd/hub'
39
39
  end
40
40
 
41
+ When(/^I establish an? mobile android browser for (.+) on the remote machine using (.+)$/) do |browser, platform|
42
+ mobile_options = {
43
+ appiumVersion: '1.6.4',
44
+ deviceName: 'Google Nexus 7 HD Emulator',
45
+ deviceOrientation: 'portrait'
46
+ }
47
+ @browser = RDee.send "#{platform.downcase}_browser",
48
+ browser.to_sym,
49
+ desired_capabilities: mobile_options,
50
+ url: 'http://rdee:730071ad-7331-4d65-bd56-ec3ebfdd8232@ondemand.saucelabs.com:80/wd/hub'
51
+ end
52
+
41
53
  Then(/^I should be able to perform a google search for cheezyworld$/) do
42
54
  visit(GoogleSearch) do |page|
43
55
  page.perform_search
@@ -8,6 +8,7 @@ module RDee
8
8
  options.merge!(ie_options) if need_ie_options? target
9
9
  options.merge!(safari_options) if need_safari_options? target
10
10
  options.merge!(ios_options) if need_ios_options? target
11
+ options.merge!(android_options) if need_android_options? target
11
12
  options
12
13
  end
13
14
 
@@ -31,5 +32,9 @@ module RDee
31
32
  not ios_options.nil? and target.to_s.include? 'ios'
32
33
  end
33
34
 
35
+ def need_android_options?(target)
36
+ not android_options.nil? and target.to_s.include? 'android'
37
+ end
38
+
34
39
  end
35
40
  end
@@ -14,8 +14,8 @@ module RDee
14
14
 
15
15
  attr_accessor :url, :persistent_http
16
16
  attr_accessor :chrome_options, :firefox_options, :ie_options,
17
- :safari_options, :ios_options
18
- attr_accessor :ios_capabilities
17
+ :safari_options, :ios_options, :android_options
18
+ attr_accessor :ios_capabilities, :android_capabilities
19
19
 
20
20
  def watir_browser(target, options)
21
21
  platform, options = platform_and_options(target, options)
@@ -30,7 +30,6 @@ module RDee
30
30
  platformVersion: version,
31
31
  platformName: mobile_platform[platform],
32
32
  browserName: mobile_browsers[platform],
33
- platform: :mac,
34
33
  javascript_enabled: true
35
34
  }.merge(existing_caps))
36
35
  end
@@ -7,6 +7,7 @@ module RDee
7
7
  def additional_capabilities_for(target)
8
8
  caps = {}
9
9
  caps.merge!(ios_capabilities) if mobile_platform[target].eql?('iOS') and ios_capabilities
10
+ caps.merge!(android_capabilities) if mobile_platform[target].eql?('Android') and android_capabilities
10
11
  caps
11
12
  end
12
13
 
@@ -13,13 +13,15 @@ module RDee
13
13
 
14
14
  def mobile_browsers
15
15
  @mobile_browsers ||= {
16
- ios: 'Safari'
16
+ ios: 'Safari',
17
+ android: 'Browser'
17
18
  }
18
19
  end
19
20
 
20
21
  def mobile_platform
21
22
  @mobile_platform ||= {
22
- ios: 'iOS'
23
+ ios: 'iOS',
24
+ android: 'Android'
23
25
  }
24
26
  end
25
27
 
@@ -54,7 +54,8 @@ module RDee
54
54
  el_capitan: 'OS X 10.11',
55
55
  sierra: 'macOS 10.12',
56
56
  linux: 'Linux',
57
- ios: 'iOS'
57
+ ios: 'iOS',
58
+ android: 'Android'
58
59
  }
59
60
  end
60
61
 
@@ -1,3 +1,3 @@
1
1
  module RDee
2
- VERSION = "0.8"
2
+ VERSION = "0.9"
3
3
  end
@@ -15,7 +15,6 @@ describe 'Mobile targets' do
15
15
  platformVersion: '1.0',
16
16
  platformName: 'iOS',
17
17
  browserName: 'Safari',
18
- platform: :mac,
19
18
  javascript_enabled: true
20
19
  }
21
20
  }
@@ -51,5 +50,41 @@ describe 'Mobile targets' do
51
50
  end
52
51
  end
53
52
  end
53
+
54
+ context 'when using Android' do
55
+ let(:caps) {
56
+ {
57
+ platformVersion: '1.0',
58
+ platformName: 'Android',
59
+ browserName: 'Browser',
60
+ javascript_enabled: true
61
+ }
62
+ }
63
+
64
+ it 'includes Android 4.4' do
65
+ caps[:platformVersion] = '4.4'
66
+ expect(capabilities).to receive(:new).with(caps)
67
+ RDee.watir_browser :android4_4, url: 'http://blah'
68
+ end
69
+
70
+ it 'should allow additional capabilities to be pass in via configuration' do
71
+ android_capabilities = {
72
+ appiumVersion: '1.6.4',
73
+ deviceName: 'Google Nexus 7 HD Emulator',
74
+ deviceOrientation: 'portrait'
75
+ }
76
+ RDee.configure do |config|
77
+ config.url = 'http://blah'
78
+ config.android_capabilities = android_capabilities
79
+ end
80
+ caps[:platformVersion] = '4.4'
81
+ expect(capabilities).to receive(:new).with(caps.merge(android_capabilities))
82
+ RDee.watir_browser :android4_4
83
+ RDee.configure do |config|
84
+ config.url = nil
85
+ config.android_capabilities = nil
86
+ end
87
+ end
88
+ end
54
89
  end
55
90
 
@@ -194,5 +194,26 @@ describe RDee do
194
194
  end
195
195
  end
196
196
 
197
+ it "should allow users to add additional options for android by configuration" do
198
+ RDee.configure do |config|
199
+ config.android_options = {android_options: 'option'}
200
+ end
201
+ expect(watir_browser).to receive(:new).with(:android, android_options: 'option')
202
+ RDee.watir_browser(:android4_4)
203
+ RDee.configure do |config|
204
+ config.android_options = nil
205
+ end
206
+ end
207
+
208
+ it "should not add android_options when not using android" do
209
+ RDee.configure do |config|
210
+ config.android_options = {android_options: 'option'}
211
+ end
212
+ expect(watir_browser).to receive(:new).with(:firefox)
213
+ RDee.watir_browser(:firefox)
214
+ RDee.configure do |config|
215
+ config.android_options = nil
216
+ end
217
+ end
197
218
  end
198
219
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RDee
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.8'
4
+ version: '0.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey S. Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-03 00:00:00.000000000 Z
11
+ date: 2017-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir