Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesIn Playwright Test, tags are labels you attach to tests and select with --grep or --grep-invert. Use them to run cross-cutting subsets such as smoke or checkout tests; use projects instead when you need a distinct configuration, such as a browser or environment. Every tag must start with @.
How Playwright tags work
A tag classifies a test for reporting and filtering. You can attach it to an individual test, put it in the test title, or apply it to a describe group so its tests share the label. A test can carry multiple tags.
As an Amazon Associate I earn from qualifying purchases.
The examples below use @smoke, @checkout, and @critical as illustrative labels. Playwright documents the mechanics, not a required naming scheme. See Playwright’s tag documentation and the Test API.
Recommended Free Tools
Add a tag with the test details object
import { test, expect } from '@playwright/test';
test('checkout accepts a valid card', {
tag: '@smoke',
}, async ({ page }) => {
// test steps
});
The details-object form keeps the classification separate from the human-readable test title.
#1 Best Overall
Put a tag in the test title
test('checkout accepts a valid card @smoke', async ({ page }) => {
// test steps
});
Playwright recognizes an @-prefixed token in the title as a tag. This is concise, but it also makes the label part of the title text.
Apply a tag to a group or use multiple tags
test.describe('checkout', { tag: '@checkout' }, () => {
test('accepts a valid card', {
tag: ['@smoke', '@critical'],
}, async ({ page }) => {
// test steps
});
});
A group-level tag is useful when every test in the block belongs to the same category. Individual tests can add further tags. The examples use documented Playwright patterns; the labels themselves are team-defined.
Run tests by tag from the command line
Use --grep to include tests matching a regular expression and --grep-invert to exclude matches. The CLI also accepts the shorter -g form for --grep. See Playwright’s command-line reference.
Rank #2
Include one tag
npx playwright test --grep @smoke
Exclude a tag
npx playwright test --grep-invert @slow
Match either of two tags
npx playwright test --grep "@smoke|@critical"
The vertical bar is the regular-expression OR operator: this selects tests matching either expression.
Require both tags
npx playwright test --grep "(?=.*@smoke)(?=.*@critical)"
The lookaheads require both strings to occur in the matched test identity. Quote expressions containing shell-significant characters, and adjust the quoting if your shell uses different rules. OR and AND here are regular-expression patterns, not separate Playwright flags.
What grep actually matches
Playwright evaluates the grep expression against a combined string that includes the project name, file name, describe title, test title, and tags. As a result, a match is not guaranteed to come from a tag: a broad pattern can also match other text in that combined identity. The TestConfig API documents the filtering configuration.
Prefer distinctive tag names and patterns. For example, use an explicit @smoke label rather than a generic word that might also occur in a file or test title. This is a practical naming recommendation, not a Playwright rule.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Choose tags or projects for the right job
| Mechanism | Use it for | How to select | Scope |
|---|---|---|---|
| Tags | Cross-cutting classifications such as smoke, slow, or checkout | --grep or --grep-invert |
Individual tests, describe groups, or labels present in titles |
| Projects | Execution groups with shared settings, commonly browsers, devices, or environments | --project |
A configured group of test executions |
Projects and tags can be combined. For example, npx playwright test --project=chromium --grep @smoke runs tests matching the smoke pattern in the configured Chromium project. Read the Projects guide for project configuration and Running and debugging tests for test-running workflows.
Set a default filter in configuration when appropriate
testConfig.grep accepts a regular expression or an array of regular expressions. grepInvert sets an inverse filter. A config-level filter affects ordinary runs using that configuration, so use it only when the default selection is intentional. The CLI options --grep and --grep-invert are useful for one-off selections.
Rank #4
Configuration-level selection is different from configuration-level tagging: a grep filter chooses which tests run, while the tag configuration option labels tests in a run for reporting.
Use the run-level tag to label a run
The config option tag prepends one or more tags to each test in the report. Each configured tag must begin with @. This can identify run context, such as an environment label, but it does not select tests. See the TestConfig reference for the option.
Choose a tag scheme your team can apply consistently
Playwright does not prescribe a taxonomy, naming policy, or maximum number of tags. Agree on a small vocabulary based on decisions your team makes, and use each label consistently.
- Execution purpose:
@smokeor@regression. - Cost or cadence:
@slowfor tests you choose to run less often. - Domain:
@checkoutfor tests concerning a feature area.
When a whole describe block shares a classification, apply the tag at that group boundary; add individual tags where a test needs an additional classification. Keep tags meaningful and distinctive so people can predict what a filter selects.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot tag selection
- A tag filter selects no tests: Confirm the tag begins with
@, matches the spelling and case used in your test, and is included in the configuration and project you are running. - A filter selects unexpected tests: Remember that grep checks project, file, describe, and test names as well as tags. Make the expression more distinctive and inspect the matching test identities.
- A test has a tag but still runs during exclusion: Check that the
--grep-invertexpression matches the tag text and that the command is using the configuration you expect. - A configured run label does not change selection: That is expected: the config
tagoption labels tests in reports; usegreporgrepInvertto filter. - A shell rejects an AND or OR expression: Quote the regular expression, and follow the quoting rules for your shell.
Take a website screenshot without setting up a browser
For automated website screenshots outside a Playwright test run, ScreenshotNeo is a screenshot API and MCP server. Here is a one-request capture; see the API documentation for options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, and failed loads are not billed; AI agents can take screenshots through its MCP server. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for free.
Frequently Asked Questions
Does every Playwright tag need an @ prefix?
Yes. Playwright’s documentation says each tag must start with the @ symbol.
Does Playwright require a specific tag vocabulary or limit?
No prescribed taxonomy or maximum number of tags is established in the documented material. Teams can define labels that fit their own selection needs.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




