website refactor

This commit is contained in:
2026-01-17 18:28:10 +01:00
parent 6d57f8b1ce
commit 64d9e7fd16
44 changed files with 1729 additions and 415 deletions

View File

@@ -0,0 +1,44 @@
import { expect, test } from '@playwright/test';
import { WebsiteAuthManager } from '../../shared/website/WebsiteAuthManager';
import { ConsoleErrorCapture } from '../../shared/website/ConsoleErrorCapture';
const WEBSITE_BASE_URL = process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:3000';
test.describe('Client-side Navigation', () => {
test('navigation from dashboard to leagues and back', async ({ browser, request }) => {
const auth = await WebsiteAuthManager.createAuthContext(browser, request, 'auth');
const capture = new ConsoleErrorCapture(auth.page);
try {
// Start at dashboard
await auth.page.goto(`${WEBSITE_BASE_URL}/dashboard`);
expect(auth.page.url()).toContain('/dashboard');
// Click on Leagues in sidebar or navigation
// Using href-based selector for stability as requested
const leaguesLink = auth.page.locator('a[href="/leagues"]').first();
await leaguesLink.click();
// Assert URL change
await auth.page.waitForURL(/\/leagues/);
expect(auth.page.url()).toContain('/leagues');
// Click on Dashboard back
const dashboardLink = auth.page.locator('a[href="/dashboard"]').first();
await dashboardLink.click();
// Assert URL change
await auth.page.waitForURL(/\/dashboard/);
expect(auth.page.url()).toContain('/dashboard');
// Assert no runtime errors during navigation
capture.setAllowlist(['hydration', 'warning:']);
if (capture.hasUnexpectedErrors()) {
throw new Error(`Found unexpected console errors during navigation:\n${capture.format()}`);
}
} finally {
await auth.context.close();
}
});
});