{attachment.contentType === kMissingContentType ? icons.warning() : icons.attachment()}
{attachment.path && {linkName || attachment.name}}
- {attachment.body && {linkifyText(attachment.name)}}
+ {!attachment.path && {linkifyText(attachment.name)}}
} loadChildren={attachment.body ? () => {
return [{linkifyText(attachment.body!)}
];
} : undefined} depth={0} style={{ lineHeight: '32px' }}>;
diff --git a/packages/html-reporter/src/testCaseView.spec.tsx b/packages/html-reporter/src/testCaseView.spec.tsx
index d73407582d..624a93805f 100644
--- a/packages/html-reporter/src/testCaseView.spec.tsx
+++ b/packages/html-reporter/src/testCaseView.spec.tsx
@@ -132,6 +132,9 @@ const resultWithAttachment: TestResult = {
name: 'first attachment',
body: 'The body with https://playwright.dev/docs/intro link and https://github.com/microsoft/playwright/issues/31284.',
contentType: 'text/plain'
+ }, {
+ name: 'attachment with inline link https://github.com/microsoft/playwright/issues/31284',
+ contentType: 'text/plain'
}],
status: 'passed',
};
@@ -157,4 +160,11 @@ test('should correctly render links in attachments', async ({ mount }) => {
await expect(body).toBeVisible();
await expect(body.locator('a').filter({ hasText: 'playwright.dev' })).toHaveAttribute('href', 'https://playwright.dev/docs/intro');
await expect(body.locator('a').filter({ hasText: 'github.com' })).toHaveAttribute('href', 'https://github.com/microsoft/playwright/issues/31284');
-});
\ No newline at end of file
+});
+
+test('should correctly render links in attachment name', async ({ mount }) => {
+ const component = await mount(