From 2326dd10031b6ff52f3bd1d69dd3f7daa4443dea Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Fri, 18 Sep 2026 14:10:29 -0700 Subject: [PATCH 1/2] [py] split the Grid-specific tests into test--grid suites and run them on the Windows nightly --- .github/workflows/ci-python.yml | 2 +- py/BUILD.bazel | 53 +++++++++++++++++++++++++++++++-- py/TESTING.md | 1 + 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index 13408df91f7ed..17ba656b8bc53 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -120,7 +120,7 @@ jobs: strategy: fail-fast: false matrix: - browser: [chrome, firefox, chrome-bidi, edge] + browser: [chrome, firefox, chrome-bidi, edge, chrome-grid, firefox-grid] os: [windows] include: - browser: safari diff --git a/py/BUILD.bazel b/py/BUILD.bazel index e27ca6bf74fdc..a47e9cca37f27 100644 --- a/py/BUILD.bazel +++ b/py/BUILD.bazel @@ -873,6 +873,9 @@ BIDI_IMPLEMENTATIONS = [] # generates no targets: an empty test_suite would mean every test in the package. REMOTE_BIDI_TESTS = [] +# Tests of Grid-specific behavior, kept apart so the scheduled Grid jobs can run just these. +GRID_TESTS = glob(["test/selenium/webdriver/remote/**/*.py"]) + # Test files that only run against browsers supporting the given feature. # Each group is split into its own sub-suite so that changing the underlying # library only triggers that group's targets, not the full ~700-target suite. @@ -1200,7 +1203,6 @@ FEATURE_SUITE_DEFS = { srcs = glob( [ "test/selenium/webdriver/common/**/*.py", - "test/selenium/webdriver/remote/**/*.py", "test/selenium/webdriver/support/**/*.py", ] + BROWSER_TESTS[browser]["browser_srcs"], exclude = BIDI_TESTS + ACTIONS_TESTS + FEATURE_TESTS + DRIVER_FINDER_TESTS + @@ -1236,6 +1238,42 @@ FEATURE_SUITE_DEFS = { ] ] +# Generate test--remote-grid targets (chrome and firefox only) +[ + py_test_suite( + name = "test-%s-remote-grid" % browser, + size = "large", + srcs = GRID_TESTS, + args = [ + "--instafail", + "--remote", + ] + BROWSERS[browser]["args"], + data = BROWSERS[browser]["data"] + [ + ":java-location", + "//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar", + "@bazel_tools//tools/jdk:current_java_runtime", + ], + env = { + "SE_BAZEL_JAVA_LOCATION": "$(rootpath :java-location)", + }, + env_inherit = ["DISPLAY"], + tags = ["no-sandbox"] + BROWSERS[browser]["tags"] + [ + "remote", + "%s-remote" % browser, + ], + target_compatible_with = BROWSERS[browser]["target_compatible_with"], + test_suffix = "%s-remote" % browser, + deps = [ + ":init-tree", + ":webserver", + ] + BROWSER_TESTS[browser]["deps"] + TEST_DEPS, + ) + for browser in [ + "chrome", + "firefox", + ] +] + # Generate test--remote-actions targets (chrome and firefox only) [ py_test_suite( @@ -1310,11 +1348,12 @@ FEATURE_SUITE_DEFS = { for feature in FEATURE_SUITE_DEFS ] -# Aggregate test--remote = remote-common + remote-actions + remote-features +# Aggregate test--remote = remote-common + remote-grid + remote-actions + remote-features [test_suite( name = "test-%s-remote" % browser, tests = [ ":test-%s-remote-common" % browser, + ":test-%s-remote-grid" % browser, ":test-%s-remote-actions" % browser, ] + [":test-%s-remote-%s" % (browser, f) for f in FEATURE_SUITE_DEFS] + ([":test-%s-remote-bidi" % browser] if REMOTE_BIDI_TESTS else []), ) for browser in [ @@ -1331,6 +1370,16 @@ test_suite( ], ) +# Aggregate test--grid = the Grid-specific tests alone, classic and (once opted in) BiDi, +# for jobs that check Grid works on an OS without paying for the whole remote suite. +[test_suite( + name = "test-%s-grid" % browser, + tests = [":test-%s-remote-grid" % browser] + ([":test-%s-remote-bidi" % browser] if REMOTE_BIDI_TESTS else []), +) for browser in [ + "chrome", + "firefox", +]] + py_binary( name = "generate-api-listing", srcs = ["generate_api_module_listing.py"], diff --git a/py/TESTING.md b/py/TESTING.md index de56d1d909ca6..b10f48be8fab9 100644 --- a/py/TESTING.md +++ b/py/TESTING.md @@ -46,6 +46,7 @@ bazel test //py:test-chrome-bidi # Against a Grid server (chrome and firefox only). The suite starts its own # Selenium standalone server and talks to it with webdriver.Remote. bazel test //py:test-chrome-remote +bazel test //py:test-chrome-grid # only the Grid-specific tests bazel test //py:test-remote # every remote suite # Test filters From 59f0905877fc0eeb7e135f4bc93a213ad32ff365 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Fri, 18 Sep 2026 16:43:29 -0700 Subject: [PATCH 2/2] [py] drop the suite comments that restate the targets below them --- py/BUILD.bazel | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/py/BUILD.bazel b/py/BUILD.bazel index a47e9cca37f27..1d25990a20dd6 100644 --- a/py/BUILD.bazel +++ b/py/BUILD.bazel @@ -873,7 +873,6 @@ BIDI_IMPLEMENTATIONS = [] # generates no targets: an empty test_suite would mean every test in the package. REMOTE_BIDI_TESTS = [] -# Tests of Grid-specific behavior, kept apart so the scheduled Grid jobs can run just these. GRID_TESTS = glob(["test/selenium/webdriver/remote/**/*.py"]) # Test files that only run against browsers supporting the given feature. @@ -1238,7 +1237,6 @@ FEATURE_SUITE_DEFS = { ] ] -# Generate test--remote-grid targets (chrome and firefox only) [ py_test_suite( name = "test-%s-remote-grid" % browser, @@ -1370,8 +1368,7 @@ test_suite( ], ) -# Aggregate test--grid = the Grid-specific tests alone, classic and (once opted in) BiDi, -# for jobs that check Grid works on an OS without paying for the whole remote suite. +# Lets an OS job check Grid works without paying for the whole remote suite. [test_suite( name = "test-%s-grid" % browser, tests = [":test-%s-remote-grid" % browser] + ([":test-%s-remote-bidi" % browser] if REMOTE_BIDI_TESTS else []),