Skip to content

Epic 27 — E2E Happy-Path Test Suite (Playwright)

End-to-end Playwright specs covering the full happy path for every profile type: Talent, Producer, Pet Owner, Agency, and Admin. Tests live in the existing castyou-automated-tests/ package alongside the smoke spec. Each profile gets its own spec file. A shared fixture/helpers layer keeps setup DRY. No mocking — all tests hit the real stack (same approach as the existing auth smoke spec).

🔧 RECONCILED 2026-06-29 — this epic was written before Epic 42 replaced "apply to job" with swipe-to-match, so its apply/cover-letter/Applicants-panel mechanics are obsolete. The castyou-automated-tests/ suite has since grown ~30 specs that cover most of the intent under different filenames. Reality vs the original tickets:

  • E2E-001 (fixtures/helpers) — ✅ done differently: functional helpers (tests/helpers.ts, tests/gql.ts) + tests/fixtures/ are used by every spec. The named page-object classes (pages/OnboardingPage.ts, NavPage.ts) were intentionally not built — the suite is helper-based.
  • E2E-002 (Talent) — ✅ covered across onboarding/profile/profile-portfolio/jobs/job-lifecycle/feed/auth-and-layout; the "apply" step is now likeJob→Match.
  • E2E-003 (Producer) — ✅ covered by job-lifecycle (post job + Matches panel) + jobs.
  • E2E-007 (cross-profile apply→review) — ✅ this is job-lifecycle.spec.ts in match form (producer posts → talent likes → producer likes back → both sides see it).
  • E2E-004 / E2E-005 / E2E-006 — ✅ NEW specs added 2026-06-29 (pet-owner.spec.ts, agency.spec.ts, admin.spec.ts) — these were the genuine gaps. All green locally. Apply steps dropped; admin System-Posts left out (SYSTEM_POSTS pinned OFF in the suite baseline).

Net: the suite is effectively complete; the per-profile structure differs from the original spec. Tickets below are historical.

E2E-001 — Shared fixtures, helpers, and page-object layer

  • [x] Done differently — helper-based, not page-object (see reconcile note).

Files:

  • Create: castyou-automated-tests/tests/helpers/auth.ts
  • Create: castyou-automated-tests/tests/helpers/db.ts
  • Create: castyou-automated-tests/tests/fixtures.ts
  • Create: castyou-automated-tests/tests/pages/OnboardingPage.ts
  • Create: castyou-automated-tests/tests/pages/NavPage.ts

Description: Shared infrastructure consumed by all profile specs:

helpers/auth.tsregisterAndOnboard(page, role, opts?) — creates a unique email, walks register → onboard for the given role, and lands on the home/dashboard route. Wraps the same pattern as the existing smoke spec.

helpers/db.tsseedJob(apiBase, producerToken) thin HTTP helper that calls the GraphQL API directly to seed prerequisite data (e.g. create a published job before the talent applies). Keeps DB seeding out of the UI flow.

fixtures.ts — Playwright test.extend with:

  • talentPage — page already logged in as a fresh Talent
  • producerPage — page already logged in as a fresh Producer
  • petOwnerPage — page already logged in as a fresh Pet Owner
  • agencyPage — page already logged in as a fresh Agency manager
  • adminPage — page already logged in with a fixed admin seed account (set via TEST_ADMIN_EMAIL / TEST_ADMIN_PASSWORD env vars)

pages/OnboardingPage.ts — selectors + actions for the onboarding flow (role picker, confirm button, profile-type-specific initial fields). pages/NavPage.ts — sidebar/bottom-nav helpers (goHome(), goToJobs(), goToProfile(), etc.).

Acceptance criteria: every other spec in this epic imports from fixtures and helpers, never repeating auth boilerplate inline.


E2E-002 — Talent happy path

  • [x] Done (covered) — across onboarding/profile/jobs/job-lifecycle/feed specs; apply→Match.

Files:

  • Create: castyou-automated-tests/tests/talent.spec.ts

Flow covered (single ordered test):

  1. Register + onboard as Talent (via registerAndOnboard).
  2. Fill profile — navigate to /profile, fill display name, upload a headshot (fixture image file), add a skill tag, save. Assert the saved values appear on the profile view.
  3. Browse job board — navigate to /jobs, assert at least one job card is visible (seeded via helpers/db). Assert job title, role badge, and "Apply" button render.
  4. Apply to a job — click "Apply" on the first job, fill the cover letter textarea, submit. Assert confirmation state ("Application submitted" toast or similar).
  5. View feed — navigate to / (home / feed), assert the "To keep you in the loop" section heading is visible and at least one post card renders.
  6. Verify shell persistence — use the tagShellNav / shellNavMarker pattern from the smoke spec across all navigation steps to assert the AppShell never remounts.

Acceptance criteria:

  • Test is fully self-contained: no shared state with other specs.
  • Profile save round-trip confirmed via DOM (not just absence of error).
  • Application confirmation verified before the test ends.

E2E-003 — Producer happy path

  • [x] Done (covered)job-lifecycle.spec.ts + jobs.spec.ts (Applicants panel → Matches panel).

Files:

  • Create: castyou-automated-tests/tests/producer.spec.ts

