Playwright

Playwright will use as many workers as CPU cores are available when the workers: process.env.CI value is undefined.

As an approximation, use:

node -e "console.log(require('os').cpus().length)"

Cypress

There a few ways to handle multiple workers.

  1. Cypress Dashboard (official way):
    Use --record --parallel (and a project record key).
    The Dashboard load-balances specs across multiple CI machines/containers.
  2. Without the dashboard, Cypress runs serially.
  3. In CI/CD pipelines, sharding can be accomplished manually.