RDee 0.2 → 0.3

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: 0ee57a488781369377cdc08a2c8ef183d0d599ad
4
- data.tar.gz: b93f7f13abec8499bd2b559bf719fb8a177a7ce5
3
+ metadata.gz: 6913d8a2e54ddce805ddbff2545d301e242f3a88
4
+ data.tar.gz: 95255bf370f561c56c592debcb485fd5d76fda50
5
5
  SHA512:
6
- metadata.gz: 8535d8b60f972c6d1b52a97b4b0b3dcd6057672825e96f927c4ef1ee83fe20334ea90d2090a56f06a61100f9c32347239a940fe232822f57204b8b181fafc326
7
- data.tar.gz: 4695865cee85acaa708296d9fd2ca3db5a6d36e5e4321f6e6e1a54a86d3ce5d2cc85575c937ad76feaf1df9614d62ccb0240d058821501f4b4a08df3c740d6e8
6
+ metadata.gz: e658f4076f85347f464ab3021d67f68f743b17c08e174b419905af9a8db31bae658ce71431536acd50d4ddfd7eb2dc3584f4a0106bb8eeead10a1cd28203bd42
7
+ data.tar.gz: 16209f4084c63e3a1ea3d7ae321133f511a366da5af8d3c3ef7c85e76b9a838590af49fecbe7fbe3d2beb9f9362709f3501ba405b385f62872de381818630df5
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ === Release 0.3 / 8-September-2014
2
+ * Enhancements
3
+ * Added iPhone support
4
+
1
5
  === Release 0.2 / 18-August-2014
2
6
  * Enhancements
3
7
  * Printing and raising exception when browser connection cannot be established
@@ -0,0 +1,26 @@
1
+ Feature: RDee should work well with mobile devices on a remote selenium grid
2
+
3
+ Scenario: Creating an iPhone browser on ios 7.1
4
+ When I establish a iphone_ios71 browser on the remote machine using Selenium
5
+ And I go to the cheezyworld site
6
+ And I select the transformations link
7
+ Then I should see the text "Cucumber Transformations Screencast"
8
+
9
+ Scenario: Creating an iPhone browser on ios 7.0
10
+ When I establish a iphone_ios70 browser on the remote machine using Selenium
11
+ And I go to the cheezyworld site
12
+ And I select the transformations link
13
+ Then I should see the text "Cucumber Transformations Screencast"
14
+
15
+ Scenario: Creating an iPhone browser on ios 6.1
16
+ When I establish a iphone_ios61 browser on the remote machine using Selenium
17
+ And I go to the cheezyworld site
18
+ And I select the transformations link
19
+ Then I should see the text "Cucumber Transformations Screencast"
20
+
21
+ Scenario: Creating an iPhone browser on ios 6.0
22
+ When I establish a iphone_ios60 browser on the remote machine using Selenium
23
+ And I go to the cheezyworld site
24
+ And I select the transformations link
25
+ Then I should see the text "Cucumber Transformations Screencast"
26
+
@@ -0,0 +1,54 @@
1
+ Feature: RDee should work well with browsers on a remote selenium grid
2
+
3
+
4
+ Scenario: Creating a browser on the remote machine using Selenium
5
+ When I establish a firefox browser on the remote machine using Selenium
6
+ Then I should be able to perform a google search for cheezyworld
7
+ And I should be able to close the connection
8
+
9
+ Scenario: Creating a browser on the remote machine using Watir
10
+ When I establish a firefox browser on the remote machine using Watir
11
+ Then I should be able to perform a google search for cheezyworld
12
+ And I should be able to close the connection
13
+
14
+ Scenario: Creating a browser on Windows 8.1
15
+ When I establish a chrome32_win81 browser on the remote machine using Watir
16
+ Then I should be able to perform a google search for cheezyworld
17
+ And I should be able to close the connection
18
+
19
+ Scenario: Creating a browser on Windows 8
20
+ When I establish a chrome32_win8 browser on the remote machine using Watir
21
+ Then I should be able to perform a google search for cheezyworld
22
+ And I should be able to close the connection
23
+
24
+ Scenario: Creating a browser on Windows 7
25
+ When I establish a chrome32_win7 browser on the remote machine using Watir
26
+ Then I should be able to perform a google search for cheezyworld
27
+ And I should be able to close the connection
28
+
29
+ Scenario: Creating a browser on Windows XP
30
+ When I establish a chrome32_winxp browser on the remote machine using Watir
31
+ Then I should be able to perform a google search for cheezyworld
32
+ And I should be able to close the connection
33
+
34
+ Scenario: Creating a browser on Snow Leopard
35
+ When I establish a chrome32_snow_leopard browser on the remote machine using Watir
36
+ Then I should be able to perform a google search for cheezyworld
37
+ And I should be able to close the connection
38
+
39
+ Scenario: Creating a browser on Mountain Lion
40
+ When I establish a chrome32_mountain_lion browser on the remote machine using Watir
41
+ Then I should be able to perform a google search for cheezyworld
42
+ And I should be able to close the connection
43
+
44
+ Scenario: Creating a browser on Mavricks
45
+ When I establish a chrome32_mavricks browser on the remote machine using Watir
46
+ Then I should be able to perform a google search for cheezyworld
47
+ And I should be able to close the connection
48
+
49
+ Scenario: Creating a browser on Linux
50
+ When I establish a chrome32_linux browser on the remote machine using Watir
51
+ Then I should be able to perform a google search for cheezyworld
52
+ And I should be able to close the connection
53
+
54
+
@@ -8,6 +8,11 @@ When(/^I establish a (.+) browser with a variable using (.+)$/) do |browser, pla
8
8
  ENV.delete 'RDEE_BROWSER'
