add playwright e2e tests for onboarding, contact tracker
- install playwright, configure for chromium with vite dev server - add onboarding flow test: redirect, form fill, navigation to prozess - add contact tracker test: create contact, verify in list - fix onboarding form navigating to /onboarding instead of /prozess - fix date rendering crash in contact list (cast datum to text) - exclude @electric-sql/pglite from vite optimizeDeps (WASM bundle) - add test-results/, playwright-report/ to .gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto("/onboarding");
|
||||
// Wait for PGlite to initialize and the form to render
|
||||
await page.getByLabel("Name").waitFor({ timeout: 15000 });
|
||||
|
||||
await page.getByLabel("Name").fill("Test User");
|
||||
await page.getByLabel("PLZ").fill("10115");
|
||||
await page.getByLabel("Ort").fill("Berlin");
|
||||
await page.getByLabel("Krankenkasse").fill("TK");
|
||||
await page.getByRole("button", { name: "Weiter" }).click();
|
||||
await expect(page).toHaveURL(/prozess/, { timeout: 10000 });
|
||||
});
|
||||
|
||||
test("add a new contact and see it in the list", async ({ page }) => {
|
||||
await page.getByRole("link", { name: "Kontakte" }).click();
|
||||
await expect(page).toHaveURL(/kontakte/);
|
||||
|
||||
await page.getByRole("link", { name: /Neu/ }).click();
|
||||
await expect(page).toHaveURL(/kontakte\/neu/);
|
||||
|
||||
await page.getByLabel("Name", { exact: false }).first().fill("Dr. Schmidt");
|
||||
await page.getByLabel("Stadt").fill("Berlin");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
|
||||
await expect(page).toHaveURL(/\/kontakte$/, { timeout: 10000 });
|
||||
await expect(page.getByText("Dr. Schmidt")).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("onboarding flow redirects new user and saves profile", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/");
|
||||
// PGlite WASM initialization takes time; wait for the redirect to complete
|
||||
await expect(page).toHaveURL(/onboarding/, { timeout: 15000 });
|
||||
|
||||
await page.getByLabel("Name").fill("Max Mustermann");
|
||||
await page.getByLabel("PLZ").fill("10115");
|
||||
await page.getByLabel("Ort").fill("Berlin");
|
||||
await page.getByLabel("Krankenkasse").fill("TK");
|
||||
await page.getByRole("button", { name: "Weiter" }).click();
|
||||
|
||||
await expect(page).toHaveURL(/prozess/, { timeout: 10000 });
|
||||
await expect(page.getByText("Dein Fortschritt")).toBeVisible();
|
||||
});
|
||||
Reference in New Issue
Block a user