Skip to content

Commit b2baba9

Browse files
committed
Modify browser version to use env variable or default to beta
1 parent 4b51609 commit b2baba9

File tree

3 files changed

+3
-24
lines changed

3 files changed

+3
-24
lines changed

rb/spec/integration/selenium/webdriver/network_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
module Selenium
2323
module WebDriver
24-
describe Network, exclude: {version: GlobalTestEnv.beta_browser_version(:chrome)},
24+
describe Network, exclude: {version: 'beta'},
2525
exclusive: {bidi: true, reason: 'only executed when bidi is enabled'},
2626
only: {browser: %i[chrome edge firefox]} do
2727
let(:username) { SpecSupport::RackServer::TestApp::BASIC_AUTH_CREDENTIALS.first }

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

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def browser
5858
end
5959

6060
def browser_version
61-
driver_instance.capabilities.browser_version
61+
ENV.fetch('WD_BROWSER_VERSION', 'stable')
6262
end
6363

6464
def driver_instance(...)
@@ -193,28 +193,6 @@ def create_driver!(listener: nil, **, &block)
193193
raise e
194194
end
195195

196-
def beta_browser_version(browser)
197-
case browser
198-
when :chrome
199-
uri = URI.parse('https://chromereleases.googleblog.com/search/label/Beta%20updates')
200-
response = Net::HTTP.get_response(uri)
201-
return "Failed to fetch Chrome Beta page: #{response.code}" unless response.is_a?(Net::HTTPSuccess)
202-
203-
response.body.match(/\d+\.\d+\.\d+\.\d+/).to_s
204-
205-
when :firefox
206-
uri = URI.parse('https://product-details.mozilla.org/1.0/firefox_versions.json')
207-
response = Net::HTTP.get_response(uri)
208-
return "Failed to fetch Firefox version API: #{response.code}" unless response.is_a?(Net::HTTPSuccess)
209-
210-
versions = JSON.parse(response.body)
211-
versions['LATEST_FIREFOX_RELEASED_DEVEL_VERSION']
212-
213-
else
214-
raise ArgumentError, "Unsupported browser: #{browser}"
215-
end
216-
end
217-
218196
private
219197

220198
def build_options(**)

rb/spec/tests.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ BROWSERS = {
111111
"env": {
112112
"WD_REMOTE_BROWSER": "firefox",
113113
"WD_SPEC_DRIVER": "firefox",
114+
"WD_BROWSER_VERSION": "beta",
114115
} | select({
115116
"@selenium//common:use_pinned_linux_firefox": {
116117
"FIREFOX_BINARY": "$(location @linux_beta_firefox//:firefox/firefox)",

0 commit comments

Comments
 (0)