Files
pn-new-crm/tests/e2e/smoke/28-berth-interests-tab.spec.ts
Matt 221ae5784e chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:

- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
  never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
  after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
  redirects (ocr to ai, reports to dashboard, invitations to users),
  docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
  flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
  let-reassign), set-state-in-effect disables in CountryFlag and
  UploadForSigning preview-bytes effect, unused 'confirm' destructures in
  interest contract + reservation tabs, unescaped apostrophe in test-template
  card copy
2026-05-23 00:52:59 +02:00

37 lines
1.8 KiB
TypeScript

import { test, expect } from '@playwright/test';
import { login, PORT_SLUG } from './helpers';
test.describe('Berth detail - Interests tab (Phase B)', () => {
test.beforeEach(async ({ page }) => {
await login(page, 'super_admin');
});
test('berth detail page exposes an Interests tab', async ({ page }) => {
// Navigate to the berths list, then click the first row to drill in.
// The list uses TanStack Table row-click handlers, so we wait for the
// table body to populate rather than for `a[href*="/berths/"]`.
await page.goto(`/${PORT_SLUG}/berths`);
const firstRow = page.locator('tbody tr').first();
await expect(firstRow).toBeVisible({ timeout: 20_000 });
// The list table uses an `onRowClick` handler on the <tr> that calls
// `router.push`. Open the row's actions menu and click "View details"
// - the menu item's handler routes the same way and is more reliable
// than firing a synthetic <tr> click under React 19 + dev-mode HMR.
await firstRow.getByRole('button', { name: /open menu/i }).click();
await page.getByRole('menuitem', { name: /view details/i }).click();
await page.waitForURL(/\/berths\/[^/]+$/, { timeout: 10_000 });
const tab = page.getByRole('tab', { name: 'Interests', exact: true });
await expect(tab).toBeVisible({ timeout: 10_000 });
await tab.click();
await expect(tab).toHaveAttribute('data-state', 'active');
// Confirm the new tab body replaced the old stub. The body might be:
// - a populated table
// - the empty-state ("No interests linked to this berth")
// - the loading skeleton (still fetching)
// The negative assertion against the old stub copy is the primary signal.
await expect(page.getByText('Interests coming soon')).not.toBeVisible({ timeout: 2_000 });
});
});