> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/~/changes/TYKBeqcc7WyqjmgOzWzB/guides/playwright-annotations.md).

# Playwright Annotations

Using Playwright Annotations to enhance reporting to Currents dashboard

{% hint style="info" %}
Requires `@currents/playwright` 1.5.0+
{% endhint %}

[Playwright Annotations](https://playwright.dev/docs/test-annotations) is a flexible way to add additional information about tests, like:

* ownership information
* metadata
* links to external resources (Jira ticket, GitHub issue)
* notes

Together with [Playwright Tags](/~/changes/TYKBeqcc7WyqjmgOzWzB/guides/playwright-tags.md) it allows augmenting your testing suite more data for easier managing, better reporting and improved integration.&#x20;

You can add an annotation to a test by setting `annotations` object to `test` definition or invoking `testInfo.annotations.push` , for example

```typescript
test("annotated test", {
    annotation: {
      type: "issue",
      description: "https://github.com/microsoft/playwright/issues/23180",
    },
}, async ({ page }, testInfo) => {
  testInfo.annotations.push({
    type: "note",
    description: "This is a note",
  });

  testInfo.annotations.push({
    type: "jira",
    description: "https://jira.company.io/ticket/JIRA-123",
  });

  testInfo.annotations.push({
    type: "owner",
    description: "johnsmith",
  });
});
```

Currents displays the annotations for recorded tests:

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2Fd9QXughSRcvO7r1paqJ0%2Fcurrents-2024-08-21-23.22.12%402x.png?alt=media&amp;token=54bd5725-ae12-4ad3-b54b-7a8378ffc2d5" alt=""><figcaption><p>Playwright annotations in Currents</p></figcaption></figure>

Currents will apply the following modifiations to annotations

* types: `skip, fixme, fail` are reserved by Playwright
* `32` max distinct annotations per test, extra annotations will be truncated (sortedby the order of appearance)
* `type` field is limited to `256` characters, the values will be trimmed and truncated to the max length
* `description` field is limited to `2048` characters, the values will be trimmed and truncated to the max length
* If `type` field is empty after trimming, the annotation will be ignored
* fields with the same `type` will be merged - their description will be merged into one field, separated by comma

### Test Owners

While Currents displays all the annotations related to a test, some annotation have a special meaning, for example - test owner.

To designate an owner of a test, add annotation with `type: owner`, for example:

```
testInfo.annotations.push({
  type: "owner",
  description: "johnsmith",
});
```

The value will appear in various areas of the dashboard so that your team can quickly identify the who owns the test.

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2FvYeJ9yUO8bIuK4ZTGhNG%2Fcurrents-2024-08-21-23.43.00%402x.png?alt=media&amp;token=c75a6881-f0e3-4946-a618-a385aab4b5e3" alt=""><figcaption><p>Showing test owner using annotations in Currents </p></figcaption></figure>

#### Slack notification for Test Owners

Currents will mention the test owners when their tests fail via Slack (if Slack integration is enabled). Currents will send the list of failed tests together with the associated owners - if the owner field value container their [Slack username](https://www.highviewapps.com/kb/how-do-i-find-my-slack-username/), they will activate the "mention" notification.

* Add Slack username, like `johnsmith` to notify individual users
* Add `<!channel>` to notify the whole channel associated with the Slack integration (equivalent to typing `@channel` in Slack UI)

You can specify multiple owners using comma-separated value, for example `user1, user2`

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2FLoB5f9ezRanu4h5GEkHe%2Fcurrents-2024-08-22-00.25.37%402x.png?alt=media&amp;token=c800149d-3529-4f39-9d04-e541885a00c9" alt=""><figcaption><p>Using Slack to activate Slack notifications</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.currents.dev/~/changes/TYKBeqcc7WyqjmgOzWzB/guides/playwright-annotations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
