selenium-launcher 0.2.0 → 0.3.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: 60547600d5b222f4397bd73d87a84d2a55685675
4
- data.tar.gz: 4cd1ece048ae683e5f7e7d493cde1c376fcaf7bb
3
+ metadata.gz: c0db0e2e699312bd2345647b3bd2a0d2892dbcff
4
+ data.tar.gz: cc9753b81d9b560d4ad06b4736117862942b9830
5
5
  SHA512:
6
- metadata.gz: a961633050e98d9700d8e33e4ab856a399966a88a8fb3388ff6f2a603f5255ca18d1712f87655c4cab1f13041ec1958ec24ec1012ddcb15831ec2c8eaa2d1d52
7
- data.tar.gz: 96676a875187b351f944163f68a3b133f05af4b5c56cc95e5b004a1e36305b34ae402bc2270f8a3d45309a4ebb1f927115026751c3563e85a38f971dfdb52445
6
+ metadata.gz: ef55fde4373f8798a430a01fcc9444095cd48d46c6cf4640d3d16425847f7265b563f42aaf172ad483f85b1eb059771d35bb7112b3e7e3d77ffed2b6b26a2ace
7
+ data.tar.gz: 35f001cb06a6c5aa219d4177c209632e8f62615db652e434ea52e0fb89378d228e8c958cf2b7ef7623c405cd860606e68686c589a6f5c05053dbaadb06b72803
data/README.txt CHANGED
@@ -26,9 +26,9 @@ sudo gem install selenium-launcher
26
26
 
27
27
  Configuration occurs through a small set of environment variables:
28
28
 
29
- SE_HOST (e.g., 'grid', or nothing)
29
+ SE_HOST (e.g., 'remote', or nothing)
30
30
  SE_HOST_URL (e.g., URL to Standalone Remote or Grid instance)
31
- SE_BROWSER (e.g., 'chrome', 'firefox', 'internet-explorer', 'safari')
31
+ SE_BROWSER (e.g., 'chrome', 'firefox', 'internet_explorer', 'safari')
32
32
 
33
33
  If these values are not set properly, a RuntimeError will be returned along with a helpful message.
34
34
 
@@ -17,7 +17,7 @@ module SeleniumLauncher
17
17
  private
18
18
 
19
19
  ERRORS = { NoBrowserSpecified: 'You need to specify a browser (e.g., SE_BROWSER).',
20
- NoGridURLSpecified: 'You need to specify a URL when using a Grid (e.g., SE_HOST_URL).' }
20
+ NoGridURLSpecified: 'You need to specify a URL when using a Remote node (e.g., SE_HOST_URL).' }
21
21
 
22
22
  def browser_check
23
23
  if ENV['SE_BROWSER'].nil?
@@ -26,7 +26,7 @@ module SeleniumLauncher
26
26
  end
27
27
 
28
28
  def grid_check
29
- if ENV['SE_HOST'] == 'grid'
29
+ if ENV['SE_HOST'] == 'remote'
30
30
  if ENV['SE_HOST_URL'].nil?
31
31
  raise ERRORS[:NoGridURLSpecified]
32
32
  end
@@ -3,7 +3,7 @@ module SeleniumLauncher
3
3
  class InternetExplorer < Browser
4
4
 
5
5
  def name
6
- 'internet-explorer'
6
+ 'internet_explorer'
7
7
  end
8
8
 
9
9
  end
@@ -19,7 +19,7 @@ module SeleniumLauncher
19
19
 
20
20
  def launch
21
21
  case ENV['SE_HOST']
22
- when 'grid'
22
+ when 'remote'
23
23
  ::Selenium::WebDriver.for(
24
24
  :remote,
25
25
  url: ENV['SE_HOST_URL'],
@@ -1,3 +1,3 @@
1
1
  module SeleniumLauncher
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -4,22 +4,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'selenium-launcher/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "selenium-launcher"
7
+ spec.name = 'selenium-launcher'
8
8
  spec.version = SeleniumLauncher::VERSION
9
- spec.authors = ["Dave Haeffner"]
10
- spec.email = ["dhaeffner@gmail.com"]
11
- spec.summary = %q{A simple way to configure and launch a Selenium instance}
12
- spec.description = %q{See README.txt}
13
- spec.homepage = "https://github.com/tourdedave/selenium-launcher"
14
- spec.license = "MIT"
9
+ spec.authors = ['Dave Haeffner']
10
+ spec.email = ['dhaeffner@gmail.com']
11
+ spec.description = %q{A simple way to configure and launch a Selenium instance}
12
+ spec.summary = %q{See README.txt}
13
+ spec.homepage = 'https://github.com/tourdedave/selenium-launcher'
14
+ spec.license = 'MIT'
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0")
16
+ spec.files = `git ls-files -z`.split("\x0") - Dir.glob('spec/vendor/*')
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
18
+ spec.require_paths = ['lib']
19
19
 
20
- spec.add_dependency "selenium-webdriver", "~> 2.43.0"
21
- spec.add_development_dependency "bundler", "~> 1.7"
22
- spec.add_development_dependency "rake", "~> 10.0"
23
- spec.add_development_dependency "rspec", "~> 3.1.0"
24
- spec.add_development_dependency "guard-rspec", "~> 4.3.1"
20
+ spec.add_dependency 'selenium-webdriver', '~> 2.43.0'
21
+ spec.add_development_dependency 'bundler', '~> 1.7'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'rspec', '~> 3.1.0'
24
+ spec.add_development_dependency 'guard-rspec', '~> 4.3.1'
25
+ spec.add_development_dependency 'typhoeus', '~> 0.6.9'
25
26
  end
data/spec/browser_spec.rb CHANGED
@@ -2,27 +2,27 @@ require_relative '../lib/selenium-launcher/browser'
2
2
 
3
3
  describe 'Browser returns', :unit do
4
4
 
5
+ def browser
6
+ SeleniumLauncher::Browser.load
7
+ end
8
+
5
9
  it 'Chrome' do
6
10
  ENV['SE_BROWSER'] = 'chrome'
7
- browser = SeleniumLauncher::Browser.load
8
11
  expect(browser.class).to eql SeleniumLauncher::Browser::Chrome
9
12
  end
10
13
 
11
14
  it 'Firefox' do
12
15
  ENV['SE_BROWSER'] = 'firefox'
13
- browser = SeleniumLauncher::Browser.load
14
16
  expect(browser.class).to eql SeleniumLauncher::Browser::Firefox
15
17
  end
16
18
 
17
19
  it 'Internet Explorer' do
18
- ENV['SE_BROWSER'] = 'internet-explorer'
19
- browser = SeleniumLauncher::Browser.load
20
+ ENV['SE_BROWSER'] = 'internet_explorer'
20
21
  expect(browser.class).to eql SeleniumLauncher::Browser::InternetExplorer
21
22
  end
22
23
 
23
24
  it 'Safari' do
24
25
  ENV['SE_BROWSER'] = 'safari'
25
- browser = SeleniumLauncher::Browser.load
26
26
  expect(browser.class).to eql SeleniumLauncher::Browser::Safari
27
27
  end
28
28
 
@@ -0,0 +1,44 @@
1
+ require_relative 'spec_helper'
2
+ require_relative '../lib/selenium-launcher/launcher'
3
+
4
+ describe 'Launcher', :integration do
5
+
6
+ context '-> Localhost -> ' do
7
+
8
+ after(:each) do
9
+ @launcher.quit
10
+ end
11
+
12
+ it 'Chrome' do
13
+ ENV['SE_BROWSER'] = 'chrome'
14
+ @launcher = SeleniumLauncher::Launcher.new
15
+ expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
16
+ expect(@launcher.driver.browser).to eql :chrome
17
+ end
18
+
19
+ it 'Firefox' do
20
+ ENV['SE_BROWSER'] = 'firefox'
21
+ @launcher = SeleniumLauncher::Launcher.new
22
+ expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
23
+ expect(@launcher.driver.browser).to eql :firefox
24
+ end
25
+
26
+ it 'Internet Explorer' do
27
+ pending 'Windows OS required' unless OS.windows?
28
+ ENV['SE_BROWSER'] = 'internet_explorer'
29
+ @launcher = SeleniumLauncher::Launcher.new
30
+ expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
31
+ expect(@launcher.driver.browser).to eql :internet_explorer
32
+ end
33
+
34
+ it 'Safari' do
35
+ skip 'Due to unresolved Selenium issue. See https://github.com/tourdedave/selenium-launcher/issues/3 for details.'
36
+ ENV['SE_BROWSER'] = 'safari'
37
+ @launcher = SeleniumLauncher::Launcher.new
38
+ expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
39
+ expect(@launcher.driver.browser).to eql :safari
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,61 @@
1
+ require_relative 'spec_helper'
2
+ require_relative '../lib/selenium-launcher/launcher'
3
+ require 'typhoeus'
4
+
5
+ describe 'Launcher', :integration do
6
+
7
+ def selenium_server_up?
8
+ Typhoeus.get(ENV['SE_HOST_URL'] + '/status').code == 200
9
+ end
10
+
11
+ before(:all) do
12
+ ENV['SE_HOST'] = 'remote'
13
+ ENV['SE_HOST_URL'] = 'http://localhost:4444/wd/hub'
14
+ @process_id = Process.spawn('java -jar spec/vendor/selenium-server-standalone-2.44.0.jar')
15
+ until selenium_server_up? do
16
+ sleep 2
17
+ end
18
+ end
19
+
20
+ after(:all) do
21
+ Process.kill("KILL", @process_id)
22
+ end
23
+
24
+ context '-> Remote -> ' do
25
+
26
+ after(:each) do
27
+ @launcher.driver.quit
28
+ end
29
+
30
+ it 'Chrome' do
31
+ ENV['SE_BROWSER'] = 'chrome'
32
+ @launcher = SeleniumLauncher::Launcher.new
33
+ expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
34
+ expect(@launcher.driver.browser).to eql :chrome
35
+ end
36
+
37
+ it 'Firefox' do
38
+ ENV['SE_BROWSER'] = 'firefox'
39
+ @launcher = SeleniumLauncher::Launcher.new
40
+ expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
41
+ expect(@launcher.driver.browser).to eql :firefox
42
+ end
43
+
44
+ it 'Internet Explorer' do
45
+ pending 'Windows OS required' unless OS.windows?
46
+ ENV['SE_BROWSER'] = 'internet_explorer'
47
+ @launcher = SeleniumLauncher::Launcher.new
48
+ expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
49
+ expect(@launcher.driver.browser).to eql :internet_explorer
50
+ end
51
+
52
+ it 'Safari' do
53
+ skip 'Due to unresolved Selenium issue. See https://github.com/tourdedave/selenium-launcher/issues/3 for details.'
54
+ ENV['SE_BROWSER'] = 'safari'
55
+ @launcher = SeleniumLauncher::Launcher.new
56
+ expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
57
+ expect(@launcher.driver.browser).to eql :safari
58
+ end
59
+
60
+ end
61
+ end
@@ -3,6 +3,7 @@ require_relative '../lib/selenium-launcher'
3
3
  describe 'Selenium Launcher', :acceptance do
4
4
 
5
5
  it 'runs' do
6
+ ENV['SE_HOST'] = nil
6
7
  ENV['SE_BROWSER'] = 'firefox'
7
8
  driver = SeleniumLauncher.launch
8
9
  expect(driver.class).to eql Selenium::WebDriver::Driver
@@ -24,12 +25,12 @@ describe 'Selenium Launcher', :acceptance do
24
25
  'You need to specify a browser (e.g., SE_BROWSER).')
