Skip to content

Commit fd5f54e

Browse files
authored
[rb] Run remote tests on RBE (#13906)
1 parent 8184982 commit fd5f54e

File tree

7 files changed

+47
-30
lines changed

7 files changed

+47
-30
lines changed

.github/workflows/ci-ruby.yml

+2-9
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,9 @@ jobs:
7474
- edge
7575
- firefox
7676
os:
77-
- ubuntu
7877
- windows
7978
- macos
8079
exclude:
81-
- browser: edge
82-
os: ubuntu
8380
- browser: edge
8481
os: macos
8582
with:
@@ -94,7 +91,7 @@ jobs:
9491
--local_test_jobs 1
9592
--test_size_filters large
9693
--test_tag_filters ${{ matrix.browser }}
97-
${{ matrix.os != 'windows' && '--pin_browsers=true' || '' }}
94+
${{ matrix.os != 'windows' && '--pin_browsers' || '' }}
9895
//rb/spec/...
9996
10097
integration-tests-remote:
@@ -107,10 +104,6 @@ jobs:
107104
include:
108105
- browser: edge
109106
os: windows
110-
- browser: chrome
111-
os: ubuntu
112-
- browser: firefox
113-
os: ubuntu
114107
with:
115108
name: Remote Tests (${{ matrix.browser }}, ${{ matrix.os }})
116109
browser: ${{ matrix.browser }}
@@ -124,5 +117,5 @@ jobs:
124117
--local_test_jobs 1
125118
--test_size_filters large
126119
--test_tag_filters ${{ matrix.browser }}-remote
127-
${{ matrix.os != 'windows' && '--pin_browsers=true' || '' }}
120+
${{ matrix.os != 'windows' && '--pin_browsers' || '' }}
128121
//rb/spec/...

.skipped-tests

+18-5
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,26 @@
2323
-//py:test-chrome-test/selenium/webdriver/chrome/chrome_service_tests.py
2424
-//py:test-chrome-test/selenium/webdriver/chrome/proxy_tests.py
2525
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome
26+
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-bidi
27+
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-remote
2628
-//rb/spec/integration/selenium/webdriver/edge:service-edge
29+
-//rb/spec/integration/selenium/webdriver/edge:service-edge-bidi
30+
-//rb/spec/integration/selenium/webdriver/edge:service-edge-remote
31+
-//rb/spec/integration/selenium/webdriver/firefox:driver-firefox-beta-bidi
2732
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox
2833
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta
29-
-//rb/spec/integration/selenium/webdriver:element-chrome
30-
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-bidi
31-
-//rb/spec/integration/selenium/webdriver/edge:service-edge-bidi
32-
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-bidi
3334
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-bidi
35+
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-remote
36+
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-bidi
37+
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-remote
38+
-//rb/spec/integration/selenium/webdriver/remote:driver-chrome-remote
39+
-//rb/spec/integration/selenium/webdriver/remote:driver-edge-remote
40+
-//rb/spec/integration/selenium/webdriver/remote:driver-firefox-beta-remote
41+
-//rb/spec/integration/selenium/webdriver/remote:driver-firefox-remote
42+
-//rb/spec/integration/selenium/webdriver/remote:element-chrome-remote
43+
-//rb/spec/integration/selenium/webdriver/remote:element-edge-remote
44+
-//rb/spec/integration/selenium/webdriver/remote:element-firefox-beta-remote
45+
-//rb/spec/integration/selenium/webdriver/remote:element-firefox-remote
46+
-//rb/spec/integration/selenium/webdriver:element-chrome
3447
-//rb/spec/integration/selenium/webdriver:element-chrome-bidi
35-
-//rb/spec/integration/selenium/webdriver/firefox:driver-firefox-beta-bidi
48+
-//rb/spec/integration/selenium/webdriver:element-chrome-remote

rb/spec/integration/selenium/webdriver/driver_spec.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
module Selenium
2323
module WebDriver
2424
describe Driver, exclusive: {bidi: false, reason: 'Not yet implemented with BiDi'} do
25-
it_behaves_like 'driver that can be started concurrently', exclude: {browser: %i[safari safari_preview]}
25+
it_behaves_like 'driver that can be started concurrently', exclude: [
26+
{browser: %i[safari safari_preview]},
27+
{driver: :remote, rbe: true, reason: 'Cannot start 2+ drivers at once.'}
28+
]
2629

2730
it 'creates default capabilities', exclude: {browser: %i[safari safari_preview]} do
2831
reset_driver! do |driver|

rb/spec/integration/selenium/webdriver/firefox/profile_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ module Firefox
3636
end
3737
end
3838

39-
it 'is able to use the same profile more than once' do
39+
it 'is able to use the same profile more than once',
40+
exclude: {driver: :remote, rbe: true, reason: 'Cannot start 2+ drivers at once.'} do
4041
reset_driver!(profile: profile) do |driver1|
4142
expect { wait(5).until { driver1.find_element(id: 'oneline') } }.not_to raise_error
4243
reset_driver!(profile: profile) do |driver2|

rb/spec/integration/selenium/webdriver/spec_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
guards.add_condition(:platform, WebDriver::Platform.os)
5858
guards.add_condition(:headless, !ENV['HEADLESS'].nil?)
5959
guards.add_condition(:bidi, !ENV['WEBDRIVER_BIDI'].nil?)
60+
guards.add_condition(:rbe, GlobalTestEnv.rbe?)
6061

6162
results = guards.disposition
6263
send(*results) if results

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

+19-4
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,24 @@ def app_server
8888
end
8989

9090
def remote_server
91+
args = if ENV.key?('CHROMEDRIVER_BINARY')
92+
["-Dwebdriver.chrome.driver=#{ENV['CHROMEDRIVER_BINARY']}"]
93+
elsif ENV.key?('MSEDGEDRIVER_BINARY')
94+
["-Dwebdriver.edge.driver=#{ENV['MSEDGEDRIVER_BINARY']}"]
95+
elsif ENV.key?('GECKODRIVER_BINARY')
96+
["-Dwebdriver.gecko.driver=#{ENV['GECKODRIVER_BINARY']}"]
97+
else
98+
%w[--selenium-manager true --enable-managed-downloads true]
99+
end
100+
91101
@remote_server ||= Selenium::Server.new(
92102
remote_server_jar,
93103
java: bazel_java,
94104
port: random_port,
95105
log_level: WebDriver.logger.debug? && 'FINE',
96106
background: true,
97107
timeout: 60,
98-
args: %w[--selenium-manager true --enable-managed-downloads true]
108+
args: args
99109
)
100110
end
101111

@@ -105,6 +115,10 @@ def bazel_java
105115
File.expand_path(File.read(File.expand_path(ENV.fetch('WD_BAZEL_JAVA_LOCATION'))).chomp)
106116
end
107117

118+
def rbe?
119+
Dir.pwd.start_with?('/mnt/engflow')
120+
end
121+
108122
def reset_remote_server
109123
@remote_server&.stop
110124
@remote_server = nil
@@ -191,7 +205,8 @@ def current_env
191205
driver: driver,
192206
version: driver_instance.capabilities.browser_version,
193207
platform: Platform.os,
194-
ci: Platform.ci
208+
ci: Platform.ci,
209+
rbe: rbe?
195210
}
196211
end
197212

