0

I am using Appium and Webdriver IO (WDIO).

I need to make API calls to the backend to setup and data and retrieve data during the test.

I can do some of this if I use the before function, but the test fails if I use it in the actual test.

Is it possible to make backend calls during these tests?

FYI, I am using async await and axios.

Daryn
  • 3,394
  • 5
  • 30
  • 41
  • Hi, Please try this and see it helps https://stackoverflow.com/questions/51791594/how-to-use-3rd-party-method-that-takes-callback-in-webdriverio/51848936#51848936 – Naveen Thiyagarajan Aug 26 '19 at 17:53

1 Answers1

0

Without a code sample, it is hard to say what is wrong, but definetly there is a way to make it work.

The first thing to question: are you running wdio in sync mode (default)?

If so, you may have an issue trying to make an API call with async/await (e.g. node-fetch library) in the same test.

Have you tried using browser.call? Check the docs, it basically the way to do what you want with wdio wrapper.

Still failing? Try to increase test suite timeout (e.g. mocha timeout in case of Mocha)

dmle
  • 3,498
  • 1
  • 14
  • 22