fix reporter-json.spec.ts due to sharding
This commit is contained in:
parent
6543baf62f
commit
59c625e56a
|
|
@ -14,9 +14,9 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as path from 'path';
|
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { test, expect, stripAnsi } from './playwright-test-fixtures';
|
import * as path from 'path';
|
||||||
|
import { expect, stripAnsi, test } from './playwright-test-fixtures';
|
||||||
|
|
||||||
test('should support spec.ok and stats', async ({ runInlineTest }) => {
|
test('should support spec.ok and stats', async ({ runInlineTest }) => {
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
|
|
@ -31,7 +31,7 @@ test('should support spec.ok and stats', async ({ runInlineTest }) => {
|
||||||
test.skip('math skipped', async ({}) => {
|
test.skip('math skipped', async ({}) => {
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { });
|
}, {});
|
||||||
expect(result.exitCode).toBe(1);
|
expect(result.exitCode).toBe(1);
|
||||||
expect(result.report.suites[0].specs[0].ok).toBe(true);
|
expect(result.report.suites[0].specs[0].ok).toBe(true);
|
||||||
expect(result.report.suites[0].specs[1].ok).toBe(false);
|
expect(result.report.suites[0].specs[1].ok).toBe(false);
|
||||||
|
|
@ -43,7 +43,7 @@ test('should support spec.ok and stats', async ({ runInlineTest }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should not report skipped due to sharding', async ({ runInlineTest }) => {
|
test('should not report skipped due to sharding', async ({ runInlineTest }) => {
|
||||||
const result = await runInlineTest({
|
const tests = {
|
||||||
'a.test.js': `
|
'a.test.js': `
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
test('one', async () => {
|
test('one', async () => {
|
||||||
|
|
@ -62,12 +62,29 @@ test('should not report skipped due to sharding', async ({ runInlineTest }) => {
|
||||||
test('five', async () => {
|
test('five', async () => {
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
}, { shard: '1/3', reporter: 'json' });
|
};
|
||||||
|
{
|
||||||
|
const result = await runInlineTest(tests, { shard: '1/3', reporter: 'json' });
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
expect(result.report.suites.length).toBe(1);
|
||||||
|
expect(result.report.suites[0].specs.length).toBe(3);
|
||||||
|
expect(result.report.suites[0].specs[0].tests[0].status).toBe('expected');
|
||||||
|
expect(result.report.suites[0].specs[1].tests[0].status).toBe('skipped');
|
||||||
|
expect(result.report.suites[0].specs[2].tests[0].status).toBe('expected');
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const result = await runInlineTest(tests, { shard: '2/3', reporter: 'json' });
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
expect(result.report.suites.length).toBe(1);
|
expect(result.report.suites.length).toBe(1);
|
||||||
expect(result.report.suites[0].specs.length).toBe(2);
|
expect(result.report.suites[0].specs.length).toBe(2);
|
||||||
expect(result.report.suites[0].specs[0].tests[0].status).toBe('expected');
|
expect(result.report.suites[0].specs[0].tests[0].status).toBe('expected');
|
||||||
expect(result.report.suites[0].specs[1].tests[0].status).toBe('skipped');
|
expect(result.report.suites[0].specs[1].tests[0].status).toBe('skipped');
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const result = await runInlineTest(tests, { shard: '3/3', reporter: 'json' });
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
expect(result.report.suites.length).toBe(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should report projects and stats', async ({ runInlineTest }, testInfo) => {
|
test('should report projects and stats', async ({ runInlineTest }, testInfo) => {
|
||||||
|
|
@ -95,7 +112,7 @@ test('should report projects and stats', async ({ runInlineTest }, testInfo) =>
|
||||||
expect(1 + 1).toBe(2);
|
expect(1 + 1).toBe(2);
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { });
|
}, {});
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
const projects = result.report.config.projects;
|
const projects = result.report.config.projects;
|
||||||
const testDir = testInfo.outputDir.split(path.sep).join(path.posix.sep);
|
const testDir = testInfo.outputDir.split(path.sep).join(path.posix.sep);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue