import { test, expect } from "@playwright/test"; import { highlightAndExpectVisible } from "@playwright/utils/highlight"; /** * Loop (RSL) Modal UI / Behavior Regression Test */ test.describe("Loop / RSL Modal", () => { test("opens and validates RSL UI & controls", async ({ page }) => { await page.goto("/kabelueberwachung"); const firstBlue = page.locator(".bg-littwin-blue.text-white").first(); await highlightAndExpectVisible(page, firstBlue); await firstBlue.click(); const heading = page.getByRole("heading", { name: /Schleifenwiderstand|Isolationswiderstand/, }); await heading.waitFor(); if ( await page .getByRole("heading", { name: "Isolationswiderstand" }) .isVisible() .catch(() => false) ) { await page.locator("button:has(i.bi-x-lg)").click(); const secondBlue = page.locator(".bg-littwin-blue.text-white").nth(1); await highlightAndExpectVisible(page, secondBlue); await secondBlue.click(); await highlightAndExpectVisible( page, page.getByRole("heading", { name: "Schleifenwiderstand" }) ); } 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(); await expect(dialog.getByText("Von")).toBeVisible(); await expect(dialog.getByText("Bis")).toBeVisible(); const modeBtn = dialog.getByRole("button", { name: /Alle Messwerte|Stündlich|Täglich/, }); await modeBtn.click(); await expect( page.getByRole("option", { name: /Alle Messwerte/ }) ).toBeVisible(); await expect(page.getByRole("option", { name: /Stündlich/ })).toBeVisible(); await expect(page.getByRole("option", { name: /Täglich/ })).toBeVisible(); await page.getByRole("option", { name: "Stündlich" }).click(); const rslButton = dialog.getByRole("button", { name: /RSL/i }); await expect(rslButton).toBeVisible(); const loadBtn = dialog.getByRole("button", { name: "Daten laden" }); await expect(loadBtn).toBeVisible(); await loadBtn.click(); await dialog.locator("canvas").waitFor({ timeout: 5000 }); await expect(dialog.locator("canvas")).toBeVisible(); }); });