migrate more APP_HARNESS env vars to new config system
This commit is contained in:
parent
f16273fa11
commit
e1ec51a589
@ -494,6 +494,12 @@ class EnvironmentVariables:
|
|||||||
# Whether to run app harness tests in headless mode.
|
# Whether to run app harness tests in headless mode.
|
||||||
APP_HARNESS_HEADLESS: EnvVar[bool] = env_var(False)
|
APP_HARNESS_HEADLESS: EnvVar[bool] = env_var(False)
|
||||||
|
|
||||||
|
# Which app harness driver to use.
|
||||||
|
APP_HARNESS_DRIVER: EnvVar[str] = env_var("Chrome")
|
||||||
|
|
||||||
|
# Arguments to pass to the app harness driver.
|
||||||
|
APP_HARNESS_DRIVER_ARGS: EnvVar[str] = env_var("")
|
||||||
|
|
||||||
|
|
||||||
environment = EnvironmentVariables()
|
environment = EnvironmentVariables()
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ class AppHarness:
|
|||||||
if environment.APP_HARNESS_HEADLESS.get:
|
if environment.APP_HARNESS_HEADLESS.get:
|
||||||
want_headless = True
|
want_headless = True
|
||||||
if driver_clz is None:
|
if driver_clz is None:
|
||||||
requested_driver = os.environ.get("APP_HARNESS_DRIVER", "Chrome")
|
requested_driver = environment.APP_HARNESS_DRIVER.get
|
||||||
driver_clz = getattr(webdriver, requested_driver)
|
driver_clz = getattr(webdriver, requested_driver)
|
||||||
if driver_options is None:
|
if driver_options is None:
|
||||||
driver_options = getattr(webdriver, f"{requested_driver}Options")()
|
driver_options = getattr(webdriver, f"{requested_driver}Options")()
|
||||||
@ -642,7 +642,7 @@ class AppHarness:
|
|||||||
driver_options.add_argument("headless")
|
driver_options.add_argument("headless")
|
||||||
if driver_options is None:
|
if driver_options is None:
|
||||||
raise RuntimeError(f"Could not determine options for {driver_clz}")
|
raise RuntimeError(f"Could not determine options for {driver_clz}")
|
||||||
if args := os.environ.get("APP_HARNESS_DRIVER_ARGS"):
|
if args := environment.APP_HARNESS_DRIVER_ARGS.get:
|
||||||
for arg in args.split(","):
|
for arg in args.split(","):
|
||||||
driver_options.add_argument(arg)
|
driver_options.add_argument(arg)
|
||||||
if driver_option_args is not None:
|
if driver_option_args is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user