0

I'm testing external website with separate server. I know that server send api request with axios, like this: GET https://website.com/api/getData Is there a way to catch this request and provide mock data for testing purpose? I don't want to change server-side code, my tests are completely separate.

I've tried axios-mock-adapter but it looks like I have to send a request directly from the test to mock it, but that's not what I'd like to achieve.

I'm using codeceptJS with TestCafe

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
Gohini
  • 69
  • 5

1 Answers1

1

Yes, you can mock requests sending with the 'axios' library using the RequestMock feature. RequestMock is a low-level feature and allows you to create mocks for any requests.

mlosev
  • 5,130
  • 1
  • 19
  • 31