Automation tests with WebdriverIO

Automation tests with WebdriverIO

Often we come across the question of selecting automation framework that will be best fit for web applications. Of these, Javascript based automated test framework are most commonly used and eventually dominating the field when it comes to automated tests for web applications. Major reason for that is the ability of these frameworks to pair well with the latest web frameworks such as AngularJs , Vue and ReactJs.

Today, I am going to show you how can we setup webdriverIO to start building most flexible automated test frameworks

Setting things up

To install webdriverIO npm package , ensure you have node and npm running on your machine. You can check the version simple by using node -v and npm -v or download here

Now, Create a folder for your project and type below command at the root of the folder

npm init -y
npm install @wdio/cli

And now to run the basic config use npm wdio config -y. This will install the following modules automatically for you to get started.

Screenshot 2020-11-13 at 4.05.20 PM.png In the image above, I did not pass -y because I wanted to select other configurations than default ones. You can try without -y as well its just for simplicity.

You will notice the tests folder is added to your directory with test file under spec folder something like this /Users/xyz/codes/wdio-demo/test/specs

Running test files

In order to run the test, use npx wdio run wdio.conf.js or add scripts under your package json like this and run npm test

 "scripts":{ 
      "test": "wdio run wdio.conf.js"
}

Screenshot 2020-11-13 at 4.21.53 PM.png

Hurray!!

pexels-tarikul-raana-3619972.jpg Photo by Tarikul Raana from Pexels