Playwright · Middle · Question 17 of 75

How do you simulate a server error for one endpoint?

Show the answer

Correct answer: route.fulfill({ status: 500 }) in a page.route handler

Explanation

Mocking a 500 lets you check the error state of the UI deterministically, without breaking a shared backend.

Further reading

Problem with a question

Playwright · Middle · question 17

Test yourself

Take the Playwright · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz