seleniumrc 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. data/CHANGES +4 -0
  2. data/README +38 -0
  3. data/Rakefile +1 -1
  4. data/lib/seleniumrc.rb +2 -4
  5. data/lib/seleniumrc/dsl/selenium_dsl.rb +8 -143
  6. data/lib/seleniumrc/extensions/testrunnermediator.rb +2 -2
  7. data/lib/seleniumrc/mongrel_selenium_server_runner.rb +9 -7
  8. data/lib/seleniumrc/selenium_configuration.rb +233 -40
  9. data/lib/seleniumrc/selenium_driver.rb +193 -0
  10. data/lib/seleniumrc/selenium_element.rb +31 -37
  11. data/lib/seleniumrc/selenium_page.rb +16 -16
  12. data/lib/seleniumrc/selenium_server_runner.rb +1 -1
  13. data/lib/seleniumrc/selenium_test_case.rb +2 -4
  14. data/lib/seleniumrc/wait_for.rb +3 -10
  15. data/lib/seleniumrc/webrick_selenium_server_runner.rb +11 -11
  16. data/spec/seleniumrc/mongrel_selenium_server_runner_spec.rb +31 -38
  17. data/spec/seleniumrc/selenese_interpreter_spec.rb +12 -12
  18. data/spec/seleniumrc/selenium_configuration_spec.rb +350 -12
  19. data/spec/seleniumrc/selenium_driver_spec.rb +104 -0
  20. data/spec/seleniumrc/selenium_element_spec.rb +78 -76
  21. data/spec/seleniumrc/selenium_page_spec.rb +39 -29
  22. data/spec/seleniumrc/selenium_test_case_spec.rb +631 -673
  23. data/spec/seleniumrc/selenium_test_case_spec_helper.rb +0 -7
  24. data/spec/seleniumrc/webrick_selenium_server_runner_spec.rb +14 -13
  25. data/spec/spec_helper.rb +7 -1
  26. metadata +4 -7
  27. data/lib/seleniumrc/app_server_checker.rb +0 -43
  28. data/lib/seleniumrc/extensions/selenium_driver.rb +0 -33
  29. data/lib/seleniumrc/selenium_context.rb +0 -226
  30. data/spec/seleniumrc/app_server_checker_spec.rb +0 -56
  31. data/spec/seleniumrc/selenium_context_spec.rb +0 -362
@@ -2,20 +2,22 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
2
 
3
3
  module Seleniumrc
4
4
  describe SeleniumPage, :shared => true do
5
+ it_should_behave_like "Selenium"
5
6
  include SeleniumTestCaseSpec
7
+ attr_reader :driver
6
8
 
7
9
  before do
8
- @selenium = "Selenium"
9
- @page = SeleniumPage.new(@selenium)
10
+ @driver = ::Seleniumrc::SeleniumDriver.new('http://test.host', 4000, "*firefox", 'http://test.host')
11
+ @page = SeleniumPage.new(driver)
10
12
  page_loaded
11
13
  end
12
14
 
13
15
  def page_loaded
14
- stub(@selenium).get_eval(SeleniumPage::PAGE_LOADED_COMMAND) {"true"}
16
+ stub(driver).get_eval(SeleniumPage::PAGE_LOADED_COMMAND) {"true"}
15
17
  end
16
18
 
17
19
  def page_not_loaded
18
- stub(@selenium).get_eval(SeleniumPage::PAGE_LOADED_COMMAND) {"false"}
20
+ stub(driver).get_eval(SeleniumPage::PAGE_LOADED_COMMAND) {"false"}
19
21
  end
20
22
  end
21
23
 
@@ -23,7 +25,7 @@ describe SeleniumPage, "#initialize" do
23
25
  it_should_behave_like "Seleniumrc::SeleniumPage"
24
26
 
25
27
  it "sets the selenium object" do
26
- @page.selenium.should == @selenium
28
+ @page.driver.should == driver
27
29
  end
28
30
  end
29
31
 
@@ -31,19 +33,27 @@ describe SeleniumPage, "#open_and_wait" do
31
33
  it_should_behave_like "Seleniumrc::SeleniumPage"
32
34
 
33
35
  it "opens the url and waits for the page to load" do
34
- mock(@selenium) do |o|
35
- o.open("/users/list")
36
- o.wait_for_page_to_load(@page.default_timeout)
37
- o.get_title {"Users in the project"}
36
+ mock(driver) do |m|
37
+ m.do_command("open", ["/users/list"]) {result}
38
+ m.do_command("waitForPageToLoad", [@page.default_timeout]) do
39
+ result
40
+ end
41
+ m.do_command("getTitle", []) do
42
+ result("Users in the project")
43
+ end
38
44
  end
39
45
  @page.open_and_wait("/users/list")
40
46
  end
41
47
 
42
48
  it "fails when titles contains Exception caught" do
43
- mock(@selenium) do |o|
44
- o.open("/users/list")
45
- o.wait_for_page_to_load(@page.default_timeout)
46
- o.get_title {"Exception caught"}
49
+ mock(driver) do |m|
50
+ m.do_command("open", ["/users/list"]) {result}
51
+ m.do_command("waitForPageToLoad", [@page.default_timeout]) do
52
+ result
53
+ end
54
+ m.do_command("getTitle", []) do
55
+ result("Exception caught")
56
+ end
47
57
  end
48
58
  proc do
49
59
  @page.open_and_wait("/users/list")
@@ -56,14 +66,14 @@ describe SeleniumPage, "#has_title" do
56
66
 
57
67
  it "passes when title is expected" do
58
68
  ticks = ["no page", "no page", "no page", "my page"]
59
- mock(@selenium).get_title do
69
+ mock(driver).get_title do
60
70
  ticks.shift
61
71
  end.times(4)
62
72
  @page.has_title("my page")
63
73
  end
64
74
 
65
75
  it "fails when element is not present" do
66
- stub(@selenium).get_title {"no page"}
76
+ stub(driver).get_title {"no page"}
67
77
  proc do
68
78
  @page.has_title("my page")
69
79
  end.should raise_error("Expected title 'my page' but was 'no page' (after 5 sec)")
@@ -74,12 +84,12 @@ describe SeleniumPage, "#has_title?" do
74
84
  it_should_behave_like "Seleniumrc::SeleniumPage"
75
85
 
76
86
  it "returns true when passed in title is the page title" do
77
- mock(@selenium).get_title {"my page"}
87
+ mock(driver).get_title {"my page"}
78
88
  @page.has_title?("my page").should be_true
79
89
  end
80
90
 
81
91
  it "returns false when passed in title is not the page title" do
82
- mock(@selenium).get_title {"no page"}
92
+ mock(driver).get_title {"no page"}
83
93
  @page.has_title?("my page").should be_false
84
94
  end
85
95
  end
@@ -89,7 +99,7 @@ describe SeleniumPage, "#is_text_present" do
89
99
 
90
100
  it "passes when title is expected" do
91
101
  ticks = [false, false, false, true]
92
- mock(@selenium).is_text_present("my page") do
102
+ mock(driver).is_text_present("my page") do
93
103
  ticks.shift
94
104
  end.times(4)
95
105
  @page.is_text_present("my page")
@@ -103,7 +113,7 @@ describe SeleniumPage, "#is_text_present" do
103
113
  end
104
114
 
105
115
  it "fails when element is not present" do
106
- stub(@selenium).is_text_present("my page") {false}
116
+ stub(driver).is_text_present("my page") {false}
107
117
  proc do
108
118
  @page.is_text_present("my page")
109
119
  end.should raise_error("Expected 'my page' to be present, but it wasn't (after 5 sec)")
@@ -114,12 +124,12 @@ describe SeleniumPage, "#is_text_present?" do
114
124
  it_should_behave_like "Seleniumrc::SeleniumPage"
115
125
 
116
126
  it "returns true when title is expected" do
117
- mock(@selenium).is_text_present("my page") {true}
127
+ mock(driver).is_text_present("my page") {true}
118
128
  @page.is_text_present?("my page").should be_true
119
129
  end
120
130
 
121
131
  it "fails when element is not present" do
122
- mock(@selenium).is_text_present("my page") {false}
132
+ mock(driver).is_text_present("my page") {false}
123
133
  @page.is_text_present?("my page").should be_false
124
134
  end
125
135
  end
@@ -129,7 +139,7 @@ describe SeleniumPage, "#is_text_not_present" do
129
139
 
130
140
  it "passes when text is not present" do
131
141
  ticks = [true, true, true, false]
132
- mock(@selenium).is_text_present("my page") do
142
+ mock(driver).is_text_present("my page") do
133
143
  ticks.shift
134
144
  end.times(4)
135
145
  @page.is_text_not_present("my page")
