WIP: Test fehlgeschlagen

This commit is contained in:
ISA
2025-09-02 14:22:58 +02:00
parent fb79817136
commit 35e34b96d1
18 changed files with 186 additions and 655 deletions

View File

@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
NEXT_PUBLIC_EXPORT_STATIC=false
NEXT_PUBLIC_USE_CGI=false
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.811
NEXT_PUBLIC_APP_VERSION=1.6.812
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)

View File

@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_EXPORT_STATIC=true
NEXT_PUBLIC_USE_CGI=true
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.811
NEXT_PUBLIC_APP_VERSION=1.6.812
NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,8 @@
## [1.6.812] 2025-09-02
- test: extracted navigation tests to separate file
---
## [1.6.811] 2025-09-02
- Test: nav ausgelagert

View File

@@ -0,0 +1,14 @@
{
"win_da_state": [
1,
0,
1,
1
],
"win_da_bezeichnung": [
"Ausgang2",
"Ausgang2",
"Ausgang3",
"Ausgang4"
]
}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "cpl-v4",
"version": "1.6.811",
"version": "1.6.812",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cpl-v4",
"version": "1.6.811",
"version": "1.6.812",
"dependencies": {
"@fontsource/roboto": "^5.1.0",
"@headlessui/react": "^2.2.4",

View File

@@ -1,6 +1,6 @@
{
"name": "cpl-v4",
"version": "1.6.811",
"version": "1.6.812",
"private": true,
"scripts": {
"dev": "next dev -p 3000",

View File

@@ -52,4 +52,5 @@ export async function footerTest(page: Page) {
page.getByRole("heading", { name: "PDF Handbücher" })
);
await highlightAndExpectVisible(page, page.getByText("KUE705FO.PDF"));
await page.getByRole("contentinfo").getByRole("button").click();
}

View File

@@ -11,8 +11,4 @@ export async function headerTest(page: Page) {
page,
page.getByRole("img", { name: "Logo", exact: true })
);
await highlightAndExpectVisible(
page,
page.getByRole("main").locator("svg").first()
);
}

View File

@@ -35,3 +35,23 @@ export async function navTest(page: Page) {
page.getByRole("link", { name: "Einstellungen" })
);
}
/*
// Sidebar Links sichtbar
const sidebarLinks2 = [
{ role: "link", name: "Übersicht" },
{ role: "link", name: "Kabelüberwachung" },
{ role: "link", name: "Meldungseingänge" },
{ role: "link", name: "Schaltausgänge" },
{ role: "link", name: "Messwerteingänge" },
{ role: "link", name: "Berichte" },
{ role: "link", name: "System" },
{ role: "link", name: "Einstellungen" },
];
for (const link of sidebarLinks2) {
const locator = page.getByRole(link.role as any, { name: link.name });
await highlightAndExpectVisible(page, locator);
await expect(locator).toBeVisible();
await page.waitForTimeout(50);
}
*/

View File

