Codecept
Codecept is an end-to-end testing framework for NodeJS.
It supports both Playwright and Puppeteer, so it's fully compatible with our service.
To get started, install Codecept and either Puppeteer or Playwright:
npm install codeceptjs puppeteer --save
Getting Started
To get started, create a new project. Choose either Puppeteer or Playwright and create a basic test.
npx codeceptjs init
A codecept.conf.js
file should be created.
To use our service, please edit this file and make sure you set the browserWSEndpoint
:
exports.config = {
tests: './*_test.js',
output: './output',
helpers: {
Puppeteer: {
url: 'https://github.com',
show: true,
windowSize: '1200x900',
chrome: {
browserWSEndpoint: "wss://chrome.headlesstesting.com?token=[YOUR-TOKEN]"
}
}
},
include: {
I: './steps_file.js'
},
bootstrap: null,
mocha: {},
name: 'codecept',
plugins: {
retryFailedStep: {
enabled: true
},
screenshotOnFail: {
enabled: true
}
}
}
Example Test
Now that you've configured everything, you can create a simple test and run it against our service:
Feature('My First Test');
Scenario('test something', (I) => {
I.amOnPage('https://github.com');
I.see('GitHub');
});
Now you can run this test:
npx codeceptjs run --steps
You should now see output similar to this:
My First Test --
test something
I am on page "https://github.com"
I see "GitHub"
✓ OK