25
26
  end
26
27
 
27
- it 'no Grid host URL' do
28
+ it 'no remote host URL' do
28
29
  ENV['SE_BROWSER'] = 'firefox'
29
- ENV['SE_HOST'] = 'grid'
30
+ ENV['SE_HOST'] = 'remote'
30
31
  expect { driver = SeleniumLauncher.launch }.to raise_error(
31
32
  RuntimeError,
32
- 'You need to specify a URL when using a Grid (e.g., SE_HOST_URL).')
33
+ 'You need to specify a URL when using a Remote node (e.g., SE_HOST_URL).')
33
34
  end
34
35
 
35
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Haeffner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-14 00:00:00.000000000 Z
11
+ date: 2014-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -80,7 +80,21 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 4.3.1
83
- description: See README.txt
83
+ - !ruby/object:Gem::Dependency
84
+ name: typhoeus
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.6.9
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.6.9
97
+ description: A simple way to configure and launch a Selenium instance
84
98
  email:
85
99
  - dhaeffner@gmail.com
86
100
  executables: []
@@ -102,8 +116,9 @@ files:
102
116
  - lib/selenium-launcher/version.rb
103
117
  - selenium-launcher.gemspec
104
118
  - spec/browser_spec.rb
105
- - spec/launcher_spec.rb
106
- - spec/selenium-connect_spec.rb
119
+ - spec/launcher_local_spec.rb
120
+ - spec/launcher_remote_spec.rb
121
+ - spec/selenium-launcher_spec.rb
107
122
  - spec/spec_helper.rb
