gondola 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +9 -9
- data/gondola.gemspec +4 -3
- data/lib/gondola/selenium.rb +21 -0
- data/lib/gondola/tester.rb +18 -16
- data/lib/gondola/testrunner.rb +1 -1
- data/lib/gondola/version.rb +1 -1
- data/lib/gondola.rb +1 -0
- data/test/test_fail.rb +15 -23
- metadata +5 -4
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
childprocess (0.1.
|
5
|
-
ffi (~> 0.6
|
4
|
+
childprocess (0.1.8)
|
5
|
+
ffi (~> 1.0.6)
|
6
6
|
cmdparse (2.0.3)
|
7
7
|
fakeweb (1.3.0)
|
8
|
-
ffi (0.
|
8
|
+
ffi (1.0.7)
|
9
9
|
rake (>= 0.8.7)
|
10
10
|
git (1.2.5)
|
11
11
|
highline (1.6.1)
|
@@ -19,12 +19,12 @@ GEM
|
|
19
19
|
net-ssh (2.1.3)
|
20
20
|
net-ssh-gateway (1.0.1)
|
21
21
|
net-ssh (>= 1.99.1)
|
22
|
-
parallel (0.5.
|
22
|
+
parallel (0.5.3)
|
23
23
|
rake (0.8.7)
|
24
24
|
rest-client (1.6.1)
|
25
25
|
mime-types (>= 1.16)
|
26
26
|
rubyzip (0.9.4)
|
27
|
-
sauce (0.
|
27
|
+
sauce (0.19.0)
|
28
28
|
childprocess (>= 0.1.6)
|
29
29
|
cmdparse (>= 2.0.2)
|
30
30
|
highline (>= 1.5.0)
|
@@ -32,10 +32,10 @@ GEM
|
|
32
32
|
net-ssh
|
33
33
|
net-ssh-gateway
|
34
34
|
rest-client
|
35
|
-
selenium-webdriver (>= 0.1.
|
36
|
-
selenium-webdriver (0.1.
|
37
|
-
childprocess (
|
38
|
-
ffi (
|
35
|
+
selenium-webdriver (>= 0.1.4)
|
36
|
+
selenium-webdriver (0.1.4)
|
37
|
+
childprocess (>= 0.1.7)
|
38
|
+
ffi (>= 1.0.7)
|
39
39
|
json_pure
|
40
40
|
rubyzip
|
41
41
|
shoulda (2.11.3)
|
data/gondola.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gondola}
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matthew Perry"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-25}
|
13
13
|
s.default_executable = %q{gondola}
|
14
14
|
s.description = %q{
|
15
15
|
Gondola is Ruby command line utility and as well as a library which helps
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/gondola.rb",
|
36
36
|
"lib/gondola/converter.rb",
|
37
37
|
"lib/gondola/html_converter.rb",
|
38
|
+
"lib/gondola/selenium.rb",
|
38
39
|
"lib/gondola/tester.rb",
|
39
40
|
"lib/gondola/testrunner.rb",
|
40
41
|
"lib/gondola/version.rb",
|
@@ -54,7 +55,7 @@ Gem::Specification.new do |s|
|
|
54
55
|
s.homepage = %q{http://github.com/perrym5/gondola}
|
55
56
|
s.licenses = ["MIT"]
|
56
57
|
s.require_paths = ["lib"]
|
57
|
-
s.rubygems_version = %q{1.6.
|
58
|
+
s.rubygems_version = %q{1.6.1}
|
58
59
|
s.summary = %q{Ruby command line utility and library for integrating the Selenium IDE more tightly with Sauce Labs' Ondemand services}
|
59
60
|
s.test_files = [
|
60
61
|
"test/helper.rb",
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Gondola - selenium.rb:
|
2
|
+
# Subclass for overwriting some of the selenium
|
3
|
+
# gem's default error reporting behaviors.
|
4
|
+
require 'sauce/selenium'
|
5
|
+
|
6
|
+
module Gondola
|
7
|
+
class Selenium < ::Sauce::Selenium
|
8
|
+
|
9
|
+
# Same function definition as the selenium gem but without
|
10
|
+
# writing to standard out
|
11
|
+
def http_post(data)
|
12
|
+
start = Time.now
|
13
|
+
called_from = caller.detect{|line| line !~ /(selenium-client|vendor|usr\/lib\/ruby|\(eval\))/i}
|
14
|
+
http = Net::HTTP.new(@host, @port)
|
15
|
+
http.open_timeout = default_timeout_in_seconds
|
16
|
+
http.read_timeout = default_timeout_in_seconds
|
17
|
+
response = http.post('/selenium-server/driver/', data, ::Selenium::Client::HTTP_HEADERS)
|
18
|
+
[ response.body[0..1], response.body ]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/gondola/tester.rb
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
# the need for a unit testing framework
|
5
5
|
|
6
6
|
module Gondola
|
7
|
+
class AssertionError < RuntimeError
|
8
|
+
end
|
9
|
+
|
7
10
|
class Tester
|
8
11
|
attr_reader :cmd_num, :errors, :job_id
|
9
12
|
attr_accessor :sel
|
@@ -20,13 +23,20 @@ module Gondola
|
|
20
23
|
@sel.start()
|
21
24
|
@job_id = @sel.session_id
|
22
25
|
eval(@converter.ruby)
|
23
|
-
rescue
|
24
|
-
|
26
|
+
rescue AssertionError => e
|
27
|
+
rescue ::Selenium::Client::CommandError => e
|
28
|
+
@errors.push({ :command => @converter.commands[@cmd_num],
|
29
|
+
:error => e.message })
|
25
30
|
ensure
|
26
31
|
begin
|
32
|
+
if @errors.empty?
|
33
|
+
@sel.passed!
|
34
|
+
else
|
35
|
+
@sel.failed!
|
36
|
+
end
|
27
37
|
@sel.stop()
|
28
|
-
rescue Selenium::Client::CommandError => e
|
29
|
-
$stderr.puts e.message + "(Most likely, the test was closed on Sauce Labs' end)"
|
38
|
+
rescue ::Selenium::Client::CommandError => e
|
39
|
+
$stderr.puts e.message + "(Most likely, the test was closed early on Sauce Labs' end)"
|
30
40
|
end
|
31
41
|
end
|
32
42
|
end
|
@@ -38,27 +48,19 @@ module Gondola
|
|
38
48
|
end
|
39
49
|
|
40
50
|
def assert(expr)
|
41
|
-
unless verify(expr)
|
42
|
-
raise "Assertion Failed"
|
43
|
-
end
|
51
|
+
raise AssertionError, "Assertion Failed" unless verify(expr)
|
44
52
|
end
|
45
53
|
|
46
54
|
def assert_not(expr)
|
47
|
-
unless verify_not(expr)
|
48
|
-
raise "Assertion Failed"
|
49
|
-
end
|
55
|
+
raise AssertionError, "Assertion Failed" unless verify_not(expr)
|
50
56
|
end
|
51
57
|
|
52
58
|
def assert_equal(eq, expr)
|
53
|
-
unless verify_equal(eq, expr)
|
54
|
-
raise "Assertion Failed"
|
55
|
-
end
|
59
|
+
raise AssertionError, "Assertion Failed" unless verify_equal(eq, expr)
|
56
60
|
end
|
57
61
|
|
58
62
|
def assert_not_equal(eq, expr)
|
59
|
-
unless verify_not_equal(eq, expr)
|
60
|
-
raise "Assertion Failed"
|
61
|
-
end
|
63
|
+
raise AssertionError, "Assertion Failed" unless verify_not_equal(eq, expr)
|
62
64
|
end
|
63
65
|
|
64
66
|
def verify(expr)
|
data/lib/gondola/testrunner.rb
CHANGED
@@ -120,7 +120,7 @@ module Gondola
|
|
120
120
|
# Add global information to this request
|
121
121
|
request.merge! global
|
122
122
|
# Request a new selenium object from Sauce
|
123
|
-
selenium =
|
123
|
+
selenium = Gondola::Selenium.new(request)
|
124
124
|
# Begin test using a tester object
|
125
125
|
tester = Gondola::Tester.new(selenium, converter)
|
126
126
|
browser_string = "#{request[:os]} #{request[:browser]} #{request[:browser_version]}"
|
data/lib/gondola/version.rb
CHANGED
data/lib/gondola.rb
CHANGED
data/test/test_fail.rb
CHANGED
@@ -16,18 +16,14 @@ class TestFail < Test::Unit::TestCase
|
|
16
16
|
should "result in a failing test" do
|
17
17
|
VCR.use_cassette('failing_test1', :record => :new_episodes) do
|
18
18
|
@runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
|
19
|
-
expected = {
|
20
|
-
:
|
21
|
-
|
22
|
-
|
23
|
-
:
|
24
|
-
|
25
|
-
:ruby=>"assert @sel.is_text_present(\"Producer FAIL\")\n"
|
26
|
-
},
|
27
|
-
:error=>"returned false, expecting true"
|
28
|
-
}]}
|
19
|
+
expected = [{
|
20
|
+
:command=>{
|
21
|
+
:ruby=>"assert @sel.is_text_present(\"Producer FAIL\")\n"
|
22
|
+
},
|
23
|
+
:error=>"returned false, expecting true"
|
24
|
+
}]
|
29
25
|
assert @runner.results.size == 1
|
30
|
-
assert_equal expected, @runner.results[0]
|
26
|
+
assert_equal expected, @runner.results[0][:result]
|
31
27
|
end
|
32
28
|
end
|
33
29
|
end
|
@@ -41,19 +37,15 @@ class TestFail < Test::Unit::TestCase
|
|
41
37
|
should "result in a failing test" do
|
42
38
|
VCR.use_cassette('failing_test2', :record => :new_episodes) do
|
43
39
|
@runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
|
44
|
-
expected = {
|
45
|
-
:
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
:ruby=>"assert @sel.is_text_present(\"Producer FAIL\")"
|
52
|
-
},
|
53
|
-
:error=>"returned false, expecting true"
|
54
|
-
}]}
|
40
|
+
expected = [{
|
41
|
+
:command=>{
|
42
|
+
:original=>"assertTextPresent(\"Producer FAIL\")",
|
43
|
+
:ruby=>"assert @sel.is_text_present(\"Producer FAIL\")"
|
44
|
+
},
|
45
|
+
:error=>"returned false, expecting true"
|
46
|
+
}]
|
55
47
|
assert @runner.results.size == 1
|
56
|
-
assert_equal expected, @runner.results[0]
|
48
|
+
assert_equal expected, @runner.results[0][:result]
|
57
49
|
end
|
58
50
|
end
|
59
51
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gondola
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matthew Perry
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-25 00:00:00 -04:00
|
14
14
|
default_executable: gondola
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/gondola.rb
|
112
112
|
- lib/gondola/converter.rb
|
113
113
|
- lib/gondola/html_converter.rb
|
114
|
+
- lib/gondola/selenium.rb
|
114
115
|
- lib/gondola/tester.rb
|
115
116
|
- lib/gondola/testrunner.rb
|
116
117
|
- lib/gondola/version.rb
|
@@ -140,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
141
|
requirements:
|
141
142
|
- - ">="
|
142
143
|
- !ruby/object:Gem::Version
|
143
|
-
hash:
|
144
|
+
hash: -2033131404099204936
|
144
145
|
segments:
|
145
146
|
- 0
|
146
147
|
version: "0"
|
@@ -153,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
154
|
requirements: []
|
154
155
|
|
155
156
|
rubyforge_project:
|
156
|
-
rubygems_version: 1.6.
|
157
|
+
rubygems_version: 1.6.1
|
157
158
|
signing_key:
|
158
159
|
specification_version: 3
|
159
160
|
summary: Ruby command line utility and library for integrating the Selenium IDE more tightly with Sauce Labs' Ondemand services
|