9
9
  end
10
10
 
11
+ When(/^I establish a (.+) browser on the remote machine using (.+)$/) do |browser, platform|
12
+ @browser = RDee.send "#{platform.downcase}_browser",
13
+ browser.to_sym, url: 'http://rdee:730071ad-7331-4d65-bd56-ec3ebfdd8232@ondemand.saucelabs.com:80/wd/hub'
14
+ end
15
+
11
16
  Then(/^I should be able to perform a google search for cheezyworld$/) do
12
17
  visit(GoogleSearch) do |page|
13
18
  page.perform_search
@@ -20,3 +25,15 @@ end
20
25
  Then(/^I should be able to close the connection$/) do
21
26
  @browser.close
22
27
  end
28
+
29
+ When(/^I go to the cheezyworld site$/) do
30
+ visit CheezyWorld
31
+ end
32
+
33
+ When(/^I select the transformations link$/) do
34
+ on(CheezyWorld).transformations_element.click
35
+ end
36
+
37
+ Then(/^I should see the text "(.*?)"$/) do |message|
38
+ expect(@current_page.text).to include message
39
+ end
@@ -0,0 +1,8 @@
1
+ class CheezyWorld
2
+ include PageObject
3
+
4
+ page_url 'http://cheezyworld.com'
5
+
6
+ h2(:transformations, class: 'post-title')
7
+
8
+ end
@@ -4,9 +4,11 @@ class GoogleSearch
4
4
  page_url 'http://google.com'
5
5
 
6
6
  text_field(:criteria, name: 'q')
7
+ button(:search, name: 'btnG')
7
8
 
8
9
  def perform_search
9
10
  self.criteria = 'cheezyworld'
11
+ search
10
12
  end
11
13
 
12
14
  end
@@ -89,7 +89,7 @@ module RDee
89
89
  end
90
90
 
91
91
  def self.selenium_browser(target = :firefox, options = {})
92
- factory.watir_browser(target, options)
92
+ factory.selenium_browser(target, options)
93
93
  end
94
94
 
95
95
  def self.configure
@@ -1,6 +1,5 @@
1
1
  require_relative 'target_parser'
2
-
3
-
2
+ require_relative 'mobile_devices'
4
3
 
5
4
  module RDee
6
5
  class ConnectionError < StandardError
@@ -10,7 +9,7 @@ module RDee
10
9
  include TargetParser
11
10
 
12
11
  attr_accessor :url, :persistent_http, :chrome_options, :firefox_options,
13
- :ie_options, :safari_options
12
+ :ie_options, :safari_options, :iphone_options
14
13
 
15
14
  def watir_browser(target, options)
16
15
  platform, options = platform_and_options(target, options)
@@ -81,6 +80,7 @@ module RDee
81
80
  options.merge!(firefox_options) if need_firefox_options? target
82
81
  options.merge!(ie_options) if need_ie_optons? target
83
82
  options.merge!(safari_options) if need_safari_options? target
83
+ options.merge!(iphone_options) if need_iphone_options? target
84
84
  options
85
85
  end
86
86
 
@@ -99,5 +99,9 @@ module RDee
99
99
  def need_safari_options?(target)
