gondola 1.1.9 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,4 +7,6 @@ group :development do
7
7
  gem "shoulda", ">= 0"
8
8
  gem "bundler", "~> 1.0.0"
9
9
  gem "jeweler", "~> 1.5.2"
10
+ gem "vcr", "~> 1.7.1"
11
+ gem "fakeweb", "~> 1.3.0"
10
12
  end
data/Gemfile.lock CHANGED
@@ -4,6 +4,7 @@ GEM
4
4
  childprocess (0.1.7)
5
5
  ffi (~> 0.6.3)
6
6
  cmdparse (2.0.3)
7
+ fakeweb (1.3.0)
7
8
  ffi (0.6.3)
8
9
  rake (>= 0.8.7)
9
10
  git (1.2.5)
@@ -38,13 +39,16 @@ GEM
38
39
  json_pure
39
40
  rubyzip
40
41
  shoulda (2.11.3)
42
+ vcr (1.7.1)
41
43
 
42
44
  PLATFORMS
43
45
  ruby
44
46
 
45
47
  DEPENDENCIES
46
48
  bundler (~> 1.0.0)
49
+ fakeweb (~> 1.3.0)
47
50
  jeweler (~> 1.5.2)
48
51
  parallel (>= 0.5.2)
49
52
  sauce (>= 0.17.5)
50
53
  shoulda
54
+ vcr (~> 1.7.1)
data/README.markdown CHANGED
@@ -71,12 +71,14 @@ The `[tests]` attribute refers to a list of test cases or test suites:
71
71
  runner = Gondola::TestRunner.new
72
72
  runner.add_test "example.html"
73
73
  runner.run({:base_url => "http://www.google.com", :browsers => browsers})
74
+ results = runner.results
74
75
 
75
76
  The above code does several things:
76
77
 
77
78
  * `runner.add_test "example.html"` adds the test case "example.html" to the list of tests that this runner will execute when you tell it to
78
79
  * `runner.run(opts={})` runs all the tests that you've added with the options specified. The list of available options is long and a work in progress
79
80
  with the rest of the documentation.
81
+ * `runner.results` returns a multidimentional array of hashes which contain detailed reports of how each test performed on each browser
80
82
 
81
83
  The end result here is that the test case that you have written with Selenium IDE, "example.html", is converted to ruby on the fly and then sent
82
84
  to Sauce Labs with two browser settings in parallel.
data/bin/gondola CHANGED
@@ -58,6 +58,24 @@ class RunCommand < CmdParse::Command
58
58
  end
59
59
  end
60
60
  runner.run(@opts)
61
+ puts
62
+ runner.results.each do |r|
63
+ puts "Sauce Labs ID: #{r[:id]}"
64
+ puts "Test Name: #{r[:name]}"
65
+ puts "Browser: #{r[:browser]}"
66
+ if r[:result] == "OK"
67
+ puts "Test Passed"
68
+ else
69
+ puts "Test Failed - #{r[:result].size} error(s)"
70
+ r[:result].each_with_index do |e,i|
71
+ puts "- Error #{i+1}:"
72
+ puts " Selenese Command: #{e[:command][:original]}" if e[:command][:original]
73
+ puts " Ruby Command: #{e[:command][:ruby]}" if e[:command][:ruby]
74
+ puts " #{e[:error]}"
75
+ end
76
+ end
77
+ puts
78
+ end
61
79
  end
62
80
  end
63
81
  cmd.add_command(RunCommand.new)
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.1.9"
8
+ s.version = "1.2.0"
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-21}
12
+ s.date = %q{2011-03-24}
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
@@ -31,9 +31,6 @@ Gem::Specification.new do |s|
31
31
  "README.markdown",
32
32
  "Rakefile",
33
33
  "bin/gondola",
34
- "examples/config.yml",
35
- "examples/gondola_agora_fail.html",
36
- "examples/gondola_agora_pass.html",
37
34
  "gondola.gemspec",
38
35
  "lib/gondola.rb",
39
36
  "lib/gondola/converter.rb",
@@ -42,7 +39,17 @@ Gem::Specification.new do |s|
42
39
  "lib/gondola/testrunner.rb",
43
40
  "lib/gondola/version.rb",
44
41
  "test/helper.rb",
45
- "test/test_gondola.rb"
42
+ "test/test_converter.rb",
43
+ "test/test_fail.rb",
44
+ "test/test_pass.rb",
45
+ "test/test_projects/config.yml",
46
+ "test/test_projects/example1/config.yml",
47
+ "test/test_projects/example1/gondola_agora_fail.html",
48
+ "test/test_projects/example1/gondola_agora_pass.html",
49
+ "test/test_projects/example2/config.yml",
50
+ "test/test_projects/example2/gondola_agora_fail.rb",
51
+ "test/test_projects/example2/gondola_agora_pass.rb",
52
+ "test/test_testrunner.rb"
46
53
  ]
47
54
  s.homepage = %q{http://github.com/perrym5/gondola}
48
55
  s.licenses = ["MIT"]
@@ -51,7 +58,12 @@ Gem::Specification.new do |s|
51
58
  s.summary = %q{Ruby command line utility and library for integrating the Selenium IDE more tightly with Sauce Labs' Ondemand services}
52
59
  s.test_files = [
53
60
  "test/helper.rb",
54
- "test/test_gondola.rb"
61
+ "test/test_converter.rb",
62
+ "test/test_fail.rb",
63
+ "test/test_pass.rb",
64
+ "test/test_projects/example2/gondola_agora_fail.rb",
65
+ "test/test_projects/example2/gondola_agora_pass.rb",
66
+ "test/test_testrunner.rb"
55
67
  ]
56
68
 
57
69
  if s.respond_to? :specification_version then
@@ -63,12 +75,16 @@ Gem::Specification.new do |s|
63
75
  s.add_development_dependency(%q<shoulda>, [">= 0"])
64
76
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
65
77
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
78
+ s.add_development_dependency(%q<vcr>, ["~> 1.7.1"])
79
+ s.add_development_dependency(%q<fakeweb>, ["~> 1.3.0"])
66
80
  else
67
81
  s.add_dependency(%q<sauce>, [">= 0.17.5"])
68
82
  s.add_dependency(%q<parallel>, [">= 0.5.2"])
69
83
  s.add_dependency(%q<shoulda>, [">= 0"])
70
84
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
71
85
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
86
+ s.add_dependency(%q<vcr>, ["~> 1.7.1"])
87
+ s.add_dependency(%q<fakeweb>, ["~> 1.3.0"])
72
88
  end
73
89
  else
74
90
  s.add_dependency(%q<sauce>, [">= 0.17.5"])
@@ -76,6 +92,8 @@ Gem::Specification.new do |s|
76
92
  s.add_dependency(%q<shoulda>, [">= 0"])
77
93
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
78
94
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
95
+ s.add_dependency(%q<vcr>, ["~> 1.7.1"])
96
+ s.add_dependency(%q<fakeweb>, ["~> 1.3.0"])
79
97
  end
80
98
  end
81
99
 
@@ -5,13 +5,14 @@
5
5
  module Gondola
6
6
  class Converter
7
7
  attr_writer :name
8
- attr_reader :file
8
+ attr_reader :file, :commands
9
9
 
10
10
  # Constructor that opens a file
11
11
  def initialize(filename, sel="@sel")
12
12
  File.open(filename, "r") do |f|
13
13
  @body = f.read
14
14
  end
15
+ @commands = []
15
16
  @s_obj = sel
16
17
  @file = filename
17
18
  ruby()
@@ -19,7 +20,7 @@ module Gondola
19
20
 
20
21
  def name
21
22
  unless @name
22
- @name = @file
23
+ @name = File.basename(@file, ".rb")
23
24
  end
24
25
  @name
25
26
  end
@@ -31,8 +32,11 @@ module Gondola
31
32
  unless @ruby
32
33
  @ruby = ""
33
34
  enum = @body.lines
34
- enum = enum.map { |l| l + "cmd_inc\n" }
35
- enum.each { |l| @ruby << l }
35
+ enum.each do |l|
36
+ @commands.push({ :ruby => l })
37
+ l = l + "cmd_inc\n"
38
+ @ruby << l
39
+ end
36
40
  end
37
41
  @ruby
38
42
  end
@@ -42,9 +42,16 @@ module Gondola
42
42
  elsif cmd[2] != ""
43
43
  cmd[2] = cmd[2].inspect
44
44
  end
45
- # Append commands to a result string
45
+
46
+ # Append commands to a result string and to
47
+ # the internal list of commands
46
48
  args = [ cmd[1], cmd[2] ]
47
- @ruby << html_to_ruby(cmd[0], args)
49
+ selenese = "#{cmd[0]}(#{cmd[1]}"
50
+ selenese = selenese + ", #{cmd[2]}" if cmd[2] != ""
51
+ selenese = selenese + ")"
52
+ ruby = html_to_ruby(cmd[0], args)
53
+ @commands.push({ :original => selenese, :ruby => ruby })
54
+ @ruby << ruby
48
55
  @ruby << "\ncmd_inc\n"
49
56
  end
50
57
  end
@@ -5,27 +5,34 @@
5
5
 
6
6
  module Gondola
7
7
  class Tester
8
- attr_reader :cmd_num, :sel, :converter, :job_id
8
+ attr_reader :cmd_num, :errors, :job_id
9
+ attr_accessor :sel
9
10
 
10
11
  def initialize(sel, converter)
11
12
  @sel = sel
12
13
  @converter = converter
13
- @cmd_num = 1
14
+ @cmd_num = 0
15
+ @errors = []
14
16
  end
15
17
 
16
18
  def begin
17
- @sel.start()
18
- @job_id = @sel.session_id
19
19
  begin
20
+ @sel.start()
21
+ @job_id = @sel.session_id
20
22
  eval(@converter.ruby)
21
- rescue => e
22
- $stderr.puts e.message + " - stopping test."
23
- rescue Selenium::Client::CommandError
23
+ rescue RuntimeError => e
24
+ $stderr.puts e.message
24
25
  ensure
25
- @sel.stop()
26
+ begin
27
+ @sel.stop()
28
+ rescue Selenium::Client::CommandError => e
29
+ $stderr.puts e.message + "(Most likely, the test was closed on Sauce Labs' end)"
30
+ end
26
31
  end
27
32
  end
28
33
 
34
+ private
35
+
29
36
  def cmd_inc
30
37
  @cmd_num+=1
31
38
  end
@@ -37,26 +44,27 @@ module Gondola
37
44
  end
38
45
 
39
46
  def assert_not(expr)
40
- unless verifyNot(expr)
47
+ unless verify_not(expr)
41
48
  raise "Assertion Failed"
42
49
  end
43
50
  end
44
51
 
45
52
  def assert_equal(eq, expr)
46
- unless verify(eq, expr)
53
+ unless verify_equal(eq, expr)
47
54
  raise "Assertion Failed"
48
55
  end
49
56
  end
50
57
 
51
58
  def assert_not_equal(eq, expr)
52
- unless verifyNot(eq, expr)
59
+ unless verify_not_equal(eq, expr)
53
60
  raise "Assertion Failed"
54
61
  end
55
62
  end
56
63
 
57
64
  def verify(expr)
58
65
  unless expr
59
- $stderr.puts "Command #{@cmd_num} returned false, expecting true"
66
+ @errors.push({ :command => @converter.commands[@cmd_num],
67
+ :error => "returned false, expecting true" })
60
68
  return false
61
69
  end
62
70
  return true
@@ -64,7 +72,8 @@ module Gondola
64
72
 
65
73
  def verify_not(expr)
66
74
  if expr
67
- $stderr.puts "Command #{@cmd_num} returned true, expecting false"
75
+ @errors.push({ :command => @converter.commands[@cmd_num],
76
+ :error => "returned true, expecting false" })
68
77
  return false
69
78
  end
70
79
  return true
@@ -72,7 +81,8 @@ module Gondola
72
81
 
73
82
  def verify_equal(eq, expr)
74
83
  unless eq == expr
75
- @stderr.puts "Command #{@cmd_num} returned '#{expr}', expecting '#{eq}'"
84
+ @errors.push({ :command => @converter.commands[@cmd_num],
85
+ :error => "returned '#{expr}', expecting '#{eq}'" })
76
86
  return false
77
87
  end
78
88
  return true
@@ -80,7 +90,8 @@ module Gondola
80
90
 
81
91
  def verify_not_equal(eq, expr)
82
92
  if eq == expr
83
- @stderr.puts "Command #{@cmd_num} returned '#{expr}', expecting '#{eq}'"
93
+ @errors.push({ :command => @converter.commands[@cmd_num],
94
+ :error => "returned '#{expr}', expecting anything but" })
84
95
  return false
85
96
  end
86
97
  return true
@@ -4,10 +4,11 @@
4
4
 
5
5
  module Gondola
6
6
  class TestRunner
7
- attr_reader :tests
7
+ attr_reader :tests, :results
8
8
 
9
9
  def initialize
10
10
  @tests = []
11
+ @results = []
11
12
  end
12
13
 
13
14
  # Function to add a test to the member array of
@@ -83,11 +84,11 @@ module Gondola
83
84
 
84
85
  # Function to read any config files which contain data for this
85
86
  # test case or suite
86
- def config_from_file(file, api=true, data=true)
87
+ def config_from_file(file, api=true)
87
88
  # If the given test is just a file then start your search in
88
89
  # its parent directory
89
90
  unless File.directory? file
90
- return config_from_file(File.dirname(file))
91
+ return config_from_file(File.expand_path(File.dirname(file)))
91
92
  end
92
93
  # Load any config files in the current directory only if
93
94
  # a config hasn't already been found
@@ -99,17 +100,15 @@ module Gondola
99
100
  api = false
100
101
  end
101
102
  end
102
- if data
103
- if File.exists? "config.yml"
104
- conf.merge! YAML.load_file("config.yml")
105
- data = false
106
- end
103
+ if File.exists? "config.yml"
104
+ conf.merge! YAML.load_file("config.yml")
105
+ data = false
107
106
  end
108
107
  end
109
108
  # Recurse through the parent directories and merge the
110
109
  # current configuration
111
110
  unless file == File.dirname(file)
112
- return config_from_file(File.dirname(file), api, data).merge(conf)
111
+ return config_from_file(File.expand_path(File.dirname(file)), api).merge(conf)
113
112
  end
114
113
  return conf
115
114
  end
@@ -125,11 +124,17 @@ module Gondola
125
124
  # Begin test using a tester object
126
125
  tester = Gondola::Tester.new(selenium, converter)
127
126
  browser_string = "#{request[:os]} #{request[:browser]} #{request[:browser_version]}"
128
- puts "Starting test case \"#{converter.name}\" with: #{browser_string}"
127
+ puts "Starting test \"#{converter.name}\" with #{browser_string}"
129
128
  tester.begin
130
- puts "#{converter.name} finished - Sauce Job ID: #{tester.job_id}"
129
+ puts "Test \"#{converter.name}\" on #{browser_string} finished with #{tester.errors.size} error(s)"
130
+ result = { :name => converter.name, :browser => browser_string, :id => tester.job_id }
131
+ if tester.errors.empty?
132
+ result[:result] = "OK"
133
+ else
134
+ result[:result] = tester.errors
135
+ end
136
+ @results.push(result)
131
137
  end
132
- puts
133
138
  end
134
139
  end
135
140
  end
@@ -1,3 +1,3 @@
1
1
  module Gondola
2
- VERSION = "1.1.9"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -0,0 +1,107 @@
1
+ require 'helper'
2
+
3
+ class TestConverter < Test::Unit::TestCase
4
+ context "A Ruby Converter" do
5
+ setup do
6
+ @converter = Gondola::Converter.new("test/test_projects/example2/gondola_agora_pass.rb")
7
+ end
8
+
9
+ should "properly convert a ruby file to a gondola ruby file" do
10
+ expected = %q{ @sel.open "/"
11
+ cmd_inc
12
+ @sel.wait_for_page_to_load "30000"
13
+ cmd_inc
14
+ @sel.type "q", "agora games"
15
+ cmd_inc
16
+ @sel.click "btnG"
17
+ cmd_inc
18
+ @sel.click "link=Careers"
19
+ cmd_inc
20
+ @sel.wait_for_page_to_load "30000"
21
+ cmd_inc
22
+ verify_equal "Agora Games", @sel.get_title
23
+ cmd_inc
24
+ verify @sel.is_text_present("At Agora")
25
+ cmd_inc
26
+ assert @sel.is_text_present("Platform Engineer")
27
+ cmd_inc
28
+ @sel.click "link=Application Engineer"
29
+ cmd_inc
30
+ assert @sel.is_text_present("Application Engineer")
31
+ cmd_inc
32
+ @sel.click "link=Producer"
33
+ cmd_inc
34
+ assert @sel.is_text_present("Producer")
35
+ cmd_inc
36
+ @sel.click "link=work at Agora."
37
+ cmd_inc
38
+ @sel.wait_for_page_to_load "30000"
39
+ cmd_inc
40
+ @sel.click "link=Fun at Agora"
41
+ cmd_inc
42
+ @sel.click "link=Hack-a-thon"
43
+ cmd_inc
44
+ @sel.click "link=Our Town"
45
+ cmd_inc
46
+ @sel.click "link=Communication at Agora"
47
+ cmd_inc
48
+ }.lines.map { |l| l.strip! }.join("\n")
49
+ assert_equal expected, @converter.ruby
50
+ end
51
+
52
+ should "properly extract the name of the test from the given file" do
53
+ assert_equal "gondola_agora_pass", @converter.name
54
+ end
55
+ end
56
+
57
+ context "An HTML Converter" do
58
+ setup do
59
+ @converter = Gondola::HtmlConverter.new("test/test_projects/example1/gondola_agora_pass.html")
60
+ end
61
+
62
+ should "properly convert a selenese HTML file to a gondola ruby file" do
63
+ expected = %q{ @sel.open "/"
64
+ cmd_inc
65
+ @sel.wait_for_page_to_load "30000"
66
+ cmd_inc
67
+ @sel.type "q", "agora games"
68
+ cmd_inc
69
+ @sel.click "btnG"
70
+ cmd_inc
71
+ @sel.click "link=Careers"
72
+ @sel.wait_for_page_to_load "30000"
73
+ cmd_inc
74
+ verify_equal "Agora Games", @sel.get_title
75
+ cmd_inc
76
+ verify @sel.is_text_present("At Agora")
77
+ cmd_inc
78
+ assert @sel.is_text_present("Platform Engineer")
79
+ cmd_inc
80
+ @sel.click "link=Application Engineer"
81
+ cmd_inc
82
+ assert @sel.is_text_present("Application Engineer")
83
+ cmd_inc
84
+ @sel.click "link=Producer"
85
+ cmd_inc
86
+ assert @sel.is_text_present("Producer")
87
+ cmd_inc
88
+ @sel.click "link=work at Agora."
89
+ @sel.wait_for_page_to_load "30000"
90
+ cmd_inc
91
+ @sel.click "link=Fun at Agora"
92
+ cmd_inc
93
+ @sel.click "link=Hack-a-thon"
94
+ cmd_inc
95
+ @sel.click "link=Our Town"
96
+ cmd_inc
97
+ @sel.click "link=Communication at Agora"
98
+ cmd_inc
99
+ }.lines.map { |l| l.strip! }.join("\n")
100
+ assert_equal expected, @converter.ruby
101
+ end
102
+
103
+ should "properly extract the name of the test from the given file" do
104
+ assert_equal "gondola_agora_pass", @converter.name
105
+ end
106
+ end
107
+ end
data/test/test_fail.rb ADDED
@@ -0,0 +1,60 @@
1
+ require 'helper'
2
+ require 'vcr'
3
+
4
+ VCR.config do |c|
5
+ c.cassette_library_dir = "test/fixtures/vcr_cassettes"
6
+ c.stub_with :fakeweb
7
+ end
8
+
9
+ class TestFail < Test::Unit::TestCase
10
+ context "A Ruby Failing Test" do
11
+ setup do
12
+ @runner = Gondola::TestRunner.new
13
+ @runner.add_test "test/test_projects/example2/gondola_agora_fail.rb"
14
+ end
15
+
16
+ should "result in a failing test" do
17
+ VCR.use_cassette('failing_test1', :record => :new_episodes) do
18
+ @runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
19
+ expected = {
20
+ :name=>"gondola_agora_fail",
21
+ :browser=>"Windows 2003 firefox 3.6",
22
+ :id=>"e3faafda8d5b76e3cb1ca4c58a708f97",
23
+ :result=>[{
24
+ :command=>{
25
+ :ruby=>"assert @sel.is_text_present(\"Producer FAIL\")\n"
26
+ },
27
+ :error=>"returned false, expecting true"
28
+ }]}
29
+ assert @runner.results.size == 1
30
+ assert_equal expected, @runner.results[0]
31
+ end
32
+ end
33
+ end
34
+
35
+ context "An HTML Failing Test" do
36
+ setup do
37
+ @runner = Gondola::TestRunner.new
38
+ @runner.add_test "test/test_projects/example1/gondola_agora_fail.html"
39
+ end
40
+
41
+ should "result in a failing test" do
42
+ VCR.use_cassette('failing_test2', :record => :new_episodes) do
43
+ @runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
44
+ expected = {
45
+ :name=>"gondola_agora_fail",
46
+ :browser=>"Windows 2003 firefox 3.6",
47
+ :id=>"e3faafda8d5b76e3cb1ca4c58a7152d9",
48
+ :result=>[{
49
+ :command=>{
50
+ :original=>"assertTextPresent(\"Producer FAIL\")",
51
+ :ruby=>"assert @sel.is_text_present(\"Producer FAIL\")"
52
+ },
53
+ :error=>"returned false, expecting true"
54
+ }]}
55
+ assert @runner.results.size == 1
56
+ assert_equal expected, @runner.results[0]
57
+ end
58
+ end
59
+ end
60
+ end
data/test/test_pass.rb ADDED
@@ -0,0 +1,39 @@
1
+ require 'helper'
2
+ require 'vcr'
3
+
4
+ VCR.config do |c|
5
+ c.cassette_library_dir = "test/fixtures/vcr_cassettes"
6
+ c.stub_with :fakeweb
7
+ end
8
+
9
+ class TestPass < Test::Unit::TestCase
10
+ context "A Ruby Failing Test" do
11
+ setup do
12
+ @runner = Gondola::TestRunner.new
13
+ @runner.add_test "test/test_projects/example2/gondola_agora_pass.rb"
14
+ end
15
+
16
+ should "result in a passing test" do
17
+ VCR.use_cassette('passing_test1', :record => :new_episodes) do
18
+ @runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
19
+ assert @runner.results.size == 1
20
+ assert_equal "OK", @runner.results[0][:result]
21
+ end
22
+ end
23
+ end
24
+
25
+ context "An HTML Failing Test" do
26
+ setup do
27
+ @runner = Gondola::TestRunner.new
28
+ @runner.add_test "test/test_projects/example1/gondola_agora_pass.html"
29
+ end
30
+
31
+ should "result in a passing test" do
32
+ VCR.use_cassette('passing_test2', :record => :new_episodes) do
33
+ @runner.run({ :browsers => [{:os => "Windows 2003", :browser => "firefox", :browser_version => "3.6"}] })
34
+ assert @runner.results.size == 1
35
+ assert_equal "OK", @runner.results[0][:result]
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,9 @@
1
+ :browsers:
2
+ -
3
+ :os: "Windows 2003"
4
+ :browser: "firefox"
5
+ :browser_version: "3.6"
6
+ -
7
+ :os: "Windows 2003"
8
+ :browser: "iexplore"
9
+ :browser_version: "8"
@@ -16,6 +16,11 @@
16
16
  <td>/</td>
17
17
  <td></td>
18
18
  </tr>
19
+ <tr>
20
+ <td>waitForPageToLoad</td>
21
+ <td></td>
22
+ <td></td>
23
+ </tr>
19
24
  <tr>
20
25
  <td>type</td>
21
26
  <td>q</td>
@@ -16,6 +16,11 @@
16
16
  <td>/</td>
17
17
  <td></td>
18
18
  </tr>
19
+ <tr>
20
+ <td>waitForPageToLoad</td>
21
+ <td></td>
22
+ <td></td>
23
+ </tr>
19
24
  <tr>
20
25
  <td>type</td>
21
26
  <td>q</td>
@@ -0,0 +1,2 @@
1
+ :project_name: "Test Project"
2
+ :base_url: "http://www.google.com"
@@ -0,0 +1,19 @@
1
+ @sel.open "/"
2
+ @sel.wait_for_page_to_load "30000"
3
+ @sel.type "q", "agora games"
4
+ @sel.click "btnG"
5
+ @sel.click "link=Careers"
6
+ @sel.wait_for_page_to_load "30000"
7
+ verify_equal "Agora Games", @sel.get_title
8
+ verify @sel.is_text_present("At Agora")
9
+ assert @sel.is_text_present("Platform Engineer")
10
+ @sel.click "link=Application Engineer"
11
+ assert @sel.is_text_present("Application Engineer")
12
+ @sel.click "link=Producer"
13
+ assert @sel.is_text_present("Producer FAIL")
14
+ @sel.click "link=work at Agora."
15
+ @sel.wait_for_page_to_load "30000"
16
+ @sel.click "link=Fun at Agora"
17
+ @sel.click "link=Hack-a-thon"
18
+ @sel.click "link=Our Town"
19
+ @sel.click "link=Communication at Agora"
@@ -0,0 +1,19 @@
1
+ @sel.open "/"
2
+ @sel.wait_for_page_to_load "30000"
3
+ @sel.type "q", "agora games"
4
+ @sel.click "btnG"
5
+ @sel.click "link=Careers"
6
+ @sel.wait_for_page_to_load "30000"
7
+ verify_equal "Agora Games", @sel.get_title
8
+ verify @sel.is_text_present("At Agora")
9
+ assert @sel.is_text_present("Platform Engineer")
10
+ @sel.click "link=Application Engineer"
11
+ assert @sel.is_text_present("Application Engineer")
12
+ @sel.click "link=Producer"
13
+ assert @sel.is_text_present("Producer")
14
+ @sel.click "link=work at Agora."
15
+ @sel.wait_for_page_to_load "30000"
16
+ @sel.click "link=Fun at Agora"
17
+ @sel.click "link=Hack-a-thon"
18
+ @sel.click "link=Our Town"
19
+ @sel.click "link=Communication at Agora"
@@ -0,0 +1,68 @@
1
+ require 'helper'
2
+
3
+ class MockTestRunner < Gondola::TestRunner
4
+ attr_accessor :files_ran
5
+
6
+ def initialize
7
+ super
8
+ @files_ran = []
9
+ end
10
+
11
+ def run_test(converter, global, browser)
12
+ @files_ran.push converter.file
13
+ return [converter, global, browser]
14
+ end
15
+ end
16
+
17
+ class TestRunner < Test::Unit::TestCase
18
+ context "Recursive projects" do
19
+ setup do
20
+ @runner = MockTestRunner.new
21
+ @runner.add_test "test/test_projects/"
22
+ @runner.run :recursive => true
23
+ end
24
+
25
+ should "run all of the relevant files" do
26
+ expected = []
27
+ Dir.chdir("test/test_projects/") do
28
+ expected = Dir.glob("**/*.html")
29
+ expected.concat(Dir.glob("**/*.rb"))
30
+ end
31
+ assert_equal expected, @runner.files_ran
32
+ end
33
+ end
34
+
35
+ context "Configs" do
36
+ setup do
37
+ @runner = MockTestRunner.new
38
+ @runner.add_test "test/test_projects/"
39
+ end
40
+
41
+ should "extract data from config files and merge correctly" do
42
+ file_conf = @runner.send :config_from_file, "test/test_projects/example1/gondola_agora_pass.html"
43
+ expected = {
44
+ :browsers=>[
45
+ {:os=>"Windows 2003", :browser=>"firefox", :browser_version=>"3.6"},
46
+ {:os=>"Windows 2003", :browser=>"iexplore", :browser_version=>"8"}
47
+ ],
48
+ :project_name=>"Test Project",
49
+ :base_url=>"http://www.google.com"
50
+ }
51
+ assert_equal expected, file_conf
52
+
53
+ file_conf = @runner.send :config_from_file, "test/test_projects/example2/gondola_agora_fail.html"
54
+ assert_equal expected, file_conf
55
+ end
56
+
57
+ should "aggregate data correctly from files, options and globally" do
58
+ c,g,b = @runner.send :aggregate_data, "test/test_projects/example1/gondola_agora_pass.html", {}
59
+ expected_g = {:job_name=>"Test Project - gondola_agora_pass", :browser_url=>"http://www.google.com"}
60
+ expected_b = [
61
+ {:os=>"Windows 2003", :browser=>"firefox", :browser_version=>"3.6"},
62
+ {:os=>"Windows 2003", :browser=>"iexplore", :browser_version=>"8"}
63
+ ]
64
+ assert_equal expected_g, g
65
+ assert_equal expected_b, b
66
+ end
67
+ end
68
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gondola
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.9
5
+ version: 1.2.0
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-21 00:00:00 -04:00
13
+ date: 2011-03-24 00:00:00 -04:00
14
14
  default_executable: gondola
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -68,6 +68,28 @@ dependencies:
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: vcr
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: 1.7.1
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
83
+ name: fakeweb
84
+ requirement: &id007 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.3.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: *id007
71
93
  description: "\n Gondola is Ruby command line utility and as well as a library which helps\n for integrate the Selenium IDE more tightly with Sauce Labs' Ondemand services and\n provide greater ease for those who would like to use both tools but do not have\n enough technical knowledge\n "
72
94
  email: mperry@agoragames.com
73
95
  executables:
@@ -85,9 +107,6 @@ files:
85
107
  - README.markdown
86
108
  - Rakefile
87
109
  - bin/gondola
88
- - examples/config.yml
89
- - examples/gondola_agora_fail.html
90
- - examples/gondola_agora_pass.html
91
110
  - gondola.gemspec
92
111
  - lib/gondola.rb
93
112
  - lib/gondola/converter.rb
@@ -96,7 +115,17 @@ files:
96
115
  - lib/gondola/testrunner.rb
97
116
  - lib/gondola/version.rb
98
117
  - test/helper.rb
99
- - test/test_gondola.rb
118
+ - test/test_converter.rb
119
+ - test/test_fail.rb
120
+ - test/test_pass.rb
121
+ - test/test_projects/config.yml
122
+ - test/test_projects/example1/config.yml
123
+ - test/test_projects/example1/gondola_agora_fail.html
124
+ - test/test_projects/example1/gondola_agora_pass.html
125
+ - test/test_projects/example2/config.yml
126
+ - test/test_projects/example2/gondola_agora_fail.rb
127
+ - test/test_projects/example2/gondola_agora_pass.rb
128
+ - test/test_testrunner.rb
100
129
  has_rdoc: true
101
130
  homepage: http://github.com/perrym5/gondola
102
131
  licenses:
@@ -111,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
140
  requirements:
112
141
  - - ">="
113
142
  - !ruby/object:Gem::Version
114
- hash: 635731009
143
+ hash: 131885875
115
144
  segments:
116
145
  - 0
117
146
  version: "0"
@@ -130,4 +159,9 @@ specification_version: 3
130
159
  summary: Ruby command line utility and library for integrating the Selenium IDE more tightly with Sauce Labs' Ondemand services
131
160
  test_files:
132
161
  - test/helper.rb
133
- - test/test_gondola.rb
162
+ - test/test_converter.rb
163
+ - test/test_fail.rb
164
+ - test/test_pass.rb
165
+ - test/test_projects/example2/gondola_agora_fail.rb
166
+ - test/test_projects/example2/gondola_agora_pass.rb
167
+ - test/test_testrunner.rb
data/test/test_gondola.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestGondola < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end