Skip to content

Commit

Permalink
Feat: Added test locators
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew718PLTS committed Nov 27, 2024
1 parent 64cce0a commit d0eee2c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/components/nav/BalancesSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ export function BalancesSummary() {
{tokenIds.map((id) => {
const balance = fromWeiRounded(balances[id], Tokens[id].decimals)
if (balance !== '0') {
const token = Tokens[id]
// TODO: @bayo Either revert this !== 0 check or add some animation for when balances are loading
return (
<div style={{ minWidth: '35%' }} className="flex pb-4 dark:text-white" key={id}>
<TokenIcon token={Tokens[id]} size="xs" />
<div
style={{ minWidth: '35%' }}
className="flex pb-4 dark:text-white"
key={id}
data-testid={`walletSettings_${token.id}_balance`}
>
<TokenIcon token={token} size="xs" />
<div className="ml-3">{balance}</div>
</div>
)
Expand Down
16 changes: 13 additions & 3 deletions src/components/nav/NetworkModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface Props {
}

export function NetworkModal({ isOpen, close }: Props) {
const baseLocator = 'networkModal'
const latestBlock = useAppSelector((s) => s.block.latestBlock)
const chainId = useChainId()
const currentChain = chainIdToChain[chainId]
Expand Down Expand Up @@ -46,7 +47,10 @@ export function NetworkModal({ isOpen, close }: Props) {
<div className="text-neutral-500 dark:text-gray-400 text-[14px] sm:text-[15px] font-normal leading-tight">
Connected to:
</div>
<div className="opacity-90 text-right text-gray-950 dark:text-white text-[15px] font-medium leading-tight">
<div
className="opacity-90 text-right text-gray-950 dark:text-white text-[15px] font-medium leading-tight"
data-testid={`${baseLocator}_currentNetwork`}
>
{currentChain?.name || 'Unknown'}
</div>
</div>
Expand All @@ -55,7 +59,10 @@ export function NetworkModal({ isOpen, close }: Props) {
<div className="text-neutral-500 dark:text-gray-400 text-[14px] sm:text-[15px] font-normal leading-tight">
Block Number:
</div>
<div className="opacity-90 text-right text-gray-950 dark:text-white text-[14px] sm:text-[15px] font-medium leading-tight">
<div
className="opacity-90 text-right text-gray-950 dark:text-white text-[14px] sm:text-[15px] font-medium leading-tight"
data-testid={`${baseLocator}_currentBlockNumber`}
>
{latestBlock?.number || 'Unknown'}
</div>
</div>
Expand All @@ -64,7 +71,10 @@ export function NetworkModal({ isOpen, close }: Props) {
<div className="text-neutral-500 dark:text-gray-400 text-[14px] sm:text-[15px] font-normal leading-tight">
Node Rpc Url:
</div>
<div className="opacity-90 text-right text-gray-950 dark:text-white text-[14px] sm:text-[15px] font-medium leading-tight">
<div
className="opacity-90 text-right text-gray-950 dark:text-white text-[14px] sm:text-[15px] font-medium leading-tight"
data-testid={`${baseLocator}_currentNodeRpcUrl`}
>
{shortenUrl(currentChain?.rpcUrl) || 'Unknown'}
</div>
</div>
Expand Down

0 comments on commit d0eee2c

Please sign in to comment.