According to Playwright Tag-Tests Docs
Tagging test looks like this:
test('My test @foo', async ({ page }) => {
// ...
});
But there is no mention of multi tagging.
I'm looking for something like:
test('My test @foo, bar', async ({ page }) => {});
or
test('My test @foo bar', async ({ page }) => {});
I've found a solution, and it's very simple and straight-forward, simply separate tags with space:
test('My test @foo @bar', async ({ page }) => {
// ...
});
Execution:
// foo OR bar
npx playwright test --grep "@foo|@bar"
// foo AND bar
npx playwright test --grep "(?=.*@foo)(?=.*@bar)"
Since v1.42 it can be achived using a new tags object too:
test('multi tags example', {
tag: ['@foo', '@bar'],
}, async ({ page }) => {
// ...
});