@@ -255,7 +270,7 @@ def chrome_options(args: [], **opts)
255270
opts[:web_socket_url] = true if ENV['WEBDRIVER_BIDI'] && !opts.key?(:web_socket_url)
256271
opts[:binary] ||= ENV['CHROME_BINARY'] if ENV.key?('CHROME_BINARY')
257272
args << '--headless=chrome' if ENV['HEADLESS']
258-
args << '--no-sandbox' if ENV['NO_SANDBOX']
273+
args << '--no-sandbox' unless Platform.windows?
259274
args << '--disable-gpu'
260275
WebDriver::Options.chrome(args: args, **opts)
261276
end
@@ -265,7 +280,7 @@ def edge_options(args: [], **opts)
265280
opts[:web_socket_url] = true if ENV['WEBDRIVER_BIDI'] && !opts.key?(:web_socket_url)
266281
opts[:binary] ||= ENV['EDGE_BINARY'] if ENV.key?('EDGE_BINARY')
267282
args << '--headless=chrome' if ENV['HEADLESS']
268-
args << '--no-sandbox' if ENV['NO_SANDBOX']
283+
args << '--no-sandbox' unless Platform.windows?
269284
args << '--disable-gpu'
270285
WebDriver::Options.edge(args: args, **opts)
271286
end

rb/spec/tests.bzl

+1-10
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ BROWSERS = {
3030
}) | select({
3131
"@selenium//common:use_headless_browser": {"HEADLESS": "true"},
3232
"//conditions:default": {},
33-
}) | select({
34-
"@platforms//os:windows": {},
35-
"//conditions:default": {"NO_SANDBOX": "true"},
3633
}),
3734
},
3835
"edge": {
@@ -56,9 +53,6 @@ BROWSERS = {
5653
}) | select({
5754
"@selenium//common:use_headless_browser": {"HEADLESS": "true"},
5855
"//conditions:default": {},
59-
}) | select({
60-
"@platforms//os:windows": {},
61-
"//conditions:default": {"NO_SANDBOX": "true"},
6256
}),
6357
},
6458
"firefox": {
@@ -188,10 +182,7 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke
188182
"WD_SPEC_DRIVER": "remote",
189183
},
190184
main = "@bundle//bin:rspec",
191-
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + tags + [
192-
"{}-remote".format(browser),
193-
"skip-remote", # Do we want to run remote tests in RBE?
194-
],
185+
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + tags + ["{}-remote".format(browser)],
195186
deps = ["//rb/spec/integration/selenium/webdriver:spec_helper"] + BROWSERS[browser]["deps"] + deps,
196187
visibility = ["//rb:__subpackages__"],
197188
target_compatible_with = BROWSERS[browser]["target_compatible_with"],

0 commit comments

Comments
 (0)