Features

Testing Browser Extensions with Manifest V3

Testing browser extensions on Chrome with Puppeteer is possible with TestingBot.
Please see the information below on how to load the extension before your test starts and how to perform UI testing with Puppeteer against your Manifest V3 extension(s).

TestingBot Storage

With TestingBot Storage, you can upload your extensions to the TestingBot servers.
The advantage of this is that our test VMs can immediately download your extension from the TestingBot network, which is much faster than downloading from the public internet.

The API call will return a unique identifier, similar to tb://efe932jfk.
You can then use this identifier with the capability: "load-extension" : "tb://..."

Chrome Browser Extension Testing with Puppeteer

You can test your .crx extension by uploading the extension and using the URL of the extension with a load-extension capability.

const puppeteer = require('puppeteer-core')

(async () => {
  const tbCapabilities = {
    browserName: 'chrome',
    platform: 'WIN10',
    key: process.env.TB_KEY,
    secret: process.env.TB_SECRET,
   'load-extension': 'tb://path-to-extension'
  }
  const wsEndpoint = `wss://cloud.testingbot.com/?capabilities=${encodeURIComponent(
    JSON.stringify(tbCapabilities)
  )}`;

  const browser = await puppeteer.connect({
    browserWSEndpoint: wsEndpoint
  })

  const page = await browser.newPage()
  await page.goto('https://testingbot.com')
  // add various checks to test your extension
  await browser.close()
})();

UI Testing Chrome Extensions

You can test the UI and functionality of your extension in a remote Chrome browser.

const puppeteer = require('puppeteer-core')

(async () => {
  const tbCapabilities = {
    browserName: 'chrome',
    platform: 'WIN10',
    key: process.env.TB_KEY,
    secret: process.env.TB_SECRET,
   'load-extension': 'tb://path-to-extension'
  }
  const wsEndpoint = `wss://cloud.testingbot.com/?capabilities=${encodeURIComponent(
    JSON.stringify(tbCapabilities)
  )}`;

  const browser = await puppeteer.connect({
    browserWSEndpoint: wsEndpoint
  })

  const page = await browser.newPage()
  await page.goto('chrome-extension://lliapakmekmldfaphofjcnbccemlgeoa/src/pages/popup/index.html')
  await browser.close()
})();