| name | e2e-test |
| description | Generate Playwright E2E tests following project conventions (Tauri fixture, storage isolation, helpers). |
Generate Playwright E2E tests for the specified feature or user flow.
Input: Feature or flow to test. Example: /e2e-test profile selection persistence across reload
Steps
- Determine spec file path:
e2e/<descriptive-name>.spec.ts
- Read relevant source to understand the UI flow being tested
- Generate the spec following project conventions (see below)
- Verify syntax:
npx playwright test e2e/<spec-file> --list (lists tests without running)
Project Conventions
Mock Pattern for Tauri Commands
test.use({
tauriMockOptions: {
invoke: {
list_manifest_files: () => [
{ name: 'my-profile', path: 'C:\\profiles\\my-profile.jsonc', displayName: 'My Profile' }
],
check_file_exists: () => true,
}
}
});
Spec Template
import { test, expect } from './fixtures/tauri';
import { forceDefaultMode, goToApplyPage } from './helpers/ui-mode';
test.describe('Feature Name', () => {
test.use({
tauriMockOptions: {
invoke: {
list_manifest_files: () => [],
}
}
});
test.beforeEach(async ({ page }) => {
await page.goto('/');
await page.waitForLoadState('networkidle');
});
test('describes expected behavior', async ({ page }) => {
await expect(page.getByRole('heading', { name: /expected/i })).toBeVisible();
});
});
Known Pitfalls
- Radix Select cannot be automated with standard click → option. Use
page.dispatchEvent() workaround or evaluate-based selection.
- Always
waitForLoadState('networkidle') after goto('/') before interacting
- Use
{ timeout: 5000 } on assertions that depend on async rendering
- Prefer
getByRole and getByText locators. Use data-testid locators only for structural elements (cards, panels)