From ebfe21b029180292828b34280aacdd95c3e1c025 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Fri, 19 Dec 2025 16:46:42 -0600 Subject: [PATCH 01/19] update ruby tests for selenium manager --- .../selenium/webdriver/chrome/service_spec.rb | 13 ++++++++----- .../selenium/webdriver/edge/service_spec.rb | 13 ++++++++----- .../selenium/webdriver/firefox/service_spec.rb | 13 ++++++++----- .../selenium/webdriver/ie/service_spec.rb | 13 ++++++++----- .../selenium/webdriver/safari/service_spec.rb | 13 ++++++++----- 5 files changed, 40 insertions(+), 25 deletions(-) diff --git a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb index 39fe65f39c03d..7558e93f536c6 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb @@ -30,13 +30,16 @@ module Chrome after { service_manager.stop } - it 'auto uses chromedriver' do - service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path + it 'selenium manager gets browser and driver' do + driver_finder = DriverFinder.new(Options.new, service) + driver_path = driver_finder.driver_path + browser_path = driver_finder.browser_path - expect(service_manager.uri).to be_a(URI) - end + expect { Platform.assert_executable(driver_path) }.not_to raise_error + expect { Platform.assert_executable(browser_path) }.not_to raise_error + + service.executable_path = driver_path - it 'can be started outside driver' do expect(service_manager.uri).to be_a(URI) end end diff --git a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb index ad68ce5b43a6f..6522a0beddebe 100644 --- a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb @@ -30,13 +30,16 @@ module Edge after { service_manager.stop } - it 'auto uses edgedriver' do - service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path + it 'selenium manager gets browser and driver' do + driver_finder = DriverFinder.new(Options.new, service) + driver_path = driver_finder.driver_path + browser_path = driver_finder.browser_path - expect(service_manager.uri).to be_a(URI) - end + expect { Platform.assert_executable(driver_path) }.not_to raise_error + expect { Platform.assert_executable(browser_path) }.not_to raise_error + + service.executable_path = driver_path - it 'can be started outside driver' do expect(service_manager.uri).to be_a(URI) end end diff --git a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb index 7c14994c56ae3..319f9c78e5e31 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb @@ -30,13 +30,16 @@ module Firefox after { service_manager.stop } - it 'auto uses geckodriver' do - service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path + it 'selenium manager gets browser and driver' do + driver_finder = DriverFinder.new(Options.new, service) + driver_path = driver_finder.driver_path + browser_path = driver_finder.browser_path - expect(service_manager.uri).to be_a(URI) - end + expect { Platform.assert_executable(driver_path) }.not_to raise_error + expect { Platform.assert_executable(browser_path) }.not_to raise_error + + service.executable_path = driver_path - it 'can be started outside driver' do expect(service_manager.uri).to be_a(URI) end end diff --git a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb index 7c2cc765fb49d..ef7224833e241 100644 --- a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb @@ -30,13 +30,16 @@ module IE after { service_manager.stop } - it 'auto uses iedriver' do - service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path + it 'selenium manager gets browser and driver' do + driver_finder = DriverFinder.new(Options.new, service) + driver_path = driver_finder.driver_path + browser_path = driver_finder.browser_path - expect(service_manager.uri).to be_a(URI) - end + expect { Platform.assert_executable(driver_path) }.not_to raise_error + expect { Platform.assert_executable(browser_path) }.not_to raise_error + + service.executable_path = driver_path - it 'can be started outside driver' do expect(service_manager.uri).to be_a(URI) end end diff --git a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb index 7d6e983b6b283..5c90b55ad35e7 100644 --- a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb @@ -30,13 +30,16 @@ module Safari after { service_manager.stop } - it 'auto uses safaridriver' do - service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path + it 'selenium manager gets browser and driver' do + driver_finder = DriverFinder.new(Options.new, service) + driver_path = driver_finder.driver_path + browser_path = driver_finder.browser_path - expect(service_manager.uri).to be_a(URI) - end + expect { Platform.assert_executable(driver_path) }.not_to raise_error + expect { Platform.assert_executable(browser_path) }.not_to raise_error + + service.executable_path = driver_path - it 'can be started outside driver' do expect(service_manager.uri).to be_a(URI) end end From c5b82331a2788401d9b94d0ee0f267ff06d531b9 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sat, 20 Dec 2025 08:37:39 -0600 Subject: [PATCH 02/19] run selenium manager tests in ruby independently --- .github/workflows/ci-ruby.yml | 35 +++++++++++++++++++ .../selenium/webdriver/chrome/BUILD.bazel | 12 ++++++- .../selenium/webdriver/edge/BUILD.bazel | 12 ++++++- .../selenium/webdriver/firefox/BUILD.bazel | 12 ++++++- .../selenium/webdriver/ie/BUILD.bazel | 8 +++++ .../selenium/webdriver/safari/BUILD.bazel | 12 ++++++- rb/spec/tests.bzl | 7 ++-- 7 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 rb/spec/integration/selenium/webdriver/ie/BUILD.bazel diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 66e0364ce17ed..b60ecf2056b80 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -111,3 +111,38 @@ jobs: --test_size_filters large --test_tag_filters ${{ matrix.browser }}-remote //rb/spec/... + + selenium-manager-tests: + name: Local Tests + needs: build + uses: ./.github/workflows/bazel.yml + strategy: + fail-fast: false + matrix: + browser: + - chrome + - edge + - firefox + os: + - windows + - macos + exclude: + - browser: edge + os: macos + with: + name: Local Tests (${{ matrix.browser }}, ${{ matrix.os }}) + browser: ${{ matrix.browser }} + cache-key: rb-${{ matrix.browser }}-${{ matrix.os }}-test + os: ${{ matrix.os }} + run: > + bazel test + --keep_going + --build_tests_only + --flaky_test_attempts 3 + --local_test_jobs 1 + --test_size_filters medium + --test_tag_filters ${{ matrix.browser }} + --pin_browsers=false + --test_env=SE_FORCE_BROWSER_DOWNLOAD=true + --test_env=SE_SKIP_DRIVER_IN_PATH=true + //rb/spec/... diff --git a/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel b/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel index a86ffd7d547ad..939ba9e379413 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel @@ -11,5 +11,15 @@ 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 = ["chrome"], + tags = ["manager"], +) diff --git a/rb/spec/integration/selenium/webdriver/edge/BUILD.bazel b/rb/spec/integration/selenium/webdriver/edge/BUILD.bazel index 73f983fef259a..d13df6362e63f 100644 --- a/rb/spec/integration/selenium/webdriver/edge/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/edge/BUILD.bazel @@ -6,5 +6,15 @@ load("//rb/spec:tests.bzl", "rb_integration_test") srcs = [file], browsers = ["edge"], # No need to run in other browsers. ) - 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 = ["edge"], + tags = ["manager"], +) diff --git a/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel b/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel index 6cb37b594a5fb..94921b5f54e1c 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel @@ -11,5 +11,15 @@ 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"], + tags = ["manager"], +) diff --git a/rb/spec/integration/selenium/webdriver/ie/BUILD.bazel b/rb/spec/integration/selenium/webdriver/ie/BUILD.bazel new file mode 100644 index 0000000000000..a7aef34edc6d0 --- /dev/null +++ b/rb/spec/integration/selenium/webdriver/ie/BUILD.bazel @@ -0,0 +1,8 @@ +load("//rb/spec:tests.bzl", "rb_integration_test") + +rb_integration_test( + name = "service", + srcs = ["service_spec.rb"], + browsers = ["ie"], + tags = ["manager"], +) diff --git a/rb/spec/integration/selenium/webdriver/safari/BUILD.bazel b/rb/spec/integration/selenium/webdriver/safari/BUILD.bazel index 54d03e20334c8..d79423ae4e393 100644 --- a/rb/spec/integration/selenium/webdriver/safari/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/safari/BUILD.bazel @@ -10,5 +10,15 @@ 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"], + tags = ["manager"], +) diff --git a/rb/spec/tests.bzl b/rb/spec/tests.bzl index 8b646ec7542a8..ab19dfcc9dbe6 100644 --- a/rb/spec/tests.bzl +++ b/rb/spec/tests.bzl @@ -175,11 +175,14 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke visibility = ["//rb:__subpackages__"], ) + # Selenium manager tests are lighter weight (no full browser session needed) + size = "medium" if "manager" in tags else "large" + for browser in browsers: # Generate a test target for local browser execution. rb_test( name = "{}-{}".format(name, browser), - size = "large", + size = size, srcs = srcs, args = ["rb/spec/"], data = BROWSERS[browser]["data"] + data + ["//common/src/web"], @@ -218,7 +221,7 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke if "bidi" in tags: rb_test( name = "{}-{}-bidi".format(name, browser), - size = "large", + size = size, srcs = srcs, args = ["rb/spec/"], data = BROWSERS[browser]["data"] + data + ["//common/src/web"], From c2421c9ce95dcdab6961667d999c70337c25eadc Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sat, 20 Dec 2025 09:09:54 -0600 Subject: [PATCH 03/19] fix cache tests --- rb/spec/integration/selenium/webdriver/chrome/service_spec.rb | 3 +++ rb/spec/integration/selenium/webdriver/edge/service_spec.rb | 3 +++ rb/spec/integration/selenium/webdriver/firefox/service_spec.rb | 3 +++ rb/spec/integration/selenium/webdriver/ie/service_spec.rb | 3 ++- rb/spec/integration/selenium/webdriver/safari/service_spec.rb | 3 +++ rb/spec/integration/selenium/webdriver/spec_helper.rb | 1 + 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb index 7558e93f536c6..888b2c97d5f54 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb @@ -27,6 +27,7 @@ module Chrome exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :chrome}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } + let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} after { service_manager.stop } @@ -37,6 +38,8 @@ module Chrome expect { Platform.assert_executable(driver_path) }.not_to raise_error expect { Platform.assert_executable(browser_path) }.not_to raise_error + expect(browser_path).to include(cache_dir) + expect(driver_path).to include(cache_dir) service.executable_path = driver_path diff --git a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb index 6522a0beddebe..a3c673d620e26 100644 --- a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb @@ -27,6 +27,7 @@ module Edge exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :edge}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } + let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} after { service_manager.stop } @@ -37,6 +38,8 @@ module Edge expect { Platform.assert_executable(driver_path) }.not_to raise_error expect { Platform.assert_executable(browser_path) }.not_to raise_error + expect(browser_path).to include(cache_dir) + expect(driver_path).to include(cache_dir) service.executable_path = driver_path diff --git a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb index 319f9c78e5e31..b0b6e69a21401 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb @@ -27,6 +27,7 @@ module Firefox exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :firefox}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } + let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} after { service_manager.stop } @@ -37,6 +38,8 @@ module Firefox expect { Platform.assert_executable(driver_path) }.not_to raise_error expect { Platform.assert_executable(browser_path) }.not_to raise_error + expect(browser_path).to include(cache_dir) + expect(driver_path).to include(cache_dir) service.executable_path = driver_path diff --git a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb index ef7224833e241..6428802575198 100644 --- a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb @@ -27,6 +27,7 @@ module IE exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :ie}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } + let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} after { service_manager.stop } @@ -36,7 +37,7 @@ module IE browser_path = driver_finder.browser_path expect { Platform.assert_executable(driver_path) }.not_to raise_error - expect { Platform.assert_executable(browser_path) }.not_to raise_error + expect(driver_path).to include(cache_dir) service.executable_path = driver_path diff --git a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb index 5c90b55ad35e7..5f798825f172f 100644 --- a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb @@ -27,6 +27,7 @@ module Safari exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :safari}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } + let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} after { service_manager.stop } @@ -37,6 +38,8 @@ module Safari expect { Platform.assert_executable(driver_path) }.not_to raise_error expect { Platform.assert_executable(browser_path) }.not_to raise_error + expect(browser_path).to include(cache_dir) + expect(driver_path).to include(cache_dir) service.executable_path = driver_path diff --git a/rb/spec/integration/selenium/webdriver/spec_helper.rb b/rb/spec/integration/selenium/webdriver/spec_helper.rb index d63f749f5a959..ffbccc52e4d02 100644 --- a/rb/spec/integration/selenium/webdriver/spec_helper.rb +++ b/rb/spec/integration/selenium/webdriver/spec_helper.rb @@ -73,6 +73,7 @@ def example_finished(notification) guards.add_condition(:bidi, !ENV['WEBDRIVER_BIDI'].nil?) guards.add_condition(:rbe, GlobalTestEnv.rbe?) guards.add_condition(:version, GlobalTestEnv.browser_version) + guards.add_condition(:manager, !ENV['SE_FORCE_BROWSER_DOWNLOAD']).nil? results = guards.disposition send(*results) if results From 64cfab4b9ca3fb460ce9c29148ca8806be9e4103 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sat, 20 Dec 2025 09:10:05 -0600 Subject: [PATCH 04/19] add guard to ruby tests --- rb/sig/lib/selenium/webdriver/common/options.rbs | 2 +- rb/sig/lib/selenium/webdriver/support/guards.rbs | 2 +- rb/spec/integration/selenium/webdriver/chrome/service_spec.rb | 2 +- rb/spec/integration/selenium/webdriver/edge/service_spec.rb | 2 +- rb/spec/integration/selenium/webdriver/firefox/service_spec.rb | 2 +- rb/spec/integration/selenium/webdriver/ie/service_spec.rb | 3 +-- rb/spec/integration/selenium/webdriver/safari/service_spec.rb | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/rb/sig/lib/selenium/webdriver/common/options.rbs b/rb/sig/lib/selenium/webdriver/common/options.rbs index b49c13380b71a..a7f8b9ddd1b94 100644 --- a/rb/sig/lib/selenium/webdriver/common/options.rbs +++ b/rb/sig/lib/selenium/webdriver/common/options.rbs @@ -33,7 +33,7 @@ module Selenium attr_accessor options: Hash[String | Symbol, String | Numeric | bool?] - def initialize: (Hash[String | Symbol, String | Numeric | bool] opts) -> void + def initialize: ?(Hash[String | Symbol, String | Numeric | bool] opts) -> void def add_option: (String | Symbol name, String | Numeric | bool? value) -> (String | Numeric | bool)? diff --git a/rb/sig/lib/selenium/webdriver/support/guards.rbs b/rb/sig/lib/selenium/webdriver/support/guards.rbs index 2f7c90896426d..45ea06479fe97 100644 --- a/rb/sig/lib/selenium/webdriver/support/guards.rbs +++ b/rb/sig/lib/selenium/webdriver/support/guards.rbs @@ -20,7 +20,7 @@ module Selenium def initialize: (untyped example, ?bug_tracker: String, ?conditions: untyped?) -> void - def add_condition: (untyped name, ?untyped? condition) { () -> untyped } -> untyped + def add_condition: (untyped name, ?untyped? condition) ?{ () -> untyped } -> untyped def add_message: (untyped name, untyped message) -> untyped diff --git a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb index 888b2c97d5f54..1e45b48083648 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb @@ -31,7 +31,7 @@ module Chrome after { service_manager.stop } - it 'selenium manager gets browser and driver' do + it 'selenium manager gets browser and driver', exclusive: {manager: true} do driver_finder = DriverFinder.new(Options.new, service) driver_path = driver_finder.driver_path browser_path = driver_finder.browser_path diff --git a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb index a3c673d620e26..f01e5db3f8ac8 100644 --- a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb @@ -31,7 +31,7 @@ module Edge after { service_manager.stop } - it 'selenium manager gets browser and driver' do + it 'selenium manager gets browser and driver', exclusive: {manager: true} do driver_finder = DriverFinder.new(Options.new, service) driver_path = driver_finder.driver_path browser_path = driver_finder.browser_path diff --git a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb index b0b6e69a21401..72f4ba0f8d25e 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb @@ -31,7 +31,7 @@ module Firefox after { service_manager.stop } - it 'selenium manager gets browser and driver' do + it 'selenium manager gets browser and driver', exclusive: {manager: true} do driver_finder = DriverFinder.new(Options.new, service) driver_path = driver_finder.driver_path browser_path = driver_finder.browser_path diff --git a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb index 6428802575198..cef973986a5cb 100644 --- a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb @@ -31,10 +31,9 @@ module IE after { service_manager.stop } - it 'selenium manager gets browser and driver' do + it 'selenium manager gets browser and driver', exclusive: {manager: true} do driver_finder = DriverFinder.new(Options.new, service) driver_path = driver_finder.driver_path - browser_path = driver_finder.browser_path expect { Platform.assert_executable(driver_path) }.not_to raise_error expect(driver_path).to include(cache_dir) diff --git a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb index 5f798825f172f..9127e556faf8f 100644 --- a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb @@ -31,7 +31,7 @@ module Safari after { service_manager.stop } - it 'selenium manager gets browser and driver' do + it 'selenium manager gets browser and driver', exclusive: {manager: true} do driver_finder = DriverFinder.new(Options.new, service) driver_path = driver_finder.driver_path browser_path = driver_finder.browser_path From 637e6884ce930cf425a63a94bd81ba5c08571371 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sat, 20 Dec 2025 11:14:23 -0600 Subject: [PATCH 05/19] fix ci test details --- .github/workflows/ci-ruby.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index b60ecf2056b80..804fe90ea8317 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -113,26 +113,19 @@ jobs: //rb/spec/... selenium-manager-tests: - name: Local Tests + name: Selenium Manager Tests needs: build uses: ./.github/workflows/bazel.yml strategy: fail-fast: false matrix: - browser: - - chrome - - edge - - firefox os: - windows - macos - exclude: - - browser: edge - os: macos + - linux with: - name: Local Tests (${{ matrix.browser }}, ${{ matrix.os }}) - browser: ${{ matrix.browser }} - cache-key: rb-${{ matrix.browser }}-${{ matrix.os }}-test + name: Selenium Manager Tests ${{ matrix.os }}) + cache-key: rb-manager-${{ matrix.os }}-test os: ${{ matrix.os }} run: > bazel test @@ -141,7 +134,6 @@ jobs: --flaky_test_attempts 3 --local_test_jobs 1 --test_size_filters medium - --test_tag_filters ${{ matrix.browser }} --pin_browsers=false --test_env=SE_FORCE_BROWSER_DOWNLOAD=true --test_env=SE_SKIP_DRIVER_IN_PATH=true From 2185111198c0a867e116cb4a4134dcc7c97d9046 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sat, 20 Dec 2025 11:15:16 -0600 Subject: [PATCH 06/19] fix ci test details --- .github/workflows/ci-ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 804fe90ea8317..7981801a7dc4c 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -124,7 +124,7 @@ jobs: - macos - linux with: - name: Selenium Manager Tests ${{ matrix.os }}) + name: Manager Tests ${{ matrix.os }}) cache-key: rb-manager-${{ matrix.os }}-test os: ${{ matrix.os }} run: > From 74c923596c20e941b3ea02e331be0cbce6a2c36e Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sat, 20 Dec 2025 15:20:45 -0600 Subject: [PATCH 07/19] fix linting --- rb/spec/integration/selenium/webdriver/chrome/service_spec.rb | 2 +- rb/spec/integration/selenium/webdriver/edge/service_spec.rb | 2 +- rb/spec/integration/selenium/webdriver/firefox/service_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb index 1e45b48083648..39cafd19b8750 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb @@ -27,7 +27,7 @@ module Chrome exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :chrome}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } - let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} + let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium' } after { service_manager.stop } diff --git a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb index f01e5db3f8ac8..3538f942fb84a 100644 --- a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb @@ -27,7 +27,7 @@ module Edge exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :edge}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } - let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} + let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium' } after { service_manager.stop } diff --git a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb index 72f4ba0f8d25e..3f7d048b69177 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb @@ -27,7 +27,7 @@ module Firefox exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :firefox}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } - let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} + let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium' } after { service_manager.stop } From ba5c59727a141915e8dc7ad144324359fcb6bde2 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sat, 20 Dec 2025 16:44:56 -0600 Subject: [PATCH 08/19] fix targets --- .skipped-tests | 8 -------- rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel | 5 ++++- .../integration/selenium/webdriver/firefox/BUILD.bazel | 5 ++++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.skipped-tests b/.skipped-tests index 41f225a3d45c6..2ed66c298ce98 100644 --- a/.skipped-tests +++ b/.skipped-tests @@ -23,14 +23,6 @@ -//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-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-beta --//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-remote --//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 diff --git a/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel b/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel index 939ba9e379413..cd440f12d7aa0 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel @@ -20,6 +20,9 @@ load("//rb/spec:tests.bzl", "rb_integration_test") rb_integration_test( name = "service", srcs = ["service_spec.rb"], - browsers = ["chrome"], + browsers = [ + "chrome", + "chrome-beta", + ], tags = ["manager"], ) diff --git a/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel b/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel index 94921b5f54e1c..d384004d490a7 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel @@ -20,6 +20,9 @@ load("//rb/spec:tests.bzl", "rb_integration_test") rb_integration_test( name = "service", srcs = ["service_spec.rb"], - browsers = ["firefox"], + browsers = [ + "firefox", + "firefox-beta", + ], tags = ["manager"], ) From 22affabb6cb6723e2e58280bc4b9bde7f7945456 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sun, 21 Dec 2025 17:09:46 -0600 Subject: [PATCH 09/19] consolidate the tests in the ci --- .github/workflows/ci-ruby.yml | 55 +++++++++-------------------------- 1 file changed, 13 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 7981801a7dc4c..c9cc1b3370e46 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -36,11 +36,11 @@ jobs: os: windows - ruby-version: 3.2.8 os: macos - - ruby-version: 3.4.3 + - ruby-version: 4.0.0-preview3 os: ubuntu - - ruby-version: jruby-10.0.0.0 + - ruby-version: jruby-10.0.2.0 os: ubuntu - - ruby-version: truffleruby-24.2.1 + - ruby-version: truffleruby-25.0.0 os: ubuntu with: name: Unit Tests (${{ matrix.ruby-version }}, ${{ matrix.os }}) @@ -55,26 +55,23 @@ jobs: //rb/spec/... integration-tests-local: - name: Local Tests + name: Integration Tests needs: build uses: ./.github/workflows/bazel.yml strategy: fail-fast: false matrix: - browser: - - chrome - - edge - - firefox - os: - - windows - - macos - exclude: - - browser: edge - os: macos + browser: ['chrome', 'edge', 'firefox'] + os: ['windows'] + include: + - browser: edge-remote + os: windows + java-version: 17 with: - name: Local Tests (${{ matrix.browser }}, ${{ matrix.os }}) + name: Integration (${{ matrix.browser }}, ${{ matrix.os }}) browser: ${{ matrix.browser }} cache-key: rb-${{ matrix.browser }}-${{ matrix.os }}-test + java-version: ${{ matrix.java-version }} os: ${{ matrix.os }} run: > bazel test @@ -86,32 +83,6 @@ jobs: --test_tag_filters ${{ matrix.browser }} //rb/spec/... - integration-tests-remote: - name: Remote Tests - needs: build - uses: ./.github/workflows/bazel.yml - strategy: - fail-fast: false - matrix: - include: - - browser: edge - os: macos - with: - name: Remote Tests (${{ matrix.browser }}, ${{ matrix.os }}) - browser: ${{ matrix.browser }} - cache-key: rb-remote-${{ matrix.browser }}-${{ matrix.os }}-test - os: ${{ matrix.os }} - java-version: 17 - run: > - bazel test - --keep_going - --build_tests_only - --flaky_test_attempts 3 - --local_test_jobs 1 - --test_size_filters large - --test_tag_filters ${{ matrix.browser }}-remote - //rb/spec/... - selenium-manager-tests: name: Selenium Manager Tests needs: build @@ -122,7 +93,7 @@ jobs: os: - windows - macos - - linux + - ubuntu with: name: Manager Tests ${{ matrix.os }}) cache-key: rb-manager-${{ matrix.os }}-test From f2e33c2b4dcdd924cc9b4c8da91fdc29fe4a0de4 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sun, 21 Dec 2025 17:31:16 -0600 Subject: [PATCH 10/19] Potential fix for code scanning alert no. 191: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/ci-ruby.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index c9cc1b3370e46..fcef4e47a183f 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -4,6 +4,9 @@ on: workflow_call: workflow_dispatch: +permissions: + contents: read + jobs: build: name: Build From ed545e4d87d578aad1a06e91ccaafa697db33d70 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sun, 21 Dec 2025 19:39:03 -0600 Subject: [PATCH 11/19] don't use new versions of ruby --- .github/workflows/ci-ruby.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index fcef4e47a183f..229bffe5f4e44 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -39,11 +39,11 @@ jobs: os: windows - ruby-version: 3.2.8 os: macos - - ruby-version: 4.0.0-preview3 + - ruby-version: 3.4.3 os: ubuntu - - ruby-version: jruby-10.0.2.0 + - ruby-version: jruby-10.0.0.0 os: ubuntu - - ruby-version: truffleruby-25.0.0 + - ruby-version: truffleruby-24.2.1 os: ubuntu with: name: Unit Tests (${{ matrix.ruby-version }}, ${{ matrix.os }}) From a3fb30824248f60c27fec5062cb9dfaaee5fb92b Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sun, 21 Dec 2025 21:34:26 -0600 Subject: [PATCH 12/19] don't actually test safari --- .github/workflows/ci-ruby.yml | 1 + rb/spec/integration/selenium/webdriver/safari/service_spec.rb | 4 +--- rb/spec/integration/selenium/webdriver/spec_helper.rb | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 229bffe5f4e44..7df2f106c404f 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -109,6 +109,7 @@ jobs: --local_test_jobs 1 --test_size_filters medium --pin_browsers=false + --test_tag_filters manager,-safari --test_env=SE_FORCE_BROWSER_DOWNLOAD=true --test_env=SE_SKIP_DRIVER_IN_PATH=true //rb/spec/... diff --git a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb index 9127e556faf8f..58e7abcda29b5 100644 --- a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb @@ -31,15 +31,13 @@ module Safari after { service_manager.stop } - it 'selenium manager gets browser and driver', exclusive: {manager: true} do + it 'selenium manager gets browser and driver' do driver_finder = DriverFinder.new(Options.new, service) driver_path = driver_finder.driver_path browser_path = driver_finder.browser_path expect { Platform.assert_executable(driver_path) }.not_to raise_error expect { Platform.assert_executable(browser_path) }.not_to raise_error - expect(browser_path).to include(cache_dir) - expect(driver_path).to include(cache_dir) service.executable_path = driver_path diff --git a/rb/spec/integration/selenium/webdriver/spec_helper.rb b/rb/spec/integration/selenium/webdriver/spec_helper.rb index ffbccc52e4d02..b8b32fa9dff1d 100644 --- a/rb/spec/integration/selenium/webdriver/spec_helper.rb +++ b/rb/spec/integration/selenium/webdriver/spec_helper.rb @@ -73,7 +73,7 @@ def example_finished(notification) guards.add_condition(:bidi, !ENV['WEBDRIVER_BIDI'].nil?) guards.add_condition(:rbe, GlobalTestEnv.rbe?) guards.add_condition(:version, GlobalTestEnv.browser_version) - guards.add_condition(:manager, !ENV['SE_FORCE_BROWSER_DOWNLOAD']).nil? + guards.add_condition(:manager, !ENV['SE_FORCE_BROWSER_DOWNLOAD'].nil?) results = guards.disposition send(*results) if results From 6e50b76fc8c2eab6b31ed978e7cd54cae198977a Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sun, 21 Dec 2025 21:38:43 -0600 Subject: [PATCH 13/19] remote is failing on windows, checking macos --- .github/workflows/ci-ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 7df2f106c404f..08aa5742f0ef0 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -68,7 +68,7 @@ jobs: os: ['windows'] include: - browser: edge-remote - os: windows + os: macos java-version: 17 with: name: Integration (${{ matrix.browser }}, ${{ matrix.os }}) From 4302a17e31fa04e06b6b8ac3547d69668fddaaaf Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sun, 21 Dec 2025 22:58:09 -0600 Subject: [PATCH 14/19] windows doesn't like the comma --- .github/workflows/ci-ruby.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 08aa5742f0ef0..17eb0bbd47fe5 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -98,7 +98,7 @@ jobs: - macos - ubuntu with: - name: Manager Tests ${{ matrix.os }}) + name: Manager Tests (${{ matrix.os }}) cache-key: rb-manager-${{ matrix.os }}-test os: ${{ matrix.os }} run: > @@ -109,7 +109,7 @@ jobs: --local_test_jobs 1 --test_size_filters medium --pin_browsers=false - --test_tag_filters manager,-safari + --test_tag_filters=manager,-safari --test_env=SE_FORCE_BROWSER_DOWNLOAD=true --test_env=SE_SKIP_DRIVER_IN_PATH=true //rb/spec/... From 601eef018cabd472447494fb926ac1816869d6c1 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Sun, 21 Dec 2025 23:44:21 -0600 Subject: [PATCH 15/19] now with quotes --- .github/workflows/ci-ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 17eb0bbd47fe5..ee6e88a1b68d5 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -109,7 +109,7 @@ jobs: --local_test_jobs 1 --test_size_filters medium --pin_browsers=false - --test_tag_filters=manager,-safari + --test_tag_filters="manager,-safari" --test_env=SE_FORCE_BROWSER_DOWNLOAD=true --test_env=SE_SKIP_DRIVER_IN_PATH=true //rb/spec/... From cf5ddd6d9844b9cd8fb4b48b37484227a6ee05bf Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Mon, 22 Dec 2025 07:04:37 -0600 Subject: [PATCH 16/19] actually write the correct ruby code --- .github/workflows/ci-ruby.yml | 2 +- rb/spec/integration/selenium/webdriver/chrome/service_spec.rb | 2 +- rb/spec/integration/selenium/webdriver/edge/service_spec.rb | 2 +- rb/spec/integration/selenium/webdriver/firefox/service_spec.rb | 2 +- rb/spec/integration/selenium/webdriver/ie/service_spec.rb | 2 +- rb/spec/integration/selenium/webdriver/safari/service_spec.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index ee6e88a1b68d5..74b9df0c4989e 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -109,7 +109,7 @@ jobs: --local_test_jobs 1 --test_size_filters medium --pin_browsers=false - --test_tag_filters="manager,-safari" + --test_tag_filters="manager,-safari,-ie" --test_env=SE_FORCE_BROWSER_DOWNLOAD=true --test_env=SE_SKIP_DRIVER_IN_PATH=true //rb/spec/... diff --git a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb index 39cafd19b8750..d784eda7b736a 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb @@ -27,7 +27,7 @@ module Chrome exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :chrome}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } - let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium' } + let(:cache_dir) { ENV['SE_CACHE'] || File.join('.cache', 'selenium') } after { service_manager.stop } diff --git a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb index 3538f942fb84a..4d2dc22633680 100644 --- a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb @@ -27,7 +27,7 @@ module Edge exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :edge}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } - let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium' } + let(:cache_dir) { ENV['SE_CACHE'] || File.join('.cache', 'selenium') } after { service_manager.stop } diff --git a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb index 3f7d048b69177..edc5cb0c6c495 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb @@ -27,7 +27,7 @@ module Firefox exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :firefox}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } - let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium' } + let(:cache_dir) { ENV['SE_CACHE'] || File.join('.cache', 'selenium') } after { service_manager.stop } diff --git a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb index cef973986a5cb..b706581cc43d0 100644 --- a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb @@ -27,7 +27,7 @@ module IE exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :ie}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } - let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} + let(:cache_dir) { ENV['SE_CACHE'] || File.join('.cache', 'selenium') } after { service_manager.stop } diff --git a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb index 58e7abcda29b5..d19ee0e0c3ca2 100644 --- a/rb/spec/integration/selenium/webdriver/safari/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/safari/service_spec.rb @@ -27,7 +27,7 @@ module Safari exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :safari}]} do let(:service) { described_class.new } let(:service_manager) { service.launch } - let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'} + let(:cache_dir) { ENV['SE_CACHE'] || File.join('.cache', 'selenium') } after { service_manager.stop } From 977e32d275846234d82df81096dc4a5059211083 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Mon, 22 Dec 2025 13:21:06 -0600 Subject: [PATCH 17/19] make a better way to check path --- rb/lib/selenium/webdriver/common/platform.rb | 7 +++++++ .../integration/selenium/webdriver/chrome/service_spec.rb | 4 ++-- .../integration/selenium/webdriver/edge/service_spec.rb | 4 ++-- .../integration/selenium/webdriver/firefox/service_spec.rb | 4 ++-- rb/spec/integration/selenium/webdriver/ie/service_spec.rb | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/rb/lib/selenium/webdriver/common/platform.rb b/rb/lib/selenium/webdriver/common/platform.rb index dae3fcd72cb03..8cbd058cfc717 100644 --- a/rb/lib/selenium/webdriver/common/platform.rb +++ b/rb/lib/selenium/webdriver/common/platform.rb @@ -17,6 +17,7 @@ # specific language governing permissions and limitations # under the License. +require 'pathname' require 'rbconfig' require 'socket' @@ -126,6 +127,12 @@ def windows_path(path) path.tr(File::SEPARATOR, File::ALT_SEPARATOR) end + def includes_path?(path, root) + path_name = Pathname.new(unix_path(path)).cleanpath + root_name = Pathname.new(unix_path(root)).cleanpath + path_name.ascend.any? { |ancestor| ancestor == root_name } + end + def make_writable(file) File.chmod 0o766, file end diff --git a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb index d784eda7b736a..f0e0ffe7d2ae7 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/chrome/service_spec.rb @@ -38,8 +38,8 @@ module Chrome expect { Platform.assert_executable(driver_path) }.not_to raise_error expect { Platform.assert_executable(browser_path) }.not_to raise_error - expect(browser_path).to include(cache_dir) - expect(driver_path).to include(cache_dir) + expect(Platform.includes_path?(browser_path, cache_dir)).to be(true) + expect(Platform.includes_path?(driver_path, cache_dir)).to be(true) service.executable_path = driver_path diff --git a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb index 4d2dc22633680..6ef33e562d953 100644 --- a/rb/spec/integration/selenium/webdriver/edge/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/edge/service_spec.rb @@ -38,8 +38,8 @@ module Edge expect { Platform.assert_executable(driver_path) }.not_to raise_error expect { Platform.assert_executable(browser_path) }.not_to raise_error - expect(browser_path).to include(cache_dir) - expect(driver_path).to include(cache_dir) + expect(Platform.includes_path?(driver_path, cache_dir)).to be(true) + expect(Platform.includes_path?(browser_path, cache_dir)).to be(true) service.executable_path = driver_path diff --git a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb index edc5cb0c6c495..4af285cc3abaa 100644 --- a/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/firefox/service_spec.rb @@ -38,8 +38,8 @@ module Firefox expect { Platform.assert_executable(driver_path) }.not_to raise_error expect { Platform.assert_executable(browser_path) }.not_to raise_error - expect(browser_path).to include(cache_dir) - expect(driver_path).to include(cache_dir) + expect(Platform.includes_path?(browser_path, cache_dir)).to be(true) + expect(Platform.includes_path?(driver_path, cache_dir)).to be(true) service.executable_path = driver_path diff --git a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb index b706581cc43d0..a926dbeb88c28 100644 --- a/rb/spec/integration/selenium/webdriver/ie/service_spec.rb +++ b/rb/spec/integration/selenium/webdriver/ie/service_spec.rb @@ -36,7 +36,7 @@ module IE driver_path = driver_finder.driver_path expect { Platform.assert_executable(driver_path) }.not_to raise_error - expect(driver_path).to include(cache_dir) + expect(Platform.includes_path?(driver_path, cache_dir)).to be(true) service.executable_path = driver_path From ad04255ef15d8f107f83fb401e7ae6d749b2564a Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Mon, 22 Dec 2025 13:53:14 -0600 Subject: [PATCH 18/19] fix linter --- rb/lib/selenium/webdriver/common/platform.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rb/lib/selenium/webdriver/common/platform.rb b/rb/lib/selenium/webdriver/common/platform.rb index 8cbd058cfc717..30519dd7f35d2 100644 --- a/rb/lib/selenium/webdriver/common/platform.rb +++ b/rb/lib/selenium/webdriver/common/platform.rb @@ -130,7 +130,7 @@ def windows_path(path) def includes_path?(path, root) path_name = Pathname.new(unix_path(path)).cleanpath root_name = Pathname.new(unix_path(root)).cleanpath - path_name.ascend.any? { |ancestor| ancestor == root_name } + path_name.ascend.any?(root_name) end def make_writable(file) From 74f170fe9e24d34c98d8e4f9e5cc389920264afc Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Mon, 22 Dec 2025 15:54:57 -0600 Subject: [PATCH 19/19] more fixes --- rb/lib/selenium/webdriver/common/platform.rb | 9 ++-- rb/spec/tests.bzl | 44 ++++++++++---------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/rb/lib/selenium/webdriver/common/platform.rb b/rb/lib/selenium/webdriver/common/platform.rb index 30519dd7f35d2..e7e6308f458f6 100644 --- a/rb/lib/selenium/webdriver/common/platform.rb +++ b/rb/lib/selenium/webdriver/common/platform.rb @@ -120,7 +120,7 @@ def cygwin_path(path, only_cygwin: false, **opts) end def unix_path(path) - path.tr(File::ALT_SEPARATOR, File::SEPARATOR) + File::ALT_SEPARATOR.nil? ? path : path.tr(File::ALT_SEPARATOR, File::SEPARATOR) end def windows_path(path) @@ -128,9 +128,10 @@ def windows_path(path) end def includes_path?(path, root) - path_name = Pathname.new(unix_path(path)).cleanpath - root_name = Pathname.new(unix_path(root)).cleanpath - path_name.ascend.any?(root_name) + path_name = unix_path(path) + root_name = unix_path(root) + WebDriver.logger.debug("Checking if #{path_name} includes #{root_name}", id: :platform) + unix_path(path).include?("/#{unix_path(root)}/") end def make_writable(file) diff --git a/rb/spec/tests.bzl b/rb/spec/tests.bzl index ab19dfcc9dbe6..fb55e914523e7 100644 --- a/rb/spec/tests.bzl +++ b/rb/spec/tests.bzl @@ -195,27 +195,29 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke ) # Generate a test target for remote browser execution (Grid). - rb_test( - name = "{}-{}-remote".format(name, browser), - size = "large", - srcs = srcs, - args = ["rb/spec/"], - data = BROWSERS[browser]["data"] + data + [ - "//common/src/web", - "//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar", - "//rb/spec:java-location", - "@bazel_tools//tools/jdk:current_java_runtime", - ], - env = BROWSERS[browser]["env"] | { - "WD_BAZEL_JAVA_LOCATION": "$(rootpath //rb/spec:java-location)", - "WD_SPEC_DRIVER": "remote", - }, - main = "@bundle//bin:rspec", - 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"], - ) + # Skip remote targets for manager tests (no Grid session needed). + if "manager" not in tags: + rb_test( + name = "{}-{}-remote".format(name, browser), + size = "large", + srcs = srcs, + args = ["rb/spec/"], + data = BROWSERS[browser]["data"] + data + [ + "//common/src/web", + "//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar", + "//rb/spec:java-location", + "@bazel_tools//tools/jdk:current_java_runtime", + ], + env = BROWSERS[browser]["env"] | { + "WD_BAZEL_JAVA_LOCATION": "$(rootpath //rb/spec:java-location)", + "WD_SPEC_DRIVER": "remote", + }, + main = "@bundle//bin:rspec", + 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"], + ) # Generate a test target for bidi browser execution if there is a matching tag if "bidi" in tags: