name: write-e2e-cases
description: Use when adding or updating Rsbuild end-to-end tests in e2e/cases, including new feature coverage, bug reproduction, and regression prevention.
Write E2E Cases
Steps
Review uncommitted git changes to define test scope and target behavior.
Read
e2e/README.mdand follow its conventions.Prefer
@e2e/helpermethods (for exampledev,build,getDistFiles,findFile,getFileContent,expectFile, andexpectFileWithContent) to keep tests minimal, including file and file-content assertions.Add Playwright cases under
e2e/cases, following existing directory patterns.Use short, direct, and stable assertions. Avoid redundant setup and checks.
Run
pnpm e2eto validate.
Case Structure
- Include a
srcdirectory in every case (required). - Prefer putting static Rsbuild configurations in
rsbuild.config.tsto enable easier debugging vianpx rsbuild. - Use inline config for dynamic values or minor per-test variations.
- Split into multiple case directories when cases need different
srccode or different Rsbuild configs.
Constraints
- If tests can pass only after source-code changes, do not change source code directly. Explain the required source change and ask the user before proceeding.