100
100
  not safari_options.nil? and target.to_s.include? 'safari'
101
101
  end
102
+
103
+ def need_iphone_options?(target)
104
+ not iphone_options.nil? and target.to_s.include? 'iphone'
105
+ end
102
106
  end
103
107
  end
@@ -0,0 +1,17 @@
1
+
2
+ module RDee
3
+ module MobileDevices
4
+
5
+ def mobile?(value)
6
+ mobile_targets.include? target_for(value)
7
+ end
8
+
9
+
10
+ def mobile_targets
11
+ @mobile_targets ||= [
12
+ :iphone
13
+ ]
14
+ end
15
+
16
+ end
17
+ end
@@ -1,9 +1,11 @@
1
+ require_relative 'mobile_devices'
1
2
 
2
3
  module RDee
3
4
  module TargetParser
5
+ include MobileDevices
4
6
 
5
7
  def parse(value)
6
- target = target_for(value).to_sym
8
+ target = target_for(value)
7
9
  version = version_for(value)
8
10
  host = host_for(value)
9
11
  return target, version, host
@@ -14,11 +16,12 @@ module RDee
14
16
  def target_for(value)
15
17
  target = value.to_s.split(/\d+/)[0]
16
18
  target = target.split('_')[0] if target.include? '_'
17
- target
19
+ target.to_sym
18
20
  end
19
21
 
20
22
  def version_for(value)
21
- version = value.to_s.gsub(target_for(value), '').split(/_/)[0]
23
+ version = mobile_version(value) if mobile?(value)
24
+ version = browser_version(value) unless mobile?(value)
22
25
  unless version.nil?
23
26
  version = nil if version.empty?
24
27
  end
@@ -30,6 +33,14 @@ module RDee
30
33
  host_lookup[host.join('_').to_sym] if host
31
34
  end
32
35
 
36
+ def browser_version(value)
37
+ value.to_s.gsub(target_for(value).to_s, '').split(/_/)[0]
38
+ end
39
+
40
+ def mobile_version(value)
41
+ value.to_s.split(/_/).slice(1..-1)[0][-2,2].insert(1, '.')
42
+ end
43
+
33
44
  def host_lookup
34
45
  @host_lookup ||= {
35
46
  win81: 'Windows 8.1',
@@ -39,8 +50,13 @@ module RDee
39
50
  snow_leopard: 'OS X 10.6',
40
51
  mountain_lion: 'OS X 10.8',
41
52
  mavricks: 'OS X 10.9',
42
- linux: 'Linux'
53
+ linux: 'Linux',
54
+ ios60: 'OS X 10.8',
55
+ ios61: 'OS X 10.8',
56
+ ios70: 'OS X 10.9',
57
+ ios71: 'OS X 10.9'
43
58
  }
44
59
  end
60
+
45
61
  end
46
62
  end
@@ -1,3 +1,3 @@
1
1
  module RDee
2
- VERSION = "0.2"
2
+ VERSION = "0.3"
3
3
  end
@@ -172,5 +172,27 @@ end
172
172
  end
173
173
  end
174
174
 
175
+ it "should allow users to add additional options for iPhone by configuration" do
176
+ RDee.configure do |config|
177
+ config.iphone_options = {iphone_options: 'option'}
178
+ end
179
+ expect(watir_browser).to receive(:new).with(:iphone, iphone_options: 'option')
180
+ RDee.watir_browser(:iphone_ios70)
181
+ RDee.configure do |config|
182
+ config.iphone_options = nil
183
+ end
184
+ end
185
+
186
+ it "shoudl not add iphone_options when not using iPhone" do
187
+ RDee.configure do |config|
188
+ config.iphone_options = {iphone_options: 'option'}
189
+ end
190
+ expect(watir_browser).to receive(:new).with(:firefox)
191
+ RDee.watir_browser(:firefox)
192
+ RDee.configure do |config|
193
+ config.iphone_options = nil
194
+ end
195
+ end
196
+
175
197
  end
176
198
  end
@@ -66,6 +66,26 @@ describe RDee::TargetParser do
66
66
  expect(host).to eql 'Linux'
67
67
  end
68
68
 
