Playwright Test Reporter Api
This appendix lists the configuration, Fixtures, Reporter and other APIs for Playwright Test Runner.
* * *
## Test Functions
| Method | Description |
| --- | --- |
| `test(name, fn)` | Define a test |
| `test.describe(name, fn)` | Define a test group |
| `test.describe.serial(name, fn)` | Serial test group |
| `test.describe.parallel(name, fn)` | Parallel test group |
| `test.describe.configure(options)` | Configure group behavior (mode, retries) |
| `test.skip(name?, fn?)` | Skip test |
| `test.fail(name?, fn?)` | Mark as expected failure |
| `test.fixme(name?, fn?)` | Mark as to be fixed |
| `test.slow(name?, fn?)` | Mark as slow test (timeout Γ3) |
| `test.only(name, fn)` | Run only this test |
| `test.beforeEach(fn)` | Execute before each test |
| `test.afterEach(fn)` | Execute after each test |
| `test.beforeAll(fn)` | Execute once before all tests |
| `test.afterAll(fn)` | Execute once after all tests |
| `test.extend(fixtures)` | Create custom Fixture |
| `test.use(options)` | Override current scope configuration |
| `test.setTimeout(ms)` | Set timeout for current test |
| `test.step(name, fn)` | Define test step (visible in report) |
| `test.info()` | Get TestInfo object |
* * *
## TestConfig Interface
| Field | Type | Description |
| --- | --- | --- |
| `testDir` | string | Test directory |
| `fullyParallel` | boolean | Fully parallel |
| `workers` | number | Number of workers |
| `retries` | number | Number of retries |
| `timeout` | number | Total test timeout |
| `reporter` | string | array | Reporter |
| `forbidOnly` | boolean | Forbid `only` |
| `testMatch` | string | RegExp | Test match pattern |
| `testIgnore` | string | RegExp | Ignore pattern |
| `projects` | Project[] | Project list |
| `webServer` | object | Web server configuration |
| `globalSetup` | string | Global Setup script path |
| `globalTeardown` | string | Global Teardown script path |
| `use` | object | Shared configuration |
| `expect` | object | Assertion configuration |
* * *
## TestInfo Interface
| Field/Method | Description |
| --- | --- |
| `testInfo.title` | Test name |
| `testInfo.file` | Test file path |
| `testInfo.line` | Line number of the test |
| `testInfo.column` | Column number of the test |
| `testInfo.expectedStatus` | Expected status: `'passed'` \| `'failed'` \| `'skipped'` |
| `testInfo.timeout` | Current test timeout |
| `testInfo.annotations` | Annotation list |
| `testInfo.attachments` | Attachment list |
| `testInfo.project.name` | Current project name |
| `testInfo.retry` | Current retry count |
| `testInfo.parallelIndex` | Parallel index |
| `testInfo.skip(reason?)` | Skip test (dynamic) |
| `testInfo.fail(reason?)` | Mark as failed (dynamic) |
| `testInfo.attach(name, options?)` | Attach file to report |
* * *
## Fixtures Interface
| Fixture | Type | Description |
| --- | --- | --- |
| `page` | Page | Browser tab |
| `context` | BrowserContext | Browser context |
| `browser` | Browser | Browser instance |
| `browserName` | string | Browser name |
| `request` | APIRequestContext | HTTP request client |
* * *
## WorkerInfo Interface
| Field | Description |
| --- | --- |
| `workerInfo.project.name` | Project name |
| `workerInfo.parallelIndex` | Worker parallel index |
| `workerInfo.config` | FullConfig object |
* * *
## Reporter Interface
| Method | Description |
| --- | --- |
| `reporter.onBegin(config, suite)` | Test begins |
| `reporter.onTestBegin(test)` | Single test begins |
| `reporter.onTestEnd(test, result)` | Single test ends |
| `reporter.onStepBegin(test, result, step)` | Step begins |
| `reporter.onStepEnd(test, result, step)` | Step ends |
| `reporter.onEnd(result)` | Test ends |
| `reporter.onExit()` | Process exits |
| `reporter.printsToStdio()` | Whether to output to stdout |
* * *
## Suite Class
| Field | Description |
| --- | --- |
| `suite.title` | Suite name |
| `suite.suites` | Child Suite list |
| `suite.tests` | Test list |
| `suite.location` | Suite location |
* * *
## TestCase Class
| Field | Description |
| --- | --- |
| `test.title` | Test name |
| `test.location` | Test location |
| `test.expectedStatus` | Expected status |
| `test.annotations` | Annotation list |
| `test.parent` | Parent Suite |
| `test.id()` | Test ID |
* * *
## TestResult Class
| Field | Description |
| --- | --- |
| `result.status` | Status: `'passed'` \| `'failed'` \| `'skipped'` \| `'interrupted'` |
| `result.duration` | Execution duration (milliseconds) |
| `result.error` | Error message (TestError) |
| `result.attachments` | Attachment list |
| `result.stdout` | Standard output |
| `result.stderr` | Standard error |
* * *
## Electron API
| Method | Description |
| --- | --- |
| `electron.launch(options?)` | Launch Electron application |
* * *
## ElectronApplication Class
| Method | Description |
| --- | --- |
| `electronApp.firstWindow()` | Get first window |
| `electronApp.windows()` | Get all windows |
| `electronApp.close()` | Close application |
* * *
## Android API
| Method/Class | Description |
| --- | --- |
| `android.devices()` | Get list of connected devices |
| `AndroidDevice` | Android device object |
| `AndroidWebView` | WebView object |
YouTip