Skip to content

test(extension): add test ids for governance actions #765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,31 @@ export const ConfirmDRepRegistration = ({ dappInfo, errorMessage, translations,
)}
<Grid columns="$1" gutters="$20">
<Cell>
<TransactionSummary.Metadata label={translations.metadata} text="" />
<TransactionSummary.Metadata label={translations.metadata} text="" testID="metadata" />
</Cell>
{metadata.url && (
<Cell>
<TransactionSummary.Address label={translations.labels.url} address={metadata.url} />
<TransactionSummary.Address label={translations.labels.url} address={metadata.url} testID="metadata-url" />
</Cell>
)}
{metadata.hash && (
<Cell>
<TransactionSummary.Address label={translations.labels.hash} address={metadata.hash} />
<TransactionSummary.Address label={translations.labels.hash} address={metadata.hash} testID="metadata-hash" />
</Cell>
)}
<Cell>
<TransactionSummary.Address label={translations.labels.drepId} address={metadata.drepId} />
<TransactionSummary.Address
label={translations.labels.drepId}
address={metadata.drepId}
testID="metadata-DRepID"
/>
</Cell>
<Cell>
<TransactionSummary.Address label={translations.labels.depositPaid} address={metadata.depositPaid} />
<TransactionSummary.Address
label={translations.labels.depositPaid}
address={metadata.depositPaid}
testID="metadata-depositPaid"
/>
</Cell>
</Grid>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,21 @@ export const ConfirmDRepRetirement = ({ dappInfo, errorMessage, translations, me
)}
<Grid columns="$1" gutters="$20">
<Cell>
<TransactionSummary.Metadata label={translations.metadata} text="" />
<TransactionSummary.Metadata label={translations.metadata} text="" testID="metadata" />
</Cell>
<Cell>
<TransactionSummary.Address label={translations.labels.drepId} address={metadata.drepId} />
<TransactionSummary.Address
label={translations.labels.drepId}
address={metadata.drepId}
testID="metadata-DRepID"
/>
</Cell>
<Cell>
<TransactionSummary.Address label={translations.labels.depositReturned} address={metadata.depositReturned} />
<TransactionSummary.Address
label={translations.labels.depositReturned}
address={metadata.depositReturned}
testID="metadata-depositReturned"
/>
</Cell>
</Grid>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,24 @@ export const ConfirmDRepUpdate = ({ dappInfo, errorMessage, translations, metada
)}
<Grid columns="$1" gutters="$20">
<Cell>
<TransactionSummary.Metadata label={translations.metadata} text="" />
<TransactionSummary.Metadata label={translations.metadata} text="" testID="metadata" />
</Cell>
{metadata.url && (
<Cell>
<TransactionSummary.Address label={translations.labels.url} address={metadata.url} />
<TransactionSummary.Address label={translations.labels.url} address={metadata.url} testID="metadata-url" />
</Cell>
)}
{metadata.hash && (
<Cell>
<TransactionSummary.Address label={translations.labels.hash} address={metadata.hash} />
<TransactionSummary.Address label={translations.labels.hash} address={metadata.hash} testID="metadata-hash" />
</Cell>
)}
<Cell>
<TransactionSummary.Address label={translations.labels.drepId} address={metadata.drepId} />
<TransactionSummary.Address
label={translations.labels.drepId}
address={metadata.drepId}
testID="metadata-DRepID"
/>
</Cell>
</Grid>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,33 @@ export const ConfirmVoteDelegation = ({ dappInfo, errorMessage, translations, me
)}
<Grid columns="$1" gutters="$20">
<Cell>
<TransactionSummary.Metadata label={translations.metadata} text="" />
<TransactionSummary.Metadata label={translations.metadata} text="" testID="metadata" />
</Cell>
{metadata.drepId && (
<Cell>
<TransactionSummary.Address label={translations.labels.drepId} address={metadata.drepId} />
<TransactionSummary.Address
label={translations.labels.drepId}
address={metadata.drepId}
testID="metadata-DRepID"
/>
</Cell>
)}
{metadata.alwaysAbstain && (
<Cell>
<TransactionSummary.Address label={translations.labels.alwaysAbstain} address={translations.option} />
<TransactionSummary.Address
label={translations.labels.alwaysAbstain}
address={translations.option}
testID="metadata-alwaysAbstain"
/>
</Cell>
)}
{metadata.alwaysNoConfidence && (
<Cell>
<TransactionSummary.Address label={translations.labels.alwaysNoConfidence} address={translations.option} />
<TransactionSummary.Address
label={translations.labels.alwaysNoConfidence}
address={translations.option}
testID="metadata-alwaysNoCOnfidence"
/>
</Cell>
)}
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,33 @@ import type { OmitClassName } from '../../types';
type Props = OmitClassName<'div'> & {
label: string;
address: string;
testID?: string;
};

export const Address = ({
label,
address,
testID,
...props
}: Readonly<Props>): JSX.Element => {
return (
<Grid {...props} columns="$2">
<Cell>
<Typography.Body.Normal className={cx.label}>
<Typography.Body.Normal
className={cx.label}
{...(testID != undefined && { 'data-testid': `${testID}-label` })}
>
{label}
</Typography.Body.Normal>
</Cell>
<Cell>
<Flex justifyContent="flex-end" h="$fill">
<Typography.Address className={cx.text}>{address}</Typography.Address>
<Typography.Address
className={cx.text}
{...(testID != undefined && { 'data-testid': `${testID}-value` })}
>
{address}
</Typography.Address>
</Flex>
</Cell>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,32 @@ import type { OmitClassName } from '../../types';
type Props = OmitClassName<'div'> & {
label: string;
text: string;
testID?: string;
};

export const Metadata = ({
label,
text,
testID,
...props
}: Readonly<Props>): JSX.Element => {
return (
<Grid {...props} columns="$2">
<Cell>
<Typography.Body.Large className={cx.label} weight="$bold">
<Typography.Body.Large
className={cx.label}
weight="$bold"
{...(testID != undefined && { 'data-testid': `${testID}-label` })}
>
{label}
</Typography.Body.Large>
</Cell>
<Cell>
<Flex justifyContent="flex-end" h="$fill">
<Typography.Body.Normal className={cx.text}>
<Typography.Body.Normal
className={cx.text}
{...(testID != undefined && { 'data-testid': `${testID}-value` })}
>
{text}
</Typography.Body.Normal>
</Flex>
Expand Down