From a6bf3db2f5852011b576ff82286664ed23000cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Fri, 30 Aug 2024 14:03:46 +0200 Subject: [PATCH] fix(#1863): add missing DRep Details test IDs --- CHANGELOG.md | 2 +- govtool/frontend/src/pages/DRepDetails.tsx | 88 +++++++++++++++++----- 2 files changed, 72 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9d31038e..07a114658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ changes. ### Added -- +- Add missing test DRep Details test IDs [Issue 1863](https://github.com/IntersectMBO/govtool/issues/1863) ### Fixed diff --git a/govtool/frontend/src/pages/DRepDetails.tsx b/govtool/frontend/src/pages/DRepDetails.tsx index bbb80a0b9..96bcfe67f 100644 --- a/govtool/frontend/src/pages/DRepDetails.tsx +++ b/govtool/frontend/src/pages/DRepDetails.tsx @@ -240,13 +240,16 @@ export const DRepDetails = ({ isConnected }: DRepDetailsProps) => { url={url} /> )} - - + + - + - + { {correctAdaFormat(votingPower)} - - {paymentAddress && } + + {paymentAddress && ( + + )} {references?.length > 0 && !metadataStatus && ( - + { )} - + {objectives} - + {motivations} - + {qualifications} @@ -341,18 +364,34 @@ const ellipsisStyles = { type DrepDetailsInfoItemProps = PropsWithChildren & { label: string; + dataTestId: string; }; -const DRepDetailsInfoItem = ({ children, label }: DrepDetailsInfoItemProps) => { +const dataTestIdInfoItemCategoryPrefix = "info-item"; + +const DRepDetailsInfoItem = ({ + children, + label, + dataTestId, +}: DrepDetailsInfoItemProps) => { if (!children) return null; return ( <> - + {label} - + {children} @@ -362,27 +401,42 @@ const DRepDetailsInfoItem = ({ children, label }: DrepDetailsInfoItemProps) => { const DRepDetailsDescriptionItem = ({ children, label, + dataTestId, }: DrepDetailsInfoItemProps) => { if (!children) return null; return ( <> - + {label} - + {children} ); }; -const CopyableText = ({ value }: { value: string }) => ( +type CopyableTextProps = { + value: string; + dataTestId: string; +}; + +const CopyableText = ({ value, dataTestId }: CopyableTextProps) => ( { navigator.clipboard.writeText(value.toString()); e.stopPropagation(); }} - data-testid="copy-drep-id-button" + data-testid={dataTestId} sx={{ gap: 1, maxWidth: "100%",