mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
chore: added starting time of test to the base json reporter (#16885)
This commit is contained in:
parent
f30ac1d678
commit
409bab59ea
@ -177,6 +177,7 @@ class JSONReporter implements Reporter {
|
||||
stderr: result.stderr.map(s => stdioEntry(s)),
|
||||
retry: result.retry,
|
||||
steps: steps.length ? steps.map(s => this._serializeTestStep(s)) : undefined,
|
||||
startTime: result.startTime,
|
||||
attachments: result.attachments.map(a => ({
|
||||
name: a.name,
|
||||
contentType: a.contentType,
|
||||
|
@ -493,6 +493,7 @@ export interface JSONReportTestResult {
|
||||
stderr: JSONReportSTDIOEntry[];
|
||||
retry: number;
|
||||
steps?: JSONReportTestStep[];
|
||||
startTime: Date;
|
||||
attachments: {
|
||||
name: string;
|
||||
path?: string;
|
||||
|
@ -235,3 +235,16 @@ test('should add line in addition to file json without CI', async ({ runInlineTe
|
||||
expect(stripAnsi(result.output)).toContain('[1/1] a.test.js:6:7 › one');
|
||||
expect(fs.existsSync(testInfo.outputPath('a.json'))).toBeTruthy();
|
||||
});
|
||||
test('should have starting time in results', async ({ runInlineTest }, testInfo) => {
|
||||
const result = await runInlineTest({
|
||||
'a.test.js': `
|
||||
const { test } = pwt;
|
||||
test('math works!', async ({}) => {
|
||||
expect(1 + 1).toBe(2);
|
||||
});
|
||||
`
|
||||
}, { reporter: 'json' });
|
||||
expect(result.exitCode).toBe(0);
|
||||
const startTime = result.report.suites[0].specs[0].tests[0].results[0].startTime;
|
||||
expect(new Date(startTime).getTime()).toBeGreaterThan(new Date('1/1/2000').getTime());
|
||||
});
|
||||
|
@ -104,6 +104,7 @@ export interface JSONReportTestResult {
|
||||
stderr: JSONReportSTDIOEntry[];
|
||||
retry: number;
|
||||
steps?: JSONReportTestStep[];
|
||||
startTime: Date;
|
||||
attachments: {
|
||||
name: string;
|
||||
path?: string;
|
||||
|
Loading…
Reference in New Issue
Block a user