From c216c25a1d325b7dc5f91438481fa6e2f10c160e Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 17 Sep 2024 15:54:22 +0200 Subject: [PATCH] feat(html-reporter): add file name copy button (#32652) --- packages/html-reporter/src/testCaseView.css | 1 + packages/html-reporter/src/testCaseView.spec.tsx | 6 +++--- packages/html-reporter/src/testCaseView.tsx | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/html-reporter/src/testCaseView.css b/packages/html-reporter/src/testCaseView.css index d87cf3aacb..90e2f4057b 100644 --- a/packages/html-reporter/src/testCaseView.css +++ b/packages/html-reporter/src/testCaseView.css @@ -47,6 +47,7 @@ flex: none; align-items: center; padding: 0 8px 8px; + line-height: 24px; } .test-case-path { diff --git a/packages/html-reporter/src/testCaseView.spec.tsx b/packages/html-reporter/src/testCaseView.spec.tsx index 72552f5184..7c9c99eeb3 100644 --- a/packages/html-reporter/src/testCaseView.spec.tsx +++ b/packages/html-reporter/src/testCaseView.spec.tsx @@ -81,9 +81,9 @@ test('should render copy buttons for annotations', async ({ mount, page, context const component = await mount(); await expect(component.getByText('Annotation text', { exact: false }).first()).toBeVisible(); - component.getByText('Annotation text', { exact: false }).first().hover(); - await expect(component.getByLabel('Copy to clipboard').first()).toBeVisible(); - await component.getByLabel('Copy to clipboard').first().click(); + await component.getByText('Annotation text', { exact: false }).first().hover(); + await expect(component.locator('.test-case-annotation').getByLabel('Copy to clipboard').first()).toBeVisible(); + await component.locator('.test-case-annotation').getByLabel('Copy to clipboard').first().click(); const handle = await page.evaluateHandle(() => navigator.clipboard.readText()); const clipboardContent = await handle.jsonValue(); expect(clipboardContent).toBe('Annotation text'); diff --git a/packages/html-reporter/src/testCaseView.tsx b/packages/html-reporter/src/testCaseView.tsx index 1fe4f42ed3..e3656bf414 100644 --- a/packages/html-reporter/src/testCaseView.tsx +++ b/packages/html-reporter/src/testCaseView.tsx @@ -50,7 +50,11 @@ export const TestCaseView: React.FC<{ {test &&
{test.path.join(' › ')}
} {test &&
{test?.title}
} {test &&
-
{test.location.file}:{test.location.line}
+
+ + {test.location.file}:{test.location.line} + +
{msToString(test.duration)}
}