Skip to content

[py] Fix test args for --headless and --bidi #15567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions py/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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"],
Expand Down Expand Up @@ -480,7 +479,7 @@ py_test_suite(
),
args = [
"--instafail",
"--headless=true",
"--headless",
] + BROWSERS["chrome"]["args"],
data = BROWSERS["chrome"]["data"],
env_inherit = ["DISPLAY"],
Expand Down
25 changes: 12 additions & 13 deletions py/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)


Expand Down Expand Up @@ -179,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
Expand All @@ -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:
Expand Down
Loading