Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
For Playwright Test suites, run npx playwright test --workers=2 to allow up to two worker processes on one machine. Playwright runs separate test files in parallel by default, but tests in the same file run in order unless you enable parallel mode. If “scripts” means two standalone Node.js programs rather than Playwright Test suites, launch them as separate operating-system processes.
Choose the kind of concurrency you need
“Two Playwright scripts” can mean either two parts of one Playwright Test suite or two independent programs started from a shell or CI job. The right method depends on which you mean:
- Two test files in one Playwright Test project: use two workers, for example
npx playwright test --workers=2. Test files are already eligible to run in parallel by default. - Two tests or suites in one file: mark the relevant group as parallel, or enable project-wide parallelism with
fullyParallel: true. - Two separate Node.js programs or shell commands: start each as its own process. A Playwright Test worker setting does not coordinate arbitrary standalone processes.
- More than one machine: split a test run into shards and run the shard commands in separate CI jobs.
Playwright Test achieves parallel execution using worker processes. A worker limit caps how many of those workers run at once; it does not make tests safe to overlap when they share mutable external data.
Run two Playwright Test files with two workers
From the directory containing your Playwright configuration, run:
#1 Best Overall
npx playwright test --workers=2
This asks Playwright Test to use at most two workers for that run. If there are at least two eligible test files and the machine has capacity, separate files can be assigned to separate workers. The value is a concurrency limit, not a promise that every run will always have exactly two active workers: the number of tests available and other execution constraints also matter.
You can use the same limit in configuration when you want it to apply by default:
import { defineConfig } from '@playwright/test';
export default defineConfig({
workers: 2,
});
Use the CLI flag when you want a one-off override, such as running more slowly while diagnosing failures. Use configuration when two workers are an intentional default for that project. If the project contains a resource that must never be accessed concurrently, lower the project’s limit or otherwise isolate that resource.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Run tests from one file concurrently
By default, tests in one file run in order in the same worker. To let tests in a particular group run in parallel, configure the group in the test file:
import { test } from '@playwright/test';
test.describe.configure({ mode: 'parallel' });
test('first independent check', async ({ page }) => {
await page.goto('https://example.com/');
// Assertions for this test
});
test('second independent check', async ({ page }) => {
await page.goto('https://example.org/');
// Assertions for this test
});
Parallel mode is appropriate only when tests can run independently. Do not enable it just to make a run faster if one test depends on another test’s state or both edit the same record.
If the whole project is designed for test-level concurrency, enable it in the configuration instead:
import { defineConfig } from '@playwright/test';
export default defineConfig({
fullyParallel: true,
workers: 2,
});
fullyParallel: true makes tests eligible to run concurrently across the project, subject to the worker limit. It changes scheduling more broadly than configuring one describe group, so first confirm that tests do not rely on ordering or shared mutable state.
Recommended Free Tools
Start two standalone scripts as operating-system processes
If you have two independent Node.js programs rather than tests discovered by Playwright Test, launch them as separate processes. For example, in a Unix-like shell:
node script-one.js &
pid_one=$!
node script-two.js &
pid_two=$!
wait "$pid_one"
status_one=$?
wait "$pid_two"
status_two=$?
printf 'script-one exit: %snscript-two exit: %sn' "$status_one" "$status_two"
[ "$status_one" -eq 0 ] && [ "$status_two" -eq 0 ]
The ampersands start both processes in the background; wait lets the shell collect each result rather than exiting as soon as the commands are launched. This example is for Unix-like shells, not Windows Command Prompt. In CI, two separate steps are not necessarily concurrent: use separate jobs or another explicit parallel-job mechanism if the CI system must run them at the same time.
Starting two standalone scripts this way does not apply Playwright Test’s worker scheduling or test fixtures. Each program is responsible for its own setup, browser lifecycle, cleanup, and exit status. If the scripts share a test account, database row, download directory, or other external resource, give them distinct resources or add coordination.
Rank #3
Prevent races in shared state
Playwright gives each test an isolated browser context, so cookies, local storage, and other browser-context state do not automatically overlap between tests. That isolation does not extend to external systems. Two tests can still submit changes to the same account, edit the same database record, overwrite the same file, or compete for a limited test resource.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Before increasing concurrency, identify every stateful resource that tests modify:
- Accounts and records: create unique data for each test or worker, for example using the test ID or worker index as part of a record name.
- Files and downloads: use a separate output path per test or worker rather than a shared fixed filename.
- Limited accounts or environments: use a lock or keep the affected project at one worker if safe partitioning is not possible.
- Ordering dependencies: keep dependent steps in one test, or arrange the setup so each test can run independently; do not depend on execution order across parallel tests.
If only one project or resource needs serialized access, constrain that work rather than reducing concurrency everywhere. A one-worker project limit is a straightforward safeguard when the shared resource cannot be partitioned. Named locks are another option when your runner and resource-management setup support them.
Scale across machines with sharding
Workers divide eligible work within a machine. Sharding divides the test suite into portions that can be run by separate jobs, such as on multiple CI machines. For two shard jobs, use:
npx playwright test --shard=1/2
and, in a separate job:
npx playwright test --shard=2/2
Run both jobs concurrently in your CI system if the goal is to shorten elapsed time. Sharding is useful when one machine has reached a practical CPU or memory limit, but it does not remove the need to control shared external state across jobs.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWithout fullyParallel, distribution is generally at the test-file level, so a large file can make shard workloads uneven. With fullyParallel, tests can be balanced at test level, provided they are safe to run independently. Sharding and workers address different levels: shards distribute work among jobs or machines, while workers limit parallel processes within a run.
Estimate speed and resource trade-offs
Two workers do not guarantee a twofold speed-up. The result depends on CPU and memory capacity, browser count, the time tests spend waiting on the system under test, and whether tests interfere with one another. Starting more browsers can increase resource use and contention; when the machine or application becomes the bottleneck, adding concurrency may not reduce elapsed time.
Compare runs under the same conditions: use the same test selection, machine, browser configuration, and external environment, then check both total duration and failures. Treat a faster run as useful only if it remains stable and does not create collisions or overload the system being tested. For repeatable or resource-constrained CI, set an explicit worker limit rather than relying on an environment-dependent default.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot concurrent runs
Only one test seems to run at a time
Check that the run contains multiple test files, or that tests in the same file have been opted into parallel mode. A worker limit of two does not override the default ordering of tests within one file. Confirm that the command is running Playwright Test and that the requested tests were actually discovered.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Tests fail only when workers are increased
Look for shared external state: reused accounts, records, files, or one-time resources. Make test data unique by test or worker, or serialize access to the resource that cannot safely be shared. Browser contexts are isolated, but your database and application are not automatically isolated by that fact.
The run is slower or the machine becomes unstable
Reduce workers and compare again. Two browser workers can use more CPU and memory than one; contention on the test environment can also increase wait times. A lower stable limit may be preferable to a higher limit that causes resource pressure.
One shard finishes much later than another
Uneven test-file sizes can produce uneven shard workloads when distribution is at file granularity. If tests are independent, fullyParallel: true allows test-level balancing; otherwise consider reorganizing unusually large files or accepting a longer tail for the job with the most work.
A shell command appears to finish before both scripts
Ensure the shell waits for both background process IDs. In the example above, each wait collects one process’s completion status. Without waiting, the parent shell can finish while background work is still in progress, and a CI step may not report the scripts’ exit statuses correctly.
Or skip the browser setup
If the task is to capture a website screenshot rather than run your Playwright test scripts, ScreenshotNeo is a screenshot API and MCP server for developers. It is not a way to run Playwright Test suites concurrently; use the worker or sharding methods above for that. For a screenshot capture, one GET request can return an image or PDF:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie banners, known consent platforms, newsletter popups, and chat widgets can be removed before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes screenshot and page-information tools to AI agents. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month with no card.
Frequently asked questions
Does a browser context equal a separate browser process?
No. A context isolates browser state for a test, while Playwright workers are separate processes that execute tests. Context isolation helps prevent cookie and storage crossover; it does not isolate data stored by your application or other external services.
Can I run two shard commands in the same CI job?
You can issue both commands, but merely listing them one after another runs them sequentially in a shell. To execute shards simultaneously, configure separate parallel CI jobs or start separate processes and manage their completion and results.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

