diff --git a/packages/html-reporter/src/copyToClipboard.tsx b/packages/html-reporter/src/copyToClipboard.tsx
index 207245c74d..17b1dfbf95 100644
--- a/packages/html-reporter/src/copyToClipboard.tsx
+++ b/packages/html-reporter/src/copyToClipboard.tsx
@@ -39,7 +39,7 @@ export const CopyToClipboard: React.FunctionComponent = ({
});
}, [value]);
const iconElement = icon === 'check' ? icons.check() : icon === 'cross' ? icons.cross() : icons.copy();
- return ;
+ return ;
};
type CopyToClipboardContainerProps = CopyToClipboardProps & {
diff --git a/packages/html-reporter/src/testCaseView.css b/packages/html-reporter/src/testCaseView.css
index f4d7448242..d87cf3aacb 100644
--- a/packages/html-reporter/src/testCaseView.css
+++ b/packages/html-reporter/src/testCaseView.css
@@ -73,5 +73,4 @@
display: flex;
flex-direction: row;
flex-wrap: wrap;
-}
-
+}
\ No newline at end of file
diff --git a/packages/html-reporter/src/testCaseView.spec.tsx b/packages/html-reporter/src/testCaseView.spec.tsx
index 21b1535911..72552f5184 100644
--- a/packages/html-reporter/src/testCaseView.spec.tsx
+++ b/packages/html-reporter/src/testCaseView.spec.tsx
@@ -76,11 +76,17 @@ test('should render test case', async ({ mount }) => {
await expect(component.getByText('My test')).toBeVisible();
});
-test('should render copy buttons for annotations', async ({ mount }) => {
+test('should render copy buttons for annotations', async ({ mount, page, context }) => {
+ await context.grantPermissions(['clipboard-read', 'clipboard-write']);
+
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.getByRole('button').first()).toBeVisible();
+ await expect(component.getByLabel('Copy to clipboard').first()).toBeVisible();
+ await component.getByLabel('Copy to clipboard').first().click();
+ const handle = await page.evaluateHandle(() => navigator.clipboard.readText());
+ const clipboardContent = await handle.jsonValue();
+ expect(clipboardContent).toBe('Annotation text');
});
const annotationLinkRenderingTestCase: TestCase = {