0

my use case is to explore how could a server-side requests be mocked. I am successful in mocking client side request using requesthooks but with server side testcafe is not able to intercept the request. Frontend is built using next.js, and at intial page load, getinitalprops prepares the page by using fetch (get request) which happens at server side(node) not browser, and testcafe is not able to intercept.

I want to introduce testcafe in my team for frontend dev & their requirement is to resolve their pain of mocking server side requests before they start using testcafe for integration testing. Please suggest if this is possible with testcafe.

Varun
  • 1
  • 1

1 Answers1

2

TestCafe works in a browser and does not know a lot about your server-side logic, so TestCafe can intercept only the requests sent from your browser. In your specific case, probably you need to modify your project by integrating some request mocking framework into your server app.

Alex Kamaev
  • 6,198
  • 1
  • 14
  • 29