Parallel Testing
Parallel Testing means you can run multiple tests simultaneously, with Puppeteer.
It allows you to speed up your test execution, drastically shortening your total test duration time.
The documentation below will show you how to run Puppeteer tests concurrently on the TestingBot browser grid, which offers over 100+ Desktop Browser combinations for Puppeteer.
Parallel Example
In the example below, we'll start various Puppeteer sessions on different browser versions, in the TestingBot cloud.
const puppeteer = require('puppeteer-core')
const doConnect = async (cap) => {
const capabilities = {
'tb:options': {
key: process.env.TB_KEY,
secret: process.env.TB_SECRET
},
browserName: cap.browserName,
browserVersion: cap.browserVersion,
platform: cap.platform
}
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://cloud.testingbot.com/puppeteer?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
})
const page = await browser.newPage()
await page.goto('https://testingbot.com')
await page.screenshot({ path: 'screenshot.png' })
browser.close()
}
const capabilities = [
{
'browserName': 'chrome',
'browserVersion': 'latest',
'platform': 'WIN10',
},
{
'browserName': 'chrome',
'browserVersion': 'latest-1',
'platform': 'LINUX',
},
{
'browserName': 'edge',
'browserVersion': 'latest',
'platform': 'BIGSUR',
}]
capabilities.forEach(async (cap) => {
await doConnect(cap)
})
You can use
latest
andlatest-x
to automatically run on the latest browser version.
Queueing
Depending on your account subscription, you can run multiple tests in parallel.
If you exceed your maximum allocated slots, the connection will be queued until a slot frees up.