Playwright Tags
How to tag Playwright executions in Currents
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 testsmanage 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.

Playwright Tags
Test title tags
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

Test group tags
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", () => { // 👈🏻 note 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:
Run
groupTag
, fast
, slow
Test login page @fast
groupTag
, fast
Test full report @slow
groupTag
, slow

Tags with --grep
applied
--grep
appliedIf 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

Removing tags from test titles
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.
Disabling parsing test title tags
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+
.
Run-level Tags
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.
Tagging a run using pwc
CLI option
pwc
CLI optionIf 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.
Tagging a run using Reporter configuration
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"]
*/
]
Tagging a run using CURRENTS_TAG
environment variable
CURRENTS_TAG
environment variableYou 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 ...
Precedence of configuration options
If there are multiple definitions of run-level tags, Currents will pick the tags as follows:
Use comma-separated tags of
CURRENTS_TAG
environment variable, if provided; otherwiseUse
--tag
CLI option values, if provided; otherwiseUse reporter configuration values, if provided; otherwise
add no run tags
Project-level 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.

How Tags are Applied
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:
Run
Own run-level tags
Tags of all the included projects
Tags of all the included test cases
Group/Project
Run-level tags
Own project-level tags
Tags of all the included test cases
Spec File Recording
Run-level tags
Project-level tags
Tags of all the included test cases
Test Case Recording
Run-level tags
Project-level tags
Own test title tags
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:

Run
runTag01
, tagA
, tagB
Test login A
runTag01, tagA
Test login B
runTag01, tagB
Last updated
Was this helpful?