selenium-launcher 0.1.0 → 0.2.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: 47064747dcd76f242df501b3316329097660ae37
4
- data.tar.gz: caae88fe2c13bceeceb425264ba2a127febd0e50
3
+ metadata.gz: 60547600d5b222f4397bd73d87a84d2a55685675
4
+ data.tar.gz: 4cd1ece048ae683e5f7e7d493cde1c376fcaf7bb
5
5
  SHA512:
6
- metadata.gz: c54ce10a41be5679d2d6346a1f437ad91aa32ffa723391e94a7f0482fb83c850f5a9c8ec09e0a58af396d03c7abe6bb587cbdf5228a51c216f494b6d0f7ccb74
7
- data.tar.gz: 493f73d610c50b8873b1da8cdf17e5fbd1f55a408553533479ce4142a5245c513fb317de2ec0deea1f727d53d28ece4824dc769a5d6add54417838eae7288396
6
+ metadata.gz: a961633050e98d9700d8e33e4ab856a399966a88a8fb3388ff6f2a603f5255ca18d1712f87655c4cab1f13041ec1958ec24ec1012ddcb15831ec2c8eaa2d1d52
7
+ data.tar.gz: 96676a875187b351f944163f68a3b133f05af4b5c56cc95e5b004a1e36305b34ae402bc2270f8a3d45309a4ebb1f927115026751c3563e85a38f971dfdb52445
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ *.swp
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /Gemfile.lock
data/Guardfile CHANGED
@@ -1,4 +1,4 @@
1
1
  guard :rspec, cmd: 'bundle exec rspec' do
