selenium-connect 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +2 -3
- data/lib/selenium-connect/configuration.rb +6 -6
- data/lib/selenium-connect/rake.task +1 -1
- data/lib/selenium-connect/runner.rb +10 -6
- data/lib/selenium-connect/selenium-connect.rb +1 -4
- data/lib/selenium-connect/server.rb +1 -1
- data/selenium-connect.gemspec +4 -1
- data/spec/basic_spec.rb +67 -0
- metadata +19 -4
- data/Gemfile.lock +0 -28
- data/example.rb +0 -12
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
#selenium-connect
|
2
|
-
===============
|
1
|
+
#selenium-connect [![Code Climate](https://codeclimate.com/github/arrgyle/selenium-connect.png)](https://codeclimate.com/github/arrgyle/selenium-connect)
|
3
2
|
|
4
3
|
This library aims to make configuring and running your Selenium tests against a Selenium Server simple for both local and remote execution.
|
5
4
|
|
@@ -11,7 +10,7 @@ SeleniumConnect.configure do |c|
|
|
11
10
|
c.host = "localhost"
|
12
11
|
c.port = "4444"
|
13
12
|
c.browser = "firefox"
|
14
|
-
c.profile_path = "#{Dir.pwd}/profiles/your_custom_firefox_profile"
|
13
|
+
c.profile_path = "#{Dir.pwd}/profiles/your_custom_firefox_profile" # or c.profile_name = "profile"
|
15
14
|
end
|
16
15
|
|
17
16
|
@driver = SeleniumConnect.start
|
@@ -1,17 +1,17 @@
|
|
1
1
|
module SeleniumConnect
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :host, :port, :browser, :profile_path, :version, :background, :log, :jar
|
3
|
+
attr_accessor :host, :port, :browser, :profile_path, :profile_name, :version, :background, :log, :jar
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
|
6
|
+
defaults
|
7
7
|
end
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
-
def
|
12
|
-
host = "localhost" unless host
|
13
|
-
port = "4444" unless port
|
14
|
-
browser = "firefox" unless browser
|
11
|
+
def defaults
|
12
|
+
@host = "localhost" unless host
|
13
|
+
@port = "4444" unless port
|
14
|
+
@browser = "firefox" unless browser
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -1,7 +1,3 @@
|
|
1
|
-
#browser type determines server type
|
2
|
-
#browser type determines config params
|
3
|
-
#initializer *should* be the same
|
4
|
-
|
5
1
|
module SeleniumConnect
|
6
2
|
class Runner
|
7
3
|
attr_reader :driver, :configuration
|
@@ -17,9 +13,17 @@ module SeleniumConnect
|
|
17
13
|
"http://#{configuration.host}:#{configuration.port}/wd/hub"
|
18
14
|
end
|
19
15
|
|
16
|
+
def get_profile
|
17
|
+
if configuration.profile_path
|
18
|
+
Selenium::WebDriver::Firefox::Profile.new configuration.profile_path
|
19
|
+
elsif configuration.profile_name
|
20
|
+
Selenium::WebDriver::Firefox::Profile.from_name configuration.profile_name
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
20
24
|
def set_profile
|
21
|
-
profile =
|
22
|
-
profile.assume_untrusted_certificate_issuer = false
|
25
|
+
profile = get_profile
|
26
|
+
profile.assume_untrusted_certificate_issuer = false unless profile.nil?
|
23
27
|
Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
|
24
28
|
end
|
25
29
|
|
@@ -27,7 +27,7 @@ module SeleniumConnect
|
|
27
27
|
#{"t.version = :latest" unless configuration.jar}
|
28
28
|
#{if configuration.jar then "t.jar = '#{configuration.jar}'" end}
|
29
29
|
t.background
|
30
|
-
t.log = #{configuration.log ? configuration.log : "false"}
|
30
|
+
t.log = '#{configuration.log ? configuration.log : "false"}'
|
31
31
|
t.port = #{configuration.port ? configuration.port : "4444"}
|
32
32
|
end"
|
33
33
|
end
|
data/selenium-connect.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'selenium-connect'
|
3
|
-
s.version = '1.
|
3
|
+
s.version = '1.3.0'
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.authors = ['Dave Haeffner']
|
6
6
|
s.email = ['dave@arrgyle.com']
|
@@ -15,4 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.add_dependency 'selenium-webdriver'
|
17
17
|
s.add_dependency 'rake'
|
18
|
+
|
19
|
+
s.add_development_dependency 'rspec'
|
20
|
+
|
18
21
|
end
|
data/spec/basic_spec.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'selenium-connect'
|
2
|
+
|
3
|
+
describe SeleniumConnect do
|
4
|
+
|
5
|
+
let(:google) { Google.new(SeleniumConnect.start) }
|
6
|
+
|
7
|
+
context "Common" do
|
8
|
+
it "logging", :wip => true do
|
9
|
+
SeleniumConnect.configure do |c|
|
10
|
+
c.log = "#{Dir.pwd}/runner.out"
|
11
|
+
end
|
12
|
+
google.visit
|
13
|
+
SeleniumConnect.finish
|
14
|
+
File.read('runner.out').empty?.should == false
|
15
|
+
File.delete('runner.out')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "Firefox" do
|
20
|
+
it "blank config" do
|
21
|
+
SeleniumConnect.configure do end
|
22
|
+
google.visit
|
23
|
+
google.page_title.should include("Google")
|
24
|
+
SeleniumConnect.finish
|
25
|
+
end
|
26
|
+
|
27
|
+
it "localhost" do
|
28
|
+
SeleniumConnect.configure do |c|
|
29
|
+
c.host = "localhost"
|
30
|
+
end
|
31
|
+
google.visit
|
32
|
+
google.page_title.should include("Google")
|
33
|
+
SeleniumConnect.finish
|
34
|
+
end
|
35
|
+
|
36
|
+
it "profile name" do
|
37
|
+
pending "requires machine setup to run, and need a public example"
|
38
|
+
SeleniumConnect.configure do |c|
|
39
|
+
c.profile_name = "YourProfileName"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it "profile path" do
|
44
|
+
pending "need to add a profile to the repo"
|
45
|
+
SeleniumConnect.configure do |c|
|
46
|
+
c.profile_path = "#{Dir.pwd}/path/to/profile"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end #Context//Firefox
|
51
|
+
end #Describe
|
52
|
+
|
53
|
+
class Google
|
54
|
+
attr_accessor :page
|
55
|
+
|
56
|
+
def initialize(driver)
|
57
|
+
@page = driver
|
58
|
+
end
|
59
|
+
|
60
|
+
def visit
|
61
|
+
page.get "http://www.google.com"
|
62
|
+
end
|
63
|
+
|
64
|
+
def page_title
|
65
|
+
page.getTitle
|
66
|
+
end
|
67
|
+
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.3.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-
|
12
|
+
date: 2013-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: selenium-webdriver
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
description:
|
47
63
|
email:
|
48
64
|
- dave@arrgyle.com
|
@@ -53,9 +69,7 @@ files:
|
|
53
69
|
- .gitignore
|
54
70
|
- .rvmrc
|
55
71
|
- Gemfile
|
56
|
-
- Gemfile.lock
|
57
72
|
- README.md
|
58
|
-
- example.rb
|
59
73
|
- lib/selenium-connect.rb
|
60
74
|
- lib/selenium-connect/configuration.rb
|
61
75
|
- lib/selenium-connect/rake.task
|
@@ -63,6 +77,7 @@ files:
|
|
63
77
|
- lib/selenium-connect/selenium-connect.rb
|
64
78
|
- lib/selenium-connect/server.rb
|
65
79
|
- selenium-connect.gemspec
|
80
|
+
- spec/basic_spec.rb
|
66
81
|
homepage: https://github.com/arrgyle/selenium-connect
|
67
82
|
licenses:
|
68
83
|
- MIT
|
data/Gemfile.lock
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
selenium-connect (1.2.0)
|
5
|
-
rake
|
6
|
-
selenium-webdriver
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
childprocess (0.3.9)
|
12
|
-
ffi (~> 1.0, >= 1.0.11)
|
13
|
-
ffi (1.6.0)
|
14
|
-
multi_json (1.7.2)
|
15
|
-
rake (10.0.4)
|
16
|
-
rubyzip (0.9.9)
|
17
|
-
selenium-webdriver (2.31.0)
|
18
|
-
childprocess (>= 0.2.5)
|
19
|
-
multi_json (~> 1.0)
|
20
|
-
rubyzip
|
21
|
-
websocket (~> 1.0.4)
|
22
|
-
websocket (1.0.7)
|
23
|
-
|
24
|
-
PLATFORMS
|
25
|
-
ruby
|
26
|
-
|
27
|
-
DEPENDENCIES
|
28
|
-
selenium-connect!
|