test(stammbaum): assert zoom-out floor via mirrored ?z; e2e affordance beforeEach (#692)
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 2m35s
CI / OCR Service Tests (pull_request) Successful in 22s
CI / Backend Unit Tests (pull_request) Successful in 3m40s
CI / fail2ban Regex (pull_request) Successful in 45s
CI / Semgrep Security Scan (pull_request) Successful in 21s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m7s

Strengthen the zoom-clamp test to assert z floors at 0.25 in the URL (was a
'does not throw' smoke test) and move the affordance localStorage reset to a
beforeEach so the e2e tests are order-independent (QA review).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-29 19:06:06 +02:00
parent 20db3d0d8f
commit 01b902e885
2 changed files with 15 additions and 5 deletions

View File

@@ -17,10 +17,15 @@ test.describe('Stammbaum — mobile read path (#692)', () => {
// affordance appears; reduced-motion is already forced project-wide.
test.use({ hasTouch: true, isMobile: true });
// Clear the affordance-dismissed flag before every test so the first-load
// hint state is deterministic regardless of test order.
test.beforeEach(async ({ page }) => {
await page.addInitScript(() => localStorage.removeItem('stammbaumAffordanceDismissedAt'));
});
for (const width of WIDTHS) {
test(`affordance + controls render at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 720 });
await page.addInitScript(() => localStorage.removeItem('stammbaumAffordanceDismissedAt'));
await page.goto('/stammbaum');
await expect(page.getByRole('heading', { name: 'Stammbaum' })).toBeVisible();

View File

@@ -88,17 +88,22 @@ describe('stammbaum page', () => {
await expect.element(page.getByRole('complementary')).not.toBeInTheDocument();
});
it('clamps the zoom level when the zoom-out button is clicked many times', async () => {
it('clamps zoom-out at MIN_ZOOM (0.25), reflected in the mirrored ?z param', async () => {
mockPage.url = new URL('http://localhost/stammbaum');
replaceState.mockClear();
const Stammbaum = await loadComponent();
render(Stammbaum, {
props: { data: { nodes: sampleNodes, edges: [], initialView: DEFAULT_VIEW } }
});
const zoomOut = page.getByRole('button', { name: /verkleinern/i });
for (let i = 0; i < 10; i++) await zoomOut.click();
// Just verify that repeated clicks don't throw — branch coverage
await expect.element(zoomOut).toBeVisible();
// Default z=1; well over (1 - 0.25) / 0.1 = 8 steps to reach the floor.
for (let i = 0; i < 15; i++) await zoomOut.click();
await vi.waitFor(() => {
const url = replaceState.mock.calls.at(-1)![0] as URL;
expect(url.searchParams.get('z')).toBe('0.25');
});
});
it('mirrors the view into ?cx&cy&z when zoomed (US-PANEL-002 AC2)', async () => {