Running tests: the command line, headed mode, filters and tags
Run all tests, one file, one browser or only the tests with a tag. Watch a test in a visible browser, and learn the flags that new users mix up.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: choosing which television channel to test. Sometimes you check one channel. Sometimes you check a group, such as the news channels. Before a big night you check every channel.
Daily List is a to-do list app. Tom's suite grows, and a full run takes a while. When he fixes the Add task button, he wants only the tests about adding tasks. Before a release, Mei wants every test.
What it is: Playwright is a library that drives a real browser. This slice is the that starts . A command-line flag is an extra word, such as --headed, that changes the run. A test filter chooses which tests run. Selenium and Cypress have their own run commands, and the flag names are not the same.
Why it matters: Waiting for the full suite slows every fix. From the terminal Tom can run one file, one tag, or one browser, and see the result while he still remembers the change. A filter can also hide a fault in a file he did not run, so the full suite still runs before a release.
Choosing one channel does not repair the other channels. A green filtered run is not a green suite.
(SYNTHETIC / TRAINING ONLY: Daily List, its test site, and every person named here are made up.)
PLAIN WORDS · 3 in this section
- playwright
- a free Microsoft tool that drives a browser for tests
- selenium
- A free tool that drives a web browser for checks.
- cypress
- A free tool that drives a web browser for checks.
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Choosing which tests to run, and how, so feedback is quick but nothing is skipped on release day.
- Pick the tests
- Pick the browser
- Pick headed or headless
- Read the report
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| A television with many channels | The test suite |
| Checking one channel | Running one file |
| Checking a group of channels | Running a tag or a title match |
| Checking every channel before an event | Running the full suite |
WHERE THIS PICTURE STOPS
- Switching channels changes nothing else. A filtered run can hide a fault in a part you did not run.
- A channel guide is printed once. Tags and titles must be kept up to date.
- You can see a channel on the screen. A headless run has no screen.
HOOK
One, some or all.
REMEMBER IT THIS WAY
A sequence: the real steps, in order.
Before you type, ask: one file, a group, or every test? Do I need to watch the browser?
| In the trick | What it stands for |
|---|---|
| One file | another word picks one test file |
| Every test | before a release he wants every test |
| Watch | one word makes the browser visible so he can watch |
TELL A FRIEND
Pick one channel, a group of channels or all of them, before you check the television.
OFTEN MIXED UP WITH Record a test with codegen, then make it yours. The codegen lesson writes a first draft of a test. This lesson runs it, alone or in a group.
Sources & standards — 4 sources
- Market practice
Command line (Playwright documentation) ↗ — Microsoft (Playwright) · npx playwright test takes flags such as --headed, --grep, --grep-invert, --project and --ui; show-report serves the last HTML report (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Running and debugging tests (Playwright documentation) ↗ — Microsoft (Playwright) · Tests run headless by default; --headed shows the browser; a file name or title can be given to run a subset; show-report opens the report (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Annotations (Playwright documentation) ↗ — Microsoft (Playwright) · Tests can carry tags, set with a tag option or an @ token in the title; each tag starts with @; npx playwright test --grep @fast runs the tagged tests and --grep-invert skips them (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Configuration (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
PRACTISE AND KEEP
Sources for this topic — 4 sources
- Market practice
Command line (Playwright documentation) ↗ — Microsoft (Playwright) · npx playwright test takes flags such as --headed, --grep, --grep-invert, --project and --ui; show-report serves the last HTML report (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Running and debugging tests (Playwright documentation) ↗ — Microsoft (Playwright) · Tests run headless by default; --headed shows the browser; a file name or title can be given to run a subset; show-report opens the report (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Annotations (Playwright documentation) ↗ — Microsoft (Playwright) · Tests can carry tags, set with a tag option or an @ token in the title; each tag starts with @; npx playwright test --grep @fast runs the tagged tests and --grep-invert skips them (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Configuration (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.