diff --git a/packages/html-reporter/src/links.tsx b/packages/html-reporter/src/links.tsx
index 424f780f5d..dbcd125974 100644
--- a/packages/html-reporter/src/links.tsx
+++ b/packages/html-reporter/src/links.tsx
@@ -68,10 +68,11 @@ export const ProjectLink: React.FunctionComponent<{
export const AttachmentLink: React.FunctionComponent<{
attachment: TestAttachment,
href?: string,
-}> = ({ attachment, href }) => {
+ linkName?: string,
+}> = ({ attachment, href, linkName }) => {
return
{attachment.contentType === kMissingContentType ? icons.warning() : icons.attachment()}
- {attachment.path && {attachment.name}}
+ {attachment.path && {linkName || attachment.name}}
{attachment.body && {attachment.name}}
} loadChildren={attachment.body ? () => {
return [{attachment.body}
];
diff --git a/packages/html-reporter/src/testResultView.tsx b/packages/html-reporter/src/testResultView.tsx
index 764cb25a14..c4622e7405 100644
--- a/packages/html-reporter/src/testResultView.tsx
+++ b/packages/html-reporter/src/testResultView.tsx
@@ -75,12 +75,12 @@ export const TestResultView: React.FC<{
}
{!!traces.length &&
- {traces.map((a, i) => }
}
{!!videos.length &&
diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.ts
index 64ac0dbffe..f93c51044c 100644
--- a/tests/playwright-test/reporter-html.spec.ts
+++ b/tests/playwright-test/reporter-html.spec.ts
@@ -279,6 +279,40 @@ test('should show trace title', async ({ runInlineTest, page, showReport }) => {
await expect(page.locator('.workbench .title')).toHaveText('a.test.js:6 › passes');
});
+test('should show multi trace source', async ({ runInlineTest, page, server, showReport }) => {
+ const result = await runInlineTest({
+ 'playwright.config.js': `
+ module.exports = { use: { trace: 'on' } };
+ `,
+ 'a.test.js': `
+ const { test } = pwt;
+ test('passes', async ({ playwright, page }) => {
+ await page.evaluate('2 + 2');
+ const request = await playwright.request.newContext();
+ await request.get('${server.EMPTY_PAGE}');
+ await request.dispose();
+ });
+ `,
+ }, { reporter: 'dot,html' });
+ expect(result.exitCode).toBe(0);
+ expect(result.passed).toBe(1);
+
+ await showReport();
+ await page.click('text=passes');
+ // Expect one image-link to trace viewer and 2 separate download links
+ await expect(page.locator('img')).toHaveCount(1);
+ await expect(page.locator('a', { hasText: 'trace' })).toHaveText(['trace-1', 'trace-2']);
+
+ await page.click('img');
+ await page.click('.action-title >> text=page.evaluate');
+ await page.click('text=Source');
+ await expect(page.locator('.source-line-running')).toContainText('page.evaluate');
+
+ await page.click('.action-title >> text=apiRequestContext.get');
+ await page.click('text=Source');
+ await expect(page.locator('.source-line-running')).toContainText('request.get');
+});
+
test('should show timed out steps', async ({ runInlineTest, page, showReport }) => {
const result = await runInlineTest({
'playwright.config.js': `