Files
CPLv4.0/playwright/tests/components/main/kabelueberwachung/tdrModal.test.ts
2025-09-09 11:11:38 +02:00

94 lines
2.8 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { highlightAndExpectVisible } from "@playwright/utils/highlight";
/**
* TDR Modal UI / Behavior Regression Test
*/
test.describe("TDR Modal", () => {
test("opens and validates TDR UI + dropdown + actions", async ({ page }) => {
await page.goto("/kabelueberwachung");
const blueButtons = page.locator(".bg-littwin-blue.text-white");
const count = await blueButtons.count();
for (let i = 0; i < Math.min(count, 4); i++) {
await highlightAndExpectVisible(page, blueButtons.nth(i));
await blueButtons.nth(i).click();
if (
await page
.getByRole("heading", { name: "TDR-Messung" })
.isVisible()
.catch(() => false)
) {
break;
} else {
if (
await page
.locator("button:has(i.bi-x-lg)")
.isVisible()
.catch(() => false)
) {
await page.locator("button:has(i.bi-x-lg)").click();
}
}
}
const heading = page.getByRole("heading", { name: "TDR-Messung" });
await heading.waitFor();
const dialog = page.getByRole("dialog");
await expect(dialog).toBeVisible();
await expect(
dialog
.locator("button:has(i.bi-arrows-fullscreen, i.bi-fullscreen-exit)")
.first()
).toBeVisible();
await expect(dialog.locator("button:has(i.bi-x-lg)")).toBeVisible();
await expect(dialog.locator(".toolbar")).toBeVisible();
await expect(dialog.locator(".toolbar").getByText("KÜ")).toBeVisible();
const refBtn = dialog.getByRole("button", {
name: "TDR-Kurve als Referenz speichern",
});
await expect(refBtn).toBeVisible();
const startBtn = dialog.getByRole("button", {
name: /TDR-Messung starten|TDR läuft/,
});
await expect(startBtn).toBeVisible();
const measurementBtn = dialog.getByRole("button", { name: /Fehlerstelle/ });
await highlightAndExpectVisible(page, measurementBtn);
await measurementBtn.click();
const option = page.getByRole("option", { name: /Fehlerstelle/ }).first();
await option.waitFor();
await expect(option).toBeVisible();
await option.click();
await expect(measurementBtn).toContainText("Fehlerstelle");
const viewToggle = dialog.getByRole("button", {
name: /Messkurve|Meldungen/,
});
await viewToggle.click();
await page.getByRole("option", { name: "Meldungen" }).click();
for (const header of [
"Prio",
"Zeitstempel",
"Quelle",
"Meldung",
"Status",
]) {
await highlightAndExpectVisible(
page,
dialog.getByRole("cell", { name: header })
);
}
await viewToggle.click();
await page.getByRole("option", { name: "Messkurve" }).click();
await expect(dialog.locator("canvas")).toBeVisible();
});
});