Skip to main content

Basic Test Case

In this tutorial we will walk through converting an existing WDIO script to use AI with Dev Tools.

Install Dependencies

If you haven't done so already, please install the devtools package

npm install @devtools-ai/wdio-sdk

Plugin setup

You will need to edit wdio.conf.js to enable the plugin by adding the following stanza.

beforeSuite: async function (suite) {
const devtoolsai_plugin = require('@devtools-ai/wdio-sdk');
await devtoolsai_plugin.register(suite.title);

Add your API key

Devtools AI supports configuration in a .env file (dotenv). At the root of your project create a .env file. The same effect can be obtained by setting environment variables in your terminal.


Sample Test

As an example of smartDriver in action, we will use a basic wdio test case that goes to Github and enters a username.

describe('GH tests', () => {
it('should enter username', async () => {
await browser.url(``);
await browser.$('//input[@id="login_field"]').keys('my_username');
await browser.pause(3000);

This test case will automatically backup the elements that are being interacted with and send them to Devtools AI. If the selector breaks, the test case will use visual AI and still work.

You can then go to to see the results.