Skip to content

Commit

Permalink
chore: add data-testids to account mgmt UI (#113)
Browse files Browse the repository at this point in the history
Co-authored-by: Michał Leszczyk <[email protected]>
  • Loading branch information
ryanewood and meeh0w authored Dec 19, 2024
1 parent 85cbf29 commit e2cef67
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/pages/Accounts/AccountDetailsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export const AccountDetailsView = () => {
}}
>
<IconButton
data-testid="account-details-back-btn"
onClick={() => history.replace('/accounts')}
sx={{
padding: 0.25,
Expand All @@ -134,6 +135,7 @@ export const AccountDetailsView = () => {
<OverflowingTypography
variant="h4"
sx={{ mr: 2, fontSize: 24, flexGrow: 1 }}
data-testid="account-details-name"
>
{account.name}
</OverflowingTypography>
Expand Down
13 changes: 11 additions & 2 deletions src/pages/Accounts/Accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export function Accounts() {
},
}}
disableRipple
data-testid="accounts-back-btn"
>
<ChevronLeftIcon size={32} />
</IconButton>
Expand All @@ -151,7 +152,11 @@ export function Accounts() {
gap: 2,
}}
>
<OverflowingTypography variant="caption" color="text.secondary">
<OverflowingTypography
variant="caption"
color="text.secondary"
data-testid="account-management-active-wallet"
>
{t('Currently using {{walletName}}', {
walletName: isPrimaryAccount(active)
? walletDetails?.name
Expand Down Expand Up @@ -183,7 +188,11 @@ export function Accounts() {
gap: 2,
}}
>
<OverflowingTypography variant="h5" fontSize={18}>
<OverflowingTypography
variant="h5"
fontSize={18}
data-testid="account-management-active-account"
>
{active?.name}
</OverflowingTypography>
<Typography variant="h5" fontSize={18}>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Accounts/components/AccountItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const AccountItem = forwardRef(
type: account.type,
});
},
[address, account.type, capture, network?.vmName, toast]
[address, account.type, capture, network?.vmName, toast],
);

return (
Expand Down Expand Up @@ -348,8 +348,8 @@ const getCopyEventNameByNetworkType = (type: NetworkVMType) => {
type === NetworkVMType.BITCOIN
? 'Btc'
: type === NetworkVMType.EVM
? 'Eth'
: type;
? 'Eth'
: type;

return `AccountSelector${normalizedType}AddressCopied`;
};
1 change: 1 addition & 0 deletions src/pages/Accounts/components/AccountName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default function AccountName({
e.stopPropagation();
promptRename();
}}
data-testid="rename-account-btn"
>
<PencilRoundIcon size={16} />
</IconButton>
Expand Down
1 change: 1 addition & 0 deletions src/pages/Accounts/components/RenameDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const RenameDialog = ({
),
}}
{...keyboardShortcuts}
data-testid="rename-account-input"
/>
</DialogContent>
<Stack
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Accounts/components/WalletHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export default function WalletHeader({
fontSize={14}
fontWeight={600}
lineHeight="16px"
data-testid="wallet-name"
>
{walletDetails?.name ?? name}
</OverflowingTypography>
Expand All @@ -97,6 +98,7 @@ export default function WalletHeader({
sx={{ fontSize: 10, height: 16 }}
color="success"
label={t('Active')}
data-testid="wallet-active-chip"
/>
</Grow>
{/* Section for the imported accounts has no WalletDetails, therefore cannot be renamed */}
Expand Down

0 comments on commit e2cef67

Please sign in to comment.