diff --git a/lib/static/new-ui/features/suites/components/TestSteps/selectors.ts b/lib/static/new-ui/features/suites/components/TestSteps/selectors.ts index 618b4474..0a7d5e41 100644 --- a/lib/static/new-ui/features/suites/components/TestSteps/selectors.ts +++ b/lib/static/new-ui/features/suites/components/TestSteps/selectors.ts @@ -63,7 +63,7 @@ export const getTestSteps = createSelector( if (result.error && !isImageDiffError(result.error) && !isAssertViewError(result.error)) { const lastErroredStep = getLastErroredStep(steps); const error = mergeSnippetIntoErrorStack(result.error); - const errorAttachment: ListTreeItemType = { + const errorInfo: ListTreeItemType = { id: `${lastErroredStep?.id} error 0`, data: { type: StepType.ErrorInfo, @@ -71,19 +71,22 @@ export const getTestSteps = createSelector( stack: error.stack } }; + const errorAttachment: ListTreeItemType = { + id: `${lastErroredStep?.id} error`, + data: { + type: StepType.Attachment, + title: 'Error', + hasChildren: true + } satisfies Attachment, + children: [errorInfo] + }; if (lastErroredStep && lastErroredStep.children && lastErroredStep.children.length > 0) { - lastErroredStep.children.push({ - id: `${lastErroredStep.id} error`, - data: { - type: StepType.Attachment, - title: 'Error', - hasChildren: true - } satisfies Attachment, - children: [errorAttachment] - }); + lastErroredStep.children.push(errorAttachment); } else if (lastErroredStep) { - lastErroredStep.children = [errorAttachment]; + lastErroredStep.children = [errorInfo]; + } else { + steps.push(errorAttachment); } }