From 629385fa5c2b3b649f28d7f8e4dac6ef33822f3d Mon Sep 17 00:00:00 2001 From: ISA Date: Thu, 14 Aug 2025 15:06:35 +0200 Subject: [PATCH] playwright: Dashboard Seite test --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 5 + package-lock.json | 4 +- package.json | 2 +- playwright/tests/dashboard.spec.ts | 229 +++++++++++++++++++++++++++++ 6 files changed, 239 insertions(+), 5 deletions(-) create mode 100644 playwright/tests/dashboard.spec.ts diff --git a/.env.development b/.env.development index 05f46f6..0d46fc8 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.723 +NEXT_PUBLIC_APP_VERSION=1.6.724 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 2263531..055fde3 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.723 +NEXT_PUBLIC_APP_VERSION=1.6.724 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f023c9f..a3dad3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.6.724] – 2025-08-14 + +- playwright: analoge Eingänge Test erfolgreich + +--- ## [1.6.723] – 2025-08-14 - playwright: analge Eingänge mit highlight color test erfoögreich diff --git a/package-lock.json b/package-lock.json index ec24757..7fad9fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.723", + "version": "1.6.724", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.723", + "version": "1.6.724", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index d3ab11b..8204c19 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.723", + "version": "1.6.724", "private": true, "scripts": { "dev": "next dev", diff --git a/playwright/tests/dashboard.spec.ts b/playwright/tests/dashboard.spec.ts new file mode 100644 index 0000000..64341ec --- /dev/null +++ b/playwright/tests/dashboard.spec.ts @@ -0,0 +1,229 @@ +import { test, expect } from "../fixtures"; +import type { Locator, Page } from "@playwright/test"; + +// Kombinierte Helper-Funktion: injiziert CSS (nur einmal), hebt hervor und prüft Sichtbarkeit +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(); +} + +test("Daschboard-Test", async ({ 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" }) + ); + 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\.723$/ }) + .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(); +});