← Back to Discord Forum

Need advice for mocking network requests in nextJS API tests

Hi all, I'm using Playwright for API testing (specifically, following https://playwright.dev/docs/api-testing#writing-tests). However, our API backend is a NextJS 13 API route handler (https://nextjs.org/docs/app/building-your-application/routing/router-handlers) and it makes outbound fetch requests to external services, which I want to mock.

My understanding is that Playwright's mocking abilities don't cover API testing. Does anyone have recommendations on how to intercept such calls in this scenario, or is this far outside the use case of Playwright?

This thread is trying to answer question "Does anyone have recommendations on how to intercept outbound fetch requests in NextJS API tests using Playwright?"

0 replies
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.