recreate attachments in teleReceiver
This commit is contained in:
parent
9a5e255529
commit
617dfcc738
|
|
@ -108,6 +108,7 @@ export type JsonTestStepEnd = {
|
||||||
id: string;
|
id: string;
|
||||||
duration: number;
|
duration: number;
|
||||||
error?: reporterTypes.TestError;
|
error?: reporterTypes.TestError;
|
||||||
|
attachments: number[]; // index of JsonTestResultEnd.attachments
|
||||||
};
|
};
|
||||||
|
|
||||||
export type JsonFullResult = {
|
export type JsonFullResult = {
|
||||||
|
|
@ -239,6 +240,8 @@ export class TeleReporterReceiver {
|
||||||
result.error = result.errors?.[0];
|
result.error = result.errors?.[0];
|
||||||
result.attachments = this._parseAttachments(payload.attachments);
|
result.attachments = this._parseAttachments(payload.attachments);
|
||||||
this._reporter.onTestEnd?.(test, result);
|
this._reporter.onTestEnd?.(test, result);
|
||||||
|
for (const step of result.steps)
|
||||||
|
step.attachments = step._attachmentIndices.map(index => result.attachments[index]);
|
||||||
// Free up the memory as won't see these step ids.
|
// Free up the memory as won't see these step ids.
|
||||||
result._stepMap = new Map();
|
result._stepMap = new Map();
|
||||||
}
|
}
|
||||||
|
|
@ -264,6 +267,7 @@ export class TeleReporterReceiver {
|
||||||
const step = result._stepMap.get(payload.id)!;
|
const step = result._stepMap.get(payload.id)!;
|
||||||
step.duration = payload.duration;
|
step.duration = payload.duration;
|
||||||
step.error = payload.error;
|
step.error = payload.error;
|
||||||
|
step._attachmentIndices = payload.attachments;
|
||||||
this._reporter.onStepEnd?.(test, result, step);
|
this._reporter.onStepEnd?.(test, result, step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -512,9 +516,11 @@ class TeleTestStep implements reporterTypes.TestStep {
|
||||||
parent: reporterTypes.TestStep | undefined;
|
parent: reporterTypes.TestStep | undefined;
|
||||||
duration: number = -1;
|
duration: number = -1;
|
||||||
steps: reporterTypes.TestStep[] = [];
|
steps: reporterTypes.TestStep[] = [];
|
||||||
attachments = [];
|
attachments: reporterTypes.TestStep['attachments'] = [];
|
||||||
|
error?: reporterTypes.TestError | undefined;
|
||||||
|
|
||||||
private _startTime: number = 0;
|
private _startTime: number = 0;
|
||||||
|
_attachmentIndices: number[] = [];
|
||||||
|
|
||||||
constructor(payload: JsonTestStepStart, parentStep: reporterTypes.TestStep | undefined, location: reporterTypes.Location | undefined) {
|
constructor(payload: JsonTestStepStart, parentStep: reporterTypes.TestStep | undefined, location: reporterTypes.Location | undefined) {
|
||||||
this.title = payload.title;
|
this.title = payload.title;
|
||||||
|
|
@ -551,7 +557,7 @@ export class TeleTestResult implements reporterTypes.TestResult {
|
||||||
errors: reporterTypes.TestResult['errors'] = [];
|
errors: reporterTypes.TestResult['errors'] = [];
|
||||||
error: reporterTypes.TestResult['error'];
|
error: reporterTypes.TestResult['error'];
|
||||||
|
|
||||||
_stepMap: Map<string, reporterTypes.TestStep> = new Map();
|
_stepMap = new Map<string, TeleTestStep>();
|
||||||
_id: string;
|
_id: string;
|
||||||
|
|
||||||
private _startTime: number = 0;
|
private _startTime: number = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue