Playwright-based system tests for the Cosy Domain Provider frontend.
- Node.js v18 or higher
- Backend running at
http://localhost:8080 - Frontend running at
http://localhost:5173(or setBASE_URLenv var to point elsewhere)
# Install dependencies
npm install
# Install Playwright browsers (only needed once, or after updating Playwright)
npx playwright install --with-deps chromium| Command | Description |
|---|---|
npm test |
Run all tests headless (localhost) |
npm run test:staging |
Run the default staging suite with one worker |
npm run test:staging:admin |
Run the Admin Portal smoke tests |
npm run test:staging:mail |
Run staging with opt-in mail-flow tests enabled |
npm run test:staging:mfa-ui |
Run the visible MFA setup/login UI test |
npm run test:staging:stripe |
Run the Stripe Checkout subscription test |
npm run test:headed |
Run with visible browser window |
npm run test:ui |
Open Playwright UI mode (interactive, with watch) |
npm run test:debug |
Step through tests in debug mode |
npm run report |
Open the last HTML test report |
Run a single spec file:
npx playwright test tests/specs/smoke.spec.tstest:staging sets BASE_URL automatically. Credentials are loaded from .env.local:
# .env.local (gitignored — create once, never commit)
STAGING_AUTH_USERNAME=youruser
STAGING_AUTH_PASSWORD=yourpassword
MAIL_SERVICE_API_KEY=mailbox-api-tokennpm run test:stagingIn CI, set STAGING_AUTH_USERNAME, STAGING_AUTH_PASSWORD, and MAIL_SERVICE_API_KEY as repository secrets and pass them as environment variables — .env.local is skipped when the variables are already present in the environment.
The Staging credentials are only used for the Staging barrier. The app test user is created during Playwright global setup via /api/v1/auth/register, verified through the test mailbox, secured with MFA, and written to .auth/test-user.json for fixtures that require an authenticated app user. The authenticated browser state after password + MFA login is stored in .auth/app-user-state.json.
By default, staging only sends the setup verification mail. Additional mail-heavy specs are skipped unless RUN_MAIL_FLOW_TESTS=1 is set, or npm run test:staging:mail is used.
At the end of a suite, registered test users are deleted through globalTeardown.
To watch the global setup verification browser:
HEADED_SETUP=1 SLOW_MO_MS=500 npm run test:staging -- tests/specs/authenticated-setup.spec.ts --headedTo watch the MFA setup and MFA login challenge in the browser:
npm run test:staging:mfa-ui -- --headed --timeout=120000tests/
├── fixtures/ # Custom test fixtures (extended test object)
├── helpers/ # Shared helper functions and test data utilities
├── pages/ # Page Object Models grouped by feature area
└── specs/ # Test specs (one file per feature area)
Page objects are grouped under tests/pages/{admin,auth,billing,domains,public} and re-exported through @pages/index.
| Repository | Description |
|---|---|
| Cosy-Domain-Provider-Backend | Spring Boot backend |
| Cosy-Domain-Provider-Frontend | React + Vite frontend |