@@ -143,7 +153,7 @@ describe SeleniumPage, "#is_text_not_present" do
143
153
  end
144
154
 
145
155
  it "fails when text is present" do
146
- stub(@selenium).is_text_present("my page") {true}
156
+ stub(driver).is_text_present("my page") {true}
147
157
  proc do
148
158
  @page.is_text_not_present("my page")
149
159
  end.should raise_error("Expected 'my page' to be absent, but it wasn't (after 5 sec)")
@@ -154,12 +164,12 @@ describe SeleniumPage, "#is_text_not_present?" do
154
164
  it_should_behave_like "Seleniumrc::SeleniumPage"
155
165
 
156
166
  it "returns true when text is not present" do
157
- mock(@selenium).is_text_present("my page") {false}
167
+ mock(driver).is_text_present("my page") {false}
158
168
  @page.is_text_not_present?("my page").should be_true
159
169
  end
160
170
 
161
171
  it "returns false when text is present" do
162
- mock(@selenium).is_text_present("my page") {true}
172
+ mock(driver).is_text_present("my page") {true}
163
173
  @page.is_text_not_present?("my page").should be_false
164
174
  end
165
175
  end
@@ -178,14 +188,14 @@ describe SeleniumPage, "#url_ends_with" do
178
188
  "http://no.com",
179
189
  "http://foobar.com?arg1=2"
180
190
  ]
181
- mock(@selenium).get_location do
191
+ mock(driver).get_location do
182
192
  ticks.shift
183
193
  end.times(4)
184
194
  @page.url_ends_with(@ends_with)
185
195
  end
186
196
 
187
197
  it "fails when element is not present" do
188
- stub(@selenium).get_location {"http://no.com"}
198
+ stub(driver).get_location {"http://no.com"}
189
199
  proc do
190
200
  @page.url_ends_with(@ends_with)
191
201
  end.should raise_error("Expected 'http://no.com' to end with '#{@ends_with}' (after 5 sec)")
@@ -200,12 +210,12 @@ describe SeleniumPage, "#url_ends_with?" do
200
210
  end
201
211
 
202
212
  it "passes when title is expected" do
203
- mock(@selenium).get_location {"http://foobar.com?arg1=2"}
213
+ mock(driver).get_location {"http://foobar.com?arg1=2"}
204
214
  @page.url_ends_with?(@ends_with).should be_true
205
215
  end
206
216
 
207
217
  it "fails when element is not present" do
208
- mock(@selenium).get_location {"http://no.com"}
218
+ mock(driver).get_location {"http://no.com"}
209
219
  @page.url_ends_with?(@ends_with).should be_false
210
220
  end
211
221
  end
@@ -1,908 +1,866 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
2
 
3
3
  module Seleniumrc
4
- describe SeleniumTestCase, :shared => true do
5
- include SeleniumTestCaseSpec
6
-
7
- before(:each) do
8
- stub_selenium_configuration
9
- @test_case = SeleniumTestCaseSpec::MySeleniumTestCase.new
10
- @base_selenium = "Base Selenium"
11
- @test_case.base_selenium = @base_selenium
12
- stub(@base_selenium).get_eval(SeleniumPage::PAGE_LOADED_COMMAND) {"true"}
13
- end
14
-
15
- def sample_locator
16
- "sample_locator"
17
- end
18
-
19
- def sample_text
20
- "test text"
21
- end
22
-
23
- def stub_selenium_configuration
24
- @context = SeleniumContext.new
25
- @context.external_app_server_host = "test.com"
26
- @context.external_app_server_port = 80
27
-
28
- stub(SeleniumConfiguration.instance).returns(@context)
29
- end
30
- end
31
-
32
- describe SeleniumTestCase, "#setup" do
33
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
34
-
35
- it "should not allow transactional fixtures" do
36
- stub(@test_case.class).use_transactional_fixtures.returns true
37
-
38
- expected_message = "Cannot use transactional fixtures if ActiveRecord concurrency is turned on (which is required for Selenium tests to work)."
39
- proc {@test_case.setup}.should raise_error(RuntimeError, expected_message)
40
- end
41
- end
42
-
43
- describe SeleniumTestCase, "#wait_for" do
44
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
45
-
46
- it "should pass when the block returns true within time limit" do
47
- @test_case.wait_for(:timeout => 2) do
48
- true
4
+ describe SeleniumTestCase, :shared => true do
5
+ it_should_behave_like "Selenium"
6
+ include SeleniumTestCaseSpec
7
+ attr_reader :driver, :test_case, :configuration
8
+
9
+ before(:each) do
10
+ stub_selenium_configuration
11
+ @test_case = SeleniumTestCaseSpec::MySeleniumTestCase.new
12
+ @driver = ::Seleniumrc::SeleniumDriver.new('http://test.host', 4000, "*firefox", 'http://test.host')
13
+ test_case.selenium_driver = driver
14
+ stub(driver).do_command("getEval", [SeleniumPage::PAGE_LOADED_COMMAND]) do
15
+ result(true)
16
+ end
49
17
  end
50
- end
51
18
 
52
- it "should raise a AssertionFailedError when block times out" do
53
- proc do
54
- @test_case.wait_for(:timeout => 2) {false}
55
- end.should raise_error(Test::Unit::AssertionFailedError, "Timeout exceeded (after 2 sec)")
56
- end
57
- end
19
+ def sample_locator
20
+ "sample_locator"
21
+ end
58
22
 
59
- describe SeleniumTestCase, "#wait_for_element_to_contain" do
60
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
23
+ def sample_text
24
+ "test text"
25
+ end
61
26
 
62
- it "should pass when finding text within time limit" do
63
- is_element_present_results = [false, true]
27
+ def stub_selenium_configuration
28
+ @configuration = SeleniumConfiguration.new
29
+ configuration.external_app_server_host = "test.com"
30
+ configuration.external_app_server_port = 80
64
31
 
65
- stub(base_selenium).is_element_present {is_element_present_results.shift}
66
- stub(base_selenium).get_eval("this.page().findElement(\"#{sample_locator}\").innerHTML") do
67
- sample_text
32
+ stub(SeleniumConfiguration.instance) {configuration}
68
33
  end
69
-
70
- @test_case.wait_for_element_to_contain(sample_locator, sample_text)
71
34
  end
72
35
 
73
- it "should fail when element not found in time" do
74
- is_element_present_results = [false, false, false, false]
36
+ describe SeleniumTestCase, "#setup" do
37
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
75
38
 
76
- stub(base_selenium).is_element_present {is_element_present_results.shift}
39
+ it "should not allow transactional fixtures" do
40
+ test_case.class.use_transactional_fixtures = true
77
41
 
78
- proc do
79
- @test_case.wait_for_element_to_contain(sample_locator, "")
80
- end.should raise_error(Test::Unit::AssertionFailedError, "Timeout exceeded (after 5 sec)")
42
+ expected_message = "Cannot use transactional fixtures if ActiveRecord concurrency is turned on (which is required for Selenium tests to work)."
43
+ proc do
44
+ test_case.setup
45
+ end.should raise_error(RuntimeError, expected_message)
46
+ end
81
47
  end
82
48
 
83
- it "should fail when text does not match in time" do
84
- is_element_present_results = [false, true, true, true]
49
+ describe SeleniumTestCase, "#wait_for" do
50
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
85
51
 
86
- stub(base_selenium).is_element_present {is_element_present_results.shift}
87
- stub(base_selenium).get_eval.
88
- with("this.page().findElement(\"#{sample_locator}\").innerHTML").
89
- returns(sample_text)
52
+ it "should pass when the block returns true within time limit" do
53
+ test_case.wait_for(:timeout => 2) do
54
+ true
55
+ end
56
+ end
90
57
 
91
- proc do
92
- @test_case.wait_for_element_to_contain(sample_locator, "wrong text", nil, 1)
93
- end.should raise_error(Test::Unit::AssertionFailedError, "Timeout exceeded (after 1 sec)")
58
+ it "should raise a AssertionFailedError when block times out" do
59
+ proc do
60
+ test_case.wait_for(:timeout => 2) {false}
61
+ end.should raise_error(Test::Unit::AssertionFailedError, "Timeout exceeded (after 2 sec)")
62
+ end
94
63
  end
95
- end
96
64
 
97
- describe SeleniumTestCase, "#default_timeout" do
98
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
65
+ describe SeleniumTestCase, "#default_timeout" do
66
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
99
67
 
100
- it "default_timeout should be 20 seconds" do
101
- @test_case.default_timeout.should == 20000
68
+ it "default_timeout should be 20 seconds" do
69
+ test_case.default_timeout.should == 20000
70
+ end
102
71
  end
103
- end
104
72
 
105
- describe SeleniumTestCase, "#open_home_page" do
106
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
73
+ describe SeleniumTestCase, "#open_home_page" do
74
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
107
75
 
108
- it "opens home page" do
109
- mock(base_selenium).open("http://localhost:4000")
110
- mock(base_selenium).wait_for_page_to_load(@test_case.default_timeout)
111
- stub(base_selenium).send {""}
112
-
113
- @test_case.open_home_page
76
+ it "opens home page" do
77
+ mock(driver).open("http://localhost:4000")
78
+ test_case.open_home_page
79
+ end
114
80
  end
115
- end
116
81
 
117
- describe SeleniumTestCase, "#open_and_wait" do
118
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
82
+ describe SeleniumTestCase, "#assert_title" do
83
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
119
84
 
120
- before do
121
- mock.proxy(SeleniumPage).new(base_selenium) do |page|
122
- mock.proxy(page).open_and_wait("/users/list")
123
- page
85
+ it "when title is expected, passes" do
86
+ mock(driver).do_command("getTitle", []) {result("my page")}
87
+ test_case.assert_title("my page")
124
88
  end
125
- end
126
89
 
127
- it "opens the url and waits for the page to load" do
128
- mock(base_selenium) do |o|
129
- o.open("/users/list")
130
- o.wait_for_page_to_load(@test_case.default_timeout)
131
- o.get_title {"Users in the project"}
90
+ it "when title is not expected, fails" do
91
+ stub(driver).do_command("getTitle", []) {result("no page")}
92
+ proc do
93
+ test_case.assert_title("my page")
94
+ end.should raise_error(Test::Unit::AssertionFailedError)
132
95
  end
133
- @test_case.open_and_wait("/users/list")
134
96
  end
135
- end
136
97
 
137
- describe SeleniumTestCase, "#assert_title" do
138
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
98
+ describe SeleniumTestCase, "#assert_text_present" do
99
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
139
100
 
140
- before do
141
- mock.proxy(SeleniumPage).new(base_selenium) do |page|
142
- mock.proxy(page).has_title("my page", {})
143
- page
101
+ before do
102
+ mock.proxy(SeleniumPage).new(driver) do |page|
103
+ mock.proxy(page).is_text_present("my page", {})
104
+ page
105
+ end
144
106
  end
145
- end
146
107
 
147
- it "passes when title is expected" do
148
- mock(base_selenium).get_title {"my page"}
149
- @test_case.assert_title("my page")
150
- end
151
-
152
- it "fails when title is not expected" do
153
- stub(base_selenium).get_title {"no page"}
154
- proc do
155
- @test_case.assert_title("my page")
156
- end.should raise_error(Test::Unit::AssertionFailedError)
157
- end
158
- end
159
-
160
- describe SeleniumTestCase, "#assert_text_present" do
161
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
162
-
163
- before do
164
- mock.proxy(SeleniumPage).new(base_selenium) do |page|
165
- mock.proxy(page).is_text_present("my page", {})
166
- page
108
+ it "passes when text is in page" do
109
+ ticks = [false, false, false, true]
110
+ mock(driver).is_text_present("my page") do
111
+ ticks.shift
112
+ end.times(4)
113
+ test_case.assert_text_present("my page")
167
114
  end
168
- end
169
115
 
170
- it "passes when text is in page" do
171
- ticks = [false, false, false, true]
172
- mock(base_selenium).is_text_present("my page") do
173
- ticks.shift
174
- end.times(4)
175
- @test_case.assert_text_present("my page")
176
- end
177
-
178
- it "fails when text is not in page" do
179
- stub(base_selenium).is_text_present("my page") {false}
180
- proc do
181
- @test_case.assert_text_present("my page")
182
- end.should raise_error(Test::Unit::AssertionFailedError)
116
+ it "fails when text is not in page" do
117
+ stub(driver).is_text_present("my page") {false}
118
+ proc do
119
+ test_case.assert_text_present("my page")
120
+ end.should raise_error(Test::Unit::AssertionFailedError)
121
+ end
183
122
  end
184
- end
185
123
 
186
- describe SeleniumTestCase, "#assert_text_not_present" do
187
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
124
+ describe SeleniumTestCase, "#assert_text_not_present" do
125
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
188
126
 
189
- before do
190
- mock.proxy(SeleniumPage).new(base_selenium) do |page|
191
- mock.proxy(page).is_text_not_present("my page", {})
192
- page
127
+ before do
128
+ mock.proxy(SeleniumPage).new(driver) do |page|
129
+ mock.proxy(page).is_text_not_present("my page", {})
130
+ page
131
+ end
193
132
  end
194
- end
195
133
 
196
- it "passes when text is not in page" do
197
- ticks = [true, true, true, false]
198
- mock(base_selenium).is_text_present("my page") do
199
- ticks.shift
200
- end.times(4)
201
- @test_case.assert_text_not_present("my page")
202
- end
134
+ it "passes when text is not in page" do
135
+ ticks = [true, true, true, false]
136
+ mock(driver).is_text_present("my page") do
137
+ ticks.shift
138
+ end.times(4)
139
+ test_case.assert_text_not_present("my page")
140
+ end
203
141
 
204
- it "fails when text is in page" do
205
- stub(base_selenium).is_text_present("my page") {true}
206
- proc do
207
- @test_case.assert_text_not_present("my page")
208
- end.should raise_error(Test::Unit::AssertionFailedError)
142
+ it "fails when text is in page" do
143
+ stub(driver).is_text_present("my page") {true}
144
+ proc do
145
+ test_case.assert_text_not_present("my page")
146
+ end.should raise_error(Test::Unit::AssertionFailedError)
147
+ end
209
148
  end
210
- end
211
149
 
212
- describe SeleniumTestCase, "#assert_location_ends_in" do
213
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
150
+ describe SeleniumTestCase, "#assert_location_ends_in" do
151
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
214
152
 
215
- before do
216
- @ends_with = "foobar.com?arg1=2"
217
- mock.proxy(SeleniumPage).new(base_selenium) do |page|
218
- mock.proxy(page).url_ends_with(@ends_with, {})
219
- page
153
+ before do
154
+ @ends_with = "foobar.com?arg1=2"
155
+ mock.proxy(SeleniumPage).new(driver) do |page|
156
+ mock.proxy(page).url_ends_with(@ends_with, {})
157
+ page
158
+ end
220
159
  end
221
- end
222
160
 
223
- it "passes when the url ends with the passed in value" do
224
- ticks = [
225
- "http://no.com",
226
- "http://no.com",
227
- "http://no.com",
228
- "http://foobar.com?arg1=2"
229
- ]
230
- mock(base_selenium).get_location do
231
- ticks.shift
232
- end.times(4)
233
- @test_case.assert_location_ends_in(@ends_with)
234
- end
161
+ it "passes when the url ends with the passed in value" do
162
+ ticks = [
163
+ "http://no.com",
164
+ "http://no.com",
165
+ "http://no.com",
166
+ "http://foobar.com?arg1=2"
167
+ ]
168
+ mock(driver).get_location do
169
+ ticks.shift
170
+ end.times(4)
171
+ test_case.assert_location_ends_in(@ends_with)
172
+ end
235
173
 
236
- it "fails when the url does not end with the passed in value" do
237
- stub(base_selenium).get_location {"http://no.com"}
238
- proc do
239
- @test_case.assert_location_ends_in(@ends_with)
240
- end.should raise_error(Test::Unit::AssertionFailedError)
174
+ it "fails when the url does not end with the passed in value" do
175
+ stub(driver).get_location {"http://no.com"}
176
+ proc do
177
+ test_case.assert_location_ends_in(@ends_with)
178
+ end.should raise_error(Test::Unit::AssertionFailedError)
179
+ end
241
180
  end
242
- end
243
181
 
244
- describe SeleniumTestCase, "#assert_element_present" do
245
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
182
+ describe SeleniumTestCase, "#assert_element_present" do
183
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
246
184
 
247
- before do
248
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
249
- mock.proxy(element).is_present({})
250
- element
185
+ before do
186
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
187
+ mock.proxy(element).is_present({})
188
+ element
189
+ end
251
190
  end
252
- end
253
191
 
254
- it "passes when element is present" do
255
- ticks = [false, false, false, true]
256
- mock(base_selenium) do |o|
257
- o.is_element_present(sample_locator) do
258
- ticks.shift
259
- end.times(4)
192
+ it "passes when element is present" do
193
+ ticks = [false, false, false, true]
194
+ mock(driver).do_command("isElementPresent", [sample_locator]).times(4) do
195
+ result(ticks.shift)
196
+ end
197
+ test_case.assert_element_present(sample_locator)
260
198
  end
261
- @test_case.assert_element_present(sample_locator)
262
- end
263
199
 
264
- it "fails when element is not present" do
265
- stub(base_selenium) do |o|
266
- o.is_element_present(sample_locator) {false}
200
+ it "fails when element is not present" do
201
+ stub(driver).do_command("isElementPresent", [sample_locator]) do
202
+ result(false)
203
+ end
204
+ proc do
205
+ test_case.assert_element_present(sample_locator)
206
+ end.should raise_error(Test::Unit::AssertionFailedError)
267
207
  end
268
- proc do
269
- @test_case.assert_element_present(sample_locator)
270
- end.should raise_error(Test::Unit::AssertionFailedError)
271
208
  end
272
- end
273
209
 
274
- describe SeleniumTestCase, "#assert_element_not_present" do
275
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
210
+ describe SeleniumTestCase, "#assert_element_not_present" do
211
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
276
212
 
277
- before do
278
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
279
- mock.proxy(element).is_not_present({})
280
- element
213
+ before do
214
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
215
+ mock.proxy(element).is_not_present({})
216
+ element
217
+ end
281
218
  end
282
- end
283
219
 
284
- it "passes when element is not present" do
285
- ticks = [true, true, true, false]
286
- mock(base_selenium) do |o|
287
- o.is_element_present(sample_locator) do
288
- ticks.shift
289
- end.times(4)
220
+ it "passes when element is not present" do
221
+ ticks = [true, true, true, false]
222
+ mock(driver) do |o|
223
+ o.is_element_present(sample_locator) do
224
+ ticks.shift
225
+ end.times(4)
226
+ end
227
+ test_case.assert_element_not_present(sample_locator)
290
228
  end
291
- @test_case.assert_element_not_present(sample_locator)
292
- end
293
229
 
294
- it "fails when element is present" do
295
- stub(base_selenium) do |o|
296
- o.is_element_present(sample_locator) {true}
230
+ it "fails when element is present" do
231
+ stub(driver) do |o|
232
+ o.is_element_present(sample_locator) {true}
233
+ end
234
+ proc do
235
+ test_case.assert_element_not_present(sample_locator)
236
+ end.should raise_error(Test::Unit::AssertionFailedError)
297
237
  end
298
- proc do
299
- @test_case.assert_element_not_present(sample_locator)
300
- end.should raise_error(Test::Unit::AssertionFailedError)
301
238
  end
302
- end
303
239
 
304
- describe SeleniumTestCase, "#assert_value" do
305
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
240
+ describe SeleniumTestCase, "#assert_value" do
241
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
306
242
 
307
- before do
308
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
309
- mock.proxy(element).has_value("passed in value")
310
- element
243
+ before do
244
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
245
+ mock.proxy(element).has_value("passed in value")
246
+ element
247
+ end
311
248
  end
312
- end
313
249
 
314
- it "passes when value is expected" do
315
- mock(base_selenium) do |o|
316
- o.is_element_present(sample_locator) {true}
317
- o.get_value(sample_locator) {"passed in value"}
250
+ it "passes when value is expected" do
251
+ mock(driver) do |o|
252
+ o.is_element_present(sample_locator) {true}
253
+ o.get_value(sample_locator) {"passed in value"}
254
+ end
255
+ test_case.assert_value(sample_locator, "passed in value")
318
256
  end
319
- @test_case.assert_value(sample_locator, "passed in value")
320
- end
321
257
 
322
- it "fails when value is not expected" do
323
- stub(base_selenium) do |o|
324
- o.is_element_present(sample_locator) {true}
325
- o.get_value(sample_locator) {"another value"}
258
+ it "fails when value is not expected" do
259
+ stub(driver) do |o|
260
+ o.is_element_present(sample_locator) {true}
261
+ o.get_value(sample_locator) {"another value"}
262
+ end
263
+ proc do
264
+ test_case.assert_value(sample_locator, "passed in value")
265
+ end.should raise_error(Test::Unit::AssertionFailedError)
326
266
  end
327
- proc do
328
- @test_case.assert_value(sample_locator, "passed in value")
329
- end.should raise_error(Test::Unit::AssertionFailedError)
330
267
  end
331
- end
332
268
 
333
- describe SeleniumTestCase, "#assert_element_contains" do
334
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
269
+ describe SeleniumTestCase, "#assert_element_contains" do
270
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
335
271
 
336
- before do
337
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
338
- mock.proxy(element).contains_text("passed in value", {})
339
- element
272
+ before do
273
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
274
+ mock.proxy(element).contains_text("passed in value", {})
275
+ element
276
+ end
277
+ @evaled_js = "this.page().findElement(\"#{sample_locator}\").innerHTML"
340
278
  end
341
- @evaled_js = "this.page().findElement(\"#{sample_locator}\").innerHTML"
342
- end
343
279
 
344
- it "passes when text is in the element's inner_html" do
345
- mock(base_selenium) do |o|
346
- o.is_element_present(sample_locator) {true}
347
- o.get_eval(@evaled_js) do
348
- "html passed in value html"
280
+ it "passes when text is in the element's inner_html" do
281
+ mock(driver) do |o|
282
+ o.is_element_present(sample_locator) {true}
283
+ o.get_eval(@evaled_js) do
284
+ "html passed in value html"
285
+ end
349
286
  end
287
+ test_case.assert_element_contains(sample_locator, "passed in value")
350
288
  end
351
- @test_case.assert_element_contains(sample_locator, "passed in value")
352
- end
353
289
 
354
- it "fails when text is not in the element's inner_html" do
355
- stub(base_selenium) do |o|
356
- o.is_element_present(sample_locator) {true}
357
- o.get_eval(@evaled_js) {"another value"}
290
+ it "fails when text is not in the element's inner_html" do
291
+ stub(driver) do |o|
292
+ o.is_element_present(sample_locator) {true}
293
+ o.get_eval(@evaled_js) {"another value"}
294
+ end
295
+ proc do
296
+ test_case.assert_element_contains(sample_locator, "passed in value")
297
+ end.should raise_error(Test::Unit::AssertionFailedError)
358
298
  end
359
- proc do
360
- @test_case.assert_element_contains(sample_locator, "passed in value")
361
- end.should raise_error(Test::Unit::AssertionFailedError)
362
299
  end
363
- end
364
300
 
365
- describe SeleniumTestCase, "#element_does_not_contain_text" do
366
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
367
-
368
- it "returns true when element is not on the page" do
369
- locator = "id=element_id"
370
- expected_text = "foobar"
371
- mock(base_selenium).is_element_present.with(locator).returns(false)
301
+ describe SeleniumTestCase, "#element_does_not_contain_text" do
302
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
372
303
 
373
- @test_case.element_does_not_contain_text(locator, expected_text).should == true
374
- end
304
+ it "when element is not on the page, returns true" do
305
+ locator = "id=element_id"
306
+ expected_text = "foobar"
307
+ mock(driver).is_element_present(locator) {false}
375
308
 
376
- it "returns true when element is on page and inner_html does not contain text" do
377
- locator = "id=element_id"
378
- inner_html = "Some text that does not contain the expected_text"
379
- expected_text = "foobar"
380
- mock(base_selenium).is_element_present.with(locator).returns(true)
381
- mock(@test_case).get_inner_html.with(locator).returns(inner_html)
309
+ test_case.element_does_not_contain_text(locator, expected_text).should == true
310
+ end
382
311
 
383
- @test_case.element_does_not_contain_text(locator, expected_text).should == true
384
- end
312
+ it "when element is on page and inner_html does not contain text, returns true" do
313
+ locator = "id=element_id"
314
+ inner_html = "Some text that does not contain the expected_text"
315
+ expected_text = "foobar"
316
+ mock(driver).do_command("isElementPresent", [locator]) do
317
+ result(true)
318
+ end
319
+ mock(driver).do_command("getEval", [driver.inner_html_js(locator)]) do
320
+ inner_html
321
+ end
385
322
 
386
- it "returns false when element is on page and inner_html does contain text" do
387
- locator = "id=element_id"
388
- inner_html = "foobar foobar foobar"
389
- expected_text = "foobar"
390
- mock(base_selenium).is_element_present.with(locator).returns(true)
391
- mock(@test_case).get_inner_html.with(locator).returns(inner_html)
323
+ test_case.element_does_not_contain_text(locator, expected_text).should == true
324
+ end
392
325
 
393
- @test_case.element_does_not_contain_text(locator, expected_text).should == false
326
+ it "when element is on page and inner_html does contain text, returns false" do
327
+ locator = "id=element_id"
328
+ inner_html = "foobar foobar foobar"
329
+ expected_text = "foobar"
330
+ mock(driver).do_command("isElementPresent", [locator]) do
331
+ result(true)
332
+ end
333
+ mock(driver).do_command("getEval", [driver.inner_html_js(locator)]) do
334
+ inner_html
335
+ end
336
+
337
+ test_case.element_does_not_contain_text(locator, expected_text).should == false
338
+ end
394
339
  end
