playwright recording and testing

This commit is contained in:
ISA
2025-08-11 16:13:01 +02:00
parent bc20f3869d
commit 9ca5ee9e66
8 changed files with 66 additions and 125 deletions

View 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