diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index 404c987a19..4ecc8e6206 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -160,7 +160,7 @@ export default defineConfig({ * since: v1.10 - type: ?<[RegExp]|[Array]<[RegExp]>> -Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only run tests with "cart" in the title. Also available in the [command line](../test-cli.md) with the `-g` option. +Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only run tests with "cart" in the title. Also available in the [command line](../test-cli.md) with the `-g` option. The regular expression will be tested against the string that consists of the test file name, `test.describe` name (if any) and the test name divided by spaces, e.g. `my-test.spec.ts my-suite my-test`. `grep` option is also useful for [tagging tests](../test-annotations.md#tag-tests). diff --git a/docs/src/test-api/class-testproject.md b/docs/src/test-api/class-testproject.md index afd1e7bcab..179a4815d8 100644 --- a/docs/src/test-api/class-testproject.md +++ b/docs/src/test-api/class-testproject.md @@ -119,7 +119,7 @@ You can configure entire test project to concurrently run all tests in all files * since: v1.10 - type: ?<[RegExp]|[Array]<[RegExp]>> -Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only run tests with "cart" in the title. Also available globally and in the [command line](../test-cli.md) with the `-g` option. The regular expression will be tested against the string that consists of the test file name, `test.describe` name (if any) and the test name divided by spaces, e.g. `my-test.spec.ts my suite my test`. +Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only run tests with "cart" in the title. Also available globally and in the [command line](../test-cli.md) with the `-g` option. The regular expression will be tested against the string that consists of the test file name, `test.describe` name (if any) and the test name divided by spaces, e.g. `my-test.spec.ts my-suite my-test`. `grep` option is also useful for [tagging tests](../test-annotations.md#tag-tests). diff --git a/docs/src/test-cli-js.md b/docs/src/test-cli-js.md index c5e77468af..35803f985f 100644 --- a/docs/src/test-cli-js.md +++ b/docs/src/test-cli-js.md @@ -82,7 +82,7 @@ Complete set of Playwright Test options is available in the [configuration file] | `-c ` or `--config `| Configuration file. If not passed, defaults to `playwright.config.ts` or `playwright.config.js` in the current directory. | | `-c ` or `--config `| Configuration file. If not passed, defaults to `playwright.config.ts` or `playwright.config.js` in the current directory. | | `--forbid-only` | Whether to disallow `test.only`. Useful on CI.| -| `-g ` or `--grep ` | Only run tests matching this regular expression. For example, this will run `'should add to cart'` when passed `-g "add to cart"`. | +| `-g ` or `--grep ` | Only run tests matching this regular expression. For example, this will run `'should add to cart'` when passed `-g "add to cart"`. The regular expression will be tested against the string that consists of the test file name, `test.describe` name (if any) and the test name divided by spaces, e.g. `my-test.spec.ts my-suite my-test`. | | `--grep-invert ` | Only run tests **not** matching this regular expression. The opposite of `--grep`. | | `--global-timeout ` | Total timeout for the whole test run in milliseconds. By default, there is no global timeout. Learn more about [various timeouts](./test-timeouts.md).| | `--list` | list all the tests, but do not run them.| diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts index a46e570539..835987141b 100644 --- a/packages/playwright-test/types/test.d.ts +++ b/packages/playwright-test/types/test.d.ts @@ -164,7 +164,7 @@ export interface FullProject { * Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only * run tests with "cart" in the title. Also available globally and in the [command line](https://playwright.dev/docs/test-cli) with the `-g` * option. The regular expression will be tested against the string that consists of the test file name, - * `test.describe` name (if any) and the test name divided by spaces, e.g. `my-test.spec.ts my suite my test`. + * `test.describe` name (if any) and the test name divided by spaces, e.g. `my-test.spec.ts my-suite my-test`. * * `grep` option is also useful for [tagging tests](https://playwright.dev/docs/test-annotations#tag-tests). */ @@ -791,7 +791,9 @@ interface TestConfig { /** * Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only - * run tests with "cart" in the title. Also available in the [command line](https://playwright.dev/docs/test-cli) with the `-g` option. + * run tests with "cart" in the title. Also available in the [command line](https://playwright.dev/docs/test-cli) with the `-g` option. The + * regular expression will be tested against the string that consists of the test file name, `test.describe` name (if + * any) and the test name divided by spaces, e.g. `my-test.spec.ts my-suite my-test`. * * `grep` option is also useful for [tagging tests](https://playwright.dev/docs/test-annotations#tag-tests). * @@ -1540,7 +1542,9 @@ export interface FullConfig { globalTimeout: number; /** * Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only - * run tests with "cart" in the title. Also available in the [command line](https://playwright.dev/docs/test-cli) with the `-g` option. + * run tests with "cart" in the title. Also available in the [command line](https://playwright.dev/docs/test-cli) with the `-g` option. The + * regular expression will be tested against the string that consists of the test file name, `test.describe` name (if + * any) and the test name divided by spaces, e.g. `my-test.spec.ts my-suite my-test`. * * `grep` option is also useful for [tagging tests](https://playwright.dev/docs/test-annotations#tag-tests). * @@ -6406,7 +6410,7 @@ interface TestProject { * Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only * run tests with "cart" in the title. Also available globally and in the [command line](https://playwright.dev/docs/test-cli) with the `-g` * option. The regular expression will be tested against the string that consists of the test file name, - * `test.describe` name (if any) and the test name divided by spaces, e.g. `my-test.spec.ts my suite my test`. + * `test.describe` name (if any) and the test name divided by spaces, e.g. `my-test.spec.ts my-suite my-test`. * * `grep` option is also useful for [tagging tests](https://playwright.dev/docs/test-annotations#tag-tests). */