3.1 KiB
3.1 KiB
| id | title |
|---|---|
| test-cli | Command Line |
# Ask for help!
npx playwright test --help
Arguments passed to npx playwright test are treated as a filter for test files. For example, npx playwright test my-spec will only run tests from files with my-spec in the name.
All the options are available in the configuration file. However, selected options can be passed to a command line and take a priority over the configuration file:
--config <file>or-c <file>: Configuration file. Defaults topwtest.config.tsorpwtest.config.jsin the current directory.--forbid-only: Whether to disallowtest.onlyexclusive tests. Useful on CI. Overridesconfig.forbidOnlyoption from the configuration file.--grep <grep>or-g <grep>: Only run tests matching this regular expression, for example/my.*test/iormy-test. Overridesconfig.grepoption from the configuration file.--global-timeout <number>: Total timeout in milliseconds for the whole test run. By default, there is no global timeout. Overridesconfig.globalTimeoutoption from the configuration file.--help: Display help.--list: List all the tests, but do not run them.--max-failures <N>or-x: Stop after the firstNtest failures. Passing-xstops after the first failure. Overridesconfig.maxFailuresoption from the configuration file.--output <dir>: Directory for artifacts produced by tests, defaults totest-results. Overridesconfig.outputDiroption from the configuration file.--quiet: Whether to suppress stdout and stderr from the tests. Overridesconfig.quietoption from the configuration file.--repeat-each <number>: Specifies how many times to run each test. Defaults to one. Overridesconfig.repeatEachoption from the configuration file.--reporter <reporter>. Specify reporter to use, comma-separated, can be some combination ofdot,json,junit,line,listandnull. See reporters for more information.--retries <number>: The maximum number of retries for each flaky test, defaults to zero (no retries). Overridesconfig.retriesoption from the configuration file.--shard <shard>: Shard tests and execute only selected shard, specified in the formcurrent/all, 1-based, for example3/5. Overridesconfig.shardoption from the configuration file.--project <project...>: Only run tests from one of the specified projects. Defaults to running all projects defined in the configuration file.--timeout <number>: Maximum timeout in milliseconds for each test, defaults to 10 seconds. Overridesconfig.timeoutoption from the configuration file.--update-snapshotsor-u: Whether to update snapshots with actual results instead of comparing them. Use this when snapshot expectations have changed. Overridesconfig.updateSnapshotsoption from the configuration file.--workers <workers>or-j <workers>: The maximum number of concurrent worker processes. Overridesconfig.workersoption from the configuration file.