Test Mode: report onFetch interceptions in the test (#55456)
This feature eases debugging significantly.
This is what an intercepted fetch looks like in Playwright debugger:
<img width="342" alt="image" src="https://github.com/vercel/next.js/assets/726049/e9fe4304-36b9-4d6d-b4f3-66d649464a35">
<img width="368" alt="image" src="https://github.com/vercel/next.js/assets/726049/db49e18e-3fc5-4a77-abf8-465d925082bc">
And here's what a failing fetch looks like:
<img width="314" alt="image" src="https://github.com/vercel/next.js/assets/726049/41be212a-e414-4b28-a0cb-d9b618b3f2ea">
You can inspect request and response's headers and bodies.
The main drawback: it uses an internal Playwright API. However, they are open to opening part of it publicly in https://github.com/microsoft/playwright/issues/27059.