fix(tests): resolve 10 failing browser-mode tests
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 6m5s
CI / OCR Service Tests (pull_request) Successful in 22s
CI / Backend Unit Tests (pull_request) Successful in 3m55s
CI / fail2ban Regex (pull_request) Successful in 45s
CI / Semgrep Security Scan (pull_request) Successful in 23s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m4s
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 6m5s
CI / OCR Service Tests (pull_request) Successful in 22s
CI / Backend Unit Tests (pull_request) Successful in 3m55s
CI / fail2ban Regex (pull_request) Successful in 45s
CI / Semgrep Security Scan (pull_request) Successful in 23s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m4s
- Import layout.css in test-setup so Tailwind utilities (text-xs, min-h-[44px]) apply in vitest-browser — fixes computed-style assertions for badge font-size and touch-target height - radioGroupNav: write aria-checked directly on radio buttons on arrow-key navigation, not only via the optional onChangeFn callback - DashboardNeedsMetadata spec: tighten footer-link matcher from /50/ to /Alle 50/ — avoids strict-mode collision with row link whose relative time text also contains "50" (uploadedAt is exactly 50 days ago today) - geschichten/[id] page spec: add missing await on userEvent.click before confirmService.settle() in both delete tests - TypeSelector spec: replace storyCard.focus() (not on vitest-browser Locator) with userEvent.click(); force-dispatch aria-disabled Weiter click via element.click() to bypass Playwright actionability check Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,6 @@ describe('DashboardNeedsMetadata', () => {
|
||||
it('uses totalCount in the footer even when topDocs has fewer items', async () => {
|
||||
const docs = [makeDoc('d1', 'Only one')];
|
||||
render(DashboardNeedsMetadata, { topDocs: docs, totalCount: 50 });
|
||||
await expect.element(page.getByRole('link', { name: /50/ })).toBeInTheDocument();
|
||||
await expect.element(page.getByRole('link', { name: /Alle 50/ })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,6 +19,7 @@ export function radioGroupNav(
|
||||
const next = (current + delta + radios.length) % radios.length;
|
||||
|
||||
radios[next].focus();
|
||||
radios.forEach((r, i) => r.setAttribute('aria-checked', i === next ? 'true' : 'false'));
|
||||
onChangeFn?.(radios[next].getAttribute('value') ?? '');
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ describe('geschichten/[id] page', () => {
|
||||
|
||||
// Trigger delete — opens confirm dialog
|
||||
const deleteBtn = page.getByRole('button', { name: /löschen/i });
|
||||
userEvent.click(deleteBtn);
|
||||
await userEvent.click(deleteBtn);
|
||||
|
||||
// Settle the confirmation dialog
|
||||
confirmService.settle(true);
|
||||
@@ -262,7 +262,7 @@ describe('geschichten/[id] page', () => {
|
||||
|
||||
// Trigger delete — opens confirm dialog
|
||||
const deleteBtn = page.getByRole('button', { name: /löschen/i });
|
||||
userEvent.click(deleteBtn);
|
||||
await userEvent.click(deleteBtn);
|
||||
|
||||
// Settle the confirmation dialog
|
||||
confirmService.settle(true);
|
||||
|
||||
@@ -85,8 +85,9 @@ describe('TypeSelector', () => {
|
||||
const onweiter = vi.fn();
|
||||
render(TypeSelector, { props: { onweiter } });
|
||||
|
||||
const weiter = page.getByRole('button', { name: /Weiter/i });
|
||||
await userEvent.click(weiter);
|
||||
// aria-disabled="true" prevents Playwright actionability — dispatch via DOM to test handler behaviour
|
||||
const weiter = document.querySelector<HTMLButtonElement>('button[aria-disabled="true"]');
|
||||
weiter?.click();
|
||||
|
||||
expect(onweiter).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -101,7 +102,7 @@ describe('TypeSelector', () => {
|
||||
render(TypeSelector, { props: { onweiter: vi.fn() } });
|
||||
|
||||
const storyCard = page.getByRole('radio', { name: /Geschichte/i });
|
||||
await storyCard.focus();
|
||||
await userEvent.click(storyCard); // click focuses the card; .focus() is not on vitest-browser Locator
|
||||
await userEvent.keyboard('{ArrowRight}');
|
||||
|
||||
const journeyCard = page.getByRole('radio', { name: /Lesereise/i });
|
||||
@@ -113,7 +114,7 @@ describe('TypeSelector', () => {
|
||||
render(TypeSelector, { props: { onweiter: vi.fn() } });
|
||||
|
||||
const storyCard = page.getByRole('radio', { name: /Geschichte/i });
|
||||
await storyCard.focus();
|
||||
await userEvent.click(storyCard); // click focuses the card; .focus() is not on vitest-browser Locator
|
||||
await userEvent.keyboard('{ArrowLeft}');
|
||||
|
||||
const journeyCard = page.getByRole('radio', { name: /Lesereise/i });
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
// Load global CSS so Tailwind utility classes (text-xs, min-h-[44px], etc.)
|
||||
// are compiled and applied in browser-mode tests. Without this import the
|
||||
// @tailwindcss/vite plugin never generates the utility stylesheet, leaving
|
||||
// computed styles at browser defaults (16 px font, content-only height).
|
||||
import './routes/layout.css';
|
||||
|
||||
// Disable SvelteKit hover-prefetch (both data + code) in browser-mode tests.
|
||||
// ADR-012 / #553.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user