End-to-end testing a Rsbuild + React app with
@rstest/playwright. The tests
run in Rstest's Node.js workers and use Playwright to drive a real Chromium
page, which makes them a natural part of the same Rstest workflow as unit
tests.
- The built Rsbuild + React app renders in a real Chromium page:
tests/home.test.tsservesdist/with theservefixture from@rstest/playwright, opens it, and checks the page title and heading withtoHaveTitleandtoHaveText.
pnpm install
# Install the Chromium binary used by Playwright (one-time setup):
pnpm exec playwright install chromium
# Build the app and run the E2E tests:
pnpm testYou can also start the app itself with pnpm dev or pnpm preview.
- Run with
PWDEBUG=1 rstestto launch Chromium in headed mode with devtools. - Set
RSTEST_PLAYWRIGHT_TRACE=retain-on-failure rstestto capture a Playwright trace for failing tests, then open it withnpx playwright show-trace <trace.zip>.