ci: Use electron browser over chrome

* Electron is already shipped along with Cypress. Can we use it?
* Pass --record kwarg only if CYPRESS_RECORD_KEY envvar is set
This commit is contained in:
Gavin D'souza 2023-09-20 16:56:28 +05:30
parent 224f97cd9c
commit a5f709b468
No known key found for this signature in database
GPG key ID: 3A7BF4D4340DE6F7

View file

@ -850,6 +850,7 @@ def run_parallel_tests(
@click.option("--headless", is_flag=True, help="Run UI Test in headless mode")
@click.option("--parallel", is_flag=True, help="Run UI Test in parallel mode")
@click.option("--with-coverage", is_flag=True, help="Generate coverage report")
@click.option("--browser", default="electron", help="Browser to run tests in")
@click.option("--ci-build-id")
@pass_context
def run_ui_tests(
@ -858,6 +859,7 @@ def run_ui_tests(
headless=False,
parallel=True,
with_coverage=False,
browser="electron",
ci_build_id=None,
cypressargs=None,
):
@ -905,9 +907,12 @@ def run_ui_tests(
frappe.commands.popen(f"(cd ../frappe && yarn add {packages} --no-lockfile)")
# run for headless mode
run_or_open = "run --browser chrome --record" if headless else "open"
run_or_open = f"run --browser {browser}" if headless else "open"
formatted_command = f"{site_env} {password_env} {coverage_env} {cypress_path} {run_or_open}"
if os.environ.get("CYPRESS_RECORD_KEY"):
formatted_command += " --record"
if parallel:
formatted_command += " --parallel"