Repository navigation
Description
Problem
e2e/helpers/testData.ts supplies shared TEST_USER/TEST_ADMIN accounts, and its cleanup deletes all Submissions for the shared member. playwright.config.ts enables parallel files locally. Serial mode inside one spec does not prevent another file deleting the first file's data.
Plant and coral specs duplicate form workflows and fixed sleeps (e2e/plant-submissions.spec.ts, e2e/coral-submissions.spec.ts). The review found 79 waitForTimeout call sites across E2E TypeScript. These waits neither establish readiness nor explain what failed. Helpers also hard-code db/database.db, independently of the server under test.
Proposed change
- Introduce Playwright fixtures that allocate run/test-unique members and committee members, record their created resources, and clean up only those resources. Keep immutable reference Species separate from mutable test-owned Submissions.
- Give the test server and database helpers one explicit disposable database configuration. Do not clean a development database or reuse an unrelated running server for mutation tests. Keep remote/staging workflows separate.
- Extend existing auth/Tom Select helpers with domain actions such as opening a Submission form, selecting Species type, waiting for the HTMX replacement, choosing a Name, and saving a draft. Use locator assertions, response completion plus resulting DOM assertions, or a specific initialization condition rather than
networkidleplus a sleep. - Share the repeated plant/coral interaction sequence, optionally with table-driven shared cases, while retaining Program-specific field assertions and independently useful test names.
- Start with plant/coral and the helpers they share; remove fixed waits elsewhere when migrating a concrete workflow, not through blind replacement.
Acceptance criteria and tests
- Plant and coral suites can execute together with at least two workers without cross-test deletion or shared mutable members.
- Teardown removes only test-owned resources and leaves another active test's Submissions intact.
- Both the server and setup/cleanup use the same disposable database; an unrelated existing server cannot be selected silently.
- Migrated flows contain no fixed readiness sleeps and fail at the unmet observable condition.
- Program-specific form visibility, draft, and submit assertions retain their meaning.
- Run the affected E2E specs with two workers and a short repeat run, retain traces on failure, and document local/CI fixture usage. Run helper tests and typecheck.
Related and non-goals
Supports #13. #476's staging fixture command has a different lifecycle and safety boundary. This does not require a browser rewrite, new frontend framework, or deleting meaningful Program-specific coverage.
Review baseline
Source review at 78e0f1b2ff157e289c237d533f1406302d95118e. Repository typechecking and the focused specialty-award/level-progress tests passed during the review; these are not reproductions of the new failure scenarios above. Full database and E2E suites were not run.
Related proposals from this review
- Separate Portal app construction from listeners and background-job startup #539: Separate Portal app construction from listeners and background-job startup
- Consolidate SQLite test setup and make fixture/foreign-key choices explicit #540: Consolidate SQLite test setup and make fixture/foreign-key choices explicit
Activity