dorfteich/apps/web/e2e/settings-nav.spec.ts
Claude Fable 5 b4247f4832
Some checks failed
CI / Lint, typecheck, test (pull_request) Successful in 4m27s
CI / Build container images (pull_request) Successful in 3m48s
CI / Auth e2e pack (pull_request) Successful in 6m58s
CI / Import/export fidelity gate (pull_request) Successful in 55s
CD / Build and push images (push) Successful in 18s
CD / Deploy to Test (push) Successful in 12s
CD / Smoke tests against Test (push) Successful in 1m14s
CD / Promote to Int (push) Successful in 11s
CI / Lint, typecheck, test (push) Failing after 4m47s
CI / Auth e2e pack (push) Has been skipped
CI / Import/export fidelity gate (push) Has been skipped
CI / Build container images (push) Has been skipped
#145: Einstellungsseiten mit Sektions-Sprungnavigation
Neue SettingsLayout-Komponente leitet die Navigation per
MutationObserver aus den section>h2-Blöcken ab (erfasst konditionale
und komponenten-eigene Sektionen ohne Verdrahtung), sticky Leiste
neben dem Inhalt, auf schmalen Viewports horizontale Chip-Leiste;
aktive Sektion über Scroll-Position, am Seitenende gewinnt die letzte.
Auf allen vier Einstellungsseiten verdrahtet; die Admin-Grundeinstel-
lungen bekommen dafür eine eigene Überschrift. Neuer CI-Pack
settings-nav.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0155v2aT8AG1kZDQEZiCLBWC
2026-07-20 00:34:15 +02:00

61 lines
2.3 KiB
TypeScript

import { expect, test, type BrowserContext } from '@playwright/test';
import { contextForUser } from './helpers';
/**
* Settings section navigation pack (issue #145): every settings page derives
* a jump nav from its stacked sections; clicking an entry scrolls the section
* into view and marks it active. Language-independent selectors (CSS classes)
* throughout.
*/
const BASE_URL = process.env.E2E_BASE_URL ?? 'http://localhost:5173';
async function json<T>(context: BrowserContext, url: string, data: unknown): Promise<T> {
const response = await context.request.post(url, { data });
if (!response.ok()) throw new Error(`post ${url}${response.status()}`);
return response.json() as Promise<T>;
}
test('user settings show the jump nav and clicking scrolls + activates', async ({ browser }) => {
const context = await contextForUser(browser, BASE_URL, 'fixture-user');
const page = await context.newPage();
await page.goto('/settings');
const nav = page.locator('.settings-nav');
await expect(nav).toBeVisible();
const links = nav.locator('.settings-nav__link');
// Profile, password, sessions, watches, API tokens, data export.
await expect(links).toHaveCount(6);
// Jump to the last section: it scrolls into view and becomes active.
const last = links.last();
await last.click();
const lastSection = page.locator('.settings-layout section[id]').last();
await expect(lastSection).toBeInViewport();
await expect(last).toHaveClass(/settings-nav__link--active/);
await context.close();
});
test('pond settings derive the nav from their sections', async ({ browser }) => {
const context = await contextForUser(browser, BASE_URL, 'fixture-user');
const pond = await json<{ id: string; slug: string }>(context, '/api/v1/ponds', {
name: `Nav Pack ${Date.now()}`,
});
const page = await context.newPage();
await page.goto(`/p/${pond.slug}/settings`);
const links = page.locator('.settings-nav .settings-nav__link');
// The pond owner sees the full section stack — at least members, labels,
// missing links, import, files, appearance, plugins, sidebar, comments,
// API, export.
await expect(links.first()).toBeVisible();
expect(await links.count()).toBeGreaterThanOrEqual(8);
await links.last().click();
await expect(page.locator('.settings-layout section[id]').last()).toBeInViewport();
await context.close();
});