Puppetry
3.2.2
Search
K
Comment on page

Exporting as Jest Project (CI-friendly)

Project suites can be exported as Jest test project and be ran in command line by, for example, Continuous Integration server.
Press Ctrl+Shift-E (⌘⇧E) or click on File/Export Project as... menu item:
Export Project as...
Export Project modal window shows up.
Export project modal
It is quite similar to Run Tests window. Similarly we can choose a target environment (see also Template variables) and set up Browser options. What it's new we have to specify the destination folder for the exported project.
After exporting we can jump to the given export directory and install npm dependencies:
npm install
then we run the tests:
npm test
We are expected to get output like that:

View Test Reports with Allure

If you have Allure installed on your system you can also run
npm run report
It will load the generated test report in Allure browser
Allure test report

Configuring Puppeteer

You can change the configuration set while exporting in puppeteer.config.json
  • incognito - when true the test will run in incognito window
  • puppeteer.launch - options to pass to puppeteer.launch
  • puppeteer.connect - options to pass to puppeteer.connect

Example:

{
"incognito": true,
"puppeteer.connect": {
"browserWSEndpoint": null,
"ignoreHTTPSErrors": true
},
"puppeteer.launch": {
"product": "chrome",
"headless": false,
"devtools": false,
"ignoreHTTPSErrors": true,
"args": [
"--start-maximized",
"--ignore-certificate-errors"
],
"executablePath": "/usr/bin/google-chrome"
}
}