395
- end
396
340
 
397
- describe SeleniumTestCase, "#assert_element_does_not_contain_text" do
398
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
341
+ describe SeleniumTestCase, "#assert_element_does_not_contain_text" do
342
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
399
343
 
400
- before do
401
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
402
- mock.proxy(element).does_not_contain_text("passed in value", {})
403
- element
344
+ before do
345
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
346
+ mock.proxy(element).does_not_contain_text("passed in value", {})
347
+ element
348
+ end
349
+ @evaled_js = "this.page().findElement(\"#{sample_locator}\").innerHTML"
404
350
  end
405
- @evaled_js = "this.page().findElement(\"#{sample_locator}\").innerHTML"
406
- end
407
351
 
408
- it "passes when text is not in the element's inner_html" do
409
- mock(base_selenium) do |o|
410
- o.is_element_present(sample_locator) {true}
411
- o.get_eval(@evaled_js) do
412
- "another value"
352
+ it "passes when text is not in the element's inner_html" do
353
+ mock(driver) do |o|
354
+ o.is_element_present(sample_locator) {true}
355
+ o.get_eval(@evaled_js) do
356
+ "another value"
357
+ end
413
358
  end
359
+ test_case.assert_element_does_not_contain_text(sample_locator, "passed in value")
414
360
  end
415
- @test_case.assert_element_does_not_contain_text(sample_locator, "passed in value")
416
- end
417
361
 
418
- it "fails when text is in the element's inner_html" do
419
- stub(base_selenium) do |o|
420
- o.is_element_present(sample_locator) {true}
421
- o.get_eval(@evaled_js) {"html passed in value html"}
362
+ it "fails when text is in the element's inner_html" do
363
+ stub(driver) do |o|
364
+ o.is_element_present(sample_locator) {true}
365
+ o.get_eval(@evaled_js) {"html passed in value html"}
366
+ end
367
+ proc do
368
+ test_case.assert_element_does_not_contain_text(sample_locator, "passed in value")
369
+ end.should raise_error(Test::Unit::AssertionFailedError)
422
370
  end
423
- proc do
424
- @test_case.assert_element_does_not_contain_text(sample_locator, "passed in value")
425
- end.should raise_error(Test::Unit::AssertionFailedError)
426
371
  end
427
- end
428
372
 
429
- describe SeleniumTestCase, "#element_does_not_contain_text" do
430
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
373
+ describe SeleniumTestCase, "#element_does_not_contain_text" do
374
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
431
375
 
432
- it "checks if text is in order" do
433
- locator = "id=foo"
434
- stub(@base_selenium).get_text(locator).returns("one\ntwo\nthree\n")
376
+ it "checks if text is in order" do
377
+ locator = "id=foo"
378
+ stub(@driver).get_text(locator).returns("one\ntwo\nthree\n")
435
379
 
436
- @test_case.is_text_in_order locator, "one", "two", "three"
380
+ test_case.is_text_in_order locator, "one", "two", "three"
381
+ end
437
382
  end
438
- end
439
383
 
440
- describe SeleniumTestCase, "#assert_attribute" do
441
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
384
+ describe SeleniumTestCase, "#assert_attribute" do
385
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
442
386
 
443
- before do
444
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
445
- mock.proxy(element).has_attribute("passed in value")
446
- element
387
+ before do
388
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
389
+ mock.proxy(element).has_attribute("passed in value")
390
+ element
391
+ end
447
392
  end
448
- end
449
393
 
450
- it "passes when attribute is expected" do
451
- mock(base_selenium) do |o|
452
- o.is_element_present(sample_locator) {true}
453
- o.get_attribute(sample_locator) {"passed in value"}
394
+ it "passes when attribute is expected" do
395
+ mock(driver) do |o|
396
+ o.is_element_present(sample_locator) {true}
397
+ o.get_attribute(sample_locator) {"passed in value"}
398
+ end
399
+ test_case.assert_attribute(sample_locator, "passed in value")
454
400
  end
455
- @test_case.assert_attribute(sample_locator, "passed in value")
456
- end
457
-
458
- it "fails when attribute is not expected" do
459
- stub(base_selenium) do |o|
460
- o.is_element_present(sample_locator) {true}
461
- o.get_attribute(sample_locator) {"another value"}
401
+
402
+ it "fails when attribute is not expected" do
403
+ stub(driver) do |o|
404
+ o.is_element_present(sample_locator) {true}
405
+ o.get_attribute(sample_locator) {"another value"}
406
+ end
407
+ proc do
408
+ test_case.assert_attribute(sample_locator, "passed in value")
409
+ end.should raise_error(Test::Unit::AssertionFailedError)
462
410
  end
463
- proc do
464
- @test_case.assert_attribute(sample_locator, "passed in value")
465
- end.should raise_error(Test::Unit::AssertionFailedError)
466
411
  end
467
- end
468
412
 
469
- describe SeleniumTestCase, "#assert_selected" do
470
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
413
+ describe SeleniumTestCase, "#assert_selected" do
414
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
471
415
 
472
- before do
473
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
474
- mock.proxy(element).has_selected("passed_in_element")
475
- element
416
+ before do
417
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
418
+ mock.proxy(element).has_selected("passed_in_element")
419
+ element
420
+ end
476
421
  end
477
- end
478
422
 
479
- it "passes when selected is expected" do
480
- mock(base_selenium) do |o|
481
- o.is_element_present(sample_locator) {true}
482
- o.get_selected_label(sample_locator) {"passed_in_element"}
423
+ it "passes when selected is expected" do
424
+ mock(driver) do |o|
425
+ o.is_element_present(sample_locator) {true}
426
+ o.get_selected_label(sample_locator) {"passed_in_element"}
427
+ end
428
+ test_case.assert_selected(sample_locator, "passed_in_element")
483
429
  end
484
- @test_case.assert_selected(sample_locator, "passed_in_element")
485
- end
486
430
 
487
- it "fails when selected is not expected" do
488
- stub(base_selenium) do |o|
489
- o.is_element_present(sample_locator) {true}
490
- o.get_selected_label(sample_locator) {"another_element"}
431
+ it "fails when selected is not expected" do
432
+ stub(driver) do |o|
433
+ o.is_element_present(sample_locator) {true}
434
+ o.get_selected_label(sample_locator) {"another_element"}
435
+ end
436
+ proc do
437
+ test_case.assert_selected(sample_locator, "passed_in_element")
438
+ end.should raise_error(Test::Unit::AssertionFailedError)
491
439
  end
492
- proc do
493
- @test_case.assert_selected(sample_locator, "passed_in_element")
494
- end.should raise_error(Test::Unit::AssertionFailedError)
495
- end
496
- end
440
+ end
497
441
 
498
- describe SeleniumTestCase, "#assert_checked" do
499
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
442
+ describe SeleniumTestCase, "#assert_checked" do
443
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
500
444
 
501
- before do
502
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
503
- mock.proxy(element).is_checked
504
- element
445
+ before do
446
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
447
+ mock.proxy(element).is_checked
448
+ element
449
+ end
505
450
  end
506
- end
507
451
 
508
- it "passes when checked" do
509
- mock(base_selenium) do |o|
510
- o.is_element_present(sample_locator) {true}
511
- o.is_checked(sample_locator) {true}
452
+ it "passes when checked" do
453
+ mock(driver) do |o|
454
+ o.is_element_present(sample_locator) {true}
455
+ o.is_checked(sample_locator) {true}
456
+ end
457
+ test_case.assert_checked(sample_locator)
512
458
  end
513
- @test_case.assert_checked(sample_locator)
514
- end
515
459
 
516
- it "fails when not checked" do
517
- stub(base_selenium) do |o|
518
- o.is_element_present(sample_locator) {true}
519
- o.is_checked(sample_locator) {false}
460
+ it "fails when not checked" do
461
+ stub(driver) do |o|
462
+ o.is_element_present(sample_locator) {true}
463
+ o.is_checked(sample_locator) {false}
464
+ end
465
+ proc do
466
+ test_case.assert_checked(sample_locator)
467
+ end.should raise_error(Test::Unit::AssertionFailedError)
520
468
  end
521
- proc do
522
- @test_case.assert_checked(sample_locator)
523
- end.should raise_error(Test::Unit::AssertionFailedError)
524
469
  end
525
- end
526
470
 
527
- describe SeleniumTestCase, "#assert_not_checked" do
528
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
471
+ describe SeleniumTestCase, "#assert_not_checked" do
472
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
529
473
 
530
- before do
531
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
532
- mock.proxy(element).is_not_checked
533
- element
474
+ before do
475
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
476
+ mock.proxy(element).is_not_checked
477
+ element
478
+ end
534
479
  end
535
- end
536
480
 
537
- it "passes when not checked" do
538
- mock(base_selenium) do |o|
539
- o.is_element_present(sample_locator) {true}
540
- o.is_checked(sample_locator) {false}
481
+ it "passes when not checked" do
482
+ mock(driver) do |o|
483
+ o.is_element_present(sample_locator) {true}
484
+ o.is_checked(sample_locator) {false}
485
+ end
486
+ test_case.assert_not_checked(sample_locator)
541
487
  end
542
- @test_case.assert_not_checked(sample_locator)
543
- end
544
488
 
545
- it "fails when checked" do
546
- stub(base_selenium) do |o|
547
- o.is_element_present(sample_locator) {true}
548
- o.is_checked(sample_locator) {true}
489
+ it "fails when checked" do
490
+ stub(driver) do |o|
491
+ o.is_element_present(sample_locator) {true}
492
+ o.is_checked(sample_locator) {true}
493
+ end
494
+ proc do
495
+ test_case.assert_not_checked(sample_locator)
496
+ end.should raise_error(Test::Unit::AssertionFailedError)
549
497
  end
550
- proc do
551
- @test_case.assert_not_checked(sample_locator)
552
- end.should raise_error(Test::Unit::AssertionFailedError)
553
498
  end
554
- end
555
499
 
556
- describe SeleniumTestCase, "#assert_text" do
557
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
500
+ describe SeleniumTestCase, "#assert_text" do
501
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
558
502
 
559
- before do
560
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
561
- mock.proxy(element).has_text("expected text", {})
562
- element
503
+ before do
504
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
505
+ mock.proxy(element).has_text("expected text", {})
506
+ element
507
+ end
563
508
  end
564
- end
565
509
 
566
- it "passes when text is expected" do
567
- mock(base_selenium) do |o|
568
- o.is_element_present(sample_locator) {true}
569
- o.get_text(sample_locator) {"expected text"}
510
+ it "passes when text is expected" do
511
+ mock(driver) do |o|
512
+ o.is_element_present(sample_locator) {true}
513
+ o.get_text(sample_locator) {"expected text"}
514
+ end
515
+ test_case.assert_text(sample_locator, "expected text")
570
516
  end
571
- @test_case.assert_text(sample_locator, "expected text")
572
- end
573
517
 
574
- it "fails when text is not expected" do
575
- stub(base_selenium) do |o|
576
- o.is_element_present(sample_locator) {true}
577
- o.get_text(sample_locator) {"unexpected text"}
518
+ it "fails when text is not expected" do
519
+ stub(driver) do |o|
520
+ o.is_element_present(sample_locator) {true}
521
+ o.get_text(sample_locator) {"unexpected text"}
522
+ end
523
+ proc do
524
+ test_case.assert_text(sample_locator, "expected text")
525
+ end.should raise_error(Test::Unit::AssertionFailedError)
578
526
  end
579
- proc do
580
- @test_case.assert_text(sample_locator, "expected text")
581
- end.should raise_error(Test::Unit::AssertionFailedError)
582
527
  end
583
- end
584
528
 
585
- describe SeleniumTestCase, "#assert_visible" do
586
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
529
+ describe SeleniumTestCase, "#assert_visible" do
530
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
587
531
 
588
- before do
589
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
590
- mock.proxy(element).is_visible({})
591
- element
532
+ before do
533
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
534
+ mock.proxy(element).is_visible({})
535
+ element
536
+ end
592
537
  end
593
- end
594
538
 
595
- it "passes when element is visible" do
596
- mock(base_selenium).is_element_present(sample_locator) {true}
597
- mock(base_selenium).is_visible(sample_locator) {true}
539
+ it "passes when element is visible" do
540
+ mock(driver).is_element_present(sample_locator) {true}
541
+ mock(driver).is_visible(sample_locator) {true}
598
542
 
599
- @test_case.assert_visible(sample_locator)
600
- end
601
-
602
- it "fails when element is not visible" do
603
- mock(base_selenium).is_element_present(sample_locator) {true}
604
- stub(base_selenium).is_visible.returns {false}
543
+ test_case.assert_visible(sample_locator)
544
+ end
545
+
546
+ it "fails when element is not visible" do
547
+ mock(driver).is_element_present(sample_locator) {true}
548
+ stub(driver).is_visible.returns {false}
605
549
 
606
- proc {
607
- @test_case.assert_visible(sample_locator)
608
- }.should raise_error(Test::Unit::AssertionFailedError)
550
+ proc {
551
+ test_case.assert_visible(sample_locator)
552
+ }.should raise_error(Test::Unit::AssertionFailedError)
553
+ end
609
554
  end
610
- end
611
555
 
612
- describe SeleniumTestCase, "#assert_not_visible" do
613
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
556
+ describe SeleniumTestCase, "#assert_not_visible" do
557
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
614
558
 
615
- before do
616
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
617
- mock.proxy(element).is_not_visible({})
618
- element
559
+ before do
560
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
561
+ mock.proxy(element).is_not_visible({})
562
+ element
563
+ end
619
564
  end
620
- end
621
565
 
622
- it "passes when element is present and is not visible" do
623
- mock(base_selenium).is_element_present(sample_locator) {true}
624
- mock(base_selenium).is_visible(sample_locator) {false}
566
+ it "passes when element is present and is not visible" do
567
+ mock(driver).is_element_present(sample_locator) {true}
568
+ mock(driver).is_visible(sample_locator) {false}
625
569
 
626
- @test_case.assert_not_visible(sample_locator)
627
- end
628
-
629
- it "fails when element is visible" do
630
- mock(base_selenium).is_element_present(sample_locator) {true}
631
- stub(base_selenium).is_visible(sample_locator) {true}
570
+ test_case.assert_not_visible(sample_locator)
571
+ end
572
+
573
+ it "fails when element is visible" do
574
+ mock(driver).is_element_present(sample_locator) {true}
575
+ stub(driver).is_visible(sample_locator) {true}
632
576
 
633
- proc {
634
- @test_case.assert_not_visible(sample_locator)
635
- }.should raise_error(Test::Unit::AssertionFailedError)
577
+ proc {
578
+ test_case.assert_not_visible(sample_locator)
579
+ }.should raise_error(Test::Unit::AssertionFailedError)
580
+ end
636
581
  end
637
- end
638
582
 
639
- describe SeleniumTestCase, "#assert_next_sibling" do
640
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
583
+ describe SeleniumTestCase, "#assert_next_sibling" do
584
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
641
585
 
642
- before do
643
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator) do |element|
644
- mock.proxy(element).has_next_sibling("next_sibling", {})
645
- element
586
+ before do
587
+ mock.proxy(SeleniumElement).new(driver, sample_locator) do |element|
588
+ mock.proxy(element).has_next_sibling("next_sibling", {})
589
+ element
590
+ end
591
+ @evaled_js = "this.page().findElement('#{sample_locator}').nextSibling.id"
646
592
  end
647
- @evaled_js = "this.page().findElement('#{sample_locator}').nextSibling.id"
648
- end
649
593
 
650
- it "passes when passed next sibling id" do
651
- mock(base_selenium) do |o|
652
- o.is_element_present(sample_locator) {true}
653
- o.get_eval(@evaled_js) {"next_sibling"}
594
+ it "passes when passed next sibling id" do
595
+ mock(driver) do |o|
596
+ o.is_element_present(sample_locator) {true}
597
+ o.get_eval(@evaled_js) {"next_sibling"}
598
+ end
599
+ test_case.assert_next_sibling(sample_locator, "next_sibling")
654
600
  end
655
- @test_case.assert_next_sibling(sample_locator, "next_sibling")
656
- end
657
601
 
658
- it "fails when not passed next sibling id" do
659
- stub(base_selenium) do |o|
660
- o.is_element_present(sample_locator) {true}
661
- o.get_eval(@evaled_js) {"wrong_sibling"}
602
+ it "fails when not passed next sibling id" do
603
+ stub(driver) do |o|
604
+ o.is_element_present(sample_locator) {true}
605
+ o.get_eval(@evaled_js) {"wrong_sibling"}
606
+ end
607
+ proc do
608
+ test_case.assert_next_sibling(sample_locator, "next_sibling")
609
+ end.should raise_error(Test::Unit::AssertionFailedError)
662
610
  end
663
- proc do
664
- @test_case.assert_next_sibling(sample_locator, "next_sibling")
665
- end.should raise_error(Test::Unit::AssertionFailedError)
666
611
  end
667
- end
668
612
 
669
- describe SeleniumTestCase, "#assert_text_in_order" do
670
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
613
+ describe SeleniumTestCase, "#assert_text_in_order" do
614
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
671
615
 
