Skill: Playwright Testing
When to Use
Use this skill when writing Playwright tests, running visual regression tests, or debugging browser-test failures.
Core Workflow
Install Chromium once:
npx playwright install chromiumRun functional tests:
npm test npm run test:polling npm run test:guiRun visual regression tests:
npm run test:init npm run test:visual
Writing Tests
- Place specs in
playwright/tests/. - Put shared browser and demo helpers in
playwright/support/. - Follow existing patterns from
basic.spec.js,pane.spec.js, andtext.spec.js. - Use web-first assertions instead of fixed sleeps when possible.
- Tests use port
8098; the Playwright config starts the Visdom server.
CI Behavior
- Functional tests run in WebSocket and polling modes.
- WebSocket tests run on the supported Python version matrix.
- Visual regression compares PR screenshots against a base-branch baseline.
Guardrails
- Keep WebSocket and polling assertions equivalent.
- Make sure port
8098is free before running tests locally. - Run
test:initbeforetest:visualto establish baselines. - If visual tests fail, inspect the generated diff and trace before changing thresholds.
- Do not commit generated reports or test results.
Documentation
playwright/playwright.config.jsplaywright.polling.config.js.github/workflows/AGENTS.mdCONTRIBUTING.md
Tests
- Functional:
npm testandnpm run test:polling - Visual:
npm run test:initfollowed bynpm run test:visual