Add E2E and integration tests (Group 11)

Journal tests (6):
- Home page, auth pages render correctly
- No password fields on register/login
- Protected routes redirect to login

Planner tests (9):
- Session creation via API
- Map loads in session
- Yjs WebSocket connects (Connected status)
- Profile selector, export button, waypoint sidebar
- Session with initial GPX waypoints
- Expired session returns 404

Integration tests (5):
- GPX import returns parsed waypoints
- BRouter computes Berlin routes
- Routes pass through all waypoints (segment by segment)
- Rate limit headers present
- Rejects < 2 waypoints

Total: 32 unit tests + 20 E2E tests, all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-03-24 23:15:30 +01:00
parent a9c99844c6
commit 79e6ae6ea2
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
5 changed files with 261 additions and 5 deletions

View file

@ -6,4 +6,36 @@ test.describe("Journal", () => {
await expect(page).toHaveTitle("trails.cool");
await expect(page.getByText("Your outdoor activity journal")).toBeVisible();
});
test("shows register and sign in when logged out", async ({ page }) => {
await page.goto("/");
await expect(page.getByRole("link", { name: "Register" })).toBeVisible();
await expect(page.getByRole("link", { name: "Sign in" })).toBeVisible();
});
test("registration page renders correctly", async ({ page }) => {
await page.goto("/auth/register");
await expect(page.getByText("Create Account")).toBeVisible();
await expect(page.getByLabel("Email")).toBeVisible();
await expect(page.getByLabel("Username")).toBeVisible();
await expect(page.getByRole("button", { name: /Register with Passkey/ })).toBeVisible();
// No password field
await expect(page.locator('input[type="password"]')).not.toBeVisible();
});
test("login page has passkey and magic link options", async ({ page }) => {
await page.goto("/auth/login");
await expect(page.getByRole("button", { name: /Sign in with Passkey/ })).toBeVisible();
await expect(page.getByText(/magic link/i)).toBeVisible();
});
test("routes page redirects to login when not authenticated", async ({ page }) => {
await page.goto("/routes");
await expect(page).toHaveURL(/auth\/login/);
});
test("activities page redirects to login when not authenticated", async ({ page }) => {
await page.goto("/activities");
await expect(page).toHaveURL(/auth\/login/);
});
});