@@ -9,9 +9,9 @@ import { runSystemTest } from "./pages/system/systemTest";
import { runSettingsPageTest } from "./pages/settingsPage/settingsPageTest";
test("Dashboard, AnalogInputs und SettingsPage", async ({ page }) => {
await runDashboardTest(page);
await runCableMonitoringTest(page);
await runDigitalInputsTest(page);
// await runDashboardTest(page);
// await runCableMonitoringTest(page);
// await runDigitalInputsTest(page);
await runDigitalOutputsTest(page);
await runAnalogInputsTest(page);
await runMeldungenTest(page);

View File

@@ -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();
}

View File

@@ -3,13 +3,15 @@ import { highlightAndExpectVisible } from "@playwright/utils/highlight";
import { navTest } from "@playwright/components/navTest";
import { headerTest } from "@playwright/components/headerTest";
import { footerTest } from "@playwright/components/footerTest";
export async function runDashboardTest(page: Page) {
await page.goto("http://localhost:3000/dashboard");
export async function runDashboardTest(page: Page) {
await page.goto("/dashboard");
//----------------------
await headerTest(page);
// Navigation-Tests ausgelagert:
await navTest(page);
await footerTest(page);
await page.waitForTimeout(400);
//----------------------
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Letzten 20 Meldungen" })

View File

@@ -1,126 +1,18 @@
import type { Locator, Page } from "@playwright/test";
import { expect } from "@playwright/test";
import type { Page } 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";
export async function runDigitalInputsTest(page: Page) {
await page.goto("/digitalInputs");
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "Logo", exact: true })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "TALAS Logo" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Meldestation" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(page, page.getByText("CPLV4 Ismail Rastede"));
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Übersicht" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Kabelüberwachung" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Meldungseingänge" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Schaltausgänge" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Messwerteingänge" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Berichte" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "System" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Einstellungen" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Littwin Systemtechnik GmbH & Co\. KG$/ })
.locator("svg")
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByText("Littwin Systemtechnik GmbH &")
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Telefon: 04402 972577-0$/ })
.locator("svg")
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByText("Telefon: 04402 972577-")
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^kontakt@littwin-systemtechnik\.de$/ })
.locator("svg")
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByText("kontakt@littwin-systemtechnik")
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Handbücher$/ })
.locator("path")
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByText("Handbücher", { exact: true })
);
await page.waitForTimeout(400);
await page.getByText("Handbücher", { exact: true }).click();
await page.waitForTimeout(400);
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "PDF Handbücher" })
);
await page.waitForTimeout(400);
await highlightAndExpectVisible(page, page.getByText("KUE705FO.PDF"));
//----------------------
await headerTest(page);
await navTest(page);
await footerTest(page);
await page.waitForTimeout(400);
//--------------------
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Meldungseingänge", exact: true })
@@ -212,41 +104,3 @@ export async function runDigitalInputsTest(page: Page) {
);
await page.waitForTimeout(1000);
}
//---------------------------------------------------------------------
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();
}

View File

@@ -1,213 +1,73 @@
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";
export async function runDigitalOutputsTest(page: Page) {
await page.goto("/digitalOutputs");
//----------------------
await headerTest(page);
await navTest(page);
await footerTest(page);
await page.waitForTimeout(400);
//----------------------
await highlightAndExpectVisible(page, page.locator("h1"));
page.locator("h1").click();
await highlightAndExpectVisible(
page,
page.locator("h2").filter({ hasText: "Schaltausgänge" })
);
// Logo
const logo = page.getByRole("img", { name: "Logo", exact: true });
await highlightAndExpectVisible(page, logo);
await logo.click();
await page.waitForTimeout(200);
// TALAS Logo
const talasLogo = page.getByRole("img", { name: "TALAS Logo" });
await highlightAndExpectVisible(page, talasLogo);
await talasLogo.click();
await page.waitForTimeout(200);
// Meldestation Heading
const meldestation = page.getByRole("heading", { name: "Meldestation" });
await highlightAndExpectVisible(page, meldestation);
await meldestation.click();
await page.waitForTimeout(200);
// CPLV4 Ismail Rastede
const cplv4Text = page.getByText("CPLV4 Ismail Rastede");
await highlightAndExpectVisible(page, cplv4Text);
await cplv4Text.click();
await page.waitForTimeout(200);
// h1
const h1 = page.locator("h1");
await highlightAndExpectVisible(page, h1);
await h1.click();
await page.waitForTimeout(200);
// Sidebar Links
const sidebarLinks = [
{ role: "link", name: "Übersicht" },
{ role: "link", name: "Kabelüberwachung" },
{ role: "link", name: "Meldungseingänge" },
{ role: "link", name: "Schaltausgänge" },
{ role: "link", name: "Messwerteingänge" },
{ role: "link", name: "Berichte" },
{ role: "link", name: "System" },
{ role: "link", name: "Einstellungen" },
];
for (const link of sidebarLinks) {
const locator = page.getByRole(link.role as any, { name: link.name });
await highlightAndExpectVisible(page, locator);
await expect(locator).toBeVisible();
await page.waitForTimeout(100);
}
// Footer/Info
const footerSvgs = [
page
.locator("div")
.filter({ hasText: /^Littwin Systemtechnik GmbH & Co\. KG$/ })
.locator("svg"),
page
.locator("div")
.filter({ hasText: /^Telefon: 04402 972577-0$/ })
.locator("path"),
page
.locator("div")
.filter({ hasText: /^kontakt@littwin-systemtechnik\.de$/ })
.locator("svg"),
page
.locator("div")
.filter({ hasText: /^Handbücher$/ })
.locator("svg"),
];
for (const svg of footerSvgs) {
await highlightAndExpectVisible(page, svg);
await expect(svg).toBeVisible();
await page.waitForTimeout(100);
}
const footerTexts = [
page.getByText("Littwin Systemtechnik GmbH &"),
page.getByText("Telefon: 04402 972577-"),
page.getByText("kontakt@littwin-systemtechnik"),
page.getByText("Handbücher", { exact: true }),
];
for (const txt of footerTexts) {
await highlightAndExpectVisible(page, txt);
await expect(txt).toBeVisible();
await page.waitForTimeout(100);
}
// Handbücher öffnen
const handbuecher = page.getByText("Handbücher", { exact: true });
await highlightAndExpectVisible(page, handbuecher);
await handbuecher.click();
await page.waitForTimeout(200);
// PDF Handbücher Heading
const pdfHandbuecher = page.getByRole("heading", { name: "PDF Handbücher" });
await highlightAndExpectVisible(page, pdfHandbuecher);
await pdfHandbuecher.click();
await page.waitForTimeout(200);
// KUE705FO.PDF sichtbar
const kuePdf = page.getByText("KUE705FO.PDF");
await highlightAndExpectVisible(page, kuePdf);
await expect(kuePdf).toBeVisible();
await page.waitForTimeout(100);
// Footer Button
const footerButton = page.getByRole("contentinfo").getByRole("button");
await highlightAndExpectVisible(page, footerButton);
await expect(footerButton).toBeVisible();
await footerButton.click();
await page.waitForTimeout(200);
// Schaltausgänge Überschrift
const schaltausgaengeH2 = page
page
.locator("h2")
.filter({ hasText: "Schaltausgänge" });
await highlightAndExpectVisible(page, schaltausgaengeH2);
await schaltausgaengeH2.click();
await page.waitForTimeout(200);
.filter({ hasText: "Schaltausgänge" })
.locator("svg")
.click();
page.locator("h2").filter({ hasText: "Schaltausgänge" }).click();
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Ausgang", exact: true })
);
const ausgang2Cell = page.getByRole("cell", { name: "Ausgang2" }).nth(1);
await ausgang2Cell.waitFor({ state: "visible", timeout: 15000 }); // bis zu 15 Sekunden warten
await ausgang2Cell.click();
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Schalter" })
);
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Schalter" })
);
await highlightAndExpectVisible(
page,
page.getByRole("cell", { name: "Aktion" })
);
page.getByRole("cell", { name: "1" }).locator("svg").click();
//page.getByRole("cell", { name: "1" }).click();
page.getByRole("cell", { name: "2", exact: true }).locator("svg").click();
page.getByRole("cell", { name: "2", exact: true }).click();
page.getByRole("cell", { name: "3", exact: true }).locator("svg").click();
page.getByRole("cell", { name: "3", exact: true }).click();
page.getByRole("cell", { name: "4", exact: true }).locator("svg").click();
page.getByRole("cell", { name: "4", exact: true }).click();
page.getByRole("cell", { name: "Ausgang2" }).first().click();
// Tabellenzellen
const tableCells = [
page.getByRole("cell", { name: "Ausgang", exact: true }),
page.getByRole("cell", { name: "Bezeichnung" }),
page.getByRole("cell", { name: "Schalter" }),
page.getByRole("cell", { name: "Aktion" }),
page.getByRole("cell", { name: "1" }),
page.getByRole("cell", { name: "2", exact: true }),
page.getByRole("cell", { name: "3", exact: true }),
page.getByRole("cell", { name: "4", exact: true }),
page.getByRole("cell", { name: "Ausgang2" }).first(),
page.getByRole("cell", { name: "Ausgang2" }).nth(1),
page.getByRole("cell", { name: "Ausgang3" }),
page.getByRole("cell", { name: "Ausgang4" }),
];
for (const cell of tableCells) {
await highlightAndExpectVisible(page, cell);
await cell.click();
await page.waitForTimeout(100);
}
page.getByRole("row", { name: "1 Ausgang2" }).locator("path").nth(1).click();
page.getByRole("row", { name: "1 Ausgang2" }).locator("path").nth(1).click();
page.getByRole("row", { name: "2 Ausgang2" }).locator("path").nth(1).click();
page.getByRole("row", { name: "2 Ausgang2" }).locator("svg").nth(1).click();
page.getByRole("row", { name: "1 Ausgang2" }).locator("path").nth(2).click();
page.getByRole("row", { name: "1 Ausgang2" }).locator("svg").nth(2).click();
page.getByRole("button", { name: "Modal schließen" }).click();
page.getByRole("row", { name: "2 Ausgang2" }).locator("svg").nth(2).click();
page.getByRole("button", { name: "Modal schließen" }).click();
page.getByRole("row", { name: "1 Ausgang2" }).locator("svg").nth(2).click();
page.getByRole("heading", { name: "Einstellungen Schaltausgang" }).click();
page.getByText("Bezeichnung:").click();
page.getByRole("textbox", { name: "z. B. Licht Relais" }).click();
// Sichtbarkeit von Zellen in Zeilen prüfen
const rowChecks = [
{ row: "1 Ausgang2", idx: 2 },
{ row: "2 Ausgang2", idx: 2 },
{ row: "Ausgang3", idx: 2 },
{ row: "Ausgang4", idx: 2 },
{ row: "1 Ausgang2", idx: 3 },
{ row: "2 Ausgang2", idx: 3 },
{ row: "Ausgang3", idx: 3 },
{ row: "Ausgang4", idx: 3 },
];
for (const { row, idx } of rowChecks) {
const cell = page
.getByRole("row", { name: row })
.getByRole("cell")
.nth(idx);
await highlightAndExpectVisible(page, cell);
await expect(cell).toBeVisible();
await page.waitForTimeout(100);
}
// SVG-Buttons in Zeilen
const rowSvgClicks = [
{ row: "1 Ausgang2", nth: 2 },
{ row: "2 Ausgang2", nth: 2 },
{ row: "Ausgang3", nth: 2 },
{ row: "Ausgang4", nth: 2 },
];
for (const { row, nth } of rowSvgClicks) {
const svg = page.getByRole("row", { name: row }).locator("svg").nth(nth);
await highlightAndExpectVisible(page, svg);
await svg.click();
await page.waitForTimeout(200);
// Modal: Einstellungen Schaltausgang
const heading = page.getByRole("heading", {
name: "Einstellungen Schaltausgang",
});
await highlightAndExpectVisible(page, heading);
await heading.click();
await page.waitForTimeout(100);
const bezeichnung = page.getByText("Bezeichnung:");
await highlightAndExpectVisible(page, bezeichnung);
await bezeichnung.click();
await page.waitForTimeout(100);
const textbox = page.getByRole("textbox", { name: "z. B. Licht Relais" });
await highlightAndExpectVisible(page, textbox);
await textbox.click();
await page.waitForTimeout(100);
const speichern = page.getByRole("button", { name: "Speichern" });
await highlightAndExpectVisible(page, speichern);
await expect(speichern).toBeVisible();
await page.waitForTimeout(100);
const modalSchliessen = page.getByRole("button", {
name: "Modal schließen",
});
await highlightAndExpectVisible(page, modalSchliessen);
await expect(modalSchliessen).toBeVisible();
await modalSchliessen.click();
await page.waitForTimeout(200);
}
page.getByRole("button", { name: "Modal schließen" }).click();
page.getByRole("row", { name: "2 Ausgang2" }).locator("path").nth(2).click();
}
//---------------------------------------------------------------------

View File

@@ -1,33 +1,17 @@
import type { Page } 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";
export async function runCableMonitoringTest(page: Page) {
await page.goto("/kabelueberwachung");
// Logo
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "Logo", exact: true })
);
await page.waitForTimeout(400);
// TALAS Logo
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "TALAS Logo" })
);
await page.waitForTimeout(400);
// Meldestation
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Meldestation" })
);
await page.waitForTimeout(400);
// CPLV4 Ismail Rastede
await highlightAndExpectVisible(page, page.getByText("CPLV4 Ismail Rastede"));
//----------------------
await headerTest(page);
await navTest(page);
await footerTest(page);
await page.waitForTimeout(400);
//----------------------
// Rack Buttons
for (const rack of [1, 2, 3, 4, 1]) {
@@ -373,8 +357,4 @@ export async function runCableMonitoringTest(page: Page) {
page.getByRole("cell", { name: "Status" })
);
await page.waitForTimeout(400);
// ...weitere Schritte können nach diesem Muster ergänzt werden
}
//---------------------------------------------------------------------

View File

@@ -1,66 +1,17 @@
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";
export async function runMeldungenTest(page: Page) {
await page.goto("/meldungen");
// Warte gezielt auf das Logo, um Server-Latenz abzufangen
await page.waitForSelector('img[alt="Logo"]', { timeout: 15000 });
// Logo
const logo = page.getByRole("img", { name: "Logo", exact: true });
await highlightAndExpectVisible(page, logo);
await logo.click();
await page.waitForTimeout(100);
// TALAS Logo
const talasLogo = page.getByRole("img", { name: "TALAS Logo" });
await highlightAndExpectVisible(page, talasLogo);
await talasLogo.click();
await page.waitForTimeout(100);
// Meldestation Heading
const meldestation = page.getByRole("heading", { name: "Meldestation" });
await highlightAndExpectVisible(page, meldestation);
await meldestation.click();
await page.waitForTimeout(100);
// CPLV4 Ismail Rastede
const cplv4Text = page.getByText("CPLV4 Ismail Rastede");
await highlightAndExpectVisible(page, cplv4Text);
await cplv4Text.click();
await page.waitForTimeout(100);
// Dark Mode Button sichtbar
const darkModeBtn = page.getByRole("button", { name: "Dark Mode" });
await highlightAndExpectVisible(page, darkModeBtn);
await expect(darkModeBtn).toBeVisible();
await page.waitForTimeout(100);
// Sidebar Links sichtbar (wie in den anderen Tests, kein explizites Sidebar-Handling)
const sidebarLinks = [
{ role: "link", name: "Übersicht" },
{ role: "link", name: "Kabelüberwachung" },
{ role: "link", name: "Meldungseingänge" },
{ role: "link", name: "Schaltausgänge" },
{ role: "link", name: "Messwerteingänge" },
{ role: "link", name: "Berichte" },
{ role: "link", name: "System" },
{ role: "link", name: "Einstellungen" },
];
for (const link of sidebarLinks) {
const locator = page.getByRole(link.role as any, { name: link.name });
await highlightAndExpectVisible(page, locator);
await expect(locator).toBeVisible();
await page.waitForTimeout(50);
}
for (const link of sidebarLinks) {
const locator = page.getByRole(link.role as any, { name: link.name });
await highlightAndExpectVisible(page, locator);
await expect(locator).toBeVisible();
await page.waitForTimeout(50);
}
//----------------------
await headerTest(page);
await navTest(page);
await footerTest(page);
await page.waitForTimeout(400);
//----------------------
// Berichte Heading
const berichteHeading = page.getByRole("heading", { name: "Berichte" });
@@ -119,14 +70,14 @@ export async function runMeldungenTest(page: Page) {
await page.waitForTimeout(50);
// Buttons sichtbar
const anzeigenBtn = page.getByRole("button", { name: "Anzeigen" });
/* const anzeigenBtn = page.getByRole("button", { name: "Anzeigen" });
await highlightAndExpectVisible(page, anzeigenBtn);
await expect(anzeigenBtn).toBeVisible();
await page.waitForTimeout(50);
await page.waitForTimeout(50); */
const alleQuellenBtn = page.getByRole("button", { name: "Alle Quellen" });
await highlightAndExpectVisible(page, alleQuellenBtn);
await expect(alleQuellenBtn).toBeVisible();
// await expect(alleQuellenBtn).toBeVisible();
await alleQuellenBtn.click();
await page.waitForTimeout(50);
await alleQuellenBtn.click();
@@ -177,5 +128,3 @@ export async function runMeldungenTest(page: Page) {
}
}
}
//---------------------------------------------------------------------

View File

@@ -1,103 +1,17 @@
import type { Page } 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";
export async function runSettingsPageTest(page: Page) {
await page.goto("http://localhost:3000/einstellungen");
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "Meldestation" })
);
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "TALAS Logo" })
);
await highlightAndExpectVisible(
page,
page.getByRole("img", { name: "Logo", exact: true })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Übersicht" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Kabelüberwachung" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Meldungseingänge" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Schaltausgänge" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Messwerteingänge" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Berichte" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "System" })
);
await highlightAndExpectVisible(
page,
page.getByRole("link", { name: "Einstellungen" })
);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Littwin Systemtechnik GmbH & Co\. KG$/ })
.locator("svg")
);
await highlightAndExpectVisible(
page,
page.getByText("Littwin Systemtechnik GmbH &")
);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Telefon: 04402 972577-0$/ })
.locator("svg")
);
await highlightAndExpectVisible(
page,
page.getByText("Telefon: 04402 972577-")
);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^kontakt@littwin-systemtechnik\.de$/ })
.locator("svg")
);
await highlightAndExpectVisible(
page,
page.getByText("kontakt@littwin-systemtechnik")
);
await highlightAndExpectVisible(
page,
page
.locator("div")
.filter({ hasText: /^Handbücher$/ })
.locator("svg")
);
await highlightAndExpectVisible(
page,
page.getByText("Handbücher", { exact: true })
);
await page.getByText("Handbücher", { exact: true }).click();
await highlightAndExpectVisible(
page,
page.getByRole("heading", { name: "PDF Handbücher" })
);
await highlightAndExpectVisible(page, page.getByText("KUE705FO.PDF"));
await page.goto("/einstellungen");
//----------------------
await headerTest(page);
await navTest(page);
await footerTest(page);
await page.waitForTimeout(400);
//----------------------
//await page.getByRole("button").filter({ hasText: /^$/ }).click();
await page.getByRole("button", { name: "Allgemeine Einstellungen" }).click();
await highlightAndExpectVisible(

View File

@@ -1,34 +1,17 @@
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";
export async function runSystemTest(page: Page) {
await page.goto("/system");
// Logo
const logo = page.getByRole("img", { name: "Logo", exact: true });
await highlightAndExpectVisible(page, logo);
await logo.click();
await page.waitForTimeout(100);
// TALAS Logo
const talasLogo = page.getByRole("img", { name: "TALAS Logo" });
await highlightAndExpectVisible(page, talasLogo);
await talasLogo.click();
await page.waitForTimeout(100);
// Meldestation Heading
const meldestation = page.getByRole("heading", { name: "Meldestation" });
await highlightAndExpectVisible(page, meldestation);
await meldestation.click();
await page.waitForTimeout(100);
// CPLV4 Ismail Rastede
const cplv4Text = page.getByText("CPLV4 Ismail Rastede");
await highlightAndExpectVisible(page, cplv4Text);
await cplv4Text.click();
await page.waitForTimeout(100);
//----------------------
await headerTest(page);
await navTest(page);
await footerTest(page);
await page.waitForTimeout(400);
//----------------------
// System Spannungen &
const systemSpannung = page.getByRole("heading", {
name: "System Spannungen &",
@@ -123,24 +106,4 @@ export async function runSystemTest(page: Page) {
await highlightAndExpectVisible(page, img3);
await img3.click({ position: { x: 272, y: 93 } });
await page.waitForTimeout(100);
// Sidebar Links sichtbar
const sidebarLinks2 = [
{ role: "link", name: "Übersicht" },
{ role: "link", name: "Kabelüberwachung" },
{ role: "link", name: "Meldungseingänge" },
{ role: "link", name: "Schaltausgänge" },
{ role: "link", name: "Messwerteingänge" },
{ role: "link", name: "Berichte" },
{ role: "link", name: "System" },
{ role: "link", name: "Einstellungen" },
];
for (const link of sidebarLinks2) {
const locator = page.getByRole(link.role as any, { name: link.name });
await highlightAndExpectVisible(page, locator);
await expect(locator).toBeVisible();
await page.waitForTimeout(50);
}
}
//---------------------------------------------------------------------