microsoft / microsoft/playwright

[Feature]: add a custom --after filter for test execution

Open
#42,763 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
96.3k
Forks
6.5k
Avg merge
1d 6h
Merged PRs (30d)
180

Description

### 🚀 Feature Request

Add support for a CLI flag that allows users to run only the tests discovered after a specified test name, while preserving the existing parallel/serial test runner behavior.

Example:
`npx playwright test --after "login"`

This should run only the tests that appear after the matching test in the discovered test order, without running earlier tests.

### Example

Currently, Playwright supports selecting tests by file or grep, but it does not provide a way to select a subset based on execution order relative to another test. This is useful in workflows where:

- a setup or prerequisite test must run first
- a user wants to rerun only the remaining tests after a known checkpoint
- a large suite is being debugged incrementally

Proposed behavior
Add a new CLI option:

`--after `

Behavior:

- Playwright discovers all tests in the configured order
- it finds the matching test name
- it removes all tests before that match
- it schedules only the remaining tests for execution
- the remaining tests can still be distributed across workers in parallel/serial mode

This means the flag acts as a pre-distribution filter, not as a strict runtime dependency.

Example:

If the discovered order is:

- setup
- login
- checkout
- payment
- logout

Then:
`npx playwright test --after "login"`

should run:
- checkout
- payment
- logout
and not setup or login.

### Motivation

This gives users a lightweight way to:
- continue execution from a known stage
- rerun only post-setup flow
- reduce debugging time for large test suites
- avoid editing files or test names just to select a subset

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Playwright's test CLI option handling and follow how discovered tests are filtered before worker distribution. Check the existing test-selection and parallel/serial runner tests first; done means --after excludes the named test and all earlier tests while preserving the remaining execution behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.