mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(runner): incorporate set project worker count into status messages (#35717)
This commit is contained in:
parent
6d3ee50a02
commit
85a101b780
@ -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);
|
||||
|
||||
@ -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');
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user