chore: do not store empty step.attachments[] in trace (#34579)
This commit is contained in:
parent
cb208836b5
commit
f1a392f844
|
|
@ -256,7 +256,7 @@ export class TeleReporterEmitter implements ReporterV2 {
|
|||
id: (step as any)[this._idSymbol],
|
||||
duration: step.duration,
|
||||
error: step.error,
|
||||
attachments: step.attachments.map(a => result.attachments.indexOf(a)),
|
||||
attachments: step.attachments.length ? step.attachments.map(a => result.attachments.indexOf(a)) : undefined,
|
||||
annotations: step.annotations.length ? step.annotations : undefined,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,6 +278,8 @@ export class TestTracing {
|
|||
}
|
||||
|
||||
function serializeAttachments(attachments: Attachment[]): trace.AfterActionTraceEvent['attachments'] {
|
||||
if (attachments.length === 0)
|
||||
return undefined;
|
||||
return attachments.filter(a => a.name !== 'trace').map(a => {
|
||||
return {
|
||||
name: a.name,
|
||||
|
|
|
|||
|
|
@ -761,7 +761,7 @@ test('should not throw when screenshot on failure fails', async ({ runInlineTest
|
|||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(1);
|
||||
const trace = await parseTrace(testInfo.outputPath('test-results', 'a-has-download-page', 'trace.zip'));
|
||||
const attachedScreenshots = trace.actions.flatMap(a => a.attachments);
|
||||
const attachedScreenshots = trace.actions.filter(a => a.attachments).flatMap(a => a.attachments);
|
||||
// One screenshot for the page, no screenshot for the download page since it should have failed.
|
||||
expect(attachedScreenshots.length).toBe(1);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue