Task: Implement Medium-Priority Playwright E2E Coverage (State-Safe) #43

Closed
opened 2026-02-22 22:31:29 +00:00 by shaun · 0 comments
Owner

Task: Implement Medium-Priority Playwright E2E Coverage (State-Safe)

Goal

Add medium-priority e2e coverage for Trips without introducing flaky behavior or leaked state across tests.

Scope (Tests to Add)

  1. Transportation lifecycle
  • Create trip
  • Add transportation item (flight)
  • Edit transportation item
  • Delete transportation item
  • Assert UI updates at each step
  1. Lodging share permissions (admin/user behavior)
  • Regular user creates lodging on a trip
  • Verify expected visibility/editability for trip participants/admin
  • Verify non-authorized user cannot access/modify (redirect/forbidden behavior)
  1. Checklist + experience persistence
  • Add checklist and/or experience items
  • Toggle/check/reorder where supported
  • Reload page
  • Assert persisted state and ordering
  1. Package tours import/display happy path (admin)
  • Trigger provider import/sync from admin UI (or equivalent app flow)
  • Assert imported tours appear
  • Assert selected tour can be attached/linked to a trip planning context (if supported in UI)

Critical Guardrails (Learned from Recent Failures)

  1. Never mutate seeded shared user credentials
  • Do not change password for e2e_user or e2e_admin.
  • If testing password/set-local-credentials behavior, create a disposable user first.
  1. Keep tests order-independent
  • Any test must pass when run alone and in full suite.
  • No dependency on previous test side effects.
  1. Use disposable entities per test
  • Use unique suffix for usernames/emails/trip names (Date.now() + small random).
  • Do not rely on hardcoded mutable records beyond seeded login users.
  1. Reset session state safely
  • Use context.clearCookies() between identity switches.
  • Avoid brittle storage hacks unless strictly required.
  1. Use valid app routes only
  • Confirm real route paths from src/routes before writing tests (e.g. /trips/trips/upcoming, not guessed paths).

Implementation Constraints

  • Use robust selectors (getByRole, getByLabel, getByText, aria-label).
  • Avoid brittle CSS selectors unless no semantic locator exists.
  • No waitForTimeout sleeps.
  • Wait with URL/assertion readiness only.
  • Keep helpers for repeated flows (login, create trip, open add-to-trip menu).

File Plan

  • e2e/transportation-lifecycle.test.ts
  • e2e/lodging-permissions.test.ts
  • e2e/checklist-experience-persistence.test.ts
  • e2e/package-tours-import.test.ts (or split by admin/trip if needed)
  • Optional shared helpers:
    • e2e/helpers/auth.ts
    • e2e/helpers/trip.ts

Data + Setup Requirements

  • Use existing seeded users from e2e/setup/test-users.ts.
  • Create additional users/entities only inside test scope.
  • If package tour import requires external/provider data:
    • Prefer deterministic fixture mode/stubbed provider path if available.
    • If no deterministic mode exists, document dependency and skip with clear reason rather than adding flaky assertions.

Assertions to Prioritize

  • User-visible state after each mutation (create/edit/delete).
  • Persistence after page reload/navigation.
  • Authorization boundaries (allowed vs blocked actions).
  • Correct section rendering and item details on trip page.

Execution

  • Full run:
    • bunx playwright test
  • Focused run:
    • bunx playwright test e2e/transportation-lifecycle.test.ts
  • One-off evidence run:
    • PW_TRACE_MODE=on PW_VIDEO_MODE=on bunx playwright test e2e/<file>.test.ts

Acceptance Criteria

  • New tests pass locally in full suite.
  • New tests pass when run individually.
  • Two consecutive full-suite runs pass without code changes.
  • No test mutates shared seeded credentials/state in a way that affects later tests.
  • PR summary includes:
    • scenarios added
    • state-isolation approach used
    • any skipped coverage and why
# Task: Implement Medium-Priority Playwright E2E Coverage (State-Safe) ## Goal Add medium-priority e2e coverage for Trips without introducing flaky behavior or leaked state across tests. ## Scope (Tests to Add) 1. Transportation lifecycle - Create trip - Add transportation item (flight) - Edit transportation item - Delete transportation item - Assert UI updates at each step 2. Lodging share permissions (admin/user behavior) - Regular user creates lodging on a trip - Verify expected visibility/editability for trip participants/admin - Verify non-authorized user cannot access/modify (redirect/forbidden behavior) 3. Checklist + experience persistence - Add checklist and/or experience items - Toggle/check/reorder where supported - Reload page - Assert persisted state and ordering 4. Package tours import/display happy path (admin) - Trigger provider import/sync from admin UI (or equivalent app flow) - Assert imported tours appear - Assert selected tour can be attached/linked to a trip planning context (if supported in UI) ## Critical Guardrails (Learned from Recent Failures) 1. Never mutate seeded shared user credentials - Do not change password for `e2e_user` or `e2e_admin`. - If testing password/set-local-credentials behavior, create a disposable user first. 2. Keep tests order-independent - Any test must pass when run alone and in full suite. - No dependency on previous test side effects. 3. Use disposable entities per test - Use unique suffix for usernames/emails/trip names (`Date.now()` + small random). - Do not rely on hardcoded mutable records beyond seeded login users. 4. Reset session state safely - Use `context.clearCookies()` between identity switches. - Avoid brittle storage hacks unless strictly required. 5. Use valid app routes only - Confirm real route paths from `src/routes` before writing tests (e.g. `/trips/trips/upcoming`, not guessed paths). ## Implementation Constraints - Use robust selectors (`getByRole`, `getByLabel`, `getByText`, `aria-label`). - Avoid brittle CSS selectors unless no semantic locator exists. - No `waitForTimeout` sleeps. - Wait with URL/assertion readiness only. - Keep helpers for repeated flows (login, create trip, open add-to-trip menu). ## File Plan - `e2e/transportation-lifecycle.test.ts` - `e2e/lodging-permissions.test.ts` - `e2e/checklist-experience-persistence.test.ts` - `e2e/package-tours-import.test.ts` (or split by admin/trip if needed) - Optional shared helpers: - `e2e/helpers/auth.ts` - `e2e/helpers/trip.ts` ## Data + Setup Requirements - Use existing seeded users from `e2e/setup/test-users.ts`. - Create additional users/entities only inside test scope. - If package tour import requires external/provider data: - Prefer deterministic fixture mode/stubbed provider path if available. - If no deterministic mode exists, document dependency and skip with clear reason rather than adding flaky assertions. ## Assertions to Prioritize - User-visible state after each mutation (create/edit/delete). - Persistence after page reload/navigation. - Authorization boundaries (allowed vs blocked actions). - Correct section rendering and item details on trip page. ## Execution - Full run: - `bunx playwright test` - Focused run: - `bunx playwright test e2e/transportation-lifecycle.test.ts` - One-off evidence run: - `PW_TRACE_MODE=on PW_VIDEO_MODE=on bunx playwright test e2e/<file>.test.ts` ## Acceptance Criteria - New tests pass locally in full suite. - New tests pass when run individually. - Two consecutive full-suite runs pass without code changes. - No test mutates shared seeded credentials/state in a way that affects later tests. - PR summary includes: - scenarios added - state-isolation approach used - any skipped coverage and why
shaun added the ai-agent label 2026-02-22 22:31:29 +00:00
ai-agent was assigned by cicd 2026-02-22 22:31:31 +00:00
shaun closed this issue 2026-02-23 00:14:07 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: campbellwireless/trips#43