Writing our first mobile test
WebdriverIO tests necessitate the use of JavaScript functions with async/await loops. This corresponds to the asynchronous nature of the calls made within the tests. Let us try to understand what these functions are and how to write one.
JavaScript functions with async/await
Let’s quickly understand what async/await functions are and how they are used in JavaScript. Async stands for asynchronous, and it permits the execution of a function without blocking the flow of the program. It uses promises, which are nothing but values that get fulfilled in the future. For example, let us consider a case where a third-party API is called from within a function as a promise. If the call and its response are successful, then the promise is fulfilled, but if there is a network failure, then it is rejected. We could define specific behavior for each of these cases.
When the async keyword is used before a function, it always makes it return a promise...