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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user