Playwright · Middle · Question 16 of 75
What does this route do?
await page.route("**/api/products", (route) =>
route.fulfill({ json: [{ id: 1, name: "Mock" }] })
);- 1Records the real API response to a file on disk
- 2Blocks the page from making any requests at all
- 3Returns fake JSON instead of calling the real API
Show the answer
Correct answer: Returns fake JSON instead of calling the real API
Explanation
route.fulfill answers the request from the test. It's useful for edge cases like empty lists or errors that are hard to get from a real backend.