Parallel Testing
Parallel testing lets you execute multiple Playwright tests at the same time, dramatically reducing your overall test suite duration and accelerating feedback cycles.
On TestingBot's browser grid, you can easily run Playwright tests concurrently across more than 100 browser and device combinations. This enables you to validate your web application in multiple environments, all in parallel.
The guide below will walk you through setting up and running Playwright tests concurrently using TestingBot’s scalable infrastructure.
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': 'SEQUOIA',
}]
(async () => {
await Promise.all(
capabilities.map((cap) => doConnect(cap))
)
console.log('All tests finished!');
})();
You can use latest
and latest-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.