Comment on page
Playwright Tags
How to tag Playwright executions in Currents
Note
A tag is limited to 128 characters
Using tags is a common technique for better classifying recorded test results and getting relevant insights about the test suite. Here are several examples of how software teams use tags:
- manage ownership - e.g. use the team name as a tag
- categorize product features - e.g. tagging
onboarding
flow tests - manage tests lifecycle - e.g. tag newly introduced tests as
ustable
The tags are available for producing meaningful reports, exploring metrics, narrowing down Slack notifications, filtering the results, API responses and more.

Example of using Tags for narrowing down Flakiness chart in Currents Dashboard
Currents parses the test titles and recognizes the conventional Playwright Tags that appear in test definitions. For example, recording the results of the following tests to Currents:
test('Test login page @fast', async ({ page }) => {
// ...
});
test('Test full report @slow', async ({ page }) => {
// ...
});
...will create a run with tags:
fast
and slow

Example of Currents run created with tags @fast and @slow
Tagging a test group (
test.describe
) will "apply" the tag to every included individual test, as well as to the created run. For example, given the following test definition:test.describe("test group @groupTag", () => { // 👈🏻 not the test group tag
test('Test login page @fast', async ({ page }) => {
// ...
});
test('Test full report @slow', async ({ page }) => {
// ...
});
})
Currents will assign the following tags to the created items:
Item | Tags |
---|---|
Run | groupTag , fast , slow |
Test login page @fast | groupTag , fast |
Test full report @slow | groupTag , slow |

Example of a run created with various tags when tagging a test group
If certain tags are excluded from the execution, for example by using
--grep
CLI option, only the included tests (and their tags) will be used for tagging.$ npx playwright test --grep @fast

Applying tags when certain tests are excluded using --grep CLI option
It is often desired to ignore the tags included in the test title to have a consistent view of the test history or preserve the metrics.
For example, let's say you have a test named
Test login page @slow
, eventually, you add another tag and the test title becomes Test login page @slow @login
. However, adding the tag will change the test name - as a result, the history of previous executions and metrics will be lost. To remove the tags from the recorded test titles, add
--pwc-remove-title-tags
CLI option or removeTitleTags
reporter configuration. Activating the removal will strip the tags from test titles (including test group names) when recording to Currents dashboard. In the example above,
Test login page @slow
and Test login page @slow @login
will be recorded as Test login page
and tags slow
+ login
will be attached to the test recording.You can disable parsing test title tags altogether by adding
--pwc-disable-title-tags
CLI option. See @currents/playwright for additional configuration options, available in versions 0.11.0+
.In addition to encoding tags in test titles, you can explicitly tag the whole run (or a playwright project). There are multiple ways to explicitly tag a run.
If you're using
pwc
executable script to run the tests, use --tag
CLI option:npx pwc --tag tagA,tagB --tag tagC
You can provide a comma-separated list of tags, provide multiple
--tag
options, or use both. You can tag playwright execution by providing a list of
tag
values to Currents Reporter in your playwright.config.ts
file. For example:import { currentsReporter } from '@currents/playwright';
// ...
reporter: [
currentsReporter({
ciBuildId: process.env.CURRENTS_CI_BUILD_ID,
recordKey: process.env.CURRENTS_RECORD_KEY,
projectId: process.env.CURRENTS_PROJECT_ID,
tag: ["runTagA", "runTagB"],
}),
/* other reporters, if exist, e.g.:
["html"]
*/
]
You can tag playwright execution by setting the
CURRENTS_TAG
environment variable value to a comma-separated list of tags, for example, with @currents/playwright reporter configured:CURRENTS_TAG=tagA,tagB npx playwright run ...
If there are multiple definitions of run-level tags, Curretns will pick the tags as follows:
- Use comma-separated tags of
CURRENTS_TAG
environment variable, if provided; otherwise - Use
--tag
CLI option values, if provided; otherwise - Use reporter configuration values, if provided; otherwise
- add no run tags
You can tag Playwright projects by using
metadata.pwc.tags
field in the project's configuration. For example, given the following Playwright project configuration:// playwright.config.ts
// ...
{
projects: [
{
name: "Desktop Chrome",
metadata: {
pwc: {
tags: ["desktop", "chrome"], // 👈🏻 note the tags
},
},
use: {
...devices["Desktop Chrome"],
},
},
// ...
]
}
Currents will create a run tagged with
desktop
, chrome
+ all the tags extracted from individual tests.
Example of using project-level tags
Currents stores the recorded results as Runs, Groups, Spec Files and Tests. The items are available in the dashboard and also in API responses.
- Run - is a high-level abstraction that represents a CI execution of a test suite
- Group - is a subset of recorded tests - representing a playwright project
- Spec File - a recorded execution of tests in a file
- Test Recording - a recorded execution of a test case
Each of the items can have multiple tags attached, and tagging a particular item can affect the tags of another item. When applying tags, Currents follows the rules below:
- Apply explicit run-level and project-level tags "downwards" to all the included items
- Apply individual test tags "upwards" to spec files, projects and runs
The table below shows the details of how the tags are applied:
Item | Tags Applied |
---|---|
Run |
|
Group/Project |
|
Spec File Recording |
|
Test Case Recording |
|
For example, given the following tests:
test('Test login A @tagA', async ({ page }) => {
// ...
});
test('Test login B @tagB', async ({ page }) => {
// ...
});
And adding a run-level tag
runTag01
using the command: pwc ... --tag runTag01
will result in the following tags:
Application of tags example
Item | Applied Tags |
---|---|
Run | runTag01 , tagA , tagB |
Test login A | runTag01, tagA |
Test login B | runTag01, tagB |