Verify-suite work (this session):
- M package.json — added typecheck, test:e2e, verify scripts; added @playwright/test devDep - M pnpm-lock.yaml - M .gitignore — Playwright artifacts - M tsconfig.json — auto-modified by Next.js include path - ?? e2e/ — config + fixtures + 3 specs - ?? playwright.config.ts - ?? scripts/verify.sh, scripts/db-test-truncate.sql
This commit is contained in:
27
e2e/therapist.spec.ts
Normal file
27
e2e/therapist.spec.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { signInAs } from "./fixtures/auth";
|
||||
|
||||
test("therapist signs in and sees their dashboard", async ({ page }) => {
|
||||
await signInAs(page, "therapist", "/therapist");
|
||||
// /therapist redirects to /therapist/bookings.
|
||||
await page.goto("/therapist");
|
||||
await expect(page).toHaveURL(/\/therapist\/bookings$/);
|
||||
|
||||
// Top nav exposes "My schedule" → bookings, and "Availability".
|
||||
await expect(page.getByRole("link", { name: /^my schedule$/i })).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: /^availability$/i })).toBeVisible();
|
||||
|
||||
await page.getByRole("link", { name: /^availability$/i }).click();
|
||||
await expect(page).toHaveURL(/\/therapist\/availability/);
|
||||
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
|
||||
|
||||
await page.getByRole("link", { name: /^my schedule$/i }).click();
|
||||
await expect(page).toHaveURL(/\/therapist\/bookings/);
|
||||
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
|
||||
});
|
||||
|
||||
test("non-therapist (customer) hitting /therapist sees the deny screen", async ({ page }) => {
|
||||
await signInAs(page, "customer", "/therapist");
|
||||
await page.goto("/therapist");
|
||||
await expect(page.getByRole("heading", { name: /therapists only/i })).toBeVisible();
|
||||
});
|
||||
Reference in New Issue
Block a user