Playwright tests (Aether)
Quick guide for running and editing the Playwright tests in this repo.
Running tests
- Run the full test suite (uses
playwright.config.ts):
npx playwright test -c playwright.config.ts
- Run a single test file:
npx playwright test tests/path/to/file.test.ts -c playwright.config.ts
- Run a single test by title (grep):
npx playwright test -g "Badge - interaction" -c playwright.config.ts
Notes
- Tests in
tests/disabled/are ignored by default (seeplaywright.config.ts). Move flaky or environment-dependent tests there. - The runner starts a local dev server via
npm run devby default (seeplaywright.config.ts:webServer). Ensure the app can start on port5173or update the config.
Writing / modifying tests
- Tests are TypeScript files under
tests/and should export Playwrighttestblocks. Example header:
import { test, expect } from '@playwright/test';
test('example', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/OSIT/);
});
- Use
page.route('**/v3/**', handler)to mock backend responses for deterministic tests. - Use
page.addInitScriptto injectae_loclocalStorage defaults when tests need authenticated/admin state.
Adding new tests
- Create a new file
tests/my_feature.test.ts. - Keep tests focused and deterministic: mock network calls and avoid relying on external services.
- Place environment-sensitive tests in
tests/disabled/so they are not run in CI by default.
Committing
- Stage and commit test changes as usual. Example:
git add tests/
git commit -m "test: add <description>"
Help
- If a test fails due to external network calls or platform-specific behavior, try mocking the relevant endpoints and move the test to
tests/disabledif it cannot be made deterministic.