playwright recording and testing
This commit is contained in:
@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
|
|||||||
NEXT_PUBLIC_EXPORT_STATIC=false
|
NEXT_PUBLIC_EXPORT_STATIC=false
|
||||||
NEXT_PUBLIC_USE_CGI=false
|
NEXT_PUBLIC_USE_CGI=false
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.6.687
|
NEXT_PUBLIC_APP_VERSION=1.6.688
|
||||||
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)
|
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)
|
||||||
|
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
|
|||||||
NEXT_PUBLIC_EXPORT_STATIC=true
|
NEXT_PUBLIC_EXPORT_STATIC=true
|
||||||
NEXT_PUBLIC_USE_CGI=true
|
NEXT_PUBLIC_USE_CGI=true
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.6.687
|
NEXT_PUBLIC_APP_VERSION=1.6.688
|
||||||
NEXT_PUBLIC_CPL_MODE=production
|
NEXT_PUBLIC_CPL_MODE=production
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
## [1.6.688] – 2025-08-11
|
||||||
|
|
||||||
|
- ISO, RSL, TDR, und KVZ Modal nach Wünsch angepasst für KÜs
|
||||||
|
|
||||||
|
---
|
||||||
## [1.6.687] – 2025-08-11
|
## [1.6.687] – 2025-08-11
|
||||||
|
|
||||||
- ISO & RSL dropdowns moved to headers like TDR; removed old dropdowns from action bars, cleaned imports, fixed TypeScript issues
|
- ISO & RSL dropdowns moved to headers like TDR; removed old dropdowns from action bars, cleaned imports, fixed TypeScript issues
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "cpl-v4",
|
"name": "cpl-v4",
|
||||||
"version": "1.6.687",
|
"version": "1.6.688",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "cpl-v4",
|
"name": "cpl-v4",
|
||||||
"version": "1.6.687",
|
"version": "1.6.688",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/roboto": "^5.1.0",
|
"@fontsource/roboto": "^5.1.0",
|
||||||
"@headlessui/react": "^2.2.4",
|
"@headlessui/react": "^2.2.4",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cpl-v4",
|
"name": "cpl-v4",
|
||||||
"version": "1.6.687",
|
"version": "1.6.688",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|||||||
56
tests/kabelueberwachung-visual.spec.ts
Normal file
56
tests/kabelueberwachung-visual.spec.ts
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import { test, expect, Page } from "@playwright/test";
|
||||||
|
|
||||||
|
// Simple visual smoke test for /kabelueberwachung
|
||||||
|
// Creates / compares a full-page screenshot (baseline generated on first run with --update-snapshots)
|
||||||
|
// To update baseline: npx playwright test tests/kabelueberwachung-visual.spec.ts --update-snapshots
|
||||||
|
// To run in UI mode: npx playwright test --ui
|
||||||
|
|
||||||
|
// Helper to stabilize dynamic UI before screenshot
|
||||||
|
|
||||||
|
test.describe("Kabelüberwachung Visual", () => {
|
||||||
|
test("test", async ({ page }) => {
|
||||||
|
await page.goto("http://localhost:3000/kabelueberwachung");
|
||||||
|
await page
|
||||||
|
.locator(".bg-littwin-blue.text-white.text-\\[0\\.625rem\\]")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
//warte 1 Sekunde
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("button", { name: "Daten laden" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("button", { name: "Messkurve" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("option", { name: "Meldungen" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("button", { name: "" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
page.once("dialog", (dialog) => {
|
||||||
|
console.log(`Dialog message: ${dialog.message()}`);
|
||||||
|
dialog.dismiss().catch(() => {});
|
||||||
|
});
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.locator(".flex > button:nth-child(2)").first().click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("button", { name: "Messkurve" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("option", { name: "Meldungen" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("button", { name: "" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page
|
||||||
|
.locator(".bg-littwin-blue.text-white.cursor-pointer")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("button", { name: "Messkurve" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("option", { name: "Meldungen" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByRole("button", { name: "" }).click();
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//zum ausführen
|
||||||
|
// npx playwright test kabelueberwachung-visual.spec.ts --project=chromium --headed
|
||||||
|
//zum aufzeichnen
|
||||||
|
// npx playwright codegen http://localhost:3000/kabelueberwachung --channel=chrome
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
import { test, expect } from "@playwright/test";
|
|
||||||
|
|
||||||
test.describe("Kue705FO Integration Tests", () => {
|
|
||||||
test.beforeEach(async ({ page }) => {
|
|
||||||
// Besuche die Seite, auf der die Komponente gerendert wird
|
|
||||||
await page.goto("/kabelueberwachung");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should render the component with default props", async ({ page }) => {
|
|
||||||
// Überprüfe, ob der Modulname und die Slotnummer angezeigt werden
|
|
||||||
await expect(page.locator("text=KÜ705-FO")).toBeVisible();
|
|
||||||
await expect(page.locator("text=Modul 1")).toBeVisible(); // Beispiel für den Modulnamen
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should update display when TDR button is clicked", async ({ page }) => {
|
|
||||||
// Klicke auf den TDR-Button
|
|
||||||
await page.locator("text=TDR").click();
|
|
||||||
|
|
||||||
// Überprüfe, ob der Text aktualisiert wurde
|
|
||||||
await expect(page.locator("text=Entfernung [Km]")).toBeVisible();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should switch back to Schleife display", async ({ page }) => {
|
|
||||||
// Klicke auf TDR, dann zurück zu Schleife
|
|
||||||
await page.locator("text=TDR").click();
|
|
||||||
await page.locator("text=Schleife").click();
|
|
||||||
|
|
||||||
// Überprüfe, ob der Text aktualisiert wurde
|
|
||||||
await expect(page.locator("text=Schleifenwiderstand [kOhm]")).toBeVisible();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should disable TDR button when tdrActive is 0", async ({ page }) => {
|
|
||||||
// Dies erfordert eine benutzerdefinierte Backend-Konfiguration oder Redux-Manipulation
|
|
||||||
await expect(page.locator("text=TDR")).toBeDisabled();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should open and close the settings modal", async ({ page }) => {
|
|
||||||
// Öffne das Modal
|
|
||||||
await page.locator("text=⚙").click();
|
|
||||||
await expect(page.locator("text=KUE Einstellung - Slot 1")).toBeVisible();
|
|
||||||
|
|
||||||
// Schließe das Modal
|
|
||||||
await page.locator("text=×").click();
|
|
||||||
await expect(
|
|
||||||
page.locator("text=KUE Einstellung - Slot 1")
|
|
||||||
).not.toBeVisible();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
import { test, expect } from "@playwright/test";
|
|
||||||
|
|
||||||
test.describe("System View Tests", () => {
|
|
||||||
test.beforeEach(async ({ page }) => {
|
|
||||||
// Besuche die System-Seite
|
|
||||||
await page.goto("/system");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should display system title", async ({ page }) => {
|
|
||||||
// Überprüfe, ob der Titel angezeigt wird
|
|
||||||
await expect(page.locator("h1")).toContainText(
|
|
||||||
"System Spannungen & Temperaturen"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should show loading state initially", async ({ page }) => {
|
|
||||||
// Überprüfe, ob der Ladeindikator angezeigt wird
|
|
||||||
await expect(
|
|
||||||
page.locator("text=Lade Systemdaten … bitte warten")
|
|
||||||
).toBeVisible();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should display system data after loading", async ({ page }) => {
|
|
||||||
// Warte auf das Verschwinden des Ladeindikators
|
|
||||||
await page.waitForSelector("text=Lade Systemdaten … bitte warten", {
|
|
||||||
state: "hidden",
|
|
||||||
timeout: 10000,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Überprüfe, ob Systemdaten angezeigt werden
|
|
||||||
// Diese Tests müssen an die tatsächliche Implementierung angepasst werden
|
|
||||||
await expect(
|
|
||||||
page.locator('[data-testid="system-overview-grid"]')
|
|
||||||
).toBeVisible({ timeout: 15000 });
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should open detail modal when clicking on voltage card", async ({
|
|
||||||
page,
|
|
||||||
}) => {
|
|
||||||
// Warte auf das Laden der Daten
|
|
||||||
await page.waitForSelector("text=Lade Systemdaten … bitte warten", {
|
|
||||||
state: "hidden",
|
|
||||||
timeout: 10000,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Klicke auf eine Spannungskarte (dies muss an die tatsächliche Implementierung angepasst werden)
|
|
||||||
await page.locator('[data-testid="voltage-card"]:first-child').click();
|
|
||||||
|
|
||||||
// Überprüfe, ob das Detail-Modal geöffnet wird
|
|
||||||
await expect(page.locator('[data-testid="detail-modal"]')).toBeVisible();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should close detail modal when clicking close button", async ({
|
|
||||||
page,
|
|
||||||
}) => {
|
|
||||||
// Warte auf das Laden der Daten
|
|
||||||
await page.waitForSelector("text=Lade Systemdaten … bitte warten", {
|
|
||||||
state: "hidden",
|
|
||||||
timeout: 10000,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Öffne das Modal
|
|
||||||
await page.locator('[data-testid="voltage-card"]:first-child').click();
|
|
||||||
await expect(page.locator('[data-testid="detail-modal"]')).toBeVisible();
|
|
||||||
|
|
||||||
// Schließe das Modal
|
|
||||||
await page.locator('[data-testid="modal-close-button"]').click();
|
|
||||||
await expect(
|
|
||||||
page.locator('[data-testid="detail-modal"]')
|
|
||||||
).not.toBeVisible();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user