docs: cleanup test.describe.parallel.only doc (#9159)

This commit is contained in:
Dmitry Gozman 2021-09-26 21:30:11 -07:00 committed by GitHub
parent ee25fefb62
commit 0801a8c486
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 37 deletions

View file

@ -283,27 +283,7 @@ A callback that is run immediately when calling [`method: Test.describe.parallel
## method: Test.describe.parallel.only
Declares a focused group of tests that could be run in parallel. By default, tests in a single test file run one after another, but using [`method: Test.describe.parallel`] allows them to run in parallel. If there are some focused tests or suites, all of them will be run but nothing else.
```js js-flavor=js
test.describe.parallel.only('group', () => {
test('runs in parallel 1', async ({ page }) => {
});
test('runs in parallel 2', async ({ page }) => {
});
});
```
```js js-flavor=ts
test.describe.parallel.only('group', () => {
test('runs in parallel 1', async ({ page }) => {
});
test('runs in parallel 2', async ({ page }) => {
});
});
```
Note that parallel tests are executed in separate processes and cannot share any state or global variables. Each of the parallel tests executes all relevant hooks.
Declares a focused group of tests that could be run in parallel. This is similar to [`method: Test.describe.parallel`], but focuses the group. If there are some focused tests or suites, all of them will be run but nothing else.
### param: Test.describe.parallel.only.title
- `title` <[string]>

19
types/test.d.ts vendored
View file

@ -1267,22 +1267,9 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
*/
parallel: SuiteFunction & {
/**
* Declares a focused group of tests that could be run in parallel. By default, tests in a single test file run one after
* another, but using
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel) allows them
* to run in parallel. If there are some focused tests or suites, all of them will be run but nothing else.
*
* ```ts
* test.describe.parallel.only('group', () => {
* test('runs in parallel 1', async ({ page }) => {
* });
* test('runs in parallel 2', async ({ page }) => {
* });
* });
* ```
*
* Note that parallel tests are executed in separate processes and cannot share any state or global variables. Each of the
* parallel tests executes all relevant hooks.
* Declares a focused group of tests that could be run in parallel. This is similar to
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel), but
* focuses the group. If there are some focused tests or suites, all of them will be run but nothing else.
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe.parallel.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel-only).
* Any tests added in this callback will belong to the group.