Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(runner): incorporate set project worker count into status messages (#35717)
Adam Gastineau85a101b780b4
diff --git a/packages/playwright/src/runner/tasks.ts b/packages/playwright/src/runner/tasks.tsindex 2bb9c3bbe2..db3fc99414 100644--- a/packages/playwright/src/runner/tasks.ts+++ b/packages/playwright/src/runner/tasks.ts@@ -340,7 +340,7 @@ function createPhasesTask(): Task<TestRun> {const projectSuite = projectToSuite.get(project)!;const testGroups = createTestGroups(projectSuite, testRun.config.config.workers);phase.projects.push({ project, projectSuite, testGroups });- testGroupsInPhase += testGroups.length;+ testGroupsInPhase += Math.min(project.workers ?? Number.MAX_SAFE_INTEGER, testGroups.length);}debug('pw:test:task')(`created phase #${testRun.phases.length} with ${phase.projects.map(p => p.project.project.name).sort()} projects, ${testGroupsInPhase} testGroups`);maxConcurrentTestGroups = Math.max(maxConcurrentTestGroups, testGroupsInPhase);diff --git a/tests/playwright-test/test-parallel.spec.ts b/tests/playwright-test/test-parallel.spec.tsindex 3939a94063..394969043a 100644--- a/tests/playwright-test/test-parallel.spec.ts+++ b/tests/playwright-test/test-parallel.spec.ts@@ -223,3 +223,52 @@ test('parallel mode should minimize running beforeAll/afterAll hooks 2', async (expect(countTimes(result.output, '%%beforeAll')).toBe(2);expect(countTimes(result.output, '%%afterAll')).toBe(2);});++test('parallel mode should display worker count taking project workers into account', async ({ runInlineTest }) => {+ const result = await runInlineTest({+ 'playwright.config.ts': `+ export default {+ workers: 10,+ fullyParallel: true,+ projects: [+ { name: 'project1', workers: 3 },+ ],+ };+ `,+ 'a.test.ts': `+ import { test, expect } from '@playwright/test';+ test('test1', () => {});+ test('test2', () => {});+ test('test3', () => {});+ test('test4', () => {});+ `,+ }, { workers: 10 });+ expect(result.exitCode).toBe(0);+ expect(result.passed).toBe(4);+ expect(result.output).toContain('Running 4 tests using 3 workers');++ // Multiple parallel projects+ const result2 = await runInlineTest({+ 'playwright.config.ts': `+ export default {+ workers: 12,+ fullyParallel: true,+ projects: [+ { name: 'project1', workers: 3 },+ { name: 'project2', workers: 4 },+ { name: 'project3', workers: 4 },+ ],+ };+ `,+ 'a.test.ts': `+ import { test, expect } from '@playwright/test';+ test('test1', () => {});+ test('test2', () => {});+ test('test3', () => {});+ test('test4', () => {});+ `,+ }, { workers: 12 });+ expect(result2.exitCode).toBe(0);+ expect(result2.passed).toBe(12);+ expect(result2.output).toContain('Running 12 tests using 11 workers');+});