managarten/apps/calendar/apps/web/e2e/error-page.spec.ts
Till JS 1a91bd7cfb test(calendar-web): add E2E test for 404 error page
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 10:22:56 +01:00

19 lines
689 B
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Error Page', () => {
test('visiting a nonexistent route shows error page with status code', async ({ page }) => {
const response = await page.goto('/nonexistent-route-that-does-not-exist');
// SvelteKit should return a 404 status
expect(response?.status()).toBe(404);
// The error page should display the status code
const statusHeading = page.locator('h1');
await expect(statusHeading).toBeVisible({ timeout: 10000 });
await expect(statusHeading).toContainText('404');
// Should show a "back to home" link
const backLink = page.locator('a[href="/"]');
await expect(backLink).toBeVisible();
});
});