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
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:
@@ -17,10 +17,15 @@ test.describe('Stammbaum — mobile read path (#692)', () => {
|
|||||||
// affordance appears; reduced-motion is already forced project-wide.
|
// affordance appears; reduced-motion is already forced project-wide.
|
||||||
test.use({ hasTouch: true, isMobile: true });
|
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) {
|
for (const width of WIDTHS) {
|
||||||
test(`affordance + controls render at ${width}px`, async ({ page }) => {
|
test(`affordance + controls render at ${width}px`, async ({ page }) => {
|
||||||
await page.setViewportSize({ width, height: 720 });
|
await page.setViewportSize({ width, height: 720 });
|
||||||
await page.addInitScript(() => localStorage.removeItem('stammbaumAffordanceDismissedAt'));
|
|
||||||
await page.goto('/stammbaum');
|
await page.goto('/stammbaum');
|
||||||
await expect(page.getByRole('heading', { name: 'Stammbaum' })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Stammbaum' })).toBeVisible();
|
||||||
|
|
||||||
|
|||||||
@@ -88,17 +88,22 @@ describe('stammbaum page', () => {
|
|||||||
await expect.element(page.getByRole('complementary')).not.toBeInTheDocument();
|
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');
|
mockPage.url = new URL('http://localhost/stammbaum');
|
||||||
|
replaceState.mockClear();
|
||||||
const Stammbaum = await loadComponent();
|
const Stammbaum = await loadComponent();
|
||||||
render(Stammbaum, {
|
render(Stammbaum, {
|
||||||
props: { data: { nodes: sampleNodes, edges: [], initialView: DEFAULT_VIEW } }
|
props: { data: { nodes: sampleNodes, edges: [], initialView: DEFAULT_VIEW } }
|
||||||
});
|
});
|
||||||
|
|
||||||
const zoomOut = page.getByRole('button', { name: /verkleinern/i });
|
const zoomOut = page.getByRole('button', { name: /verkleinern/i });
|
||||||
for (let i = 0; i < 10; i++) await zoomOut.click();
|
// Default z=1; well over (1 - 0.25) / 0.1 = 8 steps to reach the floor.
|
||||||
// Just verify that repeated clicks don't throw — branch coverage
|
for (let i = 0; i < 15; i++) await zoomOut.click();
|
||||||
await expect.element(zoomOut).toBeVisible();
|
|
||||||
|
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 () => {
|
it('mirrors the view into ?cx&cy&z when zoomed (US-PANEL-002 AC2)', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user