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

@@ -1,4 +1,5 @@
import type { Page } from "@playwright/test";
import { expect } from "@playwright/test";
import { highlightAndExpectVisible } from "../utils/highlight";
// Kombinierte Helper-Funktion: injiziert CSS (nur einmal), hebt hervor und prüft Sichtbarkeit
@@ -61,13 +62,15 @@ export async function runAnalogInputsTest(page: Page) {
page,
page.getByRole("cell", { name: "7", exact: true })
);
await page.waitForTimeout(1000);
await expect(
page.getByRole("cell", { name: "8", exact: true })
).toBeVisible();
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "8", exact: true })
);
await page.waitForTimeout(1000);
await expect(page.locator(".border.p-2.text-center").first()).toBeVisible();
await highlightAndExpectVisible(
page,
@@ -75,8 +78,6 @@ export async function runAnalogInputsTest(page: Page) {
);
// Markiere die gesamte erste Datenzeile (Row mit "AE 1" falls vorhanden)
await page.waitForTimeout(1000);
await highlightAndExpectVisible(
page,
page
@@ -84,13 +85,18 @@ export async function runAnalogInputsTest(page: Page) {
.getByRole("button")
.first()
);
await page.waitForTimeout(1000);
await expect(page.locator("tr:nth-child(3) > td:nth-child(5)")).toBeVisible();
await highlightAndExpectVisible(
page,
page.locator("tr:nth-child(3) > td:nth-child(5)")
);
await page.waitForTimeout(1000);
await expect(
page
.getByRole("row", { name: "0.01 V AE 4 Messkurve anzeigen" })
.getByRole("button")
.first()
).toBeVisible();
await highlightAndExpectVisible(
page,
@@ -99,7 +105,11 @@ export async function runAnalogInputsTest(page: Page) {
.getByRole("button")
.first()
);
await page.waitForTimeout(1000);
await expect(
page
.getByRole("row", { name: "8 -0.00 mA AE 8 Messkurve" })
.getByLabel("Messkurve anzeigen")
).toBeVisible();
await highlightAndExpectVisible(
page,
@@ -107,11 +117,14 @@ export async function runAnalogInputsTest(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 expect(page.locator(".border.p-2.text-center").first()).toBeVisible();
await page.locator(".border.p-2.text-center").first().click();
await expect(
page.getByRole("heading", { name: "Einstellungen Messwerteingang" })
).toBeVisible();
await highlightAndExpectVisible(
page,
@@ -128,13 +141,19 @@ export async function runAnalogInputsTest(page: Page) {
page,
page.getByRole("button", { name: "Speichern" })
);
await page.waitForTimeout(1000);
await expect(
page.getByRole("button", { name: "Modal schließen" })
).toBeVisible();
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Modal schließen" })
);
await page.waitForTimeout(1000);
await expect(
page.getByText(
"Einstellungen Messwerteingang 1Bezeichnung:Offset:Faktor:Einheit:"
)
).toBeVisible();
await highlightAndExpectVisible(
page,
@@ -142,14 +161,23 @@ export async function runAnalogInputsTest(page: Page) {
"Einstellungen Messwerteingang 1Bezeichnung:Offset:Faktor:Einheit:"
)
);
await page.waitForTimeout(1000);
await page.getByRole("button", { name: "Modal schließen" }).click();
await expect(
page
.getByRole("row", { name: "1 126.63 V AE 1 Messkurve" })
.getByLabel("Messkurve anzeigen")
).toBeVisible();
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 highlightAndExpectVisible(
page,
@@ -172,72 +200,42 @@ export async function runAnalogInputsTest(page: 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 expect(page.getByRole("option", { name: "Stündlich" })).toBeVisible();
await page.getByRole("option", { name: "Stündlich" }).click();
await page.waitForTimeout(1000);
await expect(page.getByRole("button", { name: "Stündlich" })).toBeVisible();
await page.getByRole("button", { name: "Stündlich" }).click();
await page.waitForTimeout(1000);
await expect(page.getByRole("option", { name: "Täglich" })).toBeVisible();
await page.getByRole("option", { name: "Täglich" }).click();
await page.waitForTimeout(1000);
await expect(page.getByRole("button", { name: "Fullscreen" })).toBeVisible();
await page.getByRole("button", { name: "Fullscreen" }).click();
await expect(
page.getByRole("button", { name: "Exit fullscreen" })
).toBeVisible();
await page.getByRole("button", { name: "Exit fullscreen" }).click();
await expect(page.getByRole("button", { name: "Fullscreen" })).toBeVisible();
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Fullscreen" })
);
await highlightAndExpectVisible(
page,
page.getByRole("button", { name: "Modal schließen" })
);
await page.waitForTimeout(1000);
// Modal schließen nur, wenn noch vorhanden
const modalCloseBtn = page.getByRole("button", { name: "Modal schließen" });
if ((await modalCloseBtn.count()) > 0 && (await modalCloseBtn.isVisible())) {
await highlightAndExpectVisible(page, modalCloseBtn);
await expect(modalCloseBtn).toBeVisible();
await modalCloseBtn.click();
}
await page.getByRole("button", { name: "Modal schließen" }).click();
// ...dein AnalogInputs-Testcode...
}