File tree Expand file tree Collapse file tree 4 files changed +20
-16
lines changed
integration/selenium/webdriver/spec_support
unit/selenium/webdriver/remote Expand file tree Collapse file tree 4 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,13 @@ def path=(path)
14
14
def path
15
15
@path ||= (
16
16
path = case Platform . os
17
- when :windows
18
- Platform . find_in_program_files ( "Safari\\ Safari.exe" )
19
- when :macosx
20
- "/Applications/Safari.app/Contents/MacOS/Safari"
21
- else
22
- Platform . find_binary ( "Safari" )
23
- end
17
+ when :windows
18
+ Platform . find_in_program_files ( "Safari\\ Safari.exe" )
19
+ when :macosx
20
+ "/Applications/Safari.app/Contents/MacOS/Safari"
21
+ else
22
+ Platform . find_binary ( "Safari" )
23
+ end
24
24
25
25
unless File . file? ( path ) && File . executable? ( path )
26
26
raise Error ::WebDriverError , "unable to find the Safari executable, please set Selenium::WebDriver::Safari.path= or add it to your PATH."
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ def install
47
47
return if @installed
48
48
49
49
if install_directory . exist?
50
+ backup_directory . rmtree if backup_directory . exist?
50
51
FileUtils . mv install_directory . to_s , backup_directory . to_s
51
52
end
52
53
Original file line number Diff line number Diff line change @@ -33,7 +33,10 @@ def reset_driver!
33
33
end
34
34
35
35
def quit_driver
36
- @driver_instance . quit if @driver_instance
36
+ if @driver_instance
37
+ @driver_instance . quit
38
+ @driver_instance = nil
39
+ end
37
40
end
38
41
39
42
def new_driver_instance
@@ -43,7 +46,7 @@ def new_driver_instance
43
46
44
47
def app_server
45
48
@app_server ||= (
46
- path = File . join ( root_folder , "common/src/web" )
49
+ path = File . join ( root , "common/src/web" )
47
50
s = RackServer . new ( path )
48
51
s . start
49
52
@@ -63,7 +66,7 @@ def remote_server
63
66
end
64
67
65
68
def remote_server_jar
66
- @remote_server_jar ||= File . join ( root_folder , "build/java/server/test/org/openqa/selenium/server-with-tests-standalone.jar" )
69
+ @remote_server_jar ||= File . join ( root , "build/java/server/test/org/openqa/selenium/server-with-tests-standalone.jar" )
67
70
end
68
71
69
72
def quit
@@ -93,12 +96,12 @@ def url_for(filename)
93
96
url
94
97
end
95
98
96
- private
97
-
98
- def root_folder
99
- @root_folder ||= File . expand_path ( "../../../../../../../" , __FILE__ )
99
+ def root
100
+ @root ||= File . expand_path ( "../../../../../../../" , __FILE__ )
100
101
end
101
102
103
+ private
104
+
102
105
def create_driver
103
106
instance = case driver
104
107
when :remote
Original file line number Diff line number Diff line change 3
3
module Selenium
4
4
module WebDriver
5
5
module Remote
6
-
6
+
7
7
describe Bridge do
8
8
it "raises ArgumentError if passed invalid options" do
9
9
lambda { Bridge . new ( :foo => 'bar' ) } . should raise_error ( ArgumentError )
10
10
end
11
11
12
12
it "raises WebDriverError if uploading non-files" do
13
- request_body = { :sessionId => '11123' , :value => { } } . to_json
13
+ request_body = WebDriver . json_dump ( :sessionId => '11123' , :value => { } )
14
14
headers = { 'Content-Type' => 'application/json' }
15
15
stub_request ( :post , "http://127.0.0.1:4444/wd/hub/session" ) . to_return (
16
16
:status => 200 , :body => request_body , :headers => headers )
You can’t perform that action at this time.
0 commit comments