webdriver-iowebdriver-io-v4

how to use mock in webdriverIO to send response as string


I have a POST API that returns the response as a string.

when I tried mocking as browser.mock('**/validate').respond('SUCCESS', { statusCode: 200 });

It's not getting mocked instead original API is hit

Can someone help me in this??.


Solution

  • Have you tried using WireMock Service?

    More info: https://webdriver.io/docs/wdio-wiremock-service/