selenium-connect 1.8.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/CHANGELOG.md +0 -0
- data/README.md +18 -9
- data/Rakefile +14 -0
- data/bin/phantomjs +0 -0
- data/build/.gitkeep +0 -0
- data/lib/selenium-connect/configuration.rb +3 -0
- data/lib/selenium-connect/rake.task +1 -1
- data/lib/selenium-connect/runner.rb +3 -1
- data/lib/selenium-connect/runners/firefox.rb +3 -0
- data/lib/selenium-connect/runners/phantomjs.rb +38 -0
- data/lib/selenium-connect/server.rb +10 -2
- data/selenium-connect.gemspec +2 -2
- data/spec/acceptance/firefox_spec.rb +60 -0
- data/spec/acceptance/headless_spec.rb +27 -0
- data/spec/acceptance/helper.rb +15 -0
- data/spec/acceptance/ie_spec.rb +19 -0
- data/spec/acceptance/logging_spec.rb +24 -0
- data/spec/runners/phantomjs_spec.rb +26 -0
- metadata +16 -6
- data/chromedriver.log +0 -56
- data/spec/acceptance_spec.rb +0 -109
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
File without changes
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#selenium-connect [![Code Climate](https://codeclimate.com/github/arrgyle/selenium-connect.png)](https://codeclimate.com/github/arrgyle/selenium-connect)
|
2
2
|
|
3
|
-
A stupid simple way to run your Selenium tests on your computer, against a Selenium Grid, or in the cloud (e.g. SauceLabs).
|
3
|
+
A stupid simple way to run your Selenium tests on your computer, against a Selenium Grid, or in the cloud (e.g. SauceLabs).
|
4
4
|
|
5
5
|
## Getting Started
|
6
6
|
```ruby
|
@@ -14,21 +14,30 @@ end
|
|
14
14
|
@driver = SeleniumConnect.start
|
15
15
|
@driver.get "http://www.google.com"
|
16
16
|
SeleniumConnect.finish
|
17
|
-
```
|
17
|
+
```
|
18
18
|
|
19
19
|
## Helpful bits
|
20
20
|
|
21
|
-
### Start
|
22
|
-
If host is set to "localhost", it will download the latest selenium-standalone-server.jar (unless it already has) and run it. Or, you can specify your own jar (if you have one you prefer to use). If no additional parameters are set, it will be exected in the background, with logging disabled. This functionality is driven using the [Selenium Rake Server Task](http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/Rake/ServerTask.html).
|
21
|
+
### Start
|
22
|
+
If host is set to "localhost", it will download the latest selenium-standalone-server.jar (unless it already has) and run it. Or, you can specify your own jar (if you have one you prefer to use). If no additional parameters are set, it will be exected in the background, with logging disabled. This functionality is driven using the [Selenium Rake Server Task](http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/Rake/ServerTask.html).
|
23
23
|
|
24
|
-
### Finish
|
25
|
-
Issues a quit command to the driver (and stops the local server if your host is set to "localhost").
|
24
|
+
### Finish
|
25
|
+
Issues a quit command to the driver (and stops the local server if your host is set to "localhost").
|
26
26
|
|
27
|
-
### Support
|
27
|
+
### Support
|
28
28
|
- Firefox (standard, profile by path, profile by name, browser binary)
|
29
29
|
- Internet Explorer
|
30
30
|
- Chrome
|
31
31
|
- SauceLabs
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
This project conforms to the [neverstopbuilding/craftsmanship](https://github.com/neverstopbuilding/craftsmanship) guidelines. Specifically related to the branching model and versioning. Please see the guidelines for details.
|
36
|
+
|
37
|
+
### Install Dependencies
|
38
|
+
|
39
|
+
bundle install
|
40
|
+
|
41
|
+
### Run the Tests
|
42
|
+
|
43
|
+
bundle exec rspec
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
task :default => [:build]
|
5
|
+
|
6
|
+
desc 'Runs standard build activities.'
|
7
|
+
task :build => [:clean, :spec]
|
8
|
+
|
9
|
+
desc 'Removes the build directory.'
|
10
|
+
task :clean do
|
11
|
+
FileUtils.rm_rf('build');
|
12
|
+
end
|
13
|
+
|
14
|
+
RSpec::Core::RakeTask.new(:spec)
|
data/bin/phantomjs
ADDED
Binary file
|
data/build/.gitkeep
ADDED
File without changes
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'selenium-connect/runners/firefox'
|
2
2
|
require 'selenium-connect/runners/ie'
|
3
3
|
require 'selenium-connect/runners/chrome'
|
4
|
+
require 'selenium-connect/runners/phantomjs'
|
4
5
|
require 'selenium-connect/runners/no_browser'
|
5
6
|
require 'selenium-connect/runners/saucelabs'
|
6
7
|
|
@@ -39,9 +40,10 @@ module SeleniumConnect
|
|
39
40
|
firefox = Firefox.new(config)
|
40
41
|
ie = InternetExplorer.new(config)
|
41
42
|
chrome = Chrome.new(config)
|
43
|
+
phantomjs = PhantomJS.new(config)
|
42
44
|
no_browser = NoBrowser.new(config)
|
43
45
|
|
44
|
-
browsers = [ firefox, ie, chrome, no_browser ]
|
46
|
+
browsers = [ firefox, ie, chrome, phantomjs, no_browser ]
|
45
47
|
end
|
46
48
|
|
47
49
|
end #Runner
|
@@ -22,12 +22,15 @@ module SeleniumConnect
|
|
22
22
|
Selenium::WebDriver::Firefox::Profile.new config.profile_path
|
23
23
|
elsif config.profile_name
|
24
24
|
Selenium::WebDriver::Firefox::Profile.from_name config.profile_name
|
25
|
+
else
|
26
|
+
Selenium::WebDriver::Firefox::Profile.new
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
def config_browser
|
29
31
|
profile = get_profile
|
30
32
|
profile.assume_untrusted_certificate_issuer = false unless profile.nil?
|
33
|
+
profile.log_file = File.join(config.log, 'firefox.log') if config.log
|
31
34
|
browser = Selenium::WebDriver::Remote::Capabilities.firefox
|
32
35
|
browser[:firefox_binary] = config.browser_path if config.browser_path
|
33
36
|
browser[:firefox_profile] = profile
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module SeleniumConnect
|
2
|
+
class Runner
|
3
|
+
class PhantomJS
|
4
|
+
attr_reader :config
|
5
|
+
|
6
|
+
def initialize(config)
|
7
|
+
@config = config
|
8
|
+
end
|
9
|
+
|
10
|
+
def match?
|
11
|
+
config.browser == "phantomjs"
|
12
|
+
end
|
13
|
+
|
14
|
+
def launch
|
15
|
+
init_browser
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def get_executable_path
|
21
|
+
current_dir_path = File.join(File.dirname(File.expand_path(__FILE__)))
|
22
|
+
current_dir_path + "/../../../bin/phantomjs"
|
23
|
+
end
|
24
|
+
|
25
|
+
def config_browser
|
26
|
+
executable_path = get_executable_path
|
27
|
+
browser = Selenium::WebDriver::Remote::Capabilities.phantomjs
|
28
|
+
browser['phantomjs.binary.path'] = executable_path
|
29
|
+
return browser
|
30
|
+
end
|
31
|
+
|
32
|
+
def init_browser
|
33
|
+
config_browser
|
34
|
+
end
|
35
|
+
|
36
|
+
end #Chrome
|
37
|
+
end #Runner
|
38
|
+
end #SeleniumConnect
|
@@ -8,7 +8,11 @@ module SeleniumConnect
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def start
|
11
|
-
|
11
|
+
# if configuration.browser == 'ghostdriver'
|
12
|
+
# start_phantomjs
|
13
|
+
# else
|
14
|
+
rake "start"
|
15
|
+
# end
|
12
16
|
end
|
13
17
|
|
14
18
|
def stop
|
@@ -35,7 +39,7 @@ module SeleniumConnect
|
|
35
39
|
t.background
|
36
40
|
#{
|
37
41
|
if configuration.log
|
38
|
-
"t.log = '#{configuration.log}'"
|
42
|
+
"t.log = '#{configuration.log}/server.log'"
|
39
43
|
else
|
40
44
|
"t.log = false"
|
41
45
|
end
|
@@ -61,5 +65,9 @@ module SeleniumConnect
|
|
61
65
|
system "rake -f #{get_rake_file} server:#{task}"
|
62
66
|
end
|
63
67
|
|
68
|
+
# def start_phantomjs
|
69
|
+
# system "#{current_dir_path} + '/../../bin/phantomjs --webdriver=#{configuration.port}"
|
70
|
+
# end
|
71
|
+
|
64
72
|
end #Server
|
65
73
|
end #SeleniumConnect
|
data/selenium-connect.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'selenium-connect'
|
3
|
-
s.version = '1.
|
3
|
+
s.version = '1.9.0'
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.authors = ['Dave Haeffner']
|
6
6
|
s.email = ['dave@arrgyle.com']
|
7
7
|
s.homepage = 'https://github.com/arrgyle/selenium-connect'
|
8
8
|
s.summary = 'A stupid simple way to run your Selenium tests on localhost, against a Selenium Grid, or in the cloud (e.g. SauceLabs).'
|
9
|
-
s.description = '
|
9
|
+
s.description = 'Changed the log option so all you need to provide is a directory. The selenium log and browser specific logs will then show up there. Also added GhostDriver support.'
|
10
10
|
s.license = 'MIT'
|
11
11
|
|
12
12
|
s.files = `git ls-files`.split($/)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'selenium-connect'
|
2
|
+
require_relative 'helper'
|
3
|
+
|
4
|
+
describe "Firefox" do
|
5
|
+
|
6
|
+
let(:google) { Google.new(SeleniumConnect.start) }
|
7
|
+
let(:quit) { SeleniumConnect.finish }
|
8
|
+
|
9
|
+
it "blank config" do
|
10
|
+
SeleniumConnect.configure do end
|
11
|
+
google.visit
|
12
|
+
google.page_title.should include("Google")
|
13
|
+
quit
|
14
|
+
end
|
15
|
+
|
16
|
+
it "localhost" do
|
17
|
+
SeleniumConnect.configure do |c|
|
18
|
+
c.host = "localhost"
|
19
|
+
end
|
20
|
+
google.visit
|
21
|
+
google.page_title.should include("Google")
|
22
|
+
quit
|
23
|
+
end
|
24
|
+
|
25
|
+
it "local jar file specified" do
|
26
|
+
SeleniumConnect.configure do |c|
|
27
|
+
c.host = "localhost"
|
28
|
+
c.jar = "#{Dir.pwd}/selenium-server-standalone-2.33.0.jar"
|
29
|
+
end
|
30
|
+
google.visit
|
31
|
+
google.page_title.should include("Google")
|
32
|
+
quit
|
33
|
+
end
|
34
|
+
|
35
|
+
it "profile name" do
|
36
|
+
pending "requires machine setup to run, and need a public example"
|
37
|
+
SeleniumConnect.configure do |c|
|
38
|
+
c.profile_name = "YourProfileNameGoesHere"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "profile path" do
|
43
|
+
pending "need to add a profile to the repo"
|
44
|
+
SeleniumConnect.configure do |c|
|
45
|
+
c.profile_path = "#{Dir.pwd}/path/to/profile"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it "browser path" do
|
50
|
+
#example only works on Mac
|
51
|
+
SeleniumConnect.configure do |c|
|
52
|
+
c.browser = "firefox"
|
53
|
+
c.browser_path = "/Applications/Firefox.app/Contents/MacOS/firefox"
|
54
|
+
end
|
55
|
+
google.visit
|
56
|
+
google.page_title.should include("Google")
|
57
|
+
quit
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'selenium-connect'
|
2
|
+
require_relative 'helper'
|
3
|
+
|
4
|
+
describe "Headless" do
|
5
|
+
|
6
|
+
let(:google) { Google.new(SeleniumConnect.start) }
|
7
|
+
let(:quit) { SeleniumConnect.finish }
|
8
|
+
|
9
|
+
it "should run a basic test with phantom js" do
|
10
|
+
SeleniumConnect.configure do |c|
|
11
|
+
c.browser = "phantomjs"
|
12
|
+
end
|
13
|
+
google.visit
|
14
|
+
google.page_title.should include("Google")
|
15
|
+
quit
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should not find something on a page" do
|
19
|
+
SeleniumConnect.configure do |c|
|
20
|
+
c.browser = "phantomjs"
|
21
|
+
end
|
22
|
+
google.visit
|
23
|
+
google.page_title.should_not include("Poogle")
|
24
|
+
quit
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'selenium-connect'
|
2
|
+
require_relative 'helper'
|
3
|
+
|
4
|
+
describe "IE" do
|
5
|
+
|
6
|
+
let(:google) { Google.new(SeleniumConnect.start) }
|
7
|
+
let(:quit) { SeleniumConnect.finish }
|
8
|
+
|
9
|
+
it "with Selenium Grid" do
|
10
|
+
pending
|
11
|
+
SeleniumConnect.configure do |c|
|
12
|
+
c.host = "192.168.1.139"
|
13
|
+
c.browser = "ie"
|
14
|
+
end
|
15
|
+
driver.get 'https://mashup.ic.mantech.com/ispace'
|
16
|
+
quit
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'selenium-connect'
|
2
|
+
require_relative 'helper'
|
3
|
+
|
4
|
+
describe "Logging" do
|
5
|
+
let(:google) { Google.new(SeleniumConnect.start) }
|
6
|
+
let(:logs_dir) { File.join(Dir.pwd, 'build') }
|
7
|
+
|
8
|
+
it "logging" do
|
9
|
+
SeleniumConnect.configure do |c|
|
10
|
+
c.log = logs_dir
|
11
|
+
end
|
12
|
+
|
13
|
+
google.visit
|
14
|
+
SeleniumConnect.finish
|
15
|
+
|
16
|
+
server_log = File.read(logs_dir+'/server.log')
|
17
|
+
server_log.empty?.should be false
|
18
|
+
|
19
|
+
browser_log = File.read(logs_dir+'/firefox.log')
|
20
|
+
browser_log.empty?.should be false
|
21
|
+
|
22
|
+
# File.delete('runner.out')
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'selenium-connect/configuration'
|
2
|
+
require 'selenium-connect/runners/phantomjs'
|
3
|
+
require 'selenium-webdriver'
|
4
|
+
|
5
|
+
describe "phantomjs runner" do
|
6
|
+
it "should match against phantomjs if configured as such" do
|
7
|
+
config = SeleniumConnect::Configuration.new
|
8
|
+
config.browser = 'phantomjs'
|
9
|
+
runner = SeleniumConnect::Runner::PhantomJS.new(config)
|
10
|
+
runner.match?.should be_true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should not match if there is a different browser specified" do
|
14
|
+
config = SeleniumConnect::Configuration.new
|
15
|
+
config.browser = 'chrome'
|
16
|
+
runner = SeleniumConnect::Runner::PhantomJS.new(config)
|
17
|
+
runner.match?.should be_false
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return a browser capabilities object for the browser on launch" do
|
21
|
+
config = SeleniumConnect::Configuration.new
|
22
|
+
config.browser = 'phantomjs'
|
23
|
+
runner = SeleniumConnect::Runner::PhantomJS.new(config)
|
24
|
+
runner.launch.is_a?(Selenium::WebDriver::Remote::Capabilities).should be true
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: selenium-webdriver
|
@@ -75,8 +75,9 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
-
description:
|
79
|
-
|
78
|
+
description: Changed the log option so all you need to provide is a directory. The
|
79
|
+
selenium log and browser specific logs will then show up there. Also added GhostDriver
|
80
|
+
support.
|
80
81
|
email:
|
81
82
|
- dave@arrgyle.com
|
82
83
|
executables: []
|
@@ -85,10 +86,13 @@ extra_rdoc_files: []
|
|
85
86
|
files:
|
86
87
|
- .gitignore
|
87
88
|
- .rvmrc
|
89
|
+
- CHANGELOG.md
|
88
90
|
- Gemfile
|
89
91
|
- README.md
|
92
|
+
- Rakefile
|
90
93
|
- bin/chromedriver
|
91
|
-
-
|
94
|
+
- bin/phantomjs
|
95
|
+
- build/.gitkeep
|
92
96
|
- lib/selenium-connect.rb
|
93
97
|
- lib/selenium-connect/configuration.rb
|
94
98
|
- lib/selenium-connect/rake.task
|
@@ -97,11 +101,17 @@ files:
|
|
97
101
|
- lib/selenium-connect/runners/firefox.rb
|
98
102
|
- lib/selenium-connect/runners/ie.rb
|
99
103
|
- lib/selenium-connect/runners/no_browser.rb
|
104
|
+
- lib/selenium-connect/runners/phantomjs.rb
|
100
105
|
- lib/selenium-connect/runners/saucelabs.rb
|
101
106
|
- lib/selenium-connect/server.rb
|
102
107
|
- selenium-connect.gemspec
|
103
|
-
- spec/
|
108
|
+
- spec/acceptance/firefox_spec.rb
|
109
|
+
- spec/acceptance/headless_spec.rb
|
110
|
+
- spec/acceptance/helper.rb
|
111
|
+
- spec/acceptance/ie_spec.rb
|
112
|
+
- spec/acceptance/logging_spec.rb
|
104
113
|
- spec/example.yaml
|
114
|
+
- spec/runners/phantomjs_spec.rb
|
105
115
|
- spec/sauce_spec.rb
|
106
116
|
- spec/yaml_spec.rb
|
107
117
|
homepage: https://github.com/arrgyle/selenium-connect
|
data/chromedriver.log
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
[0.001][INFO]: ChromeDriver 26.0.1383.0 /Users/more/Dropbox/_dev/Arrgyle/selenium-connect/bin/chromedriver
|
2
|
-
[1.019][FINE]: Initializing session with capabilities {
|
3
|
-
"browserName": "chrome",
|
4
|
-
"cssSelectorsEnabled": true,
|
5
|
-
"javascriptEnabled": true,
|
6
|
-
"nativeEvents": false,
|
7
|
-
"platform": "ANY",
|
8
|
-
"rotatable": false,
|
9
|
-
"takesScreenshot": false,
|
10
|
-
"version": ""
|
11
|
-
}
|
12
|
-
|
13
|
-
[1.019][INFO]: Launching chrome: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --disable-hang-monitor --disable-prompt-on-repost --dom-automation --full-memory-crash-report --no-default-browser-check --no-first-run --disable-background-networking --disable-sync --disable-translate --disable-web-resources --safebrowsing-disable-auto-update --safebrowsing-disable-download-protection --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --enable-logging --log-level=1 --use-mock-keychain --ignore-certificate-errors about:blank
|
14
|
-
[2.960][INFO]: Connected to Chrome successfully. Version: 27.0.1453.93
|
15
|
-
[3.044][FINE]: Command received (/session/d84d6ebf341008c58eee63695f329969)
|
16
|
-
[3.045][FINE]: Command finished (/session/d84d6ebf341008c58eee63695f329969) with response {
|
17
|
-
"sessionId": "d84d6ebf341008c58eee63695f329969",
|
18
|
-
"status": 0,
|
19
|
-
"value": {
|
20
|
-
"acceptSslCerts": false,
|
21
|
-
"applicationCacheEnabled": false,
|
22
|
-
"browserConnectionEnabled": false,
|
23
|
-
"browserName": "chrome",
|
24
|
-
"chrome.chromedriverVersion": "26.0.1383.0",
|
25
|
-
"cssSelectorsEnabled": true,
|
26
|
-
"databaseEnabled": false,
|
27
|
-
"handlesAlerts": true,
|
28
|
-
"javascriptEnabled": true,
|
29
|
-
"locationContextEnabled": false,
|
30
|
-
"nativeEvents": true,
|
31
|
-
"platform": "mac",
|
32
|
-
"rotatable": false,
|
33
|
-
"takesScreenshot": true,
|
34
|
-
"version": "27.0.1453.93",
|
35
|
-
"webStorageEnabled": true
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
[3.338][FINE]: Command received (/session/d84d6ebf341008c58eee63695f329969/url) with params {
|
40
|
-
"url": "http://google.com"
|
41
|
-
}
|
42
|
-
|
43
|
-
[3.338][FINER]: Waiting for all views to stop loading...
|
44
|
-
[3.339][FINER]: Done waiting for all views to stop loading
|
45
|
-
[3.997][FINER]: Waiting for all views to stop loading...
|
46
|
-
[3.999][FINER]: Done waiting for all views to stop loading
|
47
|
-
[3.999][FINE]: Command finished (/session/d84d6ebf341008c58eee63695f329969/url) with response {
|
48
|
-
"sessionId": "d84d6ebf341008c58eee63695f329969",
|
49
|
-
"status": 0,
|
50
|
-
"value": {
|
51
|
-
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
[4.011][FINE]: Command received (/session/d84d6ebf341008c58eee63695f329969)
|
56
|
-
[4.156][INFO]: Chrome shutdown
|
data/spec/acceptance_spec.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
require 'selenium-connect'
|
2
|
-
|
3
|
-
describe "Acceptance Tests" do
|
4
|
-
|
5
|
-
let(:google) { Google.new(SeleniumConnect.start) }
|
6
|
-
let(:driver) { SeleniumConnect.start }
|
7
|
-
let(:quit) { SeleniumConnect.finish }
|
8
|
-
|
9
|
-
context "Common" do
|
10
|
-
it "logging" do
|
11
|
-
SeleniumConnect.configure do |c|
|
12
|
-
c.log = "#{Dir.pwd}/runner.out"
|
13
|
-
end
|
14
|
-
google.visit
|
15
|
-
SeleniumConnect.finish
|
16
|
-
log = File.read('runner.out')
|
17
|
-
log.empty?.should == false
|
18
|
-
File.delete('runner.out')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "Firefox" do
|
23
|
-
it "blank config" do
|
24
|
-
SeleniumConnect.configure do end
|
25
|
-
google.visit
|
26
|
-
google.page_title.should include("Google")
|
27
|
-
quit
|
28
|
-
end
|
29
|
-
|
30
|
-
it "localhost" do
|
31
|
-
SeleniumConnect.configure do |c|
|
32
|
-
c.host = "localhost"
|
33
|
-
end
|
34
|
-
google.visit
|
35
|
-
google.page_title.should include("Google")
|
36
|
-
quit
|
37
|
-
end
|
38
|
-
|
39
|
-
it "local jar file" do
|
40
|
-
SeleniumConnect.configure do |c|
|
41
|
-
c.host = "localhost"
|
42
|
-
c.jar = "#{Dir.pwd}/selenium-server-standalone-2.32.0.jar"
|
43
|
-
end
|
44
|
-
google.visit
|
45
|
-
google.page_title.should include("Google")
|
46
|
-
quit
|
47
|
-
end
|
48
|
-
|
49
|
-
it "profile name" do
|
50
|
-
pending "requires machine setup to run, and need a public example"
|
51
|
-
SeleniumConnect.configure do |c|
|
52
|
-
c.profile_name = "YourProfileNameGoesHere"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
it "profile path" do
|
57
|
-
pending "need to add a profile to the repo"
|
58
|
-
SeleniumConnect.configure do |c|
|
59
|
-
c.profile_path = "#{Dir.pwd}/path/to/profile"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
it "browser path" do
|
64
|
-
#only works with Firefox
|
65
|
-
SeleniumConnect.configure do |c|
|
66
|
-
c.host = "localhost"
|
67
|
-
c.jar = "#{Dir.pwd}/selenium-server-standalone-2.32.0.jar"
|
68
|
-
c.browser = "firefox"
|
69
|
-
c.browser_path = "/Applications/Firefox.app/Contents/MacOS/firefox"
|
70
|
-
end
|
71
|
-
google.visit
|
72
|
-
google.page_title.should include("Google")
|
73
|
-
quit
|
74
|
-
end
|
75
|
-
|
76
|
-
end #Context//Firefox
|
77
|
-
|
78
|
-
context "IE" do
|
79
|
-
|
80
|
-
it "grid" do
|
81
|
-
pending
|
82
|
-
SeleniumConnect.configure do |c|
|
83
|
-
# c.host = "at-xp1.dodiis-aspace.local"
|
84
|
-
c.host = "192.168.1.139"
|
85
|
-
c.browser = "ie"
|
86
|
-
end
|
87
|
-
driver.get 'https://mashup.ic.mantech.com/ispace'
|
88
|
-
quit
|
89
|
-
end
|
90
|
-
|
91
|
-
end #Context//IE
|
92
|
-
|
93
|
-
end #Describe
|
94
|
-
|
95
|
-
class Google
|
96
|
-
attr_accessor :page
|
97
|
-
|
98
|
-
def initialize(driver)
|
99
|
-
@page = driver
|
100
|
-
end
|
101
|
-
|
102
|
-
def visit
|
103
|
-
page.get "http://www.google.com"
|
104
|
-
end
|
105
|
-
|
106
|
-
def page_title
|
107
|
-
page.title
|
108
|
-
end
|
109
|
-
end
|