diff --git a/src/web/htmlReport/htmlReport.css b/src/web/htmlReport/htmlReport.css index e1be6c8b98..6110b7b940 100644 --- a/src/web/htmlReport/htmlReport.css +++ b/src/web/htmlReport/htmlReport.css @@ -209,4 +209,6 @@ video, img { box-shadow: var(--box-shadow-thick); width: 80%; margin: 20px auto; + min-width: 80%; + min-height: 300px; } diff --git a/src/web/htmlReport/htmlReport.tsx b/src/web/htmlReport/htmlReport.tsx index 93806a91e7..1677d4e5fa 100644 --- a/src/web/htmlReport/htmlReport.tsx +++ b/src/web/htmlReport/htmlReport.tsx @@ -163,28 +163,53 @@ const TestResultView: React.FC<{ result: TestResult, }> = ({ result }) => { - const { screenshots, videos, attachmentsMap } = React.useMemo(() => { + const { screenshots, videos, otherAttachments, attachmentsMap } = React.useMemo(() => { const attachmentsMap = new Map(); const attachments = result?.attachments || []; + const otherAttachments: TestAttachment[] = []; const screenshots = attachments.filter(a => a.name === 'screenshot'); const videos = attachments.filter(a => a.name === 'video'); - for (const a of attachments) + const knownNames = new Set(['screenshot', 'image', 'expected', 'actual', 'diff', 'video']); + for (const a of attachments) { attachmentsMap.set(a.name, a); - return { attachmentsMap, screenshots, videos }; + if (!knownNames.has(a.name)) + otherAttachments.push(a); + } + return { attachmentsMap, screenshots, videos, otherAttachments }; }, [ result ]); + const expected = attachmentsMap.get('expected'); + const actual = attachmentsMap.get('actual'); + const diff = attachmentsMap.get('diff'); return
{result.error && } {result.steps.map((step, i) => )} - {attachmentsMap.has('expected') && attachmentsMap.has('actual') && } - {!!screenshots &&
Screenshots
} - {screenshots.map((a, i) => )} + + {expected && actual &&
+ + + + {diff && } +
} + + {!!screenshots.length &&
Screenshots
} + {screenshots.map((a, i) => { + return
+ + +
; + })} + {!!videos.length &&
Videos
} - {videos.map((a, i) => )} - {!!result.attachments &&
Attachments
} - {result.attachments.map((a, i) => )} + {videos.map((a, i) =>
+ + +
)} + + {!!otherAttachments &&
Attachments
} + {otherAttachments.map((a, i) => )}
; }; @@ -238,18 +263,18 @@ export const ImageDiff: React.FunctionComponent<{ tabs.push({ id: 'actual', title: 'Actual', - render: () =>
+ render: () => }); tabs.push({ id: 'expected', title: 'Expected', - render: () =>
+ render: () => }); if (diff) { tabs.push({ id: 'diff', title: 'Diff', - render: () =>
, + render: () => }); } return