Every test carries at least one tag. Tags decide which suite a test belongs to and whether it may run in production.
| Tag | Constant | Meaning | Runs in |
|---|---|---|---|
@smoke |
TAGS.SMOKE |
fast checks of core pages and flows | every pull request (dev) |
@integration |
TAGS.INTEGRATION |
multi-step flows across pages, including data reads | nightly (qa, staging) |
@prod |
TAGS.PROD |
read-only checks safe for production | production smoke (weekdays) |
Tags combine. A test can be @smoke @prod, which makes it part of the pull request suite and the production suite.
Use Playwright's tag option, with the constants from src/config/tags.js:
const { test } = require("../../src/fixtures");
const { TAGS } = require("../../src/config/tags");
test(
"Verify page identity, heading, and logo",
{ tag: [TAGS.SMOKE, TAGS.PROD] },
async ({ page }) => {
// ...
}
);Do not put tags in the title. The valid-test-tags lint rule checks that every tag starts with @.
Answer the three questions in order. If any answer is "no", the test is not @prod.
flowchart TD
Q1{"Does the test only read or navigate?"} -- "no" --> NO["Not @prod"]
Q1 -- "yes" --> Q2{"Does it create, change, or delete any record?"}
Q2 -- "yes" --> NO
Q2 -- "no" --> Q3{"Could a failed attempt lock an account or send email?"}
Q3 -- "yes" --> NO
Q3 -- "no" --> YES["May be tagged @prod"]
Text alternative: a test may be @prod only if it reads or navigates, creates or changes nothing, and cannot lock an
account or send email. Otherwise it is not @prod.
Examples from this repo:
| Test | Tags | Why |
|---|---|---|
| Login page identity, heading, and logo | @smoke @prod |
read-only |
| Empty-form validation messages | @integration @prod |
client-side only |
| Invalid credentials alert | @integration |
a failed login can lock an account |
| Admin user search | @integration |
reads user records, which a production run must not do |
- Use
@smokefor the fewest checks that prove the application is up and the main pages work. It must be fast. - Use
@integrationfor flows that cross pages or depend on data. These run less often, so they can be slower. - A test that is slow or fragile belongs in
@integration, not@smoke.
bun run test:smoke # @smoke
bun run test:integration # @integration
bun run test:prod # @prod
bun run test:nightly # @smoke or @integration (the nightly selection)Combine with an environment: TEST_ENV=qa bun run test:smoke.
test:prod filters by the @prod tag. test:production selects the production environment. Use
TEST_ENV=production bun run test:prod to run the @prod tests in production.
Add the constant to src/config/tags.js, document it in this file, and update the CI workflow that should run it.
A new tag is a change to the quality gates, so update the README and docs/guardrails.md in the same pull request.