mirror of
https://github.com/microsoft/playwright.git
synced 2024-10-27 05:46:28 +03:00
fix(test runner): make sure static annotations are reported for skipped tests (#26634)
Fixes #26397.
This commit is contained in:
parent
f4f9e526a2
commit
218955c155
@ -68,6 +68,7 @@ export function bindFileSuiteToProject(project: FullProjectInternal, suite: Suit
|
||||
}
|
||||
test.retries = inheritedRetries ?? project.project.retries;
|
||||
test.timeout = inheritedTimeout ?? project.project.timeout;
|
||||
test.annotations = [...test._staticAnnotations];
|
||||
|
||||
// Skip annotations imply skipped expectedStatus.
|
||||
if (test._staticAnnotations.some(a => a.type === 'skip' || a.type === 'fixme'))
|
||||
|
@ -292,6 +292,7 @@ export class TestCase extends Base implements reporterTypes.TestCase {
|
||||
poolDigest: this._poolDigest,
|
||||
workerHash: this._workerHash,
|
||||
staticAnnotations: this._staticAnnotations.slice(),
|
||||
annotations: this.annotations.slice(),
|
||||
projectId: this._projectId,
|
||||
};
|
||||
}
|
||||
@ -307,6 +308,7 @@ export class TestCase extends Base implements reporterTypes.TestCase {
|
||||
test._poolDigest = data.poolDigest;
|
||||
test._workerHash = data.workerHash;
|
||||
test._staticAnnotations = data.staticAnnotations;
|
||||
test.annotations = data.annotations;
|
||||
test._projectId = data.projectId;
|
||||
return test;
|
||||
}
|
||||
|
@ -76,7 +76,6 @@ export class Dispatcher {
|
||||
const result = test._appendTestResult();
|
||||
result.status = 'skipped';
|
||||
this._reporter.onTestBegin(test, result);
|
||||
test.annotations = [...test._staticAnnotations];
|
||||
this._reportTestEnd(test, result);
|
||||
}
|
||||
this._queue.shift();
|
||||
|
@ -619,3 +619,30 @@ test('should skip tests if beforeEach has skip', async ({ runInlineTest }) => {
|
||||
expectTest('no marker', 'skipped', 'skipped', ['skip']);
|
||||
expect(result.output).not.toContain('skip-me');
|
||||
});
|
||||
|
||||
test('static modifiers should be added in serial mode', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'a.test.ts': `
|
||||
import { test } from '@playwright/test';
|
||||
|
||||
test.describe.configure({ mode: 'serial' });
|
||||
test('failed', async ({}) => {
|
||||
test.slow();
|
||||
throw new Error('blocking error');
|
||||
});
|
||||
test.fixme('fixmed', async ({}) => {
|
||||
});
|
||||
test.skip('skipped', async ({}) => {
|
||||
});
|
||||
test('ignored', async ({}) => {
|
||||
});
|
||||
`,
|
||||
});
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.passed).toBe(0);
|
||||
expect(result.skipped).toBe(3);
|
||||
expect(result.report.suites[0].specs[0].tests[0].annotations).toEqual([{ type: 'slow' }]);
|
||||
expect(result.report.suites[0].specs[1].tests[0].annotations).toEqual([{ type: 'fixme' }]);
|
||||
expect(result.report.suites[0].specs[2].tests[0].annotations).toEqual([{ type: 'skip' }]);
|
||||
expect(result.report.suites[0].specs[3].tests[0].annotations).toEqual([]);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user