How to fix Playwright route mocking that does not intercept requests?
PlaywrightInterception fails when route patterns do not match actual request URLs or are registered too late.
Register page.route() before navigation and use a precise wildcard pattern.
await page.route('**/api/orders/*', async (route) => {
await route.fulfill({ status: 200, body: JSON.stringify({ ok: true }) });
});
await page.goto('https://example.com/orders');
Check request logs to confirm method/path/query exactly match your route rule.