Files
CPLv4.0/playwright/tests/analogInputs.spec.ts
2025-08-14 12:08:52 +02:00

126 lines
5.1 KiB
TypeScript

import { test, expect } from "@playwright/test";
/*
Zum ausführen und Aufzeichnen von Tests
npx playwright codegen http://localhost:3000/analogInputs --target=ts -o tests/e2e/analog-inputs.spec.ts
ob ein Element sichtbar ist dann Auge Icon klicken
ansonsten nimmt automatich die klicks auf
//----------------------------------------------
Zum ausführen
alle Test datei , je nach dem wie in package.json definiert ist
npm run test:e2e:ui
bestimmte datei
npm run test:e2e:ui -- tests/analogInputs.spec.ts
npm run test:e2e:ui -- tests/e2e/analog-inputs.spec.ts
*/
test("test", async ({ page }) => {
await page.goto("http://localhost:3000/analogInputs");
await expect(
page.getByRole("heading", { name: "Messwerteingänge" }).nth(1)
).toBeVisible();
await expect(page.getByRole("cell", { name: "Eingang" })).toBeVisible();
await expect(page.getByRole("cell", { name: "Messwert" })).toBeVisible();
await expect(page.getByRole("cell", { name: "Einheit" })).toBeVisible();
await expect(page.getByRole("cell", { name: "Bezeichnung" })).toBeVisible();
await expect(page.getByRole("cell", { name: "Einstellungen" })).toBeVisible();
await expect(
page.getByRole("cell", { name: "Messkurve", exact: true })
).toBeVisible();
await expect(page.getByText("1", { exact: true })).toBeVisible();
await expect(page.getByText("2", { exact: true })).toBeVisible();
await expect(page.getByText("3", { exact: true })).toBeVisible();
await expect(
page.getByRole("cell", { name: "4", exact: true }).locator("path")
).toBeVisible();
await expect(
page.getByRole("cell", { name: "5", exact: true })
).toBeVisible();
await expect(page.getByText("6", { exact: true })).toBeVisible();
await expect(
page.getByRole("cell", { name: "7", exact: true })
).toBeVisible();
await expect(
page.getByRole("cell", { name: "8", exact: true })
).toBeVisible();
await expect(page.locator(".border.p-2.text-center").first()).toBeVisible();
await expect(
page
.getByRole("row", { name: "2 5.67 °C Temperatur" })
.getByRole("button")
.first()
).toBeVisible();
await expect(page.locator("tr:nth-child(3) > td:nth-child(5)")).toBeVisible();
await expect(
page
.getByRole("row", { name: "0.01 V AE 4 Messkurve anzeigen" })
.getByRole("button")
.first()
).toBeVisible();
await expect(
page
.getByRole("row", { name: "8 -0.00 mA AE 8 Messkurve" })
.getByLabel("Messkurve anzeigen")
).toBeVisible();
await page.getByRole("cell", { name: "1", exact: true }).click();
await page.locator(".border.p-2.text-center").first().click();
await expect(
page.getByRole("heading", { name: "Einstellungen Messwerteingang" })
).toBeVisible();
await expect(page.getByText("Bezeichnung:")).toBeVisible();
await expect(page.getByText("Offset:")).toBeVisible();
await expect(page.getByText("Faktor:")).toBeVisible();
await expect(page.getByText("Einheit:")).toBeVisible();
await expect(page.getByText("Speicherintervall:")).toBeVisible();
await expect(page.getByRole("button", { name: "Speichern" })).toBeVisible();
await expect(
page.getByRole("button", { name: "Modal schließen" })
).toBeVisible();
await expect(
page.getByText(
"Einstellungen Messwerteingang 1Bezeichnung:Offset:Faktor:Einheit:"
)
).toBeVisible();
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 expect(
page.getByText(
"Messkurve Messwerteingang 1Eingang 1VonBisAlle MesswerteDaten laden"
)
).toBeVisible();
await expect(
page.getByRole("heading", { name: "Messkurve Messwerteingang" })
).toBeVisible();
await expect(page.getByText("Eingang 1VonBisAlle")).toBeVisible();
await expect(page.getByRole("button", { name: "Daten laden" })).toBeVisible();
await expect(
page.getByRole("button", { name: "Alle Messwerte " })
).toBeVisible();
await expect(page.getByText("Von")).toBeVisible();
await expect(page.getByText("Bis")).toBeVisible();
await expect(page.locator("div").filter({ hasText: /^Von$/ })).toBeVisible();
await expect(
page.locator("div").filter({ hasText: /^Von$/ }).getByRole("textbox")
).toBeVisible();
await expect(page.locator("div").filter({ hasText: /^Bis$/ })).toBeVisible();
await expect(
page.locator("div").filter({ hasText: /^Bis$/ }).getByRole("textbox")
).toBeVisible();
await expect(page.getByRole("img")).toBeVisible();
await page.getByRole("button", { name: "Alle Messwerte " }).click();
await page.getByRole("option", { name: "Stündlich" }).click();
await page.getByRole("button", { name: "Stündlich " }).click();
await page.getByRole("option", { name: "Täglich" }).click();
await page.getByRole("button", { name: "Fullscreen" }).click();
await page.getByRole("button", { name: "Exit fullscreen" }).click();
await expect(page.getByRole("button", { name: "Fullscreen" })).toBeVisible();
await expect(
page.getByRole("button", { name: "Modal schließen" })
).toBeVisible();
await page.getByRole("button", { name: "Modal schließen" }).click();
});