🔧 Error Fixes
· 1 min read

Playwright: Test Timeout — Exceeded 30000ms — How to Fix It


Test timeout of 30000ms exceeded

Your Playwright test took too long.

Fix 1: Increase timeout

// Per test
test('slow test', async ({ page }) => {
  test.setTimeout(60000);
  await page.goto('/slow-page');
});

// Global — playwright.config.ts
export default defineConfig({
  timeout: 60000,
});

Fix 2: Wait for the right thing

// ❌ Arbitrary wait
await page.waitForTimeout(5000);

// ✅ Wait for specific element
await page.waitForSelector('[data-testid="loaded"]');

// ✅ Wait for network idle
await page.goto('/page', { waitUntil: 'networkidle' });

Fix 3: Check if the page actually loads

const response = await page.goto('/page');
console.log(response?.status()); // 200? 404? 500?