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..1d25990a20dd6 100644 --- a/py/BUILD.bazel +++ b/py/BUILD.bazel @@ -873,6 +873,8 @@ BIDI_IMPLEMENTATIONS = [] # generates no targets: an empty test_suite would mean every test in the package. REMOTE_BIDI_TESTS = [] +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 +1202,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 +1237,41 @@ FEATURE_SUITE_DEFS = { ] ] +[ + 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 +1346,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 +1368,15 @@ test_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 []), +) 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