672
- before do
673
- mock.proxy(SeleniumElement).new(base_selenium, sample_locator)
674
- @evaled_js = "this.page().findElement('#{sample_locator}').nextSibling.id"
675
- end
616
+ before do
617
+ mock.proxy(SeleniumElement).new(driver, sample_locator)
618
+ @evaled_js = "this.page().findElement('#{sample_locator}').nextSibling.id"
619
+ end
676
620
 
677
- it "passes when text is in order" do
678
- mock(base_selenium) do |o|
679
- o.is_element_present(sample_locator) {true}
680
- o.get_text(sample_locator) {"one\ntwo\nthree\n"}
621
+ it "passes when text is in order" do
622
+ mock(driver) do |o|
623
+ o.is_element_present(sample_locator) {true}
624
+ o.get_text(sample_locator) {"one\ntwo\nthree\n"}
625
+ end
626
+ test_case.assert_text_in_order sample_locator, "one", "two", "three"
681
627
  end
682
- @test_case.assert_text_in_order sample_locator, "one", "two", "three"
683
- end
684
628
 
685
- it "fails when element is present and text is not in order" do
686
- stub(base_selenium) do |o|
687
- o.is_element_present(sample_locator) {true}
688
- o.get_text(sample_locator) {"<html>one\ntext not in order\n</html>"}
629
+ it "fails when element is present and text is not in order" do
630
+ stub(driver) do |o|
631
+ o.is_element_present(sample_locator) {true}
632
+ o.get_text(sample_locator) {"<html>one\ntext not in order\n</html>"}
633
+ end
634
+ proc do
635
+ test_case.assert_text_in_order sample_locator, "one", "two", "three"
636
+ end.should raise_error(Test::Unit::AssertionFailedError)
689
637
  end
690
- proc do
691
- @test_case.assert_text_in_order sample_locator, "one", "two", "three"
692
- end.should raise_error(Test::Unit::AssertionFailedError)
693
638
  end
694
- end
695
639
 
696
- describe SeleniumTestCase, "#type" do
697
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
640
+ describe SeleniumTestCase, "#type" do
641
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
698
642
 
699
- it "types when element is present and types" do
700
- is_element_present_results = [false, true]
701
- mock(base_selenium).is_element_present.with("id=foobar").twice.returns {is_element_present_results.shift}
702
- mock(base_selenium).type.with("id=foobar", "The Text")
643
+ it "types when element is present and types" do
644
+ is_element_present_results = [false, true]
645
+ mock(driver).do_command("isElementPresent", ["id=foobar"]).twice do
646
+ result(is_element_present_results.shift)
647
+ end
648
+ mock(driver).do_command("type", ["id=foobar", "The Text"]) do
649
+ result()
650
+ end
703
651
 
704
- @test_case.type "id=foobar", "The Text"
705
- end
652
+ test_case.type "id=foobar", "The Text"
653
+ end
706
654
 
707
- it "fails when element is not present" do
708
- is_element_present_results = [false, false, false, false]
709
- mock(base_selenium).is_element_present.with("id=foobar").times(4).
710
- returns {is_element_present_results.shift}
711
- dont_allow(base_selenium).type
655
+ it "fails when element is not present" do
656
+ mock(driver).do_command("isElementPresent", ["id=foobar"]).times(4) do
657
+ result(false)
658
+ end
659
+ dont_allow(driver).do_command("type", ["id=foobar", "The Text"])
712
660
 
713
- proc {
714
- @test_case.type "id=foobar", "The Text"
715
- }.should raise_error(Test::Unit::AssertionFailedError)
661
+ proc {
662
+ test_case.type "id=foobar", "The Text"
663
+ }.should raise_error(Test::Unit::AssertionFailedError)
664
+ end
716
665
  end
717
- end
718
666
 
719
- describe SeleniumTestCase, "#click" do
720
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
667
+ describe SeleniumTestCase, "#click" do
668
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
721
669
 
722
- it "click when element is present and types" do
723
- is_element_present_results = [false, true]
724
- mock(base_selenium).is_element_present.with("id=foobar").twice.returns {is_element_present_results.shift}
725
- mock(base_selenium).click.with("id=foobar")
670
+ it "click when element is present and types" do
671
+ is_element_present_results = [false, true]
672
+ mock(driver).do_command("isElementPresent", ["id=foobar"]).twice do
673
+ result(is_element_present_results.shift)
674
+ end
675
+ mock(driver).do_command("click", ["id=foobar"]) {result}
726
676
 
727
- @test_case.click "id=foobar"
728
- end
677
+ test_case.click "id=foobar"
678
+ end
729
679
 
730
- it "fails when element is not present" do
731
- is_element_present_results = [false, false, false, false]
732
- mock(base_selenium).is_element_present.with("id=foobar").times(4).
733
- returns {is_element_present_results.shift}
734
- dont_allow(base_selenium).click
680
+ it "fails when element is not present" do
681
+ is_element_present_results = [false, false, false, false]
682
+ mock(driver).do_command("isElementPresent", ["id=foobar"]).times(4) do
683
+ result(is_element_present_results.shift)
684
+ end
685
+ dont_allow(driver).do_command("click", [])
735
686
 
736
- proc {
737
- @test_case.click "id=foobar"
738
- }.should raise_error(Test::Unit::AssertionFailedError)
687
+ proc {
688
+ test_case.click "id=foobar"
689
+ }.should raise_error(Test::Unit::AssertionFailedError)
690
+ end
739
691
  end
740
- end
741
692
 
742
- describe SeleniumTestCase, "#select" do
743
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
693
+ describe SeleniumTestCase, "#select" do
694
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
744
695
 
745
- it "types when element is present and types" do
746
- is_element_present_results = [false, true]
747
- mock(base_selenium).is_element_present.with("id=foobar").twice.returns {is_element_present_results.shift}
748
- mock(base_selenium).select.with("id=foobar", "value=3")
696
+ it "types when element is present and types" do
697
+ is_element_present_results = [false, true]
698
+ mock(driver).do_command("isElementPresent", ["id=foobar"]).twice do
699
+ result is_element_present_results.shift
700
+ end
701
+ mock(driver).do_command("select", ["id=foobar", "value=3"]) {result}
749
702
 
750
- @test_case.select "id=foobar", "value=3"
751
- end
703
+ test_case.select "id=foobar", "value=3"
704
+ end
752
705
 
753
- it "fails when element is not present" do
754
- is_element_present_results = [false, false, false, false]
755
- mock(base_selenium).is_element_present.with("id=foobar").times(4).
756
- returns {is_element_present_results.shift}
757
- dont_allow(base_selenium).select
706
+ it "fails when element is not present" do
707
+ mock(driver).do_command("isElementPresent", ["id=foobar"]).times(4) do
708
+ result false
709
+ end
710
+ dont_allow(driver).do_command("select", ["id=foobar", "value=3"])
758
711
 
759
- proc {
760
- @test_case.select "id=foobar", "value=3"
761
- }.should raise_error(Test::Unit::AssertionFailedError)
712
+ proc {
713
+ test_case.select "id=foobar", "value=3"
714
+ }.should raise_error(Test::Unit::AssertionFailedError)
715
+ end
762
716
  end
763
- end
764
717
 
765
- describe SeleniumTestCase, "#wait_for_and_click" do
766
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
718
+ describe SeleniumTestCase, "#wait_for_and_click" do
719
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
767
720
 
768
- it "click when element is present and types" do
769
- is_element_present_results = [false, true]
770
- mock(base_selenium).is_element_present.with("id=foobar").twice.returns {is_element_present_results.shift}
771
- mock(base_selenium).click.with("id=foobar")
721
+ it "click when element is present and types" do
722
+ is_element_present_results = [false, true]
723
+ mock(driver).do_command("isElementPresent", ["id=foobar"]).twice do
724
+ result is_element_present_results.shift
725
+ end
726
+ mock(driver).do_command("click", ["id=foobar"]) {result}
772
727
 
773
- @test_case.wait_for_and_click "id=foobar"
774
- end
728
+ test_case.wait_for_and_click "id=foobar"
729
+ end
775
730
 
776
- it "fails when element is not present" do
777
- is_element_present_results = [false, false, false, false]
778
- mock(base_selenium).is_element_present.with("id=foobar").times(4).
779
- returns {is_element_present_results.shift}
780
- dont_allow(base_selenium).click
731
+ it "fails when element is not present" do
732
+ is_element_present_results = [false, false, false, false]
733
+ mock(driver).is_element_present("id=foobar").times(4) do
734
+ is_element_present_results.shift
735
+ end
736
+ dont_allow(driver).click
781
737
 
782
- proc {
783
- @test_case.wait_for_and_click "id=foobar"
784
- }.should raise_error(Test::Unit::AssertionFailedError)
738
+ proc {
739
+ test_case.wait_for_and_click "id=foobar"
740
+ }.should raise_error(Test::Unit::AssertionFailedError)
741
+ end
785
742
  end
