feat: migrate from Cypress to Playwright for E2E testing
- Remove Cypress dependencies and configuration files - Install @playwright/test with browser support - Add playwright.config.ts with optimized settings for Next.js - Migrate existing Cypress tests to Playwright format - Add new E2E test scripts to package.json - Configure GitHub Actions workflow for automated testing - Update .gitignore for Playwright artifacts BREAKING CHANGE: E2E testing framework changed from Cypress to Playwright
This commit is contained in:
48
tests/kue705fo.spec.ts
Normal file
48
tests/kue705fo.spec.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
72
tests/system-view.spec.ts
Normal file
72
tests/system-view.spec.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
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