mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs: fix details about WorkerInfo vs TestInfo availability (#21699)
Fixes #21695.
This commit is contained in:
parent
03a0f479d2
commit
2074a51299
@ -2,7 +2,7 @@
|
||||
* since: v1.10
|
||||
* langs: js
|
||||
|
||||
`TestInfo` contains information about currently running test. It is available to any test function, [`method: Test.beforeEach`] and [`method: Test.afterEach`] hooks and test-scoped fixtures. `TestInfo` provides utilities to control test execution: attach files, update test timeout, determine which test is currently running and whether it was retried, etc.
|
||||
`TestInfo` contains information about currently running test. It is available to test functions, [`method: Test.beforeEach`], [`method: Test.afterEach`], [`method: Test.beforeAll`] and [`method: Test.afterAll`] hooks, and test-scoped fixtures. `TestInfo` provides utilities to control test execution: attach files, update test timeout, determine which test is currently running and whether it was retried, etc.
|
||||
|
||||
```js
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
@ -2,15 +2,7 @@
|
||||
* since: v1.10
|
||||
* langs: js
|
||||
|
||||
`WorkerInfo` contains information about the worker that is running tests. It is available to [`method: Test.beforeAll`] and [`method: Test.afterAll`] hooks and worker-scoped fixtures.
|
||||
|
||||
```js
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.beforeAll(async ({ browserName }, workerInfo) => {
|
||||
console.log(`Running ${browserName} in worker #${workerInfo.workerIndex}`);
|
||||
});
|
||||
```
|
||||
`WorkerInfo` contains information about the worker that is running tests and is available to worker-scoped fixtures. `WorkerInfo` is a subset of [TestInfo] that is available in many other places.
|
||||
|
||||
## property: WorkerInfo.config
|
||||
* since: v1.10
|
||||
|
23
packages/playwright-test/types/test.d.ts
vendored
23
packages/playwright-test/types/test.d.ts
vendored
@ -1800,19 +1800,8 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
|
||||
export type TestStatus = 'passed' | 'failed' | 'timedOut' | 'skipped' | 'interrupted';
|
||||
|
||||
/**
|
||||
* `WorkerInfo` contains information about the worker that is running tests. It is available to
|
||||
* [test.beforeAll(hookFunction)](https://playwright.dev/docs/api/class-test#test-before-all) and
|
||||
* [test.afterAll(hookFunction)](https://playwright.dev/docs/api/class-test#test-after-all) hooks and worker-scoped
|
||||
* fixtures.
|
||||
*
|
||||
* ```js
|
||||
* import { test, expect } from '@playwright/test';
|
||||
*
|
||||
* test.beforeAll(async ({ browserName }, workerInfo) => {
|
||||
* console.log(`Running ${browserName} in worker #${workerInfo.workerIndex}`);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* `WorkerInfo` contains information about the worker that is running tests and is available to worker-scoped
|
||||
* fixtures. `WorkerInfo` is a subset of [TestInfo] that is available in many other places.
|
||||
*/
|
||||
export interface WorkerInfo {
|
||||
/**
|
||||
@ -1844,9 +1833,11 @@ export interface WorkerInfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* `TestInfo` contains information about currently running test. It is available to any test function,
|
||||
* [test.beforeEach(hookFunction)](https://playwright.dev/docs/api/class-test#test-before-each) and
|
||||
* [test.afterEach(hookFunction)](https://playwright.dev/docs/api/class-test#test-after-each) hooks and test-scoped
|
||||
* `TestInfo` contains information about currently running test. It is available to test functions,
|
||||
* [test.beforeEach(hookFunction)](https://playwright.dev/docs/api/class-test#test-before-each),
|
||||
* [test.afterEach(hookFunction)](https://playwright.dev/docs/api/class-test#test-after-each),
|
||||
* [test.beforeAll(hookFunction)](https://playwright.dev/docs/api/class-test#test-before-all) and
|
||||
* [test.afterAll(hookFunction)](https://playwright.dev/docs/api/class-test#test-after-all) hooks, and test-scoped
|
||||
* fixtures. `TestInfo` provides utilities to control test execution: attach files, update test timeout, determine
|
||||
* which test is currently running and whether it was retried, etc.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user