Skip to content

Commit

Permalink
[rb] Run all unit tests in RBE
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Feb 26, 2024
1 parent cc93539 commit 2418844
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 11 deletions.
13 changes: 13 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

http_archive(
name = "aspect_bazel_lib",
sha256 = "f75d03783588e054899eb0729a97fb5b8973c1a26f30373fafd485c90bf207d1",
strip_prefix = "bazel-lib-2.4.2",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.4.2/bazel-lib-v2.4.2.tar.gz",
)

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")

aspect_bazel_lib_dependencies()

aspect_bazel_lib_register_toolchains()

http_archive(
name = "rules_python",
sha256 = "5868e73107a8e85d8f323806e60cad7283f34b32163ea6ff1020cf27abef6036",
Expand Down
9 changes: 3 additions & 6 deletions rb/lib/selenium/devtools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@bazel_skylib//rules:run_binary.bzl", "run_binary")
load("@aspect_bazel_lib//lib:run_binary.bzl", "run_binary")
load("@rules_ruby//ruby:defs.bzl", "rb_binary", "rb_library")

package(default_visibility = ["//rb:__subpackages__"])
Expand Down Expand Up @@ -38,17 +38,14 @@ rb_binary(
"//common/devtools/chromium/" + version + ":browser_protocol",
"//common/devtools/chromium/" + version + ":js_protocol",
],
outs = [
version,
version + ".rb",
],
outs = [version + ".rb"],
args = [
"$(location //common/devtools/chromium/" + version + ":browser_protocol)",
"$(location //common/devtools/chromium/" + version + ":js_protocol)",
"$(location :" + version + ")/",
"$(location :" + version + ".rb)",
version,
],
out_dirs = [version],
tool = ":cdp-generate",
)
for version in CDP_VERSIONS
Expand Down
4 changes: 2 additions & 2 deletions rb/lib/selenium/devtools/support/cdp_client_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ def process_loader(domains)
end

if $PROGRAM_NAME == __FILE__
browser_protocol_path, js_protocol_path, output_dir, loader_path, version = *ARGV
browser_protocol_path, js_protocol_path, loader_path, version = *ARGV

Selenium::DevTools::Support::CDPClientGenerator.new.call(
browser_protocol_path: browser_protocol_path,
js_protocol_path: js_protocol_path,
output_dir: output_dir,
output_dir: loader_path.sub(/\.rb$/, ''),
loader_path: loader_path,
version: version
)
Expand Down
2 changes: 2 additions & 0 deletions rb/spec/unit/selenium/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rb_test(
"//rb/lib/selenium:webdriver",
"//rb/lib/selenium/webdriver:atoms",
"//rb/lib/selenium/webdriver:common",
"//rb/spec/unit/selenium/webdriver:spec_helper",
"@bundle",
],
)
Expand All @@ -33,6 +34,7 @@ rb_test(
"//rb/lib/selenium:webdriver",
"//rb/lib/selenium/webdriver:atoms",
"//rb/lib/selenium/webdriver:common",
"//rb/spec/unit/selenium/webdriver:spec_helper",
"@bundle",
],
)
1 change: 1 addition & 0 deletions rb/spec/unit/selenium/devtools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rb_test(
"//rb/lib/selenium/devtools:cdp-generate",
"//rb/lib/selenium/webdriver:atoms",
"//rb/lib/selenium/webdriver:common",
"//rb/spec/unit/selenium/webdriver:spec_helper",
"@bundle",
],
)
3 changes: 3 additions & 0 deletions rb/spec/unit/selenium/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ module Selenium

it 'raises Selenium::Server::Error if the server is not launched within the timeout' do
allow(File).to receive(:exist?).with('selenium_server_deploy.jar').and_return(true)
allow(WebDriver::ChildProcess).to receive(:build)
.with('java', '-jar', 'selenium_server_deploy.jar', 'standalone', '--port', port.to_s)
.and_return(mock_process)

poller = instance_double(WebDriver::SocketPoller)
allow(poller).to receive(:connected?).and_return(false)
Expand Down
5 changes: 2 additions & 3 deletions scripts/github-actions/ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ bazel test --config=remote-ci --build_tests_only \
//java/... \
//javascript/atoms/... //javascript/webdriver/... \
//py/... \
//rb/spec/unit/selenium/webdriver/... -- $(cat .skipped-tests | tr '\n' ' ')
//rb/spec/unit/... -- $(cat .skipped-tests | tr '\n' ' ')

# Build the packages we want to ship to users
bazel build --config=remote-ci //dotnet:all java/src/... //javascript/node/selenium-webdriver:selenium-webdriver //py:selenium-wheel

bazel build --config=remote-ci //dotnet:all java/src/... //javascript/node/selenium-webdriver:selenium-webdriver //py:selenium-wheel

0 comments on commit 2418844

Please sign in to comment.