From de5807ce9def1df1525a807b0ca7d68fb2bb93ac Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Mon, 25 Mar 2024 19:42:40 +0530 Subject: [PATCH] Copy annoation text to clipboard --- packages/html-reporter/src/testCaseView.css | 10 ++++++++++ packages/html-reporter/src/testCaseView.tsx | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/html-reporter/src/testCaseView.css b/packages/html-reporter/src/testCaseView.css index d87cf3aacb..93e26a9b79 100644 --- a/packages/html-reporter/src/testCaseView.css +++ b/packages/html-reporter/src/testCaseView.css @@ -73,4 +73,14 @@ display: flex; flex-direction: row; flex-wrap: wrap; +} + +.annotation-copy-button{ + padding-left: 3px; + display: none; +} + +.test-case-annotation:hover .annotation-copy-button{ + padding-left: 3px; + display: inline; } \ No newline at end of file diff --git a/packages/html-reporter/src/testCaseView.tsx b/packages/html-reporter/src/testCaseView.tsx index eecbdac9f5..0c8dcf981a 100644 --- a/packages/html-reporter/src/testCaseView.tsx +++ b/packages/html-reporter/src/testCaseView.tsx @@ -25,6 +25,7 @@ import './testCaseView.css'; import { TestResultView } from './testResultView'; import { hashStringToInt } from './labelUtils'; import { msToString } from './uiUtils'; +import { CopyToClipboard } from './copyToClipboard'; export const TestCaseView: React.FC<{ projectNames: string[], @@ -68,15 +69,16 @@ function renderAnnotationDescription(description: string) { try { if (['http:', 'https:'].includes(new URL(description).protocol)) return {description}; - } catch {} + } catch { } return description; } function TestCaseAnnotationView({ annotation: { type, description } }: { annotation: TestCaseAnnotation }) { return (
- {type} + {type} {description && : {renderAnnotationDescription(description)}} + {description && }
); }