import { test, expect } from '@playwright/test'; test.describe('Homepage', () => { test('loads and displays hero content', async ({ page }) => { await page.goto('/'); // The hero section renders "Find your perfect property" per i18n await expect(page.locator('h1').first()).toBeVisible(); }); test('has correct page title', async ({ page }) => { await page.goto('/'); await expect(page).toHaveTitle(/GoodGo/i); }); test('renders without critical console errors', async ({ page }) => { const criticalErrors: string[] = []; page.on('console', (msg) => { if (msg.type() === 'error') { const text = msg.text(); // Ignore known non-critical errors in test environment if ( text.includes('mapbox') || text.includes('NEXT_PUBLIC_MAPBOX_TOKEN') || text.includes('hydration') || text.includes('Content Security Policy') ) { return; } criticalErrors.push(text); } }); await page.goto('/'); await page.waitForLoadState('networkidle'); expect(criticalErrors).toHaveLength(0); }); test('is responsive — mobile viewport', async ({ page }) => { await page.setViewportSize({ width: 375, height: 667 }); await page.goto('/'); const main = page.locator('main'); await expect(main).toBeVisible(); const h1 = page.locator('h1'); await expect(h1).toBeVisible(); }); });