docs(test-runner): add note about custom annotations (#12681)
o-authored-by: Dmitry Gozman <dgozman@gmail.com>
This commit is contained in:
parent
95c774cf84
commit
d15910b450
|
|
@ -212,3 +212,25 @@ test('user profile', async ({ page }) => {
|
|||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
## Custom annotations
|
||||
|
||||
It's also possible to add custom metadata in the form of annotations to your tests. Annotations are key/value pairs accessible via [`test.info().annotations`](./api/class-testinfo#test-info-annotations). Many reporters show annotations, for example `'html'`.
|
||||
|
||||
```js js-flavor=js
|
||||
// example.spec.js
|
||||
|
||||
test('user profile', async ({ page }) => {
|
||||
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/<some-issue>' });
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
```js js-flavor=ts
|
||||
// example.spec.ts
|
||||
|
||||
test('user profile', async ({ page }) => {
|
||||
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/<some-issue>' });
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in a new issue