Skip to content

[build] Ensure all valid ruby tests are running on RBE #15718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelrc.remote
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build:rbe --define=EXECUTOR=remote
build:rbe --experimental_inmemory_dotd_files
build:rbe --experimental_inmemory_jdeps_files
build:rbe --remote_timeout=3600
build:rbe --spawn_strategy=remote,local
build:rbe --spawn_strategy=remote
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out this doesn't fix the problem I thought it would, so I'll revert it.

For some reason, when I'm running --config=rbe anything with tag exclusive-with-local still runs in series instead of parallel. I'm not sure why. @shs96c do you know why this may be?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(it makes a huge difference time-wise when I remove the exclusive-with-local tags and running on rbe.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well known issue bazelbuild/bazel#17834

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so this is probably why we were previously skipping them on rbe to avoid the performance hit

#build:rbe --nolegacy_important_outputs
build:rbe --incompatible_strict_action_env=true

Expand Down
25 changes: 0 additions & 25 deletions .skipped-tests
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,4 @@
-//javascript/selenium-webdriver:test-builder-test.js-chrome
-//javascript/selenium-webdriver:test-chrome-devtools-test.js-chrome
-//javascript/selenium-webdriver:test-firefox-options-test.js-firefox
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-bidi
-//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-bidi
-//rb/spec/integration/selenium/webdriver/edge:service-edge-remote
-//rb/spec/integration/selenium/webdriver/firefox:driver-firefox-beta-bidi
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-bidi
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-remote
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-bidi
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-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-beta-remote
-//rb/spec/integration/selenium/webdriver/remote:driver-firefox-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-beta-remote
-//rb/spec/integration/selenium/webdriver/remote:element-firefox-remote
-//rb/spec/integration/selenium/webdriver:element-chrome
-//rb/spec/integration/selenium/webdriver:element-chrome-bidi
-//rb/spec/integration/selenium/webdriver:element-chrome-remote
-//rb/spec/integration/selenium/webdriver:action_builder-firefox-beta-remote
-//rb:lint
36 changes: 21 additions & 15 deletions rb/lib/selenium/webdriver/common/websocket_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,27 @@ def attach_socket_listener
Thread.current.abort_on_exception = true
Thread.current.report_on_exception = false

until socket.eof?
incoming_frame << socket.readpartial(1024)

while (frame = incoming_frame.next)
message = process_frame(frame)
next unless message['method']

params = message['params']
callbacks[message['method']].each do |callback|
@callback_threads.add(callback_thread(params, &callback))
end
end
read_and_process_frames until socket.eof?
rescue *CONNECTION_ERRORS => e
WebDriver.logger.debug("BiDi socket closed: #{e.class} - #{e.message}", id: :websocket)
Thread.exit
rescue StandardError => e
WebDriver.logger.debug("Unexpected error in BiDi socket thread: #{e.class} - #{e.message}", id: :websocket)
Thread.exit
end
end

def read_and_process_frames
incoming_frame << socket.readpartial(1024)

while (frame = incoming_frame.next)
message = process_frame(frame)
next unless message['method']

params = message['params']
callbacks[message['method']].each do |callback|
@callback_threads.add(callback_thread(params, &callback))
end
rescue *CONNECTION_ERRORS
Thread.stop
end
end

Expand Down Expand Up @@ -142,7 +148,7 @@ def callback_thread(params)

yield params
rescue Error::WebDriverError, *CONNECTION_ERRORS
Thread.stop
Thread.exit
end
end

Expand Down
19 changes: 18 additions & 1 deletion rb/spec/integration/selenium/webdriver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,31 @@ rb_library(
"driver_spec.rb",
"devtools_spec.rb",
"element_spec.rb",
"network_spec.rb",
],
)
]

rb_integration_test(
name = "network",
srcs = ["network_spec.rb"],
tags = [
"exclusive-if-local",
"bidi-only",
],
deps = [
"//rb/lib/selenium/devtools",
"//rb/lib/selenium/webdriver:bidi",
],
)

rb_integration_test(
name = "bidi",
srcs = ["bidi_spec.rb"],
tags = ["exclusive-if-local"],
tags = [
"exclusive-if-local",
"bidi-only",
],
deps = [
"//rb/lib/selenium/devtools",
"//rb/lib/selenium/webdriver:bidi",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ module WebDriver

describe '#scroll_by' do
it 'scrolls by given amount',
exclude: {driver: :firefox, reason: 'inconsistent behavior between versions'} do
exclude: {browser: :firefox, reason: 'inconsistent behavior between versions'} do
driver.navigate.to url_for('scrolling_tests/frame_with_nested_scrolling_frame_out_of_view.html')
footer = driver.find_element(tag_name: 'footer')
delta_y = footer.rect.y.round
Expand Down
5 changes: 4 additions & 1 deletion rb/spec/integration/selenium/webdriver/bidi/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
rb_integration_test(
name = file[:-8],
srcs = [file],
tags = ["exclusive-if-local"],
tags = [
"exclusive-if-local",
"bidi-only",
],
deps = [
"//rb/lib/selenium/devtools",
"//rb/lib/selenium/webdriver:bidi",
Expand Down
17 changes: 15 additions & 2 deletions rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
rb_integration_test(
name = file[:-8],
srcs = [file],
browsers = ["chrome"], # No need to run in other browsers.
browsers = ["chrome"],
)
for file in glob(
["*_spec.rb"],
exclude = ["service_spec.rb"],
)
for file in glob(["*_spec.rb"])
]

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = ["chrome"],
tags = [
"no-grid",
"skip-rbe", # RBE needs internet
],
)
3 changes: 1 addition & 2 deletions rb/spec/integration/selenium/webdriver/devtools_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

module Selenium
module WebDriver
describe DevTools, exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'},
{browser: %i[chrome edge]}] do
describe DevTools, exclusive: {browser: %i[chrome edge]} do
after { |example| reset_driver!(example: example) }

it 'sends commands' do
Expand Down
17 changes: 15 additions & 2 deletions rb/spec/integration/selenium/webdriver/edge/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
rb_integration_test(
name = file[:-8],
srcs = [file],
browsers = ["edge"], # No need to run in other browsers.
browsers = ["edge"],
)
for file in glob(
["*_spec.rb"],
exclude = ["service_spec.rb"],
)
for file in glob(["*_spec.rb"])
]

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = ["edge"],
tags = [
"no-grid",
"skip-rbe", # RBE needs internet
],
)
Binary file not shown.
18 changes: 17 additions & 1 deletion rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,21 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
],
data = ["//common/extensions"],
)
for file in glob(["*_spec.rb"])
for file in glob(
["*_spec.rb"],
exclude = ["service_spec.rb"],
)
]

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = [
"firefox",
"firefox-beta",
],
tags = [
"no-grid",
"skip-rbe", # RBE needs internet
],
)
8 changes: 8 additions & 0 deletions rb/spec/integration/selenium/webdriver/ie/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("//rb/spec:tests.bzl", "rb_integration_test")

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = ["ie"],
tags = ["no-grid"],
)
1 change: 1 addition & 0 deletions rb/spec/integration/selenium/webdriver/remote/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
rb_integration_test(
name = file[:-8],
srcs = [file],
tags = ["grid-only"],
)
for file in glob(["*_spec.rb"])
]
7 changes: 4 additions & 3 deletions rb/spec/integration/selenium/webdriver/remote/driver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ module Remote
wait.until { driver.find_element(id: 'upload_label').displayed? }

driver.switch_to.frame('upload_target')
wait.until { driver.find_element(xpath: '//body') }
wait(ignore: [Error::NoSuchElementError, Error::StaleElementReferenceError]).until do
!driver.find_element(xpath: '//body').text.empty?
end

body = driver.find_element(xpath: '//body')
expect(body.text.scan('This is a dummy test file').count).to eq(1)
Expand Down Expand Up @@ -83,8 +85,7 @@ module Remote
end
end

it 'errors when not set', {except: {browser: :firefox, reason: 'grid always sets true and firefox returns it'},
exclude: {browser: :safari, reason: 'grid hangs'}} do
it 'errors when not set', {exclude: {browser: :safari, reason: 'grid hangs'}} do
reset_driver!(enable_downloads: false) do |driver|
expect {
driver.downloadable_files
Expand Down
15 changes: 14 additions & 1 deletion rb/spec/integration/selenium/webdriver/safari/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,18 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
"safari-preview",
],
)
for file in glob(["*_spec.rb"])
for file in glob(
["*_spec.rb"],
exclude = ["service_spec.rb"],
)
]

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = [
"safari",
"safari-preview",
],
tags = ["no-grid"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def wait_for_new_url(old_url)
end
end

def wait(timeout = 10)
Wait.new(timeout: timeout)
def wait(timeout = 10, **opts)
Wait.new(timeout: timeout, **opts)
end

def png_size(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def call(env)
case env['PATH_INFO']
when '/upload'
req = Rack::Request.new(env)
body = case req['upload']
body = case req.params['upload']
when Array
req.params['upload'].map { |upload| upload[:tempfile].read }.join("\n")
when Hash
Expand Down
Loading
Loading