CodeceptJS & Puppeteer

CodeceptJS is an end-to-end testing framework which provides support for many automation drivers, including Puppeteer.

To get started, please install these packages:

npm install codeceptjs puppeteer --save

To create a sample project from scratch, you can use this command:

npx codeceptjs init

Configure CodeceptJS with Puppeteer

To configure CodeceptJS, please edit codecept.conf.js and make sure to add the Puppeteer helper.

{ // ..
  helpers: {
    Puppeteer: {
      url: "http://localhost",
      show: true,
      windowSize: '1200x900',
      chrome: {
        browserWSEndpoint: "wss://cloud.testingbot.com?key=YOUR_KEY&secret=YOUR_SECRET"
  // ..

The browserWSEndpoint URL instructs CodeceptJS to use TestingBot's Puppeteer grid to run the tests on.

Specifying browser and version

To specify on which browser and version your CodeceptJS + Puppeteer test should run, you can include both a browserName and browserVersion in the browserWSEndpoint URL.

Select a browser & version

Run your first test

Let's create our first test, which will open the TestingBot website and check to see if the word 'TestingBot' is included on the page.


Scenario('test testingbot homepage', ({ I }) => {

Now you can run this first test on TestingBot.

$ npx codeceptjs run --steps
Test --
  test something
    I am on page "https://testingbot.com"
    I see "TestingBot"
  ✔ OK in 1057ms

  OK  | 1 passed   // 11s

This test will appear in your Member Dashboard, together with a video of the test and any logs that were generated.