Skip to main content

Getting started with Vitaq AI

Install WebdriverIO with Vitaq-Mocha#

Vitaq AI works on top of WebDriverIO. WebdriverIO is a next-generation browser and mobile automation test framework. It is written in JavaScript and is not restricted to just Selenium or Appium because it supports the Chrome Devtools protocol directly. Which means that you can get started without having to install Java or Selenium.

You write your tests in the language of front-end developers, JavaScript. With the same testing tools that you are used to using for unit tests, Mocha. The commands you use in your WebdriverIO tests are concise and common sense.

WebdriverIO is a Node.js based system, so the first thing you need to do is install Node (if you do not have it installed already). Go to and follow the instructions or install it using a version manager such as NVM

The installation instructions for WebDriverIO can be found here

First set up a new folder for writing tests in. In the example below we will call it wdio-vitaq (you can name it what you like).

mkdir wdio-vitaq && cd wdio-vitaq

From inside that folder initialise a new NPM project

npm init -y

That will create a package.json file that is used for saving dependencies.

Now you can install the WDIO CLI ("Command Line Interface")

npm install @wdio/cli

Installing ChromeDriver#

To get started as quickly as possible we are not going to install Selenium or Appium. We are going to show you how to test a web App in a Chrome Browser using the ChromeDriver.

npm install -g chromedriver

Setting Up WebdriverIO#

To setup WebdriverIO with the base configuration, run:

npx wdio config --yes

IMPORTANT NOTE: Vitaq uses a modified version of the Mocha framework which we distribute in a package called vitaq-mocha. This package will sit alongside your existing Mocha installation and will be specified by configuration settings as described below. The vitaq-mocha package is installed as a dependency of the vitaq-mocha-framework package. Vitaq does not yet support Jest or Cucumber, so you will need to write your TDD/BDD tests in Mocha.
npm install @wdio/vitaq-mocha-framework

You will also need to edit the default wdio.conf.js file that was automatically created in this directory to define the framework to use as vitaq-mocha, add in the vitaqai service and set the test Specs to be grouped.

The definition of the specs in the WDIO config file has been extended so that it can now accept arrays within the specs array. All of the files within an inner array [['VitaqAI Spec action .js files here']] are grouped together and run in the same instance.

We suggest you keep your Vitaq WebdriverIO Spec Action scripts in a directory called actions underneath the WebdriverIO test directory. So then you configure your wdio.conf.js with:

specs: [

Vitaq only supports the modified version of the Mocha framework, so you need to define this framework here:

framework: 'vitaq-mocha',

To add in the vitaqai service you need to modify your wdio.conf.js with:

services: [
['vitaqai', {
userName: 'your-user-name',
testActivityName: 'swaglabs',
projectName: "onBoarding",
url: "",
userAPIKey: "get this long key from your account and paste here"
useSync: false

Creating a Vitaq AI Test Activity to auto-generate tests#

This flow diagram provides a high-level view of the steps needed to create your first Test Activity with Vitaq AI to auto-generate tests with webDriverIO.

Logging into Vitaq AI#

Go to and click on the Login button. Complete login with your provided username and password. Create a Project by completing the project Name field and clicking Submit. Click on your created Project and then click on Create Test Activity. Complete the Test Activity name field and then click on Submit. Click on your created Test Activity Name and the Vitaq AI Test Activity editor will launch.

You will notice that your account is preloaded with the onBoarding project which contains the swaglabs Test Activity. We will use this to show you how to run your first end-to-end tests with Vitaq AI.

Running your first Test Activity#

In the directory you created for writing tests (in which we recommended you call wdio-vitaq above) you can run your Test Activity by using the 'run' command and pointing to the WebdriverIO config that you just created.

Now you can run the swaglabs Test Activity listed in testActivityName in the config file.

>npx wdio run wdio.conf.js

To run the Test Activity using the AI-driven capability, where Vitaq will "machine-learn" what next allowable tests it needs to auto-generate to reach 100% test coverage use these options.

>npx wdio run wdio.conf.js --useCoverage true --useAI true

Once completed, you should see that the WebdriverIO tests passed. Then you can open the swaglabs Test Activity in your browser, click on the coverage icon and open the functional coverage results for the Test Activity run to see how many end-to-end tests were created to complete 100% user journey coverage.