diff --git a/.env.development b/.env.development index 9c47ae0..2c47c52 100644 --- a/.env.development +++ b/.env.development @@ -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.753 +NEXT_PUBLIC_APP_VERSION=1.6.754 NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) diff --git a/.env.production b/.env.production index 8d18022..0508b36 100644 --- a/.env.production +++ b/.env.production @@ -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.753 +NEXT_PUBLIC_APP_VERSION=1.6.754 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4043d80..e7c884a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.6.754] – 2025-08-27 + +- test: Einstellungen Seite mit highlighting + +--- ## [1.6.753] – 2025-08-25 - test: playwright funktion highlight in separate Datei diff --git a/Playwright 26.08.2025.odp b/Playwright 26.08.2025.odp new file mode 100644 index 0000000..b1b7837 Binary files /dev/null and b/Playwright 26.08.2025.odp differ diff --git a/Screenshot 2025-08-27 082443.png b/Screenshot 2025-08-27 082443.png new file mode 100644 index 0000000..101fe1a Binary files /dev/null and b/Screenshot 2025-08-27 082443.png differ diff --git a/Testing_CPLV4_Webseiten.pptx b/Testing_CPLV4_Webseiten.pptx deleted file mode 100644 index 573b3a2..0000000 Binary files a/Testing_CPLV4_Webseiten.pptx and /dev/null differ diff --git a/components/main/dashboard/modulesStatus/KabelModulStatus.tsx b/components/main/dashboard/modulesStatus/KabelModulStatus.tsx index d93323c..257fc0e 100644 --- a/components/main/dashboard/modulesStatus/KabelModulStatus.tsx +++ b/components/main/dashboard/modulesStatus/KabelModulStatus.tsx @@ -18,10 +18,16 @@ const KabelModulStatus: React.FC = ({ // Modultyp basierend auf der Version bestimmen let moduleName = ""; let moduleType = ""; - if (moduleVersion === 420) { + if (moduleVersion === 419) { moduleName = "KÜ705"; moduleType = "FO"; - } else if (moduleVersion === 419) { + } else if (moduleVersion === 420) { + moduleName = "KÜ705"; + moduleType = "FO"; + } else if (moduleVersion === 421) { + moduleName = "KÜ705"; + moduleType = "FO"; + } else if (moduleVersion === 431) { moduleName = "KÜ705"; moduleType = "FO"; } else if (moduleVersion === 350) { diff --git a/package-lock.json b/package-lock.json index f7f070e..4f2ddcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.753", + "version": "1.6.754", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.753", + "version": "1.6.754", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index 5398cc0..1802703 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.753", + "version": "1.6.754", "private": true, "scripts": { "dev": "next dev", diff --git a/playwright/tests/analogInputsTest.ts b/playwright/tests/analogInputsTest.ts index c15682e..e5787dd 100644 --- a/playwright/tests/analogInputsTest.ts +++ b/playwright/tests/analogInputsTest.ts @@ -61,13 +61,13 @@ export async function runAnalogInputsTest(page: Page) { page, page.getByRole("cell", { name: "7", exact: true }) ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, page.getByRole("cell", { name: "8", exact: true }) ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, @@ -75,7 +75,7 @@ export async function runAnalogInputsTest(page: Page) { ); // Markiere die gesamte erste Datenzeile (Row mit "AE 1" falls vorhanden) - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, @@ -84,13 +84,13 @@ export async function runAnalogInputsTest(page: Page) { .getByRole("button") .first() ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, page.locator("tr:nth-child(3) > td:nth-child(5)") ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, @@ -99,7 +99,7 @@ export async function runAnalogInputsTest(page: Page) { .getByRole("button") .first() ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, @@ -107,7 +107,7 @@ export async function runAnalogInputsTest(page: Page) { .getByRole("row", { name: "8 -0.00 mA AE 8 Messkurve" }) .getByLabel("Messkurve anzeigen") ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await page.getByRole("cell", { name: "1", exact: true }).click(); @@ -128,13 +128,13 @@ export async function runAnalogInputsTest(page: Page) { page, page.getByRole("button", { name: "Speichern" }) ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, page.getByRole("button", { name: "Modal schließen" }) ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, @@ -142,7 +142,7 @@ export async function runAnalogInputsTest(page: Page) { "Einstellungen Messwerteingang 1Bezeichnung:Offset:Faktor:Einheit:" ) ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await page.getByRole("button", { name: "Modal schließen" }).click(); @@ -190,38 +190,38 @@ export async function runAnalogInputsTest(page: Page) { page, page.locator("div").filter({ hasText: /^Von$/ }).getByRole("textbox") ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, page.locator("div").filter({ hasText: /^Bis$/ }) ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, page.locator("div").filter({ hasText: /^Bis$/ }).getByRole("textbox") ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible(page, page.getByRole("img")); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await highlightAndExpectVisible( page, page.getByRole("button", { name: "Alle Messwerte " }) ); await page.getByRole("button", { name: "Alle Messwerte " }).click(); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await page.getByRole("option", { name: "Stündlich" }).click(); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await page.getByRole("button", { name: "Stündlich" }).click(); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await page.getByRole("option", { name: "Täglich" }).click(); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await page.getByRole("button", { name: "Fullscreen" }).click(); @@ -236,7 +236,7 @@ export async function runAnalogInputsTest(page: Page) { page, page.getByRole("button", { name: "Modal schließen" }) ); - await page.waitForTimeout(3000); + await page.waitForTimeout(1000); await page.getByRole("button", { name: "Modal schließen" }).click(); // ...dein AnalogInputs-Testcode... diff --git a/playwright/tests/michael/README.md b/playwright/tests/michael/README.md new file mode 100644 index 0000000..18f8006 --- /dev/null +++ b/playwright/tests/michael/README.md @@ -0,0 +1,22 @@ +# Playwright Tests für Michael + +Dieses Verzeichnis enthält nur die Playwright-Tests und die nötige Konfiguration, um automatisiert gegen ein Gerät zu testen. + +## Vorbereitung + +1. IP, Benutzername und Passwort in `config.ts` eintragen. +2. Im Terminal im aktuellen Verzeichnis ausführen: + + npm install + +## Test ausführen + + npx playwright test + +Oder mit dem npm-Skript: + + npm test + +--- + +**Hinweis:** Es wird keine Web-App oder Entwicklungsumgebung benötigt, nur Node.js und Zugang zum Testgerät. diff --git a/playwright/tests/michael/analogInputsTest.ts b/playwright/tests/michael/analogInputsTest.ts new file mode 100644 index 0000000..3cb9793 --- /dev/null +++ b/playwright/tests/michael/analogInputsTest.ts @@ -0,0 +1,246 @@ +// playwright/tests/michael/analogInputsTest.ts +import type { Page } from "@playwright/test"; +import { highlightAndExpectVisible } from "./highlight"; +import { DEVICE_CONFIG } from "./config"; +// Kombinierte Helper-Funktion: injiziert CSS (nur einmal), hebt hervor und prüft Sichtbarkeit + +export async function runAnalogInputsTest(page: Page) { + await page.goto(`${DEVICE_CONFIG.ip}/analogInputs`); + await highlightAndExpectVisible( + page, + page.getByRole("heading", { name: "Messwerteingänge" }).nth(1) + ); + // Username und Passwort stehen jetzt in DEVICE_CONFIG.username und DEVICE_CONFIG.password bereit + 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... +} diff --git a/playwright/tests/michael/combined.spec.ts b/playwright/tests/michael/combined.spec.ts new file mode 100644 index 0000000..bc17874 --- /dev/null +++ b/playwright/tests/michael/combined.spec.ts @@ -0,0 +1,11 @@ +// playwright/tests/michael/combined.spec.ts +import { test } from "./fixtures"; +import { runDashboardTest } from "./dashboardTest"; +import { runAnalogInputsTest } from "./analogInputsTest"; +import { runSettingsPageTest } from "./settingsPageTest"; + +test("Dashboard, AnalogInputs und SettingsPage", async ({ page }) => { + await runDashboardTest(page); + await runAnalogInputsTest(page); + await runSettingsPageTest(page); +}); diff --git a/playwright/tests/michael/config.ts b/playwright/tests/michael/config.ts new file mode 100644 index 0000000..45f9862 --- /dev/null +++ b/playwright/tests/michael/config.ts @@ -0,0 +1,5 @@ +export const DEVICE_CONFIG = { + ip: "https://10.10.0.118", // Hier IP anpassen + username: "Littwin", // Hier Benutzername anpassen + password: "Littwin", // Hier Passwort anpassen +}; diff --git a/playwright/tests/michael/dashboardTest.ts b/playwright/tests/michael/dashboardTest.ts new file mode 100644 index 0000000..1c8abb7 --- /dev/null +++ b/playwright/tests/michael/dashboardTest.ts @@ -0,0 +1,203 @@ +// playwright/tests/michael/dashboardTest.ts +import type { Page } from "@playwright/test"; +import { highlightAndExpectVisible } from "./highlight"; + +export async function runDashboardTest(page: Page) { + await page.goto("http://localhost:3000/dashboard"); + await highlightAndExpectVisible( + page, + page.getByRole("heading", { name: "Meldestation" }) + ); + await highlightAndExpectVisible(page, page.getByRole("banner")); + await highlightAndExpectVisible( + page, + page.getByRole("img", { name: "Logo", exact: true }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("main").locator("svg").first() + ); + await highlightAndExpectVisible( + page, + page.getByRole("heading", { name: "Letzten 20 Meldungen" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("cell", { name: "Prio" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("cell", { name: "Zeitstempel" }) + ); + // ...existing code... + await highlightAndExpectVisible( + page, + page.getByRole("cell", { name: "Quelle" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("cell", { name: "Meldung" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("cell", { name: "Status" }) + ); + 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.getByRole("heading", { name: "Versionsinformationen" }) + ); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^Applikationsversion: 0\.02$/ }) + .locator("svg") + ); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^Webversion: 1\.6/ }) + .locator("path") + ); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^1KÜ705FO$/ }) + .first() + ); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^2KÜ705FO$/ }) + .first() + ); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^3KÜ705FO$/ }) + .first() + ); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^32KÜ705FO$/ }) + .first() + ); + await highlightAndExpectVisible( + page, + page.getByRole("img", { name: "IP Address" }) + ); + await highlightAndExpectVisible(page, page.getByText("IP-Adresse")); + await highlightAndExpectVisible(page, page.getByRole("main")); + await highlightAndExpectVisible(page, page.getByText("10.10.0.243")); + await highlightAndExpectVisible(page, page.getByText("Subnet-Maske")); + await highlightAndExpectVisible( + page, + page.getByRole("img", { name: "subnet mask" }) + ); + await highlightAndExpectVisible(page, page.getByText("255.255.255.0")); + await highlightAndExpectVisible(page, page.getByText("Gateway")); + await highlightAndExpectVisible( + page, + page.getByRole("img", { name: "gateway" }) + ); + await highlightAndExpectVisible(page, page.getByText("10.10.0.1")); + await highlightAndExpectVisible(page, page.getByText("OPC-UA")); + await highlightAndExpectVisible( + page, + page.getByRole("paragraph").filter({ hasText: "Status" }) + ); + await highlightAndExpectVisible( + page, + page.getByText("Server betriebsbereit") + ); + 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 highlightAndExpectVisible(page, page.getByRole("button")); + //await page.getByRole("button").click(); +} diff --git a/playwright/tests/michael/digitalInputsTest.ts b/playwright/tests/michael/digitalInputsTest.ts new file mode 100644 index 0000000..eb268bc --- /dev/null +++ b/playwright/tests/michael/digitalInputsTest.ts @@ -0,0 +1,118 @@ +// playwright/tests/michael/digitalInputsTest.ts +import { test, expect } from "@playwright/test"; + +test("test", async ({ page }) => { + await page.goto("http://localhost:3000/digitalInputs"); + await expect( + page.getByRole("img", { name: "Logo", exact: true }) + ).toBeVisible(); + await expect(page.getByRole("img", { name: "TALAS Logo" })).toBeVisible(); + await expect( + page.getByRole("heading", { name: "Meldestation" }) + ).toBeVisible(); + await expect(page.getByText("CPLV4 Ismail Rastede")).toBeVisible(); + await expect(page.getByRole("link", { name: "Übersicht" })).toBeVisible(); + await expect( + page.getByRole("link", { name: "Kabelüberwachung" }) + ).toBeVisible(); + await expect( + page.getByRole("link", { name: "Meldungseingänge" }) + ).toBeVisible(); + await expect( + page.getByRole("link", { name: "Schaltausgänge" }) + ).toBeVisible(); + await expect( + page.getByRole("link", { name: "Messwerteingänge" }) + ).toBeVisible(); + await expect(page.getByRole("link", { name: "Berichte" })).toBeVisible(); + await expect(page.getByRole("link", { name: "System" })).toBeVisible(); + await expect(page.getByRole("link", { name: "Einstellungen" })).toBeVisible(); + await expect( + page + .locator("div") + .filter({ hasText: /^Littwin Systemtechnik GmbH & Co\. KG$/ }) + .locator("svg") + ).toBeVisible(); + await expect(page.getByText("Littwin Systemtechnik GmbH &")).toBeVisible(); + await expect( + page + .locator("div") + .filter({ hasText: /^Telefon: 04402 972577-0$/ }) + .locator("svg") + ).toBeVisible(); + await expect(page.getByText("Telefon: 04402 972577-")).toBeVisible(); + await expect( + page + .locator("div") + .filter({ hasText: /^kontakt@littwin-systemtechnik\.de$/ }) + .locator("svg") + ).toBeVisible(); + await expect(page.getByText("kontakt@littwin-systemtechnik")).toBeVisible(); + await expect( + page + .locator("div") + .filter({ hasText: /^Handbücher$/ }) + .locator("path") + ).toBeVisible(); + await expect(page.getByText("Handbücher", { exact: true })).toBeVisible(); + await page.getByText("Handbücher", { exact: true }).click(); + await expect( + page.getByRole("heading", { name: "PDF Handbücher" }) + ).toBeVisible(); + await expect(page.getByText("KUE705FO.PDF")).toBeVisible(); + await page.getByRole("button").click(); + await expect( + page.getByRole("heading", { name: "Meldungseingänge", exact: true }) + ).toBeVisible(); + await expect( + page.getByRole("heading", { name: "Meldungseingänge 1 –" }).locator("svg") + ).toBeVisible(); + await expect( + page.getByRole("heading", { name: "Meldungseingänge 1 –" }) + ).toBeVisible(); + await expect( + page.getByRole("cell", { name: "Eingang" }).first() + ).toBeVisible(); + await expect( + page.getByRole("cell", { name: "Zustand" }).first() + ).toBeVisible(); + await expect( + page.getByRole("cell", { name: "Bezeichnung" }).first() + ).toBeVisible(); + await expect( + page.getByRole("cell", { name: "Aktion" }).first() + ).toBeVisible(); + await expect( + page.getByRole("cell", { name: "1", exact: true }).locator("svg") + ).toBeVisible(); + await expect(page.getByText("1", { exact: true })).toBeVisible(); + await expect( + page + .getByRole("row", { name: "1 ● DE 1", exact: true }) + .getByRole("cell") + .nth(1) + ).toBeVisible(); + await expect( + page.getByRole("row", { name: "1 ● DE 1", exact: true }).locator("span") + ).toBeVisible(); + await expect( + page.getByRole("cell", { name: "DE 1", exact: true }) + ).toBeVisible(); + await expect( + page + .getByRole("row", { name: "1 ● DE 1", exact: true }) + .locator("svg") + .nth(1) + ).toBeVisible(); + await expect( + page.getByRole("cell", { name: "13", exact: true }).locator("svg") + ).toBeVisible(); + await expect(page.getByText("13", { exact: true })).toBeVisible(); + await expect( + page.getByRole("row", { name: "● DE 13" }).getByRole("cell").nth(1) + ).toBeVisible(); + await expect( + page.getByRole("row", { name: "● DE 13" }).locator("span") + ).toBeVisible(); + await expect(page.getByRole("cell", { name: "DE 13" })).toBeVisible(); +}); diff --git a/playwright/tests/michael/element-highlighter.ts b/playwright/tests/michael/element-highlighter.ts new file mode 100644 index 0000000..1e0b0c6 --- /dev/null +++ b/playwright/tests/michael/element-highlighter.ts @@ -0,0 +1,4 @@ +// Dummy-Element-Highlighter für Michael-Standalone-Test +export async function installElementHighlighter(page: any) { + // Keine Aktion nötig für Standalone-Test +} diff --git a/playwright/tests/michael/fixtures.ts b/playwright/tests/michael/fixtures.ts new file mode 100644 index 0000000..6ee148d --- /dev/null +++ b/playwright/tests/michael/fixtures.ts @@ -0,0 +1,4 @@ +import { test as base } from "@playwright/test"; + +export const test = base; +export const expect = base.expect; diff --git a/playwright/tests/michael/highlight.ts b/playwright/tests/michael/highlight.ts new file mode 100644 index 0000000..12a4620 --- /dev/null +++ b/playwright/tests/michael/highlight.ts @@ -0,0 +1,30 @@ +// playwright/tests/michael/highlight.ts +// Kombinierte Helper-Funktion: injiziert CSS (nur einmal), hebt hervor und prüft Sichtbarkeit +import type { Locator, Page } from "@playwright/test"; +import { expect } from "./fixtures"; +export async function highlightAndExpectVisible( + page: Page, + locator: Locator, + durationMs = 800 +) { + // CSS nur einmal pro Page injizieren + if (!(await page.evaluate(() => (window as any).__pwForceCssInjected))) { + 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(); +} diff --git a/playwright/tests/michael/mouse-overlay.ts b/playwright/tests/michael/mouse-overlay.ts new file mode 100644 index 0000000..bed9259 --- /dev/null +++ b/playwright/tests/michael/mouse-overlay.ts @@ -0,0 +1,4 @@ +// Dummy-Mouse-Overlay für Michael-Standalone-Test +export async function installMouseOverlay(page: any) { + // Keine Aktion nötig für Standalone-Test +} diff --git a/playwright/tests/michael/package-lock.json b/playwright/tests/michael/package-lock.json new file mode 100644 index 0000000..0d1172f --- /dev/null +++ b/playwright/tests/michael/package-lock.json @@ -0,0 +1,75 @@ +{ + "name": "michael-playwright-tests", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "michael-playwright-tests", + "version": "1.0.0", + "license": "MIT", + "devDependencies": { + "@playwright/test": "^1.43.0" + } + }, + "node_modules/@playwright/test": { + "version": "1.55.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.55.0.tgz", + "integrity": "sha512-04IXzPwHrW69XusN/SIdDdKZBzMfOT9UNT/YiJit/xpy2VuAoB8NHc8Aplb96zsWDddLnbkPL3TsmrS04ZU2xQ==", + "dev": true, + "dependencies": { + "playwright": "1.55.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/playwright": { + "version": "1.55.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.55.0.tgz", + "integrity": "sha512-sdCWStblvV1YU909Xqx0DhOjPZE4/5lJsIS84IfN9dAZfcl/CIZ5O8l3o0j7hPMjDvqoTF8ZUcc+i/GL5erstA==", + "dev": true, + "dependencies": { + "playwright-core": "1.55.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.55.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.55.0.tgz", + "integrity": "sha512-GvZs4vU3U5ro2nZpeiwyb0zuFaqb9sUiAJuyrWpcGouD8y9/HLgGbNRjIph7zU9D3hnPaisMl9zG9CgFi/biIg==", + "dev": true, + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + } + } +} diff --git a/playwright/tests/michael/package.json b/playwright/tests/michael/package.json new file mode 100644 index 0000000..9a014bb --- /dev/null +++ b/playwright/tests/michael/package.json @@ -0,0 +1,14 @@ +{ + "name": "michael-playwright-tests", + "version": "1.0.0", + "description": "Playwright Tests für Michael (nur Testumgebung, keine App)", + "main": "combined.spec.ts", + "scripts": { + "test": "npx playwright test" + }, + "author": "", + "license": "MIT", + "devDependencies": { + "@playwright/test": "^1.43.0" + } +} diff --git a/playwright/tests/michael/settingsPageTest.ts b/playwright/tests/michael/settingsPageTest.ts new file mode 100644 index 0000000..7c79a15 --- /dev/null +++ b/playwright/tests/michael/settingsPageTest.ts @@ -0,0 +1,261 @@ +// playwright/tests/michael/settingsPageTests.ts +import { expect } from "@playwright/test"; +import type { Page } from "@playwright/test"; +import { highlightAndExpectVisible } from "./highlight"; + +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.getByRole("button").filter({ hasText: /^$/ }).click(); + await page.getByRole("button", { name: "Allgemeine Einstellungen" }).click(); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Allgemeine Einstellungen" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("heading", { name: "Allgemeine Einstellungen" }) + ); + await highlightAndExpectVisible(page, page.getByText("Name:")); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^Name:$/ }) + .getByRole("textbox") + ); + await highlightAndExpectVisible(page, page.getByText("MAC Adresse 1:")); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Systemzeit übernehmen" }) + ); + await highlightAndExpectVisible(page, page.getByText("IP:")); + await highlightAndExpectVisible( + page, + page.locator("div").filter({ hasText: /^IP:$/ }).getByRole("textbox") + ); + await highlightAndExpectVisible(page, page.getByText("Subnet:")); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^Subnet:$/ }) + .getByRole("textbox") + ); + await highlightAndExpectVisible(page, page.getByText("Gateway:")); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^Gateway:$/ }) + .getByRole("textbox") + ); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Neustart CPL" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Speichern" }) + ); + await page.getByRole("button", { name: "OPCUA" }).click(); + await highlightAndExpectVisible( + page, + page.getByRole("img", { name: "OPCUA Logo" }).first() + ); + await highlightAndExpectVisible( + page, + page.getByRole("img", { name: "OPCUA Logo" }).nth(1) + ); + await highlightAndExpectVisible(page, page.getByText("Server Status:")); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Aktiviert" }) + ); + await highlightAndExpectVisible(page, page.getByText("OPCUA Zustand")); + await highlightAndExpectVisible(page, page.getByText("1")); + await highlightAndExpectVisible(page, page.getByText("Nodeset Name")); + await highlightAndExpectVisible(page, page.getByText("Aktuelle OPC-Clients")); + await highlightAndExpectVisible(page, page.getByText("0", { exact: true })); + await page.getByRole("button", { name: "Datenbank" }).click(); + await highlightAndExpectVisible( + page, + page.getByRole("heading", { name: "Datenbank Einstellungen" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Meldungen löschen" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Messwerte Logger löschen" }) + ); + await page.getByRole("button", { name: "NTP" }).click(); + await highlightAndExpectVisible( + page, + page.getByRole("heading", { name: "NTP Einstellungen" }) + ); + await highlightAndExpectVisible(page, page.getByText("NTP Server 1")); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^NTP Server 1$/ }) + .getByRole("textbox") + ); + await highlightAndExpectVisible(page, page.getByText("NTP Server 3")); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^NTP Server 3$/ }) + .getByRole("textbox") + ); + await highlightAndExpectVisible(page, page.getByText("NTP Server 2")); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^NTP Server 2$/ }) + .getByRole("textbox") + ); + await highlightAndExpectVisible(page, page.getByText("Zeitzone")); + await highlightAndExpectVisible( + page, + page + .locator("div") + .filter({ hasText: /^Zeitzone$/ }) + .getByRole("textbox") + ); + await highlightAndExpectVisible(page, page.getByText("NTP aktiv:")); + await highlightAndExpectVisible(page, page.getByRole("checkbox")); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Speichern" }) + ); + await page.getByRole("button", { name: "Benutzerverwaltung" }).click(); + await highlightAndExpectVisible( + page, + page.getByRole("heading", { name: "Login Admin-Bereich" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("textbox", { name: "Benutzername" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("textbox", { name: "Passwort" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Admin anmelden" }) + ); + await page.getByRole("textbox", { name: "Benutzername" }).click(); + await page.getByRole("textbox", { name: "Benutzername" }).fill("admin"); + await page.getByRole("textbox", { name: "Passwort" }).click(); + await page.getByRole("textbox", { name: "Passwort" }).fill("admin"); + await page.getByRole("button", { name: "Admin anmelden" }).click(); + await highlightAndExpectVisible(page, page.getByText("Login erfolgreich!")); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Abmelden" }) + ); + await highlightAndExpectVisible( + page, + page.getByRole("button", { name: "Admin anmelden" }) + ); +} diff --git a/playwright/tests/michael/test-results/.last-run.json b/playwright/tests/michael/test-results/.last-run.json new file mode 100644 index 0000000..3907aa5 --- /dev/null +++ b/playwright/tests/michael/test-results/.last-run.json @@ -0,0 +1,6 @@ +{ + "status": "failed", + "failedTests": [ + "c8fc5bd7b8d71727c205-3c3c626b45d0ca851ae2" + ] +} \ No newline at end of file