diff --git a/packages/html-reporter/src/testResultView.tsx b/packages/html-reporter/src/testResultView.tsx
index 01cb14540f..a3c75f30be 100644
--- a/packages/html-reporter/src/testResultView.tsx
+++ b/packages/html-reporter/src/testResultView.tsx
@@ -84,12 +84,19 @@ export const TestResultView: React.FC<{
const screenshots = new Set(attachments.filter(a => getAttachmentCategory(a) === 'screenshot'));
const videos = attachments.filter(a => getAttachmentCategory(a) === 'video');
const traces = attachments.filter(a => getAttachmentCategory(a) === 'trace');
- const htmls = attachments.filter(a => getAttachmentCategory(a) === 'html');
- const otherAttachments = attachments.filter(a => getAttachmentCategory(a) === 'other');
+
const diffs = groupImageDiffs(screenshots);
const errors = classifyErrors(result.errors, diffs);
+
+ const collectAttachments = (step: TestStep): number[] => step.attachments.concat(...step.steps.map(collectAttachments));
+ const stepAttachments = result.steps.flatMap(collectAttachments);
+
+ const topLevelAttachments = result.attachments.filter((_, index) => !stepAttachments.includes(index));
+ const htmls = topLevelAttachments.filter(a => getAttachmentCategory(a) === 'html');
+ const otherAttachments = topLevelAttachments.filter(a => getAttachmentCategory(a) === 'other');
+
return { screenshots: [...screenshots], videos, traces, otherAttachments, diffs, errors, htmls };
- }, [result.attachments, result.errors]);
+ }, [result]);
const videoRef = React.useRef(null);
const imageDiffRef = React.useRef(null);
@@ -115,6 +122,8 @@ export const TestResultView: React.FC<{
}
{!!result.steps.length &&
{result.steps.map((step, i) => )}
+ {htmls.map((a, i) => )}
+ {otherAttachments.map((a, i) => )}
}
{diffs.map((diff, index) =>
@@ -152,7 +161,7 @@ export const TestResultView: React.FC<{
)}
}
- {!!(otherAttachments.length + htmls.length) &&
+ {!result.steps.length && !!(otherAttachments.length + htmls.length) &&
{[...htmls].map((a, i) => (
)
)}
@@ -189,6 +198,9 @@ const StepTreeItem: React.FC<{
depth: number,
attachments: TestAttachment[],
}> = ({ step, depth, attachments }) => {
+ if (step.category === 'attach')
+ return;
+
return
{msToString(step.duration)}
{statusIcon(step.error || step.duration === -1 ? 'failed' : 'passed')}
@@ -198,7 +210,7 @@ const StepTreeItem: React.FC<{
{step.attachments.length > 0 && 1 ? 's' : ''}`}>{icons.paperclip()}}
} loadChildren={step.steps.length + step.attachments.length + (step.snippet ? 1 : 0) ? () => {
const children = step.steps.map((s, i) => );
- children.unshift(...step.attachments.map(a => {
+ children.push(...step.attachments.map(a => {
const attachment = attachments[a];
return ;
}));