Files
CPLv4.0/playwright/tests/analogInputsTest.ts
2025-08-27 09:27:47 +02:00

244 lines
6.4 KiB
TypeScript

import type { Page } from "@playwright/test";
import { highlightAndExpectVisible } from "./highlight";
// Kombinierte Helper-Funktion: injiziert CSS (nur einmal), hebt hervor und prüft Sichtbarkeit
export async function runAnalogInputsTest(page: Page) {
await page.goto("/analogInputs");
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Messwerteingänge" }).nth(1)
);
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Eingang" })
);
// ...existing code...
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Messwert" })
);
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Einheit" })
);
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Bezeichnung" })
);
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Einstellungen" })
);
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Messkurve", exact: true })
);
await highlightAndExpectVisible(page, page.getByText("1", { exact: true }));
await highlightAndExpectVisible(page, page.getByText("2", { exact: true }));
await highlightAndExpectVisible(page, page.getByText("3", { exact: true }));
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "4", exact: true }).locator("path")
);
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "5", exact: true })
);
await highlightAndExpectVisible(page, page.getByText("6", { exact: true }));
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "7", exact: true })
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "8", exact: true })
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page.locator(".border.p-2.text-center").first()
);
// Markiere die gesamte erste Datenzeile (Row mit "AE 1" falls vorhanden)
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page
.getByRole("row", { name: "2 5.67 °C Temperatur" })
.getByRole("button")
.first()
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page.locator("tr:nth-child(3) > td:nth-child(5)")
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page
.getByRole("row", { name: "0.01 V AE 4 Messkurve anzeigen" })
.getByRole("button")
.first()
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page
.getByRole("row", { name: "8 -0.00 mA AE 8 Messkurve" })
.getByLabel("Messkurve anzeigen")
);
await page.waitForTimeout(1000);
await page.getByRole("cell", { name: "1", exact: true }).click();
await page.locator(".border.p-2.text-center").first().click();
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Einstellungen Messwerteingang" })
);
await highlightAndExpectVisible(page, page.getByText("Bezeichnung:"));
await highlightAndExpectVisible(page, page.getByText("Offset:"));
await highlightAndExpectVisible(page, page.getByText("Faktor:"));
await highlightAndExpectVisible(page, page.getByText("Einheit:"));
await highlightAndExpectVisible(page, page.getByText("Speicherintervall:"));
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Speichern" })
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Modal schließen" })
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page.getByText(
"Einstellungen Messwerteingang 1Bezeichnung:Offset:Faktor:Einheit:"
)
);
await page.waitForTimeout(1000);
await page.getByRole("button", { name: "Modal schließen" }).click();
await page
.getByRole("row", { name: "1 126.63 V AE 1 Messkurve" })
.getByLabel("Messkurve anzeigen")
.click();
await highlightAndExpectVisible(
page,
page.getByText(
"Messkurve Messwerteingang 1Eingang 1VonBisAlle MesswerteDaten laden"
)
);
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Messkurve Messwerteingang" })
);
await highlightAndExpectVisible(page, page.locator("canvas"));
await highlightAndExpectVisible(page, page.getByText("Eingang 1VonBisAlle"));
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Daten laden" })
);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Alle Messwerte " })
);
await highlightAndExpectVisible(page, page.getByText("Von"));
await highlightAndExpectVisible(page, page.getByText("Bis"));
await highlightAndExpectVisible(
page,
page.locator("div").filter({ hasText: /^Von$/ })
);
await highlightAndExpectVisible(
page,
page.locator("div").filter({ hasText: /^Von$/ }).getByRole("textbox")
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page.locator("div").filter({ hasText: /^Bis$/ })
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page.locator("div").filter({ hasText: /^Bis$/ }).getByRole("textbox")
);
await page.waitForTimeout(1000);
await highlightAndExpectVisible(page, page.getByRole("img"));
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Alle Messwerte " })
);
await page.getByRole("button", { name: "Alle Messwerte " }).click();
await page.waitForTimeout(1000);
await page.getByRole("option", { name: "Stündlich" }).click();
await page.waitForTimeout(1000);
await page.getByRole("button", { name: "Stündlich" }).click();
await page.waitForTimeout(1000);
await page.getByRole("option", { name: "Täglich" }).click();
await page.waitForTimeout(1000);
await page.getByRole("button", { name: "Fullscreen" }).click();
await page.getByRole("button", { name: "Exit fullscreen" }).click();
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Fullscreen" })
);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Modal schließen" })
);
await page.waitForTimeout(1000);
await page.getByRole("button", { name: "Modal schließen" }).click();
// ...dein AnalogInputs-Testcode...
}