Parallel Testing
Parallel Testing means you can run multiple tests simultaneously, with Playwright. 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 Playwright tests concurrently on the TestingBot browser grid, which offers over 100+ Desktop Browser combinations for Playwright.
Parallel Example
In the example below, we'll start various Playwright sessions on different browser versions, in the TestingBot cloud.
const pw = require('playwright-core');
const doConnect = async (cap) => {
const browser = await pw.chromium.connect({
wsEndpoint: 'wss://cloud.testingbot.com/playwright?key=api_key&secret=api_secret&browserName=chrome&browserVersion=latest',
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://testingbot.com/');
await page.screenshot({ path: 'screenshot.png' });
await 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.