fix: all.test.ts

This commit is contained in:
ISA
2025-08-29 13:47:23 +02:00
parent 6df31455a9
commit 8850b0ffda
10 changed files with 180 additions and 82 deletions

View File

@@ -4,6 +4,8 @@ import { expect } from "@playwright/test";
export async function runMeldungenTest(page: Page) {
await page.goto("/meldungen");
// Warte gezielt auf das Logo, um Server-Latenz abzufangen
await page.waitForSelector('img[alt="Logo"]', { timeout: 15000 });
// Logo
const logo = page.getByRole("img", { name: "Logo", exact: true });
@@ -35,7 +37,7 @@ export async function runMeldungenTest(page: Page) {
await expect(darkModeBtn).toBeVisible();
await page.waitForTimeout(100);
// Sidebar Links sichtbar
// Sidebar Links sichtbar (wie in den anderen Tests, kein explizites Sidebar-Handling)
const sidebarLinks = [
{ role: "link", name: "Übersicht" },
{ role: "link", name: "Kabelüberwachung" },
@@ -53,6 +55,13 @@ export async function runMeldungenTest(page: Page) {
await page.waitForTimeout(50);
}
for (const link of sidebarLinks) {
const locator = page.getByRole(link.role as any, { name: link.name });
await highlightAndExpectVisible(page, locator);
await expect(locator).toBeVisible();
await page.waitForTimeout(50);
}
// Berichte Heading
const berichteHeading = page.getByRole("heading", { name: "Berichte" });
await highlightAndExpectVisible(page, berichteHeading);
@@ -196,6 +205,8 @@ export async function highlightAndExpectVisible(
});
}
// Erst prüfen, ob das Element sichtbar ist, sonst bricht der Test sauber ab
await expect(locator).toBeVisible({ timeout: 10000 });
const els = await locator.elementHandles();
for (const el of els) {
await el.evaluate((node: unknown, ms: number) => {