chore: pass parent step id in tele reporter (#21934)
This commit is contained in:
parent
d4e0ef7f1a
commit
900f9deb4f
|
|
@ -90,6 +90,7 @@ export type JsonTestResultEnd = {
|
||||||
|
|
||||||
export type JsonTestStepStart = {
|
export type JsonTestStepStart = {
|
||||||
id: string;
|
id: string;
|
||||||
|
parentStepId?: string;
|
||||||
title: string;
|
title: string;
|
||||||
category: string,
|
category: string,
|
||||||
startTime: string;
|
startTime: string;
|
||||||
|
|
@ -193,19 +194,21 @@ export class TeleReporterReceiver {
|
||||||
private _onStepBegin(testId: string, resultId: string, payload: JsonTestStepStart) {
|
private _onStepBegin(testId: string, resultId: string, payload: JsonTestStepStart) {
|
||||||
const test = this._tests.get(testId)!;
|
const test = this._tests.get(testId)!;
|
||||||
const result = test.resultsMap.get(resultId)!;
|
const result = test.resultsMap.get(resultId)!;
|
||||||
|
const parentStep = payload.parentStepId ? result.stepMap.get(payload.parentStepId) : undefined;
|
||||||
|
|
||||||
const step: TestStep = {
|
const step: TestStep = {
|
||||||
titlePath: () => [],
|
titlePath: () => [],
|
||||||
title: payload.title,
|
title: payload.title,
|
||||||
category: payload.category,
|
category: payload.category,
|
||||||
location: this._absoluteLocation(payload.location),
|
location: this._absoluteLocation(payload.location),
|
||||||
|
parent: parentStep,
|
||||||
startTime: new Date(payload.startTime),
|
startTime: new Date(payload.startTime),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
steps: [],
|
steps: [],
|
||||||
};
|
};
|
||||||
// TODO: implement nested steps.
|
if (parentStep)
|
||||||
|
parentStep.steps.push(step);
|
||||||
result.stepMap.set(payload.id, step);
|
result.stepMap.set(payload.id, step);
|
||||||
result.stepStack[result.stepStack.length - 1].steps.push(step);
|
|
||||||
result.stepStack.push(step);
|
|
||||||
this._reporter.onStepBegin?.(test, result, step);
|
this._reporter.onStepBegin?.(test, result, step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,9 +216,6 @@ export class TeleReporterReceiver {
|
||||||
const test = this._tests.get(testId)!;
|
const test = this._tests.get(testId)!;
|
||||||
const result = test.resultsMap.get(resultId)!;
|
const result = test.resultsMap.get(resultId)!;
|
||||||
const step = result.stepMap.get(payload.id)!;
|
const step = result.stepMap.get(payload.id)!;
|
||||||
const i = result.stepStack.indexOf(step);
|
|
||||||
if (i !== -1)
|
|
||||||
result.stepStack.splice(i, 1);
|
|
||||||
step.duration = payload.duration;
|
step.duration = payload.duration;
|
||||||
step.error = payload.error;
|
step.error = payload.error;
|
||||||
this._reporter.onStepEnd?.(test, result, step);
|
this._reporter.onStepEnd?.(test, result, step);
|
||||||
|
|
@ -444,9 +444,7 @@ export class TeleTestCase implements reporterTypes.TestCase {
|
||||||
steps: [],
|
steps: [],
|
||||||
errors: [],
|
errors: [],
|
||||||
stepMap: new Map(),
|
stepMap: new Map(),
|
||||||
stepStack: [],
|
|
||||||
};
|
};
|
||||||
result.stepStack.push(result);
|
|
||||||
this.results.push(result);
|
this.results.push(result);
|
||||||
this.resultsMap.set(id, result);
|
this.resultsMap.set(id, result);
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -455,7 +453,6 @@ export class TeleTestCase implements reporterTypes.TestCase {
|
||||||
|
|
||||||
export type TeleTestResult = reporterTypes.TestResult & {
|
export type TeleTestResult = reporterTypes.TestResult & {
|
||||||
stepMap: Map<string, reporterTypes.TestStep>;
|
stepMap: Map<string, reporterTypes.TestStep>;
|
||||||
stepStack: (reporterTypes.TestStep | reporterTypes.TestResult)[];
|
|
||||||
statusEx: reporterTypes.TestResult['status'] | 'scheduled' | 'running';
|
statusEx: reporterTypes.TestResult['status'] | 'scheduled' | 'running';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,7 @@ export class TeleReporterEmitter implements Reporter {
|
||||||
private _serializeStepStart(step: TestStep): JsonTestStepStart {
|
private _serializeStepStart(step: TestStep): JsonTestStepStart {
|
||||||
return {
|
return {
|
||||||
id: (step as any)[idSymbol],
|
id: (step as any)[idSymbol],
|
||||||
|
parentStepId: (step.parent as any)?.[idSymbol],
|
||||||
title: step.title,
|
title: step.title,
|
||||||
category: step.category,
|
category: step.category,
|
||||||
startTime: step.startTime.toISOString(),
|
startTime: step.startTime.toISOString(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue