import { test, expect } from '@playwright/test'; import { WebsiteRouteManager } from '../../shared/website/WebsiteRouteManager'; const WEBSITE_BASE_URL = process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:3000'; test.describe('Debug Public Routes', () => { let routeManager: WebsiteRouteManager; test.beforeEach(() => { routeManager = new WebsiteRouteManager(); }); test('debug public routes', async ({ page }) => { const routes = routeManager.getWebsiteRouteInventory(); const publicRoutes = routes.filter(r => r.access === 'public').slice(0, 5); console.log('Testing public routes:', publicRoutes); for (const route of publicRoutes) { const path = routeManager.resolvePathTemplate(route.pathTemplate, route.params); const fullUrl = `${WEBSITE_BASE_URL}${path}`; console.log(`\nTesting route: ${route.pathTemplate} -> ${path}`); const response = await page.goto(fullUrl); const status = response?.status(); const ok = response?.ok(); console.log(` URL: ${fullUrl}`); console.log(` Status: ${status}`); console.log(` OK: ${ok}`); console.log(` Current URL: ${page.url()}`); // Should load successfully or show 404 page const passes = ok || status === 404; console.log(` Passes: ${passes}`); if (!passes) { console.log(` ❌ FAILED: ${path} returned status ${status}`); } else { console.log(` ✅ PASSED: ${path}`); } } }); });