feedback - remove redundant tests

This commit is contained in:
Mathias Leppich 2024-09-09 15:30:03 +02:00
parent 8d485f58b9
commit e7273de4dd

View file

@ -214,14 +214,6 @@ test('should respect shard=4/4', async ({ runInlineTest }) => {
]); ]);
}); });
test('should not produce skipped tests for zero-sized shards', async ({ runInlineTest }) => {
const result = await runInlineTest(tests, { ['sharding-mode']: 'round-robin', shard: '10/10', workers: 1 });
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(0);
expect(result.failed).toBe(0);
expect(result.skipped).toBe(0);
expect(result.outputLines).toEqual([]);
});
test('should respect shard=1/2 in config', async ({ runInlineTest }) => { test('should respect shard=1/2 in config', async ({ runInlineTest }) => {
const result = await runInlineTest({ const result = await runInlineTest({
@ -273,100 +265,6 @@ test('should work with workers=1 and --fully-parallel', async ({ runInlineTest }
} }
}); });
test('should skip dependency when project is sharded out', async ({ runInlineTest }) => {
const tests = {
'playwright.config.ts': `
module.exports = {
projects: [
{ name: 'setup1', testMatch: /setup.ts/ },
{ name: 'tests1', dependencies: ['setup1'] },
{ name: 'setup2', testMatch: /setup.ts/ },
{ name: 'tests2', dependencies: ['setup2'] },
],
};
`,
'test.spec.ts': `
import { test } from '@playwright/test';
test('test', async ({}) => {
console.log('\\n%%test in ' + test.info().project.name);
});
`,
'setup.ts': `
import { test } from '@playwright/test';
test('setup', async ({}) => {
console.log('\\n%%setup in ' + test.info().project.name);
});
`,
};
const result = await runInlineTest(tests, { ['sharding-mode']: 'round-robin', shard: '2/2', workers: 1 });
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(2);
expect(result.skipped).toBe(0);
expect(result.outputLines).toEqual([
'setup in setup2',
'test in tests2',
]);
});
test('should not shard mode:default suites', async ({ runInlineTest }) => {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/22891' });
const tests = {
'a1.spec.ts': `
import { test } from '@playwright/test';
test('test0', async ({ }) => {
console.log('\\n%%test0');
});
test('test1', async ({ }) => {
console.log('\\n%%test1');
});
`,
'a2.spec.ts': `
import { test } from '@playwright/test';
test.describe.configure({ mode: 'parallel' });
test.describe(() => {
test.describe.configure({ mode: 'default' });
test.beforeAll(() => {
console.log('\\n%%beforeAll1');
});
test('test2', async ({ }) => {
console.log('\\n%%test2');
});
test('test3', async ({ }) => {
console.log('\\n%%test3');
});
});
test.describe(() => {
test.describe.configure({ mode: 'default' });
test.beforeAll(() => {
console.log('\\n%%beforeAll2');
});
test('test4', async ({ }) => {
console.log('\\n%%test4');
});
test('test5', async ({ }) => {
console.log('\\n%%test5');
});
});
`,
};
{
const result = await runInlineTest(tests, { ['sharding-mode']: 'round-robin', shard: '2/3', workers: 1 });
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(2);
expect(result.outputLines).toEqual(['beforeAll1', 'test2', 'test3']);
}
{
const result = await runInlineTest(tests, { ['sharding-mode']: 'round-robin', shard: '3/3', workers: 1 });
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(2);
expect(result.outputLines).toEqual(['beforeAll2', 'test4', 'test5']);
}
});
test('should not shard mode:serial suites when fully-parallel', async ({ runInlineTest }) => { test('should not shard mode:serial suites when fully-parallel', async ({ runInlineTest }) => {
const tests = { const tests = {