786
- end
787
743
 
788
- describe SeleniumTestCase, "#page" do
789
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
790
-
791
- it "returns page" do
792
- @test_case.page.should == SeleniumPage.new(base_selenium)
744
+ describe SeleniumTestCase, "#page" do
745
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
746
+
747
+ it "returns page" do
748
+ test_case.page.should == SeleniumPage.new(driver)
749
+ end
793
750
  end
794
- end
795
751
 
796
- describe "SeleniumTestCase in test browser mode and test fails" do
797
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
752
+ describe "SeleniumTestCase in test browser mode and test fails" do
753
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
798
754
 
799
- it "should stop interpreter when configuration says to stop test" do
800
- @test_case.configuration = "Seleniumrc::SeleniumConfiguration"
801
- mock(@test_case.configuration).test_browser_mode?.returns(true)
755
+ it "should stop driver when configuration says to stop test" do
756
+ test_case.configuration = configuration = Seleniumrc::SeleniumConfiguration.new
757
+ configuration.test_browser_mode
802
758
 
803
- stub(@test_case).passed?.returns(false)
804
- mock(@test_case.configuration).stop_selenese_interpreter?.with(false).returns(true)
759
+ stub(test_case).passed? {false}
760
+ configuration.keep_browser_open_on_failure = false
805
761
 
806
- mock(base_selenium).stop.once
807
- @test_case.base_selenium = base_selenium
762
+ mock(driver).stop.once
763
+ test_case.selenium_driver = driver
808
764
 
809
- @test_case.teardown
810
- end
765
+ test_case.teardown
766
+ end
811
767
 
812
- it "should not stop interpreter when configuration says not to stop test" do
813
- @test_case.configuration = "Seleniumrc::SeleniumConfiguration"
814
- mock(@test_case.configuration).test_browser_mode?.returns(true)
768
+ it "should not stop driver when configuration says not to stop test" do
769
+ test_case.configuration = "Seleniumrc::SeleniumConfiguration"
770
+ mock(test_case.configuration).test_browser_mode?.returns(true)
815
771
 
816
- stub(@test_case).passed?.returns(false)
817
- mock(@test_case.configuration).stop_selenese_interpreter?.with(false).returns(false)
772
+ stub(test_case).passed? {false}
773
+ mock(test_case.configuration).stop_driver?(false) {false}
818
774
 
819
- @test_case.base_selenium = base_selenium
775
+ test_case.selenium_driver = driver
820
776
 
821
- @test_case.teardown
777
+ test_case.teardown
778
+ end
822
779
  end
823
- end
824
780
 
825
- describe "SeleniumTestCase in test browser mode and test pass" do
826
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
781
+ describe "SeleniumTestCase in test browser mode and test pass" do
782
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
827
783
 
828
- it "should stop interpreter when configuration says to stop test" do
829
- @test_case.configuration = "Seleniumrc::SeleniumConfiguration"
830
- mock(@test_case.configuration).test_browser_mode?.returns(true)
784
+ it "should stop driver when configuration says to stop test" do
785
+ test_case.configuration = "Seleniumrc::SeleniumConfiguration"
786
+ mock(test_case.configuration).test_browser_mode?.returns(true)
831
787
 
832
- stub(@test_case).passed?.returns(true)
833
- mock(@test_case.configuration).stop_selenese_interpreter?.with(true).returns(true)
788
+ stub(test_case).passed?.returns(true)
789
+ mock(test_case.configuration).stop_driver?(true) {true}
834
790
 
835
- mock(base_selenium).stop.once
836
- @test_case.base_selenium = base_selenium
791
+ mock(driver).stop.once
792
+ test_case.selenium_driver = driver
837
793
 
838
- @test_case.teardown
839
- end
794
+ test_case.teardown
795
+ end
840
796
 
841
- it "should not stop interpreter when configuration says not to stop test" do
842
- @test_case.configuration = "Seleniumrc::SeleniumConfiguration"
843
- mock(@test_case.configuration).test_browser_mode?.returns(true)
797
+ it "should not stop driver when configuration says not to stop test" do
798
+ test_case.configuration = "Seleniumrc::SeleniumConfiguration"
799
+ mock(test_case.configuration).test_browser_mode?.returns(true)
844
800
 
845
- stub(@test_case).passed?.returns(true)
846
- mock(@test_case.configuration).stop_selenese_interpreter?.with(true).returns(false)
801
+ stub(test_case).passed?.returns(true)
802
+ mock(test_case.configuration).stop_driver?(true) {false}
847
803
 
848
- @test_case.base_selenium = base_selenium
804
+ test_case.selenium_driver = driver
849
805
 
850
- @test_case.teardown
806
+ test_case.teardown
807
+ end
851
808
  end
852
- end
853
809
 
854
- describe "SeleniumTestCase not in suite browser mode" do
855
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
810
+ describe "SeleniumTestCase not in suite browser mode" do
811
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
856
812
 
857
- it "should not stop interpreter when tests fail" do
858
- @test_case.configuration = "Seleniumrc::SeleniumConfiguration"
859
- mock(@test_case.configuration).test_browser_mode?.returns(false)
813
+ it "should not stop driver when tests fail" do
814
+ test_case.configuration = "Seleniumrc::SeleniumConfiguration"
815
+ mock(test_case.configuration).test_browser_mode? {false}
860
816
 
861
- def @test_case.passed?; false; end
817
+ def test_case.passed?;
818
+ false;
819
+ end
862
820
 
863
- @test_case.base_selenium = base_selenium
821
+ test_case.selenium_driver = driver
864
822
 
865
- @test_case.teardown
866
- end
823
+ test_case.teardown
824
+ end
867
825
 
868
- it "should stop interpreter when tests pass" do
869
- @test_case.configuration = "Seleniumrc::SeleniumConfiguration"
870
- mock(@test_case.configuration).test_browser_mode?.returns(false)
826
+ it "should stop driver when tests pass" do
827
+ test_case.configuration = "Seleniumrc::SeleniumConfiguration"
828
+ mock(test_case.configuration).test_browser_mode? {false}
871
829
 
872
- stub(@test_case).passed?.returns(true)
830
+ stub(test_case).passed?.returns(true)
873
831
 
874
- @test_case.base_selenium = base_selenium
832
+ test_case.selenium_driver = driver
875
833
 
876
- @test_case.teardown
877
- end
878
- end
834
+ test_case.teardown
835
+ end
836
+ end
879
837
 
880
- describe "SeleniumTestCase in test browser mode and test pass" do
881
- it_should_behave_like "Seleniumrc::SeleniumTestCase"
838
+ describe "SeleniumTestCase in test browser mode and test pass" do
839
+ it_should_behave_like "Seleniumrc::SeleniumTestCase"
882
840
 
883
- it "should stop interpreter when configuration says to stop test" do
884
- @test_case.configuration = "Seleniumrc::SeleniumConfiguration"
885
- mock(@test_case.configuration).test_browser_mode?.returns(true)
841
+ it "should stop driver when configuration says to stop test" do
842
+ test_case.configuration = "Seleniumrc::SeleniumConfiguration"
843
+ mock(test_case.configuration).test_browser_mode?.returns(true)
886
844
 
887
- stub(@test_case).passed?.returns(true)
888
- mock(@test_case.configuration).stop_selenese_interpreter?.with(true).returns(true)
845
+ stub(test_case).passed?.returns(true)
846
+ mock(test_case.configuration).stop_driver?(true) {true}
889
847
 
890
- mock(base_selenium).stop.once
891
- @test_case.base_selenium = base_selenium
848
+ mock(driver).stop.once
849
+ test_case.selenium_driver = driver
892
850
 
893
- @test_case.teardown
894
- end
851
+ test_case.teardown
852
+ end
895
853
 
896
- it "should not stop interpreter when configuration says not to stop test" do
897
- @test_case.configuration = "Seleniumrc::SeleniumConfiguration"
898
- mock(@test_case.configuration).test_browser_mode?.returns(true)
854
+ it "should not stop driver when configuration says not to stop test" do
855
+ test_case.configuration = "Seleniumrc::SeleniumConfiguration"
856
+ mock(test_case.configuration).test_browser_mode? {true}
899
857
 
900
- stub(@test_case).passed?.returns(true)
901
- mock(@test_case.configuration).stop_selenese_interpreter?.with(true).returns(false)
858
+ stub(test_case).passed?.returns(true)
859
+ mock(test_case.configuration).stop_driver?(true) {false}
902
860
 
903
- @test_case.base_selenium = base_selenium
861
+ test_case.selenium_driver = driver
904
862
 
905
- @test_case.teardown
863
+ test_case.teardown
864
+ end
906
865
  end
907
866
  end
908
- end