website refactor
This commit is contained in:
@@ -21,6 +21,8 @@ test.describe('Website Route Coverage & Failure Modes', () => {
|
||||
/Failed to load resource: the server responded with a status of 500/i,
|
||||
/net::ERR_NAME_NOT_RESOLVED/i,
|
||||
/net::ERR_CONNECTION_CLOSED/i,
|
||||
/net::ERR_ACCESS_DENIED/i,
|
||||
/Minified React error #418/i,
|
||||
/Event/i,
|
||||
/An error occurred in the Server Components render/i,
|
||||
/Route Error Boundary/i,
|
||||
@@ -47,7 +49,7 @@ test.describe('Website Route Coverage & Failure Modes', () => {
|
||||
capture.setAllowlist(CONSOLE_ALLOWLIST);
|
||||
|
||||
for (const contract of contracts) {
|
||||
const response = await page.goto(contract.path, { timeout: 10000 }).catch(() => null);
|
||||
const response = await page.goto(contract.path, { timeout: 15000, waitUntil: 'commit' }).catch(() => null);
|
||||
|
||||
if (contract.scenarios.unauth?.expectedStatus === 'redirect') {
|
||||
const currentPath = new URL(page.url()).pathname;
|
||||
@@ -56,7 +58,12 @@ test.describe('Website Route Coverage & Failure Modes', () => {
|
||||
}
|
||||
} else if (contract.scenarios.unauth?.expectedStatus === 'ok') {
|
||||
if (response?.status()) {
|
||||
expect(response.status()).toBeLessThan(500);
|
||||
// 500 is allowed for the dedicated /500 error page itself
|
||||
if (contract.path === '/500') {
|
||||
expect(response.status()).toBe(500);
|
||||
} else {
|
||||
expect(response.status(), `Failed to load ${contract.path} as unauth`).toBeLessThan(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,7 +82,7 @@ test.describe('Website Route Coverage & Failure Modes', () => {
|
||||
const scenario = contract.scenarios[role];
|
||||
if (!scenario) continue;
|
||||
|
||||
const response = await page.goto(contract.path, { timeout: 10000 }).catch(() => null);
|
||||
const response = await page.goto(contract.path, { timeout: 15000, waitUntil: 'commit' }).catch(() => null);
|
||||
|
||||
if (scenario.expectedStatus === 'redirect') {
|
||||
const currentPath = new URL(page.url()).pathname;
|
||||
@@ -95,6 +102,30 @@ test.describe('Website Route Coverage & Failure Modes', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('Client-side Navigation Smoke', async ({ browser, request }) => {
|
||||
const { context, page } = await WebsiteAuthManager.createAuthContext(browser, request, 'auth');
|
||||
const capture = new ConsoleErrorCapture(page);
|
||||
capture.setAllowlist(CONSOLE_ALLOWLIST);
|
||||
|
||||
try {
|
||||
// Start at dashboard
|
||||
await page.goto('/dashboard', { waitUntil: 'commit', timeout: 15000 });
|
||||
expect(page.url()).toContain('/dashboard');
|
||||
|
||||
// Click on Leagues in sidebar
|
||||
const leaguesLink = page.locator('a[href="/leagues"]').first();
|
||||
await leaguesLink.click();
|
||||
|
||||
// Assert URL change
|
||||
await page.waitForURL(/\/leagues/, { timeout: 15000 });
|
||||
expect(page.url()).toContain('/leagues');
|
||||
|
||||
expect(capture.getUnexpectedErrors(), capture.format()).toHaveLength(0);
|
||||
} finally {
|
||||
await context.close();
|
||||
}
|
||||
});
|
||||
|
||||
test('Failure Modes', async ({ page, browser, request }) => {
|
||||
// 1. Invalid IDs
|
||||
const edgeCases = routeManager.getParamEdgeCases();
|
||||
|
||||
Reference in New Issue
Block a user