2
2
  watch(%r{^spec/*/.+_spec\.rb$})
3
- watch(%r{^lib/selenium-connect/*/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
3
+ watch(%r{^lib/selenium-launcher/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
4
  end
data/README.txt CHANGED
@@ -4,42 +4,45 @@
4
4
 
5
5
  selenium-launcher provides a simple way to configure Selenium and launch a browser.
6
6
 
7
- Currently supported approachs include:
7
+ Currently supported approaches include:
8
8
  1. Local browser execution with browser drivers (for easier test authoring)
9
9
  2. Remote execution (for a single node or a grid)
10
10
 
11
+ NOTE: selenium-launcher will return a Selenium WebDriver object.
12
+
11
13
  == CONSIDERATIONS:
12
14
 
13
15
  + Will need to sort out the best way to handle browser driver downloads and configuration per OS. Will start by letting the user do the work and automate it later (in a separate gem).
14
16
  + Cloud execution will need to be added later, but that has additional considerations. So that will be deferred for now.
15
17
  + Mobile is also a consideration. Again, one to defer for now.
16
18
 
19
+ == INSTALL:
20
+
21
+ sudo gem install selenium-launcher
22
+
17
23
  == USAGE:
18
24
 
19
25
  === Environment Variables
20
26
 
21
27
  Configuration occurs through a small set of environment variables:
22
28
 
23
- SL_HOST (e.g., 'grid', or nothing)
24
- SL_HOST_URL (e.g., URL to Standalone Remote or Grid instance)
25
- SL_BROWSER (e.g., 'chrome', 'firefox', 'internet-explorer', 'safari')
29
+ SE_HOST (e.g., 'grid', or nothing)
30
+ SE_HOST_URL (e.g., URL to Standalone Remote or Grid instance)
31
+ SE_BROWSER (e.g., 'chrome', 'firefox', 'internet-explorer', 'safari')
26
32
 
27
33
  If these values are not set properly, a RuntimeError will be returned along with a helpful message.
28
34
 
29
-
30
- selenium-launcher will return a Selenium WebDriver object.
31
-
32
35
  === Local
33
36
 
34
- ENV['SL_BROWSER'] = 'firefox'
37
+ ENV['SE_BROWSER'] = 'firefox'
35
38
  driver = SeleniumLauncher.launch
36
39
  driver.quit
37
40
 
38
41
  === Grid
39
42
 
40
- ENV['SL_BROWSER'] = 'firefox'
41
- ENV['SL_HOST'] = 'grid'
42
- ENV['SL_HOST_URL'] = 'http://localhost:4444/wd/hub'
43
+ ENV['SE_BROWSER'] = 'firefox'
44
+ ENV['SE_HOST'] = 'grid'
45
+ ENV['SE_HOST_URL'] = 'http://localhost:4444/wd/hub'
43
46
  driver = SeleniumLauncher.launch
44
47
  driver.quit
45
48
 
@@ -16,18 +16,18 @@ module SeleniumLauncher
16
16
 
17
17
  private
18
18
 
19
- ERRORS = { NoBrowserSpecified: 'You need to specify a browser (e.g., SL_BROWSER).',
20
- NoGridURLSpecified: 'You need to specify a URL when using a Grid (e.g., SL_HOST_URL).' }
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).' }
21
21
 
22
22
  def browser_check
23
- if ENV['SL_BROWSER'].nil?
23
+ if ENV['SE_BROWSER'].nil?
24
24
  raise ERRORS[:NoBrowserSpecified]
25
25
  end
26
26
  end
27
27
 
28
28
  def grid_check
29
- if ENV['SL_HOST'] == 'grid'
30
- if ENV['SL_HOST_URL'].nil?
29
+ if ENV['SE_HOST'] == 'grid'
30
+ if ENV['SE_HOST_URL'].nil?
31
31
  raise ERRORS[:NoGridURLSpecified]
32
32
  end
33
33
  end
@@ -9,7 +9,7 @@ module SeleniumLauncher
9
9
  attr_reader :name
10
10
 
11
11
  def match?
12
- name == ENV['SL_BROWSER']
12
+ name == ENV['SE_BROWSER']
13
13
  end
14
14
 
15
15
  def capabilities
@@ -18,11 +18,11 @@ module SeleniumLauncher
18
18
  private
19
19
 
20
20
  def launch
21
- case ENV['SL_HOST']
21
+ case ENV['SE_HOST']
22
22
  when 'grid'
23
23
  ::Selenium::WebDriver.for(
24
24
  :remote,
25
- url: ENV['SL_HOST_URL'],
25
+ url: ENV['SE_HOST_URL'],
26
26
  desired_capabilities: browser.capabilities)
27
27
  else
28
28
  ::Selenium::WebDriver.for browser.name.to_sym
@@ -1,3 +1,3 @@
1
1
  module SeleniumLauncher
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
data/spec/browser_spec.rb CHANGED
@@ -3,25 +3,25 @@ require_relative '../lib/selenium-launcher/browser'
3
3
  describe 'Browser returns', :unit do
4
4
 
5
5
  it 'Chrome' do
6
- ENV['SL_BROWSER'] = 'chrome'
6
+ ENV['SE_BROWSER'] = 'chrome'
7
7
  browser = SeleniumLauncher::Browser.load
8
8
  expect(browser.class).to eql SeleniumLauncher::Browser::Chrome
9
9
  end
10
10
 
11
11
  it 'Firefox' do
12
- ENV['SL_BROWSER'] = 'firefox'
12
+ ENV['SE_BROWSER'] = 'firefox'
13
13
  browser = SeleniumLauncher::Browser.load
14
14
  expect(browser.class).to eql SeleniumLauncher::Browser::Firefox
15
15
  end
16
16
 
17
17
  it 'Internet Explorer' do
18
- ENV['SL_BROWSER'] = 'internet-explorer'
18
+ ENV['SE_BROWSER'] = 'internet-explorer'
19
19
  browser = SeleniumLauncher::Browser.load
20
20
  expect(browser.class).to eql SeleniumLauncher::Browser::InternetExplorer
21
21
  end
22
22
 
23
23
  it 'Safari' do
24
- ENV['SL_BROWSER'] = 'safari'
24
+ ENV['SE_BROWSER'] = 'safari'
25
25
  browser = SeleniumLauncher::Browser.load
26
26
  expect(browser.class).to eql SeleniumLauncher::Browser::Safari
27
27
  end
@@ -10,14 +10,14 @@ describe 'Launcher', :integration do
10
10
  context '-> Localhost -> ' do
11
11
 
12
12
  it 'Chrome' do
13
- ENV['SL_BROWSER'] = 'chrome'
13
+ ENV['SE_BROWSER'] = 'chrome'
14
14
  @launcher = SeleniumLauncher::Launcher.new
15
15
  expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
16
16
  expect(@launcher.driver.browser).to eql :chrome
17
17
  end
18
18
 
19
19
  it 'Firefox' do
20
- ENV['SL_BROWSER'] = 'firefox'
20
+ ENV['SE_BROWSER'] = 'firefox'
21
21
  @launcher = SeleniumLauncher::Launcher.new
22
22
  expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
23
23
  expect(@launcher.driver.browser).to eql :firefox
@@ -25,14 +25,14 @@ describe 'Launcher', :integration do
25
25
 
26
26
  it 'Internet Explorer' do
27
27
  pending 'Windows OS required' unless OS.windows?
28
- ENV['SL_BROWSER'] = 'internet-explorer'
28
+ ENV['SE_BROWSER'] = 'internet-explorer'
29
29
  @launcher = SeleniumLauncher::Launcher.new
30
30
  expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
31
31
  expect(@launcher.driver.browser).to eql :"internet-explorer"
32
32
  end
33
33
 
34
34
  it 'Safari' do
35
- ENV['SL_BROWSER'] = 'safari'
35
+ ENV['SE_BROWSER'] = 'safari'
36
36
  @launcher = SeleniumLauncher::Launcher.new
37
37
  expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
38
38
  expect(@launcher.driver.browser).to eql :safari
@@ -43,19 +43,21 @@ describe 'Launcher', :integration do
43
43
  context '-> Grid -> ' do
44
44
 
45
45
  before(:all) do
46
- ENV['SL_HOST'] = 'grid'
47
- ENV['SL_HOST_URL'] = 'http://localhost:4444/wd/hub'
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
48
50
  end
49
51
 
50
52
  it 'Chrome' do
51
- ENV['SL_BROWSER'] = 'chrome'
53
+ ENV['SE_BROWSER'] = 'chrome'
52
54
  @launcher = SeleniumLauncher::Launcher.new
53
55
  expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
54
56
  expect(@launcher.driver.browser).to eql :chrome
55
57
  end
56
58
 
57
59
  it 'Firefox' do
58
- ENV['SL_BROWSER'] = 'firefox'
60
+ ENV['SE_BROWSER'] = 'firefox'
59
61
  @launcher = SeleniumLauncher::Launcher.new
60
62
  expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
61
63
  expect(@launcher.driver.browser).to eql :firefox
@@ -63,14 +65,14 @@ describe 'Launcher', :integration do
63
65
 
64
66
  it 'Internet Explorer' do
65
67
  pending 'Windows OS required' unless OS.windows?
66
- ENV['SL_BROWSER'] = 'internet-explorer'
68
+ ENV['SE_BROWSER'] = 'internet-explorer'
67
69
  @launcher = SeleniumLauncher::Launcher.new
68
70
  expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
69
71
  expect(@launcher.driver.browser).to eql :"internet-explorer"
70
72
  end
71
73
 
72
74
  it 'Safari' do
73
- ENV['SL_BROWSER'] = 'safari'
75
+ ENV['SE_BROWSER'] = 'safari'
74
76
  @launcher = SeleniumLauncher::Launcher.new
75
77
  expect(@launcher.driver.class).to eql Selenium::WebDriver::Driver
76
78
  expect(@launcher.driver.browser).to eql :safari
@@ -3,7 +3,7 @@ require_relative '../lib/selenium-launcher'
3
3
  describe 'Selenium Launcher', :acceptance do
4
4
 
5
5
  it 'runs' do
6
- ENV['SL_BROWSER'] = 'firefox'
6
+ ENV['SE_BROWSER'] = 'firefox'
7
7
  driver = SeleniumLauncher.launch
8
8
  expect(driver.class).to eql Selenium::WebDriver::Driver
9
9
  expect(driver.browser).to eql :firefox
@@ -13,23 +13,23 @@ describe 'Selenium Launcher', :acceptance do
13
13
  context '-> Config Checker -> ' do
14
14
 
15
15
  before(:each) do
16
- ENV['SL_BROWSER'] = nil
17
- ENV['SL_HOST'] = nil
18
- ENV['SL_HOST_URL'] = nil
16
+ ENV['SE_BROWSER'] = nil
17
+ ENV['SE_HOST'] = nil
18
+ ENV['SE_HOST_URL'] = nil
19
19
  end
20
20
 
21
21
  it 'no browser' do
22
22
  expect { driver = SeleniumLauncher.launch }.to raise_error(
23
23
  RuntimeError,
24
- 'You need to specify a browser (e.g., SL_BROWSER).')
24
+ 'You need to specify a browser (e.g., SE_BROWSER).')
25
25
  end
26
26
 
27
27
  it 'no Grid host URL' do
28
- ENV['SL_BROWSER'] = 'firefox'
29
- ENV['SL_HOST'] = 'grid'
28
+ ENV['SE_BROWSER'] = 'firefox'
29
+ ENV['SE_HOST'] = 'grid'
30
30
  expect { driver = SeleniumLauncher.launch }.to raise_error(
31
31
  RuntimeError,
32
- 'You need to specify a URL when using a Grid (e.g., SL_HOST_URL).')
32
+ 'You need to specify a URL when using a Grid (e.g., SE_HOST_URL).')
33
33
  end
34
34
 
35
35
  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.1.0
4
+ version: 0.2.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-11 00:00:00.000000000 Z
11
+ date: 2014-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver