revert step.attachments
This commit is contained in:
parent
bc66311a05
commit
9231cd5d8e
|
|
@ -32,8 +32,7 @@ import type { StackFrame } from '@protocol/channels';
|
||||||
import { testInfoError } from './util';
|
import { testInfoError } from './util';
|
||||||
|
|
||||||
export interface TestStepInternal {
|
export interface TestStepInternal {
|
||||||
complete(result: { error?: Error | unknown, suggestedRebaseline?: string }): void;
|
complete(result: { error?: Error | unknown, attachments?: Attachment[], suggestedRebaseline?: string }): void;
|
||||||
attachments: Attachment[];
|
|
||||||
stepId: string;
|
stepId: string;
|
||||||
title: string;
|
title: string;
|
||||||
category: 'hook' | 'fixture' | 'test.step' | 'expect' | 'attach' | string;
|
category: 'hook' | 'fixture' | 'test.step' | 'expect' | 'attach' | string;
|
||||||
|
|
@ -268,12 +267,10 @@ export class TestInfoImpl implements TestInfo {
|
||||||
}
|
}
|
||||||
data.location = data.location || filteredStack[0];
|
data.location = data.location || filteredStack[0];
|
||||||
|
|
||||||
const attachments: Attachment[] = [];
|
|
||||||
const step: TestStepInternal = {
|
const step: TestStepInternal = {
|
||||||
stepId,
|
stepId,
|
||||||
...data,
|
...data,
|
||||||
steps: [],
|
steps: [],
|
||||||
attachments,
|
|
||||||
complete: result => {
|
complete: result => {
|
||||||
if (step.endWallTime)
|
if (step.endWallTime)
|
||||||
return;
|
return;
|
||||||
|
|
@ -301,9 +298,6 @@ export class TestInfoImpl implements TestInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const attachment of attachments ?? [])
|
|
||||||
this._attach(attachment, stepId);
|
|
||||||
|
|
||||||
const payload: StepEndPayload = {
|
const payload: StepEndPayload = {
|
||||||
testId: this.testId,
|
testId: this.testId,
|
||||||
stepId,
|
stepId,
|
||||||
|
|
@ -313,7 +307,7 @@ export class TestInfoImpl implements TestInfo {
|
||||||
};
|
};
|
||||||
this._onStepEnd(payload);
|
this._onStepEnd(payload);
|
||||||
const errorForTrace = step.error ? { name: '', message: step.error.message || '', stack: step.error.stack } : undefined;
|
const errorForTrace = step.error ? { name: '', message: step.error.message || '', stack: step.error.stack } : undefined;
|
||||||
this._tracing.appendAfterActionForStep(stepId, errorForTrace, attachments);
|
this._tracing.appendAfterActionForStep(stepId, errorForTrace, result.attachments);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const parentStepList = parentStep ? parentStep.steps : this._steps;
|
const parentStepList = parentStep ? parentStep.steps : this._steps;
|
||||||
|
|
@ -416,8 +410,9 @@ export class TestInfoImpl implements TestInfo {
|
||||||
title: `attach "${name}"`,
|
title: `attach "${name}"`,
|
||||||
category: 'attach',
|
category: 'attach',
|
||||||
});
|
});
|
||||||
step.attachments.push(await normalizeAndSaveAttachment(this.outputPath(), name, options));
|
const attachment = await normalizeAndSaveAttachment(this.outputPath(), name, options);
|
||||||
step.complete({});
|
this._attach(attachment, step.stepId);
|
||||||
|
step.complete({ attachments: [attachment] });
|
||||||
}
|
}
|
||||||
|
|
||||||
private _attach(attachment: TestInfo['attachments'][0], stepId: string | undefined) {
|
private _attach(attachment: TestInfo['attachments'][0], stepId: string | undefined) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue