This commit is contained in:
Simon Knott 2024-07-17 14:22:12 +02:00
parent 5b758230d4
commit ce788a6a1f
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 7 additions and 1 deletions

View file

@ -22,6 +22,11 @@ Here are the most common options available in the command line.
npx playwright test tests/todo-page/ tests/landing-page/ 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 - Run files that have `my-spec` or `my-spec-2` in the file name
```bash ```bash
npx playwright test my-spec my-spec-2 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 <N>` or `-x`| Stop after the first `N` test failures. Passing `-x` stops after the first failure.| | `--max-failures <N>` 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. | | `--no-deps` | Ignore the dependencies between projects and behave as if they were not specified. |
| `--output <dir>` | Directory for artifacts produced by tests, defaults to `test-results`. | | `--output <dir>` | 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. | | `--pass-with-no-tests` | Allows the test suite to pass when no files are found. |
| `--project <name>` | Only run tests from the specified [projects](./test-projects.md), supports '*' wildcard. Defaults to running all projects defined in the configuration file.| | `--project <name>` | 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. | | `--quiet` | Whether to suppress stdout and stderr from the tests. |

View file

@ -360,7 +360,7 @@ const testOptions: [string, string][] = [
['--max-failures <N>', `Stop after the first N failures`], ['--max-failures <N>', `Stop after the first N failures`],
['--no-deps', 'Do not run project dependencies'], ['--no-deps', 'Do not run project dependencies'],
['--output <dir>', `Folder for output artifacts (default: "test-results")`], ['--output <dir>', `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`], ['--pass-with-no-tests', `Makes test run succeed even if no tests were found`],
['--project <project-name...>', `Only run tests from the specified list of projects, supports '*' wildcard (default: run all projects)`], ['--project <project-name...>', `Only run tests from the specified list of projects, supports '*' wildcard (default: run all projects)`],
['--quiet', `Suppress stdio`], ['--quiet', `Suppress stdio`],