69
+ it "should parse ios60 for iphone" do
70
+ target, version, host = parser.parse(:iphone_ios60)
71
+ expect(host).to eql 'OS X 10.8'
72
+ end
73
+
74
+ it "should parse ios70 for iphone" do
75
+ target, version, host = parser.parse(:iphone_ios70)
76
+ expect(host).to eql 'OS X 10.9'
77
+ end
78
+
79
+ it "should parse ios71 for iphone" do
80
+ target, version, host = parser.parse(:iphone_ios71)
81
+ expect(host).to eql 'OS X 10.9'
82
+ end
83
+
84
+ it "should parse ios61 for iphone" do
85
+ target, version, host = parser.parse(:iphone_ios61)
86
+ expect(host).to eql 'OS X 10.8'
87
+ end
88
+
69
89
  it "should cleanly handle an invalid host" do
70
90
  target, version, host = parser.parse(:firefox30_foobar)
71
91
  expect(host).to be_nil
@@ -177,6 +177,42 @@ describe "Supported browser combinations" do
177
177
  end
178
178
  end
179
179
 
180
+ context "for iPhone" do
181
+
182
+ before(:each) do
183
+ allow(capabilities).to receive(:iphone).and_return(desired_capabilities)
184
+ end
185
+
186
+ it "includes iPhone with ios 6.0" do
187
+ expect(desired_capabilities).to receive(:version=).with('6.0')
188
+ expect(desired_capabilities).to receive(:platform=).with('OS X 10.8')
189
+ expect(watir_browser).to receive(:new).with(:remote, url: 'http://blah', desired_capabilities: anything())
190
+ RDee.watir_browser :iphone_ios60, url: 'http://blah'
191
+ end
192
+
193
+ it "includes iPhone with ios 6.1" do
194
+ expect(desired_capabilities).to receive(:version=).with('6.1')
195
+ expect(desired_capabilities).to receive(:platform=).with('OS X 10.8')
196
+ expect(watir_browser).to receive(:new).with(:remote, url: 'http://blah', desired_capabilities: anything())
197
+ RDee.watir_browser :iphone_ios61, url: 'http://blah'
198
+ end
199
+
200
+ it "includes iPhone with ios 7.0" do
201
+ expect(desired_capabilities).to receive(:version=).with('7.0')
202
+ expect(desired_capabilities).to receive(:platform=).with('OS X 10.9')
203
+ expect(watir_browser).to receive(:new).with(:remote, url: 'http://blah', desired_capabilities: anything())
204
+ RDee.watir_browser :iphone_ios70, url: 'http://blah'
205
+ end
206
+
207
+ it "includes iPhone with ios 7.1" do
208
+ expect(desired_capabilities).to receive(:version=).with('7.1')
209
+ expect(desired_capabilities).to receive(:platform=).with('OS X 10.9')
210
+ expect(watir_browser).to receive(:new).with(:remote, url: 'http://blah', desired_capabilities: anything())
211
+ RDee.watir_browser :iphone_ios71, url: 'http://blah'
212
+ end
213
+
214
+ end
215
+
180
216
  context "for hosts" do
181
217
  before(:each) do
182
218
  allow(capabilities).to receive(:firefox).and_return(desired_capabilities)
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.2'
4
+ version: '0.3'
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: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir-webdriver
@@ -128,11 +128,15 @@ files:
128
128
  - cucumber.yml
129
129
  - features/environment_variable.feature
130
130
  - features/local_browsers.feature
131
+ - features/mobile_remote.feature
132
+ - features/remote_browsers.feature
131
133
  - features/step_definitions/rdee_steps.rb
132
134
  - features/support/env.rb
135
+ - features/support/pages/cheezyworld.rb
133
136
  - features/support/pages/google_search.rb
134
137
  - lib/rdee.rb
135
138
  - lib/rdee/browser_factory.rb
139
+ - lib/rdee/mobile_devices.rb
136
140
  - lib/rdee/target_parser.rb
137
141
  - lib/rdee/version.rb
138
142
  - rdee.gemspec
@@ -167,11 +171,13 @@ summary: Dynamically create a connection for Selenium or Watir.
167
171
  test_files:
168
172
  - features/environment_variable.feature
169
173
  - features/local_browsers.feature
174
+ - features/mobile_remote.feature
175
+ - features/remote_browsers.feature
170
176
  - features/step_definitions/rdee_steps.rb
171
177
  - features/support/env.rb
178
+ - features/support/pages/cheezyworld.rb
172
179
  - features/support/pages/google_search.rb
173
180
  - spec/lib/rd_spec.rb
174
181
  - spec/lib/target_parser_spec.rb
175
182
  - spec/lib/targets_spec.rb
176
183
  - spec/spec_helper.rb
177
- has_rdoc: