WIP: Test fehlgeschlagen
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
import type { Locator, Page } from "@playwright/test";
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect } from "@playwright/test";
|
||||
import { highlightAndExpectVisible } from "@playwright/utils/highlight";
|
||||
import { navTest } from "@playwright/components/navTest";
|
||||
import { headerTest } from "@playwright/components/headerTest";
|
||||
import { footerTest } from "@playwright/components/footerTest";
|
||||
|
||||
// Kombinierte Helper-Funktion: injiziert CSS (nur einmal), hebt hervor und prüft Sichtbarkeit
|
||||
|
||||
export async function runAnalogInputsTest(page: Page) {
|
||||
await page.goto("/analogInputs");
|
||||
//----------------------
|
||||
await headerTest(page);
|
||||
await navTest(page);
|
||||
await footerTest(page);
|
||||
await page.waitForTimeout(400);
|
||||
//----------------------
|
||||
await highlightAndExpectVisible(
|
||||
page,
|
||||
page.getByRole("heading", { name: "Messwerteingänge" }).nth(1)
|
||||
@@ -124,7 +134,7 @@ export async function runAnalogInputsTest(page: Page) {
|
||||
await page.locator(".border.p-2.text-center").first().click();
|
||||
await expect(
|
||||
page.getByRole("heading", { name: "Einstellungen Messwerteingang" })
|
||||
).toBeVisible();
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
|
||||
await highlightAndExpectVisible(
|
||||
page,
|
||||
@@ -132,10 +142,14 @@ export async function runAnalogInputsTest(page: Page) {
|
||||
);
|
||||
|
||||
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.getByText("Offset:"), 5000);
|
||||
await highlightAndExpectVisible(page, page.getByText("Faktor:"), 5000);
|
||||
await highlightAndExpectVisible(page, page.getByText("Einheit:"), 5000);
|
||||
await highlightAndExpectVisible(
|
||||
page,
|
||||
page.getByText("Speicherintervall:"),
|
||||
5000
|
||||
);
|
||||
|
||||
await highlightAndExpectVisible(
|
||||
page,
|
||||
@@ -236,45 +250,4 @@ export async function runAnalogInputsTest(page: Page) {
|
||||
await expect(modalCloseBtn).toBeVisible();
|
||||
await modalCloseBtn.click();
|
||||
}
|
||||
|
||||
// ...dein AnalogInputs-Testcode...
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
export async function highlightAndExpectVisible(
|
||||
page: Page,
|
||||
locator: Locator,
|
||||
durationMs = 800
|
||||
) {
|
||||
// CSS nur einmal pro Page injizieren
|
||||
const alreadyInjected = await page.evaluate(
|
||||
() => (window as any).__pwForceCssInjected === true
|
||||
);
|
||||
|
||||
if (!alreadyInjected) {
|
||||
await page.addStyleTag({
|
||||
content: `
|
||||
.pw-force-outline {
|
||||
outline: 3px solid #ff1744 !important;
|
||||
outline-offset: 2px !important;
|
||||
box-shadow: 0 0 0 3px rgba(224,0,43,.35) !important;
|
||||
}
|
||||
`,
|
||||
});
|
||||
await page.evaluate(() => {
|
||||
(window as any).__pwForceCssInjected = true;
|
||||
});
|
||||
}
|
||||
|
||||
const els = await locator.elementHandles();
|
||||
for (const el of els) {
|
||||
await el.evaluate((node: unknown, ms: number) => {
|
||||
const n = node as HTMLElement;
|
||||
n.classList.add("pw-force-outline");
|
||||
window.setTimeout(() => n.classList.remove("pw-force-outline"), ms);
|
||||
}, durationMs);
|
||||
}
|
||||
|
||||
await expect(locator).toBeVisible();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user