Просмотр исходного кода

fix: make --record optional for cypress tests #18341

version-14
Ankush Menat 2 лет назад
committed by GitHub
Родитель
Сommit
66592827f4
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
2 измененных файлов: 20 добавлений и 7 удалений
  1. +3
    -1
      .github/workflows/ui-tests.yml
  2. +17
    -6
      frappe/commands/utils.py

+ 3
- 1
.github/workflows/ui-tests.yml Просмотреть файл

@@ -144,7 +144,9 @@ jobs:


- name: UI Tests - name: UI Tests
if: ${{ steps.check-build.outputs.build == 'strawberry' }} if: ${{ steps.check-build.outputs.build == 'strawberry' }}
run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests frappe --headless --record --parallel --ci-build-id $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT
run: |
cd ~/frappe-bench/
bench --site test_site run-ui-tests frappe --headless --parallel --ci-build-id $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT -- --record
env: env:
CYPRESS_RECORD_KEY: 4a48f41c-11b3-425b-aa88-c58048fa69eb CYPRESS_RECORD_KEY: 4a48f41c-11b3-425b-aa88-c58048fa69eb




+ 17
- 6
frappe/commands/utils.py Просмотреть файл

@@ -835,16 +835,27 @@ def run_parallel_tests(
ParallelTestRunner(app, site=site, build_number=build_number, total_builds=total_builds) ParallelTestRunner(app, site=site, build_number=build_number, total_builds=total_builds)




@click.command("run-ui-tests")
@click.command(
"run-ui-tests",
context_settings=dict(
ignore_unknown_options=True,
),
)
@click.argument("app") @click.argument("app")
@click.argument("cypressargs", nargs=-1, type=click.UNPROCESSED)
@click.option("--headless", is_flag=True, help="Run UI Test in headless mode") @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("--parallel", is_flag=True, help="Run UI Test in parallel mode")
@click.option("--with-coverage", is_flag=True, help="Generate coverage report") @click.option("--with-coverage", is_flag=True, help="Generate coverage report")
@click.option("--ci-build-id") @click.option("--ci-build-id")
@click.option("--record", is_flag=True, help="Record using Cypress Dashboard")
@pass_context @pass_context
def run_ui_tests( def run_ui_tests(
context, app, headless=False, parallel=True, with_coverage=False, ci_build_id=None, record=False
context,
app,
headless=False,
parallel=True,
with_coverage=False,
ci_build_id=None,
cypressargs=None,
): ):
"Run UI tests" "Run UI tests"
site = get_site(context) site = get_site(context)
@@ -892,15 +903,15 @@ def run_ui_tests(
run_or_open = "run --browser chrome" if headless else "open" run_or_open = "run --browser chrome" if headless else "open"
formatted_command = f"{site_env} {password_env} {coverage_env} {cypress_path} {run_or_open}" formatted_command = f"{site_env} {password_env} {coverage_env} {cypress_path} {run_or_open}"


if record:
run_or_open += " --record"

if parallel: if parallel:
formatted_command += " --parallel" formatted_command += " --parallel"


if ci_build_id: if ci_build_id:
formatted_command += f" --ci-build-id {ci_build_id}" formatted_command += f" --ci-build-id {ci_build_id}"


if cypressargs:
formatted_command += " " + " ".join(cypressargs)

click.secho("Running Cypress...", fg="yellow") click.secho("Running Cypress...", fg="yellow")
frappe.commands.popen(formatted_command, cwd=app_base_path, raise_err=True) frappe.commands.popen(formatted_command, cwd=app_base_path, raise_err=True)




Загрузка…
Отмена
Сохранить