Testing Chrome extensions with TestDriver

TestDriver can be used to test Chrome extensions. This guide provides an overview of how to set up and run tests for your Chrome extension using TestDriver.

Prerequisites

Before running the tests, ensure you have performed the following steps:

  1. If you haven’t already, signup for a Free Trial on the TestDriver website
  2. Install the TestDriver CLI globally using npm or just follow the VS Code Extension Setup Walkthrough:
npm install -g @testdriverai@beta
  1. Run the init command to set up the TestDriver configuration using the API key you got when you signed up for the trial:
testdriverai init
Now you are ready to run the tests!

How do I test Chrome extensions?

TestDriver provides a powerful solution for testing Chrome extensions. With our platform, you can easily create and run tests to ensure your extension functions as expected across different browsers and operating systems.

Getting started

You can test a preinstalled extension or test by installing an extension. If the extension is in development mode, turn this on by checking the “Developer mode” checkbox in the Chrome extensions page. From there you can load the unpacked extension by selecting the folder where your extension is located. To download the files onto the VM if you are performing a test on cloud hosted runners, see the Lifecycle and Prerun docs.

Sample test steps

  1. Load a the Chrome Web Store.
  2. Search for the extension you want to test.
  3. Click on the extension to open its details page.
  4. Click on the “Add to Chrome” button to install the extension.
  5. Wait for the installation to complete.
  6. Click the ‘puzzle piece’ icon to pin the extension to the toolbar.
  7. Click on the extension icon to open it.

TestDriver in action

Now what?

Once you have installed your extension, simply create a TestDriver test to test any functionality a user would use.