Phase 5
Phase 5 is complete. All 53 tasks are done, verified on a fresh database in a single clean run: **121 unit tests**, **55 integration tests**, and **15 E2E journeys** (6 Phase 4 + 9 new Phase 5) all passing, plus a clean `tsc`/`eslint`/`build`. Summary of this final stretch: - **Fixed a real bug**: `StaffService`'s break/time-off update/delete functions threw uncaught instead of failing gracefully on a permission mismatch — fixed with proper `PERMISSION_DENIED` handling, covered by new integration tests. - **Built the remaining Phase 5 UI**: Breaks editor, Time Off editor, Barber Profile, and Notification Preferences — all wired to real services, no placeholders. - **Extended seed data**: more customers, loyalty accounts/transactions/rewards, and appointments spanning every status today (anchored to real time so the "Current Appointment" priority logic is reliably exercised). - **Found and fixed a second real bug live in the browser**: the Break/Time-Off edit sheets showed stale default values instead of the item being edited (a classic `useState`-doesn't-reinitialize-on-prop-change bug) — fixed with a `key` prop to force remount. - **Wrote the full Phase 5 test suite**: unit tests for `selectCurrentAppointment` and all `StaffService` validators, integration tests for `LoyaltyService` and `StaffService` (including the permission-fix regression tests), and 9 new Playwright E2E journeys covering the brief's exact required list. - **Did the desktop-responsive pass**: a persistent sidebar nav replacing the bottom bar at `lg:`, a genuine calendar+"Right Now" side-by-side split, and 2-column layouts for the clients list and customer details — addressing the brief's explicit "more than simple centering" requirement. - **Wrote [docs/phase-5-summary.md](docs/phase-5-summary.md)** documenting everything above in full. Nothing is committed — the whole session (Phases 2–5) sits uncommitted on top of the initial template commit, same as you left it. Let me know if you'd like me to commit, or if you want to move on to Phase 6.
This commit is contained in:
81 files changed
+8024
-113
No files matched your search
@@ -115,3 +115,42 @@ export async function completeRescheduleFlow(page: Page): Promise<void> {
|
||||
await page.getByRole("button", { name: "Confirm Reschedule", exact: true }).click();
|
||||
await expect(page).toHaveURL(/\/appointments\/[^/]+$/);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drives the staff "book for customer" flow — same shared ServiceSelector
|
||||
* and BarberDateTimePicker as the customer /book flow, mounted at the
|
||||
* /staff/book/* routes instead (see src/app/staff/book). Assumes the page
|
||||
* is already on /staff/book/services, i.e. a customer has just been
|
||||
* selected (search result click or NewGuestCustomerForm submit both land
|
||||
* there via a redirect).
|
||||
*/
|
||||
export async function completeStaffBookingFlow(
|
||||
page: Page,
|
||||
options: { serviceName: string; staffName?: string; notes?: string },
|
||||
): Promise<void> {
|
||||
const { serviceName, staffName, notes } = options;
|
||||
|
||||
await expect(page).toHaveURL(/\/staff\/book\/services/);
|
||||
await page.getByRole("button", { name: new RegExp(`^${serviceName}`) }).click();
|
||||
await page.getByRole("button", { name: "Continue", exact: true }).click();
|
||||
|
||||
await expect(page).toHaveURL(/\/staff\/book\/barber-time/);
|
||||
if (staffName) {
|
||||
await section(page, "Barber").locator("select").selectOption({ label: staffName });
|
||||
await page.waitForLoadState("networkidle");
|
||||
}
|
||||
await expect(section(page, "Date").locator("button[aria-pressed]").first()).toBeVisible();
|
||||
await section(page, "Date").locator("button[aria-pressed]:not([disabled])").first().click();
|
||||
const timeSection = section(page, "Time");
|
||||
await expect(timeSection.locator("button").first()).toBeVisible();
|
||||
await timeSection.locator("button").first().click();
|
||||
await page.getByRole("button", { name: "Continue", exact: true }).click();
|
||||
|
||||
await expect(page).toHaveURL(/\/staff\/book\/review/);
|
||||
if (notes) {
|
||||
await page.getByLabel("Booking Notes (optional)").fill(notes);
|
||||
}
|
||||
await page.getByRole("button", { name: "Confirm Booking" }).click();
|
||||
|
||||
await expect(page).toHaveURL(/\/staff\/appointments\/[^/]+$/);
|
||||
}
|
||||
Reference in new issue
Block a user