Skip to content

Commit 597f474

Browse files
committed
[rb] simplify the remote server code
1 parent 288b337 commit 597f474

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,17 @@ def remote_server?
102102
end
103103

104104
def remote_server_jar
105-
local_selenium_jar = 'selenium_server_deploy.jar'
106-
downloaded_selenium_jar = "selenium-server-standalone-#{Selenium::Server.latest}.jar"
107-
108-
directory_names = [
109-
root,
110-
root.join('rb'),
111-
root.join('build'),
112-
root.join('build/rb'),
113-
Pathname.new(Dir.pwd).join('rb')
114-
]
115-
file_names = [local_selenium_jar, downloaded_selenium_jar]
116-
file_names.delete(local_selenium_jar) if ENV['DOWNLOAD_SERVER']
117-
118-
files = file_names.each_with_object([]) do |file, array|
119-
directory_names.each { |dir| array << "#{dir}/#{file}" }
120-
end
121-
122-
jar = files.find { |file| File.exist?(file) } ||
123-
Selenium::Server.download(:latest) && files.find { |file| File.exist?(file) }
105+
test_jar = "#{Pathname.new(Dir.pwd).join('rb')}/selenium_server_deploy.jar"
106+
built_jar = root.join('bazel-bin/java/server/src/org/openqa/selenium/grid/selenium_server_deploy.jar')
107+
jar = if File.exist?(test_jar) && ENV['DOWNLOAD_SERVER'].nil?
108+
test_jar
109+
elsif File.exist?(built_jar) && ENV['DOWNLOAD_SERVER'].nil?
110+
built_jar
111+
else
112+
Selenium::Server.download(:latest)
113+
end
124114

125115
WebDriver.logger.info "Server Location: #{jar}"
126-
puts "Server Location: #{jar}"
127116
jar
128117
end
129118

0 commit comments

Comments
 (0)