From 24188440cbfa7f67125a56fcdd21292d35318c8f Mon Sep 17 00:00:00 2001 From: Alex Rodionov Date: Mon, 26 Feb 2024 11:55:53 -0800 Subject: [PATCH] [rb] Run all unit tests in RBE --- WORKSPACE | 13 +++++++++++++ rb/lib/selenium/devtools/BUILD.bazel | 9 +++------ .../devtools/support/cdp_client_generator.rb | 4 ++-- rb/spec/unit/selenium/BUILD.bazel | 2 ++ rb/spec/unit/selenium/devtools/BUILD.bazel | 1 + rb/spec/unit/selenium/server_spec.rb | 3 +++ scripts/github-actions/ci-build.sh | 5 ++--- 7 files changed, 26 insertions(+), 11 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index c84f7b5f50651..fd8a462531dd5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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", diff --git a/rb/lib/selenium/devtools/BUILD.bazel b/rb/lib/selenium/devtools/BUILD.bazel index 92626fe9a4f20..e43ff8d029eb1 100644 --- a/rb/lib/selenium/devtools/BUILD.bazel +++ b/rb/lib/selenium/devtools/BUILD.bazel @@ -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__"]) @@ -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 diff --git a/rb/lib/selenium/devtools/support/cdp_client_generator.rb b/rb/lib/selenium/devtools/support/cdp_client_generator.rb index 4b12931d4dab1..0d983fb035357 100644 --- a/rb/lib/selenium/devtools/support/cdp_client_generator.rb +++ b/rb/lib/selenium/devtools/support/cdp_client_generator.rb @@ -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 ) diff --git a/rb/spec/unit/selenium/BUILD.bazel b/rb/spec/unit/selenium/BUILD.bazel index 073e13c3140b2..470530d1b82f5 100644 --- a/rb/spec/unit/selenium/BUILD.bazel +++ b/rb/spec/unit/selenium/BUILD.bazel @@ -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", ], ) @@ -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", ], ) diff --git a/rb/spec/unit/selenium/devtools/BUILD.bazel b/rb/spec/unit/selenium/devtools/BUILD.bazel index a75b6f36df064..9ad623ae8e8f0 100644 --- a/rb/spec/unit/selenium/devtools/BUILD.bazel +++ b/rb/spec/unit/selenium/devtools/BUILD.bazel @@ -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", ], ) diff --git a/rb/spec/unit/selenium/server_spec.rb b/rb/spec/unit/selenium/server_spec.rb index 98ac3789dbfe0..eedd755dd4131 100644 --- a/rb/spec/unit/selenium/server_spec.rb +++ b/rb/spec/unit/selenium/server_spec.rb @@ -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) diff --git a/scripts/github-actions/ci-build.sh b/scripts/github-actions/ci-build.sh index 6b8644f490236..a7782c06d6d9e 100755 --- a/scripts/github-actions/ci-build.sh +++ b/scripts/github-actions/ci-build.sh @@ -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 - \ No newline at end of file +bazel build --config=remote-ci //dotnet:all java/src/... //javascript/node/selenium-webdriver:selenium-webdriver //py:selenium-wheel