BrauzerLab
← Back to missions 45 / 50

Combo: Block + Mock

Hard ~300 sec

Sometimes a single test requires combined network strategies: blocking a tracking request while simultaneously mocking a data request.

page.route can be called multiple times — each call registers a handler for a different URL pattern. Use route.abort() for /api/tracking and route.fulfill(...) for /api/data.

page is already available. Write two separate page.route calls; the fake data response must contain the word "mocked". Then click the «Load» button.

Either glob patterns or exact paths work for both handlers — the choice is yours.

TASK

Block and mock requests.

Provided for you
import { test, expect } from '@playwright/test';

test('Combo: Block + Mock', async ({ page }) => {
  await page.goto('https://lab.local/mission/combo-block-mock');
  // ↓ Your code goes below ↓
});
Editor
https://lab.local/mission/combo-block-mock
Loading...
Results will appear here — press Run or Check.