Repository navigation
Description
🚀 Feature Request
When a config uses project dependencies, the runner groups projects into phases and runs them strictly one after another. A project only starts after every project in the previous phase has finished, including projects it doesn't depend on.
So a project whose own dependencies finished long ago can sit waiting for slow, unrelated projects, with most workers idle.
The cause is in createPhasesTask (lib/runner/index.js, 1.64.0). It builds phases from a topological sort, and createRunTestsTask runs them in order (for (const { dispatcher, projects } of testRun.phases)).
Proposal: schedule projects from the dependency graph instead of from phases.
- A project's test groups become eligible as soon as all of its own
dependencieshave finished successfully, or are skipped as they are today when a dependency fails. - Eligible test groups from all ready projects share the global worker pool. Project-level
workerslimits andfullyParallelbehave as they do now. teardownkeeps its current meaning: a teardown project runs after its setup and everything that depends on that setup.maxFailures/ignoreMaxFailureskeep their current behaviour for setup and teardown projects.
If changing the default is too risky, an opt-in setting would also work:
export default defineConfig({
projectScheduling: 'graph', // default: 'phases' (current behaviour)
});Note: metadata.actualWorkers is currently the largest number of concurrent test groups in any single phase. With graph scheduling, it would need to be computed over the whole run.
Example
Minimal repro:
// playwright.config.ts
export default defineConfig({
workers: 4,
projects: [
{ name: 'setup-fast', testMatch: /fast\.setup\.ts/ }, // ~5s
{ name: 'independent', testMatch: /independent\.spec\.ts/ }, // ~5 min, no dependencies
{ name: 'dependent', dependencies: ['setup-fast'],
testMatch: /dependent\.spec\.ts/ }, // ~5 min
],
});npx playwright test --project=independent --project=dependent
- Expected:
dependentstarts about 5 seconds in, whensetup-fastfinishes. Both projects run in parallel, so the whole run takes about 5 minutes. - Actual:
dependentwaits forindependentto finish. The run takes about 10 minutes, and workers sit idle for the first half.
With graph scheduling, the config stays exactly the same; only the start times change.
Motivation
Project dependencies are the recommended replacement for globalSetup, and the usual pattern is one setup project per isolated data set, feeding parallel test projects. Phase-based scheduling undercuts that parallelism.
Our real case: 8 test batches, each with workers: 1 (they share seeded data), and workers: 8 overall. Six batches each depend on their own setup project; two have no dependencies. Phase 1 holds the six setups plus the two independent batches. Once the setups finish (2 to 4 minutes), phase 1 is down to two running workers, while six batches stay blocked even though their setups passed. Six of the eight workers are idle for most of the run.
The only workaround is to give every project an artificial no-op dependency so they all fall into the same phase. That's a hack that delays the projects that had no dependencies and makes the config harder to follow.
Scheduling by the dependency graph would make the configured worker count a real number, cut wall-clock time for suites that use setup projects, and make project dependencies behave the way most users already assume they do.
Activity
microsoft-playwright-automation commentedon Nov 23, 2026
microsoft-playwright-automation commentedon Nov 23, 2026
Hi, I'm the Playwright bot and I checked the runner and the earlier reports.
This is the same scheduling request as #27723 and #29714, and it is not implemented yet. At
aa3c4453c15602f20ccf60c52fde74497e1ac268(1.66.0-next), the runner still waits for every project in a phase before starting the next phase. There is no documentedprojectSchedulingoption.Your per-project
workers: 1limits are an important detail: idle workers cannot speed up those unrelated batches. EnablingfullyParalleldoes not remove the phase boundary or those limits.Source findings and scope of the change
In tasks.ts, each phase has its own dispatcher, and the runner awaits both
dispatcher.run()anddispatcher.stop()before advancing.metadata.actualWorkersis computed from the largest phase, as you described.Replacing that loop is not sufficient:
maxFailuresstops the whole dispatcher. Teardown projects use separate dispatchers that ignore that limit, so a shared pool needs a way to stop ordinary work while still running cleanup.The earlier maintainer response in #29714 confirms that phase scheduling was an intentional simplification. #27723 and #30296 were later closed for inactivity, not by a scheduling fix. No closing PR was found for this issue.
I checked the source and existing dependency tests; I did not run a reproduction. The initial test command stopped before discovery because this checkout has no installed stable test runner. No browser-specific results or timings were measured.
No fix is proposed in this run: this needs a runner design decision about project completion and failure handling in a shared dependency-aware pool, rather than one focused change to the phase loop.
Triaged on Linux by the Playwright bot - agent run