Quickstart
Install appium
Make sure you have set up appium on your machine. You can follow the installation instructions here Install Appium (official docs):
Set configuration values in wdio.conf.ts
We recommend setting the following values in the wdio.conf.ts so that GPT Driver can utilize them across your test files.
Please note that we get the API Key from the env variable GPT_DRIVER_API_KEY which should be set in your .env file.
import type { Options } from '@wdio/types';
export const config: Options.Testrunner = {
// GPT Driver configuration
protocol: 'http',
hostname: '127.0.0.1',
port: 4723,
path: '/',
gptDriverApiKey: process.env.GPT_DRIVER_API_KEY || '',
// standard WebdriverIO config values like specs, maxInstances, etc.
...
}Create GPT Driver instance beforeEach
To leverage GPT Driver inside your test methods, you have to create a new GPT Driver instance for each test execution. We therefore recommend to utilize the beforeEach() hook.
import GptDriver from 'gpt-driver-node';
describe('Product Catalog', () => {
let gptDriver: GptDriver;
beforeEach(async function () {
// Initialize GPT Driver
const baseUrl = `${browser.options.protocol}://${browser.options.hostname}:${browser.options.port}${browser.options.path}`;
gptDriver = new GptDriver({
apiKey: browser.options.gptDriverApiKey,
driver: browser,
serverConfig: {
url: baseUrl
},
cachingMode: "FULL_SCREEN",
testId: (this.currentTest?.parent?.title || 'unknown-suite') + ' - ' + (this.currentTest?.title || 'unknown-test')
});
});Use GPT Driver inside your test methods
Inside your test methods you can now use the gptDriver object to perform steps defined in natural language. Please refer to the Reference for available methods.
it('add product to cart counter', async () => {
await gptDriver.aiExecute("Tap on a product");
await gptDriver.aiExecute("Add the product to cart");
await gptDriver.assert("The cart icon should show a counter of 1");
});Execute test and review execution log
Run tests based on your WebdriverIO config file
npm run wdio wdio.conf.jsDuring the test execution GPT Driver generates an INFO log containing a URL. This URL provides access to the execution log which includes all screenshots, executed test steps, and system reasoning for any AI Steps. This breakdown helps to understand how GPT Driver followed the natural language instructions.
Monitor execution at: https://app.mobileboost.io/gpt-driver/sessions/...Last updated