108
123
  homepage: https://github.com/tourdedave/selenium-launcher
109
124
  licenses:
@@ -128,9 +143,10 @@ rubyforge_project:
128
143
  rubygems_version: 2.2.2
129
144
  signing_key:
130
145
  specification_version: 4
131
- summary: A simple way to configure and launch a Selenium instance
146
+ summary: See README.txt
132
147
  test_files:
133
148
  - spec/browser_spec.rb
134
- - spec/launcher_spec.rb
135
- - spec/selenium-connect_spec.rb
149
+ - spec/launcher_local_spec.rb
150
+ - spec/launcher_remote_spec.rb
151
+ - spec/selenium-launcher_spec.rb
136
152
  - spec/spec_helper.rb
@@ -1,82 +0,0 @@
1
- require_relative 'spec_helper'
2
- require_relative '../lib/selenium-launcher/launcher'
3
-
4
- describe 'Launcher', :integration do
5
-
6
- after(:each) do
7
- @launcher.quit
8
- end
9
-
10
- context '-> Localhost -> ' do
11
-
12
- it 'Chrome' do
13
- ENV['SE_BROWSER'] = 'chrome'
14
- @launcher = SeleniumLauncher::Launcher.new
15
- expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
16
- expect(@launcher.driver.browser).to eql :chrome
17
- end
18
-
19
- it 'Firefox' do
20
- ENV['SE_BROWSER'] = 'firefox'
21
- @launcher = SeleniumLauncher::Launcher.new
22
- expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
23
- expect(@launcher.driver.browser).to eql :firefox
24
- end
25
-
26
- it 'Internet Explorer' do
27
- pending 'Windows OS required' unless OS.windows?
28
- ENV['SE_BROWSER'] = 'internet-explorer'
29
- @launcher = SeleniumLauncher::Launcher.new
30
- expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
31
- expect(@launcher.driver.browser).to eql :"internet-explorer"
32
- end
33
-
34
- it 'Safari' do
35
- ENV['SE_BROWSER'] = 'safari'
36
- @launcher = SeleniumLauncher::Launcher.new
37
- expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
38
- expect(@launcher.driver.browser).to eql :safari
39
- end
40
-
41
- end
42
-
43
- context '-> Grid -> ' do
44
-
45
- before(:all) do
46
- ENV['SE_HOST'] = 'grid'
47
- ENV['SE_HOST_URL'] = 'http://localhost:4444/wd/hub'
48
- # Start Selenium Standalone Server
49
- # For help downloading, see https://github.com/tourdedave/selenium-prep
50
- end
51
-
52
- it 'Chrome' do
53
- ENV['SE_BROWSER'] = 'chrome'
54
- @launcher = SeleniumLauncher::Launcher.new
55
- expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
56
- expect(@launcher.driver.browser).to eql :chrome
57
- end
58
-
59
- it 'Firefox' do
60
- ENV['SE_BROWSER'] = 'firefox'
61
- @launcher = SeleniumLauncher::Launcher.new
62
- expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
63
- expect(@launcher.driver.browser).to eql :firefox
64
- end
65
-
66
- it 'Internet Explorer' do
67
- pending 'Windows OS required' unless OS.windows?
68
- ENV['SE_BROWSER'] = 'internet-explorer'
69
- @launcher = SeleniumLauncher::Launcher.new
70
- expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
71
- expect(@launcher.driver.browser).to eql :"internet-explorer"
72
- end
73
-
74
- it 'Safari' do
75
- ENV['SE_BROWSER'] = 'safari'
76
- @launcher = SeleniumLauncher::Launcher.new
77
- expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
78
- expect(@launcher.driver.browser).to eql :safari
79
- end
80
-
81
- end
82
- end