import { expect, test } from '@playwright/test'; import { watchErrors } from './helpers.js'; test('Neuigkeiten: suchen, filtern und Ansicht merken', async ({ page }) => { const errors = watchErrors(page); await page.goto('/neuigkeiten'); await page.getByPlaceholder('Beiträge durchsuchen').fill('Sommer'); await page.waitForURL(/q=Sommer/); await expect(page.getByRole('main').getByRole('link', { name: /Sommer/ }).first()).toBeVisible(); await page.getByRole('button', { name: 'Als Liste' }).click(); await page.reload(); await expect(page.getByRole('button', { name: 'Als Liste' })).toHaveAttribute('aria-pressed', 'true'); await page.getByRole('button', { name: 'Als Kacheln' }).click(); errors.assertNone(); }); test('Globale Suche findet Neuigkeiten', async ({ page }) => { await page.goto('/suche?q=Sommer'); await expect(page.getByRole('main').getByRole('link', { name: /Sommerfest/ }).first()).toBeVisible(); // Ausschnitte sind reiner Text – keine sichtbaren HTML-Reste await expect(page.getByRole('main')).not.toContainText(''); }); test('Personen: Suche filtert das Verzeichnis', async ({ page }) => { const errors = watchErrors(page); await page.goto('/personen'); await page.getByRole('main').getByRole('searchbox').fill('Ada'); await page.waitForURL(/q=Ada/); await expect(page.getByRole('main').getByText('Ada Admin')).toBeVisible(); errors.assertNone(); });