Files
pn-new-crm/tests/e2e/exhaustive/03-tenancies.spec.ts

64 lines
2.5 KiB
TypeScript
Raw Normal View History

test(e2e): exhaustive click-through suite + destructive narrow tests PR 14: adds a tier-3.5 Playwright pass that opens every refactored page, clicks every visible button/link/role=button, and asserts no console errors, no app-side network 4xx/5xx, and no click-time exceptions. Helper: - tests/helpers/click-everything.ts — shared `clickEverythingOnPage` with default skips for destructive selectors (archive, delete, transfer, sign-out), auto-closing of dialogs, and return-to-start after navigation. Exhaustive specs (tests/e2e/exhaustive/): - 01-yachts: list + detail + transfer dialog - 02-companies: list + detail + add-membership dialog - 03-reservations: berth list + detail reservations tab + reserve dialog - 04-client-detail: list + detail walking every tab - 05-eoi-generate: generate dialog opens with Documenso option - 06-invoice-form: new-invoice dialog billing-entity toggle - 07-berths: list + detail walking every tab - 08-portal: client portal yachts / memberships / reservations - 09-navigation: every primary nav target loads cleanly Destructive specs (tests/e2e/destructive/): - 01-yacht-archive: create-via-API → archive via UI → assert removed. Skips with a clear message when the global setup does not seed an owner client (avoids brittle failures while the full destructive fixture lands). Playwright config: testDir hoisted to ./tests/e2e; new `exhaustive` and `destructive` projects share the existing setup project. New scripts test:e2e / test:e2e:smoke / test:e2e:exhaustive / test:e2e:destructive in package.json drive each project independently. CI integration deferred — no .github/workflows/* exists in this repo yet, so the PR 14 task to wire a separate CI job is N/A. The new projects will pick up automatically when a workflow lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 14:06:10 +02:00
import { test, expect } from '@playwright/test';
import { clickEverythingOnPage } from '../../helpers/click-everything';
import { login, navigateTo, PORT_SLUG } from '../smoke/helpers';
fix(tenancies-audit): resolve findings from 7-agent system-wide rename audit MUST-FIX: - src/app/api/v1/admin/users/[id]/permission-overrides/route.ts:70 — the PUT allowlist still gated `reservations: {view,create,activate,cancel}`. Stale: would reject valid `tenancies.{view,manage,cancel}` writes and silently accept ghost `reservations.*` writes that never land. Replaced. - src/lib/services/alert-rules.ts:68 — `reservation.no_agreement` alert emitted `entityType: 'reservation'`. Every other tenancy-related audit/socket/dashboard label is `'berth_tenancy'`. Inconsistent dedupe + activity-feed label miss. - tests/e2e/exhaustive/08-portal.spec.ts:6 — hardcoded /portal/my-reservations navigates to a 404 every run. - tests/e2e/exhaustive/03-reservations.spec.ts — entire spec renamed to 03-tenancies.spec.ts; tab + button locators updated to match renamed UI. SHOULD-FIX (consistency): - src/components/clients/client-detail.tsx — useRealtimeInvalidation only caught 3 of the 4 berth_tenancy:* events; added the `:created` listener. - src/lib/services/client-merge.service.ts — MergeResult.movedRows.reservations + snapshot.reservations + local loserReservations / movedReservations renamed to tenancies / loserTenancies / movedTenancies. No external consumers grep-confirmed. - src/lib/services/gdpr-bundle-builder.ts — GdprBundle.reservations field renamed to .tenancies; user-facing HTML section "Reservations" → "Tenancies"; local reservationRows → tenancyRows. - 6 UI copy strings: gdpr-export-button, bulk-archive-wizard, bulk-hard-delete-dialog, hard-delete-dialog, admin-sections-browser ×2, admin/import/page, won-status-panel — all "reservations" prose updated to "tenancies" (occupancy-record sense). - tests/integration/api/tenancies.test.ts — handler import aliases `createReservationHandler` etc renamed to `createTenancyHandler` etc. - tests/unit/services/berth-tenancies.test.ts — local helper makeReservation → makeTenancyLocal (avoids shadow of the renamed factory). - scripts/audit-permissions.ts — stale allowlist entry for /berth-reservations/[id]/route.ts removed (path no longer exists). - docs/runbooks/permission-audit.md — stale row for same path removed. - docs/tenancies-design.md — fixed factual error ("tenancies.service.ts" → "berth-tenancies.service.ts"). Verified: tsc clean, 1493/1493 vitest. Dev-server note: the running `next dev` process started before P2 and shows Turbopack cached compile errors against the renamed schema files. Source is correct (./tenancies); restart `next dev` to clear the cache. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:03:14 +02:00
test.describe('exhaustive: berth tenancies', () => {
test(e2e): exhaustive click-through suite + destructive narrow tests PR 14: adds a tier-3.5 Playwright pass that opens every refactored page, clicks every visible button/link/role=button, and asserts no console errors, no app-side network 4xx/5xx, and no click-time exceptions. Helper: - tests/helpers/click-everything.ts — shared `clickEverythingOnPage` with default skips for destructive selectors (archive, delete, transfer, sign-out), auto-closing of dialogs, and return-to-start after navigation. Exhaustive specs (tests/e2e/exhaustive/): - 01-yachts: list + detail + transfer dialog - 02-companies: list + detail + add-membership dialog - 03-reservations: berth list + detail reservations tab + reserve dialog - 04-client-detail: list + detail walking every tab - 05-eoi-generate: generate dialog opens with Documenso option - 06-invoice-form: new-invoice dialog billing-entity toggle - 07-berths: list + detail walking every tab - 08-portal: client portal yachts / memberships / reservations - 09-navigation: every primary nav target loads cleanly Destructive specs (tests/e2e/destructive/): - 01-yacht-archive: create-via-API → archive via UI → assert removed. Skips with a clear message when the global setup does not seed an owner client (avoids brittle failures while the full destructive fixture lands). Playwright config: testDir hoisted to ./tests/e2e; new `exhaustive` and `destructive` projects share the existing setup project. New scripts test:e2e / test:e2e:smoke / test:e2e:exhaustive / test:e2e:destructive in package.json drive each project independently. CI integration deferred — no .github/workflows/* exists in this repo yet, so the PR 14 task to wire a separate CI job is N/A. The new projects will pick up automatically when a workflow lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 14:06:10 +02:00
test.beforeEach(async ({ page }) => {
await login(page, 'super_admin');
});
fix(tenancies-audit): resolve findings from 7-agent system-wide rename audit MUST-FIX: - src/app/api/v1/admin/users/[id]/permission-overrides/route.ts:70 — the PUT allowlist still gated `reservations: {view,create,activate,cancel}`. Stale: would reject valid `tenancies.{view,manage,cancel}` writes and silently accept ghost `reservations.*` writes that never land. Replaced. - src/lib/services/alert-rules.ts:68 — `reservation.no_agreement` alert emitted `entityType: 'reservation'`. Every other tenancy-related audit/socket/dashboard label is `'berth_tenancy'`. Inconsistent dedupe + activity-feed label miss. - tests/e2e/exhaustive/08-portal.spec.ts:6 — hardcoded /portal/my-reservations navigates to a 404 every run. - tests/e2e/exhaustive/03-reservations.spec.ts — entire spec renamed to 03-tenancies.spec.ts; tab + button locators updated to match renamed UI. SHOULD-FIX (consistency): - src/components/clients/client-detail.tsx — useRealtimeInvalidation only caught 3 of the 4 berth_tenancy:* events; added the `:created` listener. - src/lib/services/client-merge.service.ts — MergeResult.movedRows.reservations + snapshot.reservations + local loserReservations / movedReservations renamed to tenancies / loserTenancies / movedTenancies. No external consumers grep-confirmed. - src/lib/services/gdpr-bundle-builder.ts — GdprBundle.reservations field renamed to .tenancies; user-facing HTML section "Reservations" → "Tenancies"; local reservationRows → tenancyRows. - 6 UI copy strings: gdpr-export-button, bulk-archive-wizard, bulk-hard-delete-dialog, hard-delete-dialog, admin-sections-browser ×2, admin/import/page, won-status-panel — all "reservations" prose updated to "tenancies" (occupancy-record sense). - tests/integration/api/tenancies.test.ts — handler import aliases `createReservationHandler` etc renamed to `createTenancyHandler` etc. - tests/unit/services/berth-tenancies.test.ts — local helper makeReservation → makeTenancyLocal (avoids shadow of the renamed factory). - scripts/audit-permissions.ts — stale allowlist entry for /berth-reservations/[id]/route.ts removed (path no longer exists). - docs/runbooks/permission-audit.md — stale row for same path removed. - docs/tenancies-design.md — fixed factual error ("tenancies.service.ts" → "berth-tenancies.service.ts"). Verified: tsc clean, 1493/1493 vitest. Dev-server note: the running `next dev` process started before P2 and shows Turbopack cached compile errors against the renamed schema files. Source is correct (./tenancies); restart `next dev` to clear the cache. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:03:14 +02:00
test('berths list - tenancy-related affordances are clickable', async ({ page }) => {
test(e2e): exhaustive click-through suite + destructive narrow tests PR 14: adds a tier-3.5 Playwright pass that opens every refactored page, clicks every visible button/link/role=button, and asserts no console errors, no app-side network 4xx/5xx, and no click-time exceptions. Helper: - tests/helpers/click-everything.ts — shared `clickEverythingOnPage` with default skips for destructive selectors (archive, delete, transfer, sign-out), auto-closing of dialogs, and return-to-start after navigation. Exhaustive specs (tests/e2e/exhaustive/): - 01-yachts: list + detail + transfer dialog - 02-companies: list + detail + add-membership dialog - 03-reservations: berth list + detail reservations tab + reserve dialog - 04-client-detail: list + detail walking every tab - 05-eoi-generate: generate dialog opens with Documenso option - 06-invoice-form: new-invoice dialog billing-entity toggle - 07-berths: list + detail walking every tab - 08-portal: client portal yachts / memberships / reservations - 09-navigation: every primary nav target loads cleanly Destructive specs (tests/e2e/destructive/): - 01-yacht-archive: create-via-API → archive via UI → assert removed. Skips with a clear message when the global setup does not seed an owner client (avoids brittle failures while the full destructive fixture lands). Playwright config: testDir hoisted to ./tests/e2e; new `exhaustive` and `destructive` projects share the existing setup project. New scripts test:e2e / test:e2e:smoke / test:e2e:exhaustive / test:e2e:destructive in package.json drive each project independently. CI integration deferred — no .github/workflows/* exists in this repo yet, so the PR 14 task to wire a separate CI job is N/A. The new projects will pick up automatically when a workflow lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 14:06:10 +02:00
await navigateTo(page, '/berths');
await page.waitForLoadState('networkidle');
const result = await clickEverythingOnPage(page);
expect(result.errors, JSON.stringify(result.errors, null, 2)).toEqual([]);
});
fix(tenancies-audit): resolve findings from 7-agent system-wide rename audit MUST-FIX: - src/app/api/v1/admin/users/[id]/permission-overrides/route.ts:70 — the PUT allowlist still gated `reservations: {view,create,activate,cancel}`. Stale: would reject valid `tenancies.{view,manage,cancel}` writes and silently accept ghost `reservations.*` writes that never land. Replaced. - src/lib/services/alert-rules.ts:68 — `reservation.no_agreement` alert emitted `entityType: 'reservation'`. Every other tenancy-related audit/socket/dashboard label is `'berth_tenancy'`. Inconsistent dedupe + activity-feed label miss. - tests/e2e/exhaustive/08-portal.spec.ts:6 — hardcoded /portal/my-reservations navigates to a 404 every run. - tests/e2e/exhaustive/03-reservations.spec.ts — entire spec renamed to 03-tenancies.spec.ts; tab + button locators updated to match renamed UI. SHOULD-FIX (consistency): - src/components/clients/client-detail.tsx — useRealtimeInvalidation only caught 3 of the 4 berth_tenancy:* events; added the `:created` listener. - src/lib/services/client-merge.service.ts — MergeResult.movedRows.reservations + snapshot.reservations + local loserReservations / movedReservations renamed to tenancies / loserTenancies / movedTenancies. No external consumers grep-confirmed. - src/lib/services/gdpr-bundle-builder.ts — GdprBundle.reservations field renamed to .tenancies; user-facing HTML section "Reservations" → "Tenancies"; local reservationRows → tenancyRows. - 6 UI copy strings: gdpr-export-button, bulk-archive-wizard, bulk-hard-delete-dialog, hard-delete-dialog, admin-sections-browser ×2, admin/import/page, won-status-panel — all "reservations" prose updated to "tenancies" (occupancy-record sense). - tests/integration/api/tenancies.test.ts — handler import aliases `createReservationHandler` etc renamed to `createTenancyHandler` etc. - tests/unit/services/berth-tenancies.test.ts — local helper makeReservation → makeTenancyLocal (avoids shadow of the renamed factory). - scripts/audit-permissions.ts — stale allowlist entry for /berth-reservations/[id]/route.ts removed (path no longer exists). - docs/runbooks/permission-audit.md — stale row for same path removed. - docs/tenancies-design.md — fixed factual error ("tenancies.service.ts" → "berth-tenancies.service.ts"). Verified: tsc clean, 1493/1493 vitest. Dev-server note: the running `next dev` process started before P2 and shows Turbopack cached compile errors against the renamed schema files. Source is correct (./tenancies); restart `next dev` to clear the cache. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:03:14 +02:00
test('berth detail - tenancies tab opens and is interactive', async ({ page }) => {
test(e2e): exhaustive click-through suite + destructive narrow tests PR 14: adds a tier-3.5 Playwright pass that opens every refactored page, clicks every visible button/link/role=button, and asserts no console errors, no app-side network 4xx/5xx, and no click-time exceptions. Helper: - tests/helpers/click-everything.ts — shared `clickEverythingOnPage` with default skips for destructive selectors (archive, delete, transfer, sign-out), auto-closing of dialogs, and return-to-start after navigation. Exhaustive specs (tests/e2e/exhaustive/): - 01-yachts: list + detail + transfer dialog - 02-companies: list + detail + add-membership dialog - 03-reservations: berth list + detail reservations tab + reserve dialog - 04-client-detail: list + detail walking every tab - 05-eoi-generate: generate dialog opens with Documenso option - 06-invoice-form: new-invoice dialog billing-entity toggle - 07-berths: list + detail walking every tab - 08-portal: client portal yachts / memberships / reservations - 09-navigation: every primary nav target loads cleanly Destructive specs (tests/e2e/destructive/): - 01-yacht-archive: create-via-API → archive via UI → assert removed. Skips with a clear message when the global setup does not seed an owner client (avoids brittle failures while the full destructive fixture lands). Playwright config: testDir hoisted to ./tests/e2e; new `exhaustive` and `destructive` projects share the existing setup project. New scripts test:e2e / test:e2e:smoke / test:e2e:exhaustive / test:e2e:destructive in package.json drive each project independently. CI integration deferred — no .github/workflows/* exists in this repo yet, so the PR 14 task to wire a separate CI job is N/A. The new projects will pick up automatically when a workflow lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 14:06:10 +02:00
await navigateTo(page, '/berths');
await page.waitForLoadState('networkidle');
const firstRow = page.locator('tbody tr a, tbody tr button').first();
if (!(await firstRow.isVisible({ timeout: 3000 }).catch(() => false))) {
test.skip(true, 'no berths seeded');
return;
}
await firstRow.click();
await page.waitForURL(new RegExp(`/${PORT_SLUG}/berths/[^/]+`), { timeout: 10_000 });
await page.waitForLoadState('networkidle');
fix(tenancies-audit): resolve findings from 7-agent system-wide rename audit MUST-FIX: - src/app/api/v1/admin/users/[id]/permission-overrides/route.ts:70 — the PUT allowlist still gated `reservations: {view,create,activate,cancel}`. Stale: would reject valid `tenancies.{view,manage,cancel}` writes and silently accept ghost `reservations.*` writes that never land. Replaced. - src/lib/services/alert-rules.ts:68 — `reservation.no_agreement` alert emitted `entityType: 'reservation'`. Every other tenancy-related audit/socket/dashboard label is `'berth_tenancy'`. Inconsistent dedupe + activity-feed label miss. - tests/e2e/exhaustive/08-portal.spec.ts:6 — hardcoded /portal/my-reservations navigates to a 404 every run. - tests/e2e/exhaustive/03-reservations.spec.ts — entire spec renamed to 03-tenancies.spec.ts; tab + button locators updated to match renamed UI. SHOULD-FIX (consistency): - src/components/clients/client-detail.tsx — useRealtimeInvalidation only caught 3 of the 4 berth_tenancy:* events; added the `:created` listener. - src/lib/services/client-merge.service.ts — MergeResult.movedRows.reservations + snapshot.reservations + local loserReservations / movedReservations renamed to tenancies / loserTenancies / movedTenancies. No external consumers grep-confirmed. - src/lib/services/gdpr-bundle-builder.ts — GdprBundle.reservations field renamed to .tenancies; user-facing HTML section "Reservations" → "Tenancies"; local reservationRows → tenancyRows. - 6 UI copy strings: gdpr-export-button, bulk-archive-wizard, bulk-hard-delete-dialog, hard-delete-dialog, admin-sections-browser ×2, admin/import/page, won-status-panel — all "reservations" prose updated to "tenancies" (occupancy-record sense). - tests/integration/api/tenancies.test.ts — handler import aliases `createReservationHandler` etc renamed to `createTenancyHandler` etc. - tests/unit/services/berth-tenancies.test.ts — local helper makeReservation → makeTenancyLocal (avoids shadow of the renamed factory). - scripts/audit-permissions.ts — stale allowlist entry for /berth-reservations/[id]/route.ts removed (path no longer exists). - docs/runbooks/permission-audit.md — stale row for same path removed. - docs/tenancies-design.md — fixed factual error ("tenancies.service.ts" → "berth-tenancies.service.ts"). Verified: tsc clean, 1493/1493 vitest. Dev-server note: the running `next dev` process started before P2 and shows Turbopack cached compile errors against the renamed schema files. Source is correct (./tenancies); restart `next dev` to clear the cache. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:03:14 +02:00
const tenanciesTab = page.getByRole('tab', { name: /tenancies/i }).first();
if (await tenanciesTab.isVisible({ timeout: 3000 }).catch(() => false)) {
await tenanciesTab.click();
test(e2e): exhaustive click-through suite + destructive narrow tests PR 14: adds a tier-3.5 Playwright pass that opens every refactored page, clicks every visible button/link/role=button, and asserts no console errors, no app-side network 4xx/5xx, and no click-time exceptions. Helper: - tests/helpers/click-everything.ts — shared `clickEverythingOnPage` with default skips for destructive selectors (archive, delete, transfer, sign-out), auto-closing of dialogs, and return-to-start after navigation. Exhaustive specs (tests/e2e/exhaustive/): - 01-yachts: list + detail + transfer dialog - 02-companies: list + detail + add-membership dialog - 03-reservations: berth list + detail reservations tab + reserve dialog - 04-client-detail: list + detail walking every tab - 05-eoi-generate: generate dialog opens with Documenso option - 06-invoice-form: new-invoice dialog billing-entity toggle - 07-berths: list + detail walking every tab - 08-portal: client portal yachts / memberships / reservations - 09-navigation: every primary nav target loads cleanly Destructive specs (tests/e2e/destructive/): - 01-yacht-archive: create-via-API → archive via UI → assert removed. Skips with a clear message when the global setup does not seed an owner client (avoids brittle failures while the full destructive fixture lands). Playwright config: testDir hoisted to ./tests/e2e; new `exhaustive` and `destructive` projects share the existing setup project. New scripts test:e2e / test:e2e:smoke / test:e2e:exhaustive / test:e2e:destructive in package.json drive each project independently. CI integration deferred — no .github/workflows/* exists in this repo yet, so the PR 14 task to wire a separate CI job is N/A. The new projects will pick up automatically when a workflow lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 14:06:10 +02:00
await page.waitForLoadState('networkidle');
}
const result = await clickEverythingOnPage(page);
expect(result.errors, JSON.stringify(result.errors, null, 2)).toEqual([]);
});
fix(tenancies-audit): resolve findings from 7-agent system-wide rename audit MUST-FIX: - src/app/api/v1/admin/users/[id]/permission-overrides/route.ts:70 — the PUT allowlist still gated `reservations: {view,create,activate,cancel}`. Stale: would reject valid `tenancies.{view,manage,cancel}` writes and silently accept ghost `reservations.*` writes that never land. Replaced. - src/lib/services/alert-rules.ts:68 — `reservation.no_agreement` alert emitted `entityType: 'reservation'`. Every other tenancy-related audit/socket/dashboard label is `'berth_tenancy'`. Inconsistent dedupe + activity-feed label miss. - tests/e2e/exhaustive/08-portal.spec.ts:6 — hardcoded /portal/my-reservations navigates to a 404 every run. - tests/e2e/exhaustive/03-reservations.spec.ts — entire spec renamed to 03-tenancies.spec.ts; tab + button locators updated to match renamed UI. SHOULD-FIX (consistency): - src/components/clients/client-detail.tsx — useRealtimeInvalidation only caught 3 of the 4 berth_tenancy:* events; added the `:created` listener. - src/lib/services/client-merge.service.ts — MergeResult.movedRows.reservations + snapshot.reservations + local loserReservations / movedReservations renamed to tenancies / loserTenancies / movedTenancies. No external consumers grep-confirmed. - src/lib/services/gdpr-bundle-builder.ts — GdprBundle.reservations field renamed to .tenancies; user-facing HTML section "Reservations" → "Tenancies"; local reservationRows → tenancyRows. - 6 UI copy strings: gdpr-export-button, bulk-archive-wizard, bulk-hard-delete-dialog, hard-delete-dialog, admin-sections-browser ×2, admin/import/page, won-status-panel — all "reservations" prose updated to "tenancies" (occupancy-record sense). - tests/integration/api/tenancies.test.ts — handler import aliases `createReservationHandler` etc renamed to `createTenancyHandler` etc. - tests/unit/services/berth-tenancies.test.ts — local helper makeReservation → makeTenancyLocal (avoids shadow of the renamed factory). - scripts/audit-permissions.ts — stale allowlist entry for /berth-reservations/[id]/route.ts removed (path no longer exists). - docs/runbooks/permission-audit.md — stale row for same path removed. - docs/tenancies-design.md — fixed factual error ("tenancies.service.ts" → "berth-tenancies.service.ts"). Verified: tsc clean, 1493/1493 vitest. Dev-server note: the running `next dev` process started before P2 and shows Turbopack cached compile errors against the renamed schema files. Source is correct (./tenancies); restart `next dev` to clear the cache. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:03:14 +02:00
test('create-tenancy dialog opens and closes', async ({ page }) => {
test(e2e): exhaustive click-through suite + destructive narrow tests PR 14: adds a tier-3.5 Playwright pass that opens every refactored page, clicks every visible button/link/role=button, and asserts no console errors, no app-side network 4xx/5xx, and no click-time exceptions. Helper: - tests/helpers/click-everything.ts — shared `clickEverythingOnPage` with default skips for destructive selectors (archive, delete, transfer, sign-out), auto-closing of dialogs, and return-to-start after navigation. Exhaustive specs (tests/e2e/exhaustive/): - 01-yachts: list + detail + transfer dialog - 02-companies: list + detail + add-membership dialog - 03-reservations: berth list + detail reservations tab + reserve dialog - 04-client-detail: list + detail walking every tab - 05-eoi-generate: generate dialog opens with Documenso option - 06-invoice-form: new-invoice dialog billing-entity toggle - 07-berths: list + detail walking every tab - 08-portal: client portal yachts / memberships / reservations - 09-navigation: every primary nav target loads cleanly Destructive specs (tests/e2e/destructive/): - 01-yacht-archive: create-via-API → archive via UI → assert removed. Skips with a clear message when the global setup does not seed an owner client (avoids brittle failures while the full destructive fixture lands). Playwright config: testDir hoisted to ./tests/e2e; new `exhaustive` and `destructive` projects share the existing setup project. New scripts test:e2e / test:e2e:smoke / test:e2e:exhaustive / test:e2e:destructive in package.json drive each project independently. CI integration deferred — no .github/workflows/* exists in this repo yet, so the PR 14 task to wire a separate CI job is N/A. The new projects will pick up automatically when a workflow lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 14:06:10 +02:00
await navigateTo(page, '/berths');
await page.waitForLoadState('networkidle');
const firstRow = page.locator('tbody tr a, tbody tr button').first();
if (!(await firstRow.isVisible({ timeout: 3000 }).catch(() => false))) {
test.skip(true, 'no berths seeded');
return;
}
await firstRow.click();
await page.waitForLoadState('networkidle');
fix(tenancies-audit): resolve findings from 7-agent system-wide rename audit MUST-FIX: - src/app/api/v1/admin/users/[id]/permission-overrides/route.ts:70 — the PUT allowlist still gated `reservations: {view,create,activate,cancel}`. Stale: would reject valid `tenancies.{view,manage,cancel}` writes and silently accept ghost `reservations.*` writes that never land. Replaced. - src/lib/services/alert-rules.ts:68 — `reservation.no_agreement` alert emitted `entityType: 'reservation'`. Every other tenancy-related audit/socket/dashboard label is `'berth_tenancy'`. Inconsistent dedupe + activity-feed label miss. - tests/e2e/exhaustive/08-portal.spec.ts:6 — hardcoded /portal/my-reservations navigates to a 404 every run. - tests/e2e/exhaustive/03-reservations.spec.ts — entire spec renamed to 03-tenancies.spec.ts; tab + button locators updated to match renamed UI. SHOULD-FIX (consistency): - src/components/clients/client-detail.tsx — useRealtimeInvalidation only caught 3 of the 4 berth_tenancy:* events; added the `:created` listener. - src/lib/services/client-merge.service.ts — MergeResult.movedRows.reservations + snapshot.reservations + local loserReservations / movedReservations renamed to tenancies / loserTenancies / movedTenancies. No external consumers grep-confirmed. - src/lib/services/gdpr-bundle-builder.ts — GdprBundle.reservations field renamed to .tenancies; user-facing HTML section "Reservations" → "Tenancies"; local reservationRows → tenancyRows. - 6 UI copy strings: gdpr-export-button, bulk-archive-wizard, bulk-hard-delete-dialog, hard-delete-dialog, admin-sections-browser ×2, admin/import/page, won-status-panel — all "reservations" prose updated to "tenancies" (occupancy-record sense). - tests/integration/api/tenancies.test.ts — handler import aliases `createReservationHandler` etc renamed to `createTenancyHandler` etc. - tests/unit/services/berth-tenancies.test.ts — local helper makeReservation → makeTenancyLocal (avoids shadow of the renamed factory). - scripts/audit-permissions.ts — stale allowlist entry for /berth-reservations/[id]/route.ts removed (path no longer exists). - docs/runbooks/permission-audit.md — stale row for same path removed. - docs/tenancies-design.md — fixed factual error ("tenancies.service.ts" → "berth-tenancies.service.ts"). Verified: tsc clean, 1493/1493 vitest. Dev-server note: the running `next dev` process started before P2 and shows Turbopack cached compile errors against the renamed schema files. Source is correct (./tenancies); restart `next dev` to clear the cache. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:03:14 +02:00
const createBtn = page.getByRole('button', { name: /create tenancy|reserve/i }).first();
if (await createBtn.isVisible({ timeout: 3000 }).catch(() => false)) {
await createBtn.click();
test(e2e): exhaustive click-through suite + destructive narrow tests PR 14: adds a tier-3.5 Playwright pass that opens every refactored page, clicks every visible button/link/role=button, and asserts no console errors, no app-side network 4xx/5xx, and no click-time exceptions. Helper: - tests/helpers/click-everything.ts — shared `clickEverythingOnPage` with default skips for destructive selectors (archive, delete, transfer, sign-out), auto-closing of dialogs, and return-to-start after navigation. Exhaustive specs (tests/e2e/exhaustive/): - 01-yachts: list + detail + transfer dialog - 02-companies: list + detail + add-membership dialog - 03-reservations: berth list + detail reservations tab + reserve dialog - 04-client-detail: list + detail walking every tab - 05-eoi-generate: generate dialog opens with Documenso option - 06-invoice-form: new-invoice dialog billing-entity toggle - 07-berths: list + detail walking every tab - 08-portal: client portal yachts / memberships / reservations - 09-navigation: every primary nav target loads cleanly Destructive specs (tests/e2e/destructive/): - 01-yacht-archive: create-via-API → archive via UI → assert removed. Skips with a clear message when the global setup does not seed an owner client (avoids brittle failures while the full destructive fixture lands). Playwright config: testDir hoisted to ./tests/e2e; new `exhaustive` and `destructive` projects share the existing setup project. New scripts test:e2e / test:e2e:smoke / test:e2e:exhaustive / test:e2e:destructive in package.json drive each project independently. CI integration deferred — no .github/workflows/* exists in this repo yet, so the PR 14 task to wire a separate CI job is N/A. The new projects will pick up automatically when a workflow lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 14:06:10 +02:00
const dialog = page.getByRole('dialog');
await expect(dialog).toBeVisible({ timeout: 5000 });
const cancel = dialog.getByRole('button', { name: /cancel|close/i }).first();
await cancel.click();
await expect(dialog).toBeHidden({ timeout: 5000 });
}
});
});