Saltar a contenido

Playwright E2E migration

Date: 2026-05-06 Tracking issue: https://github.com/larancibia/labis-eppa-software/issues/21

Decision

Adopt Playwright as the new EPPA end-to-end test harness and keep Cypress only while existing coverage is migrated.

Why

  • Cypress is currently failing locally before tests execute with spawn .../node EACCES in the config process.
  • Playwright starts the app servers from config, records traces on retry, and does not need the Cypress Electron/config subprocess path that is failing on this Mac.
  • Playwright's locator and auto-wait model maps better to EPPA flows where we need to wait for visible UI state, API responses, downloads, and screenshots.
  • Playwright has an MCP server maintained by Microsoft, so it can later support interactive UI inspection and agent-assisted debugging without inventing a custom browser bridge.

References:

  • Playwright actionability and auto-waiting: https://playwright.dev/docs/actionability
  • Playwright trace viewer: https://playwright.dev/docs/trace-viewer
  • Microsoft Playwright MCP: https://github.com/microsoft/playwright-mcp

Pilot coverage

The initial Playwright pilot covers:

  • anterior cervico-cefalica image upload, marker import, calibration, reference line, API status, and rounded visible result value.
  • posterior full region workflow with API status and rounded visible result values.
  • lateral right and left cervico-cefalica workflows with rounded visible result values.

Local validation:

  • npm run typecheck: passing.
  • PYTHON=/tmp/labis-eppa-venv311/bin/python npm run test:e2e:playwright: 3 passing in 10.8 seconds.

Migration order

  1. Keep Cypress passing and disabled video recording until equivalent Playwright coverage exists.
  2. Port analysis workflows first because they validate MATLAB-equivalent clinical outputs.
  3. Port marker capture next because it exercises the most fragile UI flow.
  4. Port video baseline screenshots to Playwright screenshots.
  5. Remove Cypress once Playwright covers the same behavior and CI is green.

Commands

npm run test:e2e:playwright
npm run test:e2e:playwright:ui
npm run test:e2e:playwright:report

For a fresh machine:

npx playwright install chromium