Skip to content

Commit

Permalink
[rb] Run remote tests on RBE
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed May 3, 2024
1 parent 17d927b commit 7cdb8b2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 23 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/ci-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,11 @@ jobs:
- firefox
- safari
os:
- ubuntu
- windows
- macos
exclude:
- browser: edge
os: ubuntu
- browser: edge
os: macos
- browser: safari
os: ubuntu
- browser: safari
os: windows
with:
Expand All @@ -111,10 +106,6 @@ jobs:
include:
- browser: edge
os: windows
- browser: chrome
os: ubuntu
- browser: firefox
os: ubuntu
- browser: safari
os: macos
with:
Expand Down
13 changes: 13 additions & 0 deletions .skipped-tests
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,20 @@
-//py:test-chrome-test/selenium/webdriver/chrome/chrome_service_tests.py
-//py:test-chrome-test/selenium/webdriver/chrome/proxy_tests.py
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-remote
-//rb/spec/integration/selenium/webdriver/edge:service-edge
-//rb/spec/integration/selenium/webdriver/edge:service-edge-remote
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-remote
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-remote
-//rb/spec/integration/selenium/webdriver:element-chrome
-//rb/spec/integration/selenium/webdriver:element-chrome-remote
-//rb/spec/integration/selenium/webdriver/remote:driver-chrome-remote
-//rb/spec/integration/selenium/webdriver/remote:driver-edge-remote
-//rb/spec/integration/selenium/webdriver/remote:driver-firefox-remote
-//rb/spec/integration/selenium/webdriver/remote:driver-firefox-beta-remote
-//rb/spec/integration/selenium/webdriver/remote:element-chrome-remote
-//rb/spec/integration/selenium/webdriver/remote:element-edge-remote
-//rb/spec/integration/selenium/webdriver/remote:element-firefox-remote
-//rb/spec/integration/selenium/webdriver/remote:element-firefox-beta-remote
2 changes: 1 addition & 1 deletion rb/.ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.6
jruby-9.4.6.0
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,24 @@ def app_server
end

def remote_server
if ENV.key?('CHROMEDRIVER_BINARY')
args = ["-Dwebdriver.chrome.driver=#{ENV['CHROMEDRIVER_BINARY']}"]
elsif ENV.key?('MSEDGEDRIVER_BINARY')
args = ["-Dwebdriver.edge.driver=#{ENV['MSEDGEDRIVER_BINARY']}"]
elsif ENV.key?('GECKODRIVER_BINARY')
args = ["-Dwebdriver.gecko.driver=#{ENV['MSEDGEDRIVER_BINARY']}"]
else
args = %w[--selenium-manager true --enable-managed-downloads true]
end

@remote_server ||= Selenium::Server.new(
remote_server_jar,
java: bazel_java,
port: random_port,
log_level: WebDriver.logger.debug? && 'FINE',
background: true,
timeout: 60,
args: %w[--selenium-manager true --enable-managed-downloads true]
args: args
)
end

Expand Down Expand Up @@ -250,15 +260,15 @@ def safari_preview_driver(**opts)
def chrome_options(args: [], **opts)
opts[:binary] ||= ENV['CHROME_BINARY'] if ENV.key?('CHROME_BINARY')
args << '--headless=chrome' if ENV['HEADLESS']
args << '--no-sandbox' if ENV['NO_SANDBOX']
args << '--no-sandbox' unless Platform.windows?
args << '--disable-gpu'
WebDriver::Options.chrome(browser_version: 'stable', args: args, **opts)
end

def edge_options(args: [], **opts)
opts[:binary] ||= ENV['EDGE_BINARY'] if ENV.key?('EDGE_BINARY')
args << '--headless=chrome' if ENV['HEADLESS']
args << '--no-sandbox' if ENV['NO_SANDBOX']
args << '--no-sandbox' unless Platform.windows?
args << '--disable-gpu'
WebDriver::Options.edge(browser_version: 'stable', args: args, **opts)
end
Expand Down
11 changes: 1 addition & 10 deletions rb/spec/tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ BROWSERS = {
}) | select({
"@selenium//common:use_headless_browser": {"HEADLESS": "true"},
"//conditions:default": {},
}) | select({
"@platforms//os:windows": {},
"//conditions:default": {"NO_SANDBOX": "true"},
}),
},
"edge": {
Expand All @@ -56,9 +53,6 @@ BROWSERS = {
}) | select({
"@selenium//common:use_headless_browser": {"HEADLESS": "true"},
"//conditions:default": {},
}) | select({
"@platforms//os:windows": {},
"//conditions:default": {"NO_SANDBOX": "true"},
}),
},
"firefox": {
Expand Down Expand Up @@ -188,10 +182,7 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke
"WD_SPEC_DRIVER": "remote",
},
main = "@bundle//bin:rspec",
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + tags + [
"{}-remote".format(browser),
"skip-remote", # Do we want to run remote tests in RBE?
],
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + tags + ["{}-remote".format(browser)],
deps = ["//rb/spec/integration/selenium/webdriver:spec_helper"] + BROWSERS[browser]["deps"] + deps,
visibility = ["//rb:__subpackages__"],
target_compatible_with = BROWSERS[browser]["target_compatible_with"],
Expand Down

0 comments on commit 7cdb8b2

Please sign in to comment.