From ce788a6a1fe8757e01e807f934e4c188f0f09435 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Wed, 17 Jul 2024 14:22:12 +0200 Subject: [PATCH] add docs --- docs/src/test-cli-js.md | 6 ++++++ packages/playwright/src/program.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/src/test-cli-js.md b/docs/src/test-cli-js.md index 290fb7df96..a48753033c 100644 --- a/docs/src/test-cli-js.md +++ b/docs/src/test-cli-js.md @@ -22,6 +22,11 @@ Here are the most common options available in the command line. npx playwright test tests/todo-page/ tests/landing-page/ ``` +- Run only test files that have local changes + ```bash + npx playwright test --only-changed + ``` + - Run files that have `my-spec` or `my-spec-2` in the file name ```bash npx playwright test my-spec my-spec-2 @@ -93,6 +98,7 @@ Complete set of Playwright Test options is available in the [configuration file] | `--max-failures ` or `-x`| Stop after the first `N` test failures. Passing `-x` stops after the first failure.| | `--no-deps` | Ignore the dependencies between projects and behave as if they were not specified. | | `--output ` | Directory for artifacts produced by tests, defaults to `test-results`. | +| `--only-changed [ref]` | Only run tests that have been changed between `HEAD` and `ref`. Defaults to running all uncommitted changes. Only supports Git. | | `--pass-with-no-tests` | Allows the test suite to pass when no files are found. | | `--project ` | Only run tests from the specified [projects](./test-projects.md), supports '*' wildcard. Defaults to running all projects defined in the configuration file.| | `--quiet` | Whether to suppress stdout and stderr from the tests. | diff --git a/packages/playwright/src/program.ts b/packages/playwright/src/program.ts index 412d323631..57d6a43077 100644 --- a/packages/playwright/src/program.ts +++ b/packages/playwright/src/program.ts @@ -360,7 +360,7 @@ const testOptions: [string, string][] = [ ['--max-failures ', `Stop after the first N failures`], ['--no-deps', 'Do not run project dependencies'], ['--output ', `Folder for output artifacts (default: "test-results")`], - ['--only-changed [base-commit]', `something something docs`], + ['--only-changed [ref]', `Only run tests that have been changed between 'HEAD' and 'ref'. Defaults to running all uncommitted changes. Only supports Git.`], ['--pass-with-no-tests', `Makes test run succeed even if no tests were found`], ['--project ', `Only run tests from the specified list of projects, supports '*' wildcard (default: run all projects)`], ['--quiet', `Suppress stdio`],