Flow covered:

  1. Register + onboard as Producer.
  2. Fill profile — navigate to /profile, fill company name and bio, save. Assert saved values on view.
  3. Post a job — navigate to /jobs/new, fill title, role, description, location, set status to Published, save. Assert the new job appears in /jobs (producer view — own jobs list).
  4. View applicants — click the posted job, open the applicants panel. Assert the empty state renders correctly ("No applicants yet" or equivalent) — the panel itself must be present.
  5. Discover feed — navigate to the Discover/AI matching screen, assert the page loads without error (section heading visible).
  6. View feed — navigate to / (home), assert feed renders.

Acceptance criteria:

  • Job is findable by title in the producer's job list after creation.
  • Applicants panel renders on the job detail page without throwing.

E2E-004 — Pet Owner happy path

  • [x] Done 2026-06-29pet-owner.spec.ts (register/onboard → add pet → edit → roster → job board).

Files:

  • Create: castyou-automated-tests/tests/pet-owner.spec.ts

Flow covered:

  1. Register + onboard as Pet Owner (this is already covered by the smoke spec — this spec extends it with the full profile + pet CRUD).
  2. Add a pet — navigate to /pets, click "Add pet", fill name + species + breed, upload a pet photo (fixture image), save. Assert the pet card appears in the list with the entered name.
  3. Edit the pet — click the pet card → edit, change the breed, save. Assert updated breed appears on the card.
  4. Browse job board — navigate to /jobs, assert the pet-owner-specific job listings (pet-friendly or animal roles) tab/filter is visible and the list renders.
  5. Apply to a pet-role job — pick the first listed job, apply. Assert confirmation state.
  6. View feed — navigate to /, assert feed renders.

Acceptance criteria:

  • Pet CRUD (add + edit) verified via DOM, not just form submission.
  • Application submission confirmed before test ends.

E2E-005 — Agency happy path

  • [x] Done 2026-06-29agency.spec.ts (onboard → name agency → talent roster + invite guidance). Two-sided invite-accept left out (flaky).

Files:

  • Create: castyou-automated-tests/tests/agency.spec.ts

Flow covered:

  1. Register + onboard as Agency.
  2. Fill agency profile — navigate to /profile, fill agency name, location, and focus area, save. Assert saved values on view.
  3. Invite / add a managed talent — navigate to the agency talents section, use the "Add talent" flow to attach a talent by email (seed a talent account via helpers/db first). Assert the talent row appears in the agency roster.
  4. Browse job board — navigate to /jobs, assert jobs list renders. Assert the agency-specific "Post on behalf of" selector or equivalent is present.
  5. Post a job — fill job form selecting the managed talent's name as the submission, publish. Assert the job appears in the list.
  6. View feed — navigate to /, assert feed renders.

Acceptance criteria:

  • Managed talent appears in the roster before job-posting test step.
  • Posted job is attributable to the agency in the job list.

E2E-006 — Admin happy path

  • [x] Done 2026-06-29admin.spec.ts (suspend → Suspended → restore → Active on a throwaway talent). System Posts out of scope (SYSTEM_POSTS pinned OFF).

Files:

  • Create: castyou-automated-tests/tests/admin.spec.ts

Flow covered:

  1. Log in as the seeded admin account (env-var credentials, not a fresh register).
  2. User management — navigate to Admin → Users. Assert the paginated users table renders with at least one row. Search for the talent seeded in E2E-005; assert the row appears. Open the user detail page; assert profile data renders.
  3. Suspend a user — click the action menu on a test user (seeded via helpers/db), click Suspend, fill the reason, confirm. Assert the user's status badge changes to "Suspended".
  4. Restore the user — click Restore on the same user, confirm. Assert status returns to "Active".
  5. System Posts — navigate to Admin → System Posts. Click "New system post", upload a fixture image, fill caption, enable CTA toggle, fill button text and URL, click Publish. Assert the new post row appears in the system posts list.
  6. Verify post in feed — navigate to / as the admin. Assert a post card with the "Official" badge and the CasTyou logo avatar is visible in the feed and its CTA button text matches what was entered.

Acceptance criteria:

  • Suspend → Restore round-trip verified by DOM badge, not just absence of error.
  • System post visible in feed with correct "Official" badge and CTA.

E2E-007 — Cross-profile: Talent applies to Producer's job

  • [x] Done (covered)job-lifecycle.spec.ts is this flow in match form (post → like → match → both sides see it).

Files:

  • Create: castyou-automated-tests/tests/cross-profile.spec.ts

Flow covered (two browser contexts in one test):

  1. Producer context — register + onboard as Producer, post a job (title: unique slug for this run), publish it. Store the job ID from the URL.
  2. Talent context — register + onboard as Talent in a separate Playwright browserContext, navigate to /jobs, find the producer's job by title, apply with a cover letter. Assert confirmation.
  3. Producer context resumes — switch back to the Producer browser context, navigate to the job detail page, open the Applicants panel. Assert the Talent's display name appears as an applicant.

Purpose: This is the most integration-heavy test. It validates the full producer → post → talent apply → producer review lifecycle end-to-end with real accounts on both sides.

Acceptance criteria:

  • Both browser contexts run in the same test (no separate workers or shared state files).
  • Talent name visible in the Applicants panel before the test ends.
  • Test is deterministic: the job is identified by a run-unique slug, not a hardcoded ID.