From 8cef0786c2c3fb6424770794555473d279a41e19 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Thu, 3 Apr 2025 19:07:45 -0400 Subject: [PATCH 1/3] [py] Fix test args for --headless and --bidi --- py/BUILD.bazel | 3 +-- py/conftest.py | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/py/BUILD.bazel b/py/BUILD.bazel index 578b746bb69b1..cae71c30a691f 100644 --- a/py/BUILD.bazel +++ b/py/BUILD.bazel @@ -405,7 +405,6 @@ BIDI_TESTS = glob(["test/selenium/webdriver/common/**/*bidi*_tests.py"]) ), args = [ "--instafail", - "--bidi=false", ] + BROWSERS[browser]["args"], data = BROWSERS[browser]["data"], env_inherit = ["DISPLAY"], @@ -432,7 +431,7 @@ BIDI_TESTS = glob(["test/selenium/webdriver/common/**/*bidi*_tests.py"]) ), args = [ "--instafail", - "--bidi=true", + "--bidi", ] + BROWSERS[browser]["args"], data = BROWSERS[browser]["data"], env_inherit = ["DISPLAY"], diff --git a/py/conftest.py b/py/conftest.py index 1cf4d3a98691b..d7ae98b121f38 100644 --- a/py/conftest.py +++ b/py/conftest.py @@ -47,44 +47,43 @@ def pytest_addoption(parser): choices=drivers, dest="drivers", metavar="DRIVER", - help="driver to run tests against ({})".format(", ".join(drivers)), + help="Driver to run tests against ({})".format(", ".join(drivers)), ) parser.addoption( "--browser-binary", action="store", dest="binary", - help="location of the browser binary", + help="Location of the browser binary", ) parser.addoption( "--driver-binary", action="store", dest="executable", - help="location of the service executable binary", + help="Location of the service executable binary", ) parser.addoption( "--browser-args", action="store", dest="args", - help="arguments to start the browser with", + help="Arguments to start the browser with", ) parser.addoption( "--headless", - action="store", + action="store_true", dest="headless", - help="Allow tests to run in headless", + help="Run tests in headless mode", ) parser.addoption( "--use-lan-ip", action="store_true", dest="use_lan_ip", - help="Whether to start test server with lan ip instead of localhost", + help="Start test server with lan ip instead of localhost", ) parser.addoption( "--bidi", - action="store", + action="store_true", dest="bidi", - metavar="BIDI", - help="Whether to enable BiDi support", + help="Enable BiDi support", ) @@ -196,8 +195,8 @@ def fin(): def get_options(driver_class, config): browser_path = config.option.binary browser_args = config.option.args - headless = bool(config.option.headless) - bidi = bool(config.option.bidi) + headless = config.option.headless + bidi = config.option.bidi options = None if browser_path or browser_args: From b4433385a05ff5b5e9584f9f6662975608251af9 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Thu, 3 Apr 2025 19:20:47 -0400 Subject: [PATCH 2/3] [py] Call headless correctly --- py/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/BUILD.bazel b/py/BUILD.bazel index cae71c30a691f..a4a3d2068f6b0 100644 --- a/py/BUILD.bazel +++ b/py/BUILD.bazel @@ -479,7 +479,7 @@ py_test_suite( ), args = [ "--instafail", - "--headless=true", + "--headless", ] + BROWSERS["chrome"]["args"], data = BROWSERS["chrome"]["data"], env_inherit = ["DISPLAY"], From 31b659cbf71c949258e1dd1c9f97de39d2ed6281 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Thu, 3 Apr 2025 19:32:42 -0400 Subject: [PATCH 3/3] [py] Remove bool --- py/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/conftest.py b/py/conftest.py index d7ae98b121f38..47088ed71d77b 100644 --- a/py/conftest.py +++ b/py/conftest.py @@ -178,7 +178,7 @@ def fin(): # and doesn't seems to be stable enough, causing the flakiness of the # subsequent tests. # Remove this when BiDi implementation and API is stable. - if bool(request.config.option.bidi): + if request.config.option.bidi: def fin(): global driver_instance