Skip to content

Commit

Permalink
TW-884: [e2e] Home hape. Fix some testId
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tsx committed Oct 12, 2023
1 parent 2b13dfe commit b64115c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
10 changes: 7 additions & 3 deletions e2e/src/page-objects/pages/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ export class HomePage extends Page {
}

async isZeroBalanceHidden() {
const tokenList = await findElements(AssetsSelectors.assetItemCryptoBalanceButton);
const balancesElems = await findElements(AssetsSelectors.assetItemCryptoBalanceButton);

/* Begin from second index (third token in the list) because
first two tokens won't be hidden after clicking on 'hide 0 balances' */
for (let i = 2; i < tokenList.length; i++) {
const tokenBalance = await getElementText(tokenList[i]);
for (let i = 2; i < balancesElems.length; i++) {
const balanceElem = balancesElems[i];
const fullValueElem = await balanceElem.$(':scope > input');
if (!fullValueElem) throw new Error('Cannot read full token balance value');

const tokenBalance = await getElementText(fullValueElem);

if (Number(tokenBalance) === 0) {
throw new Error(`Token with zero balance is not hidden`);
Expand Down
3 changes: 1 addition & 2 deletions src/app/atoms/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
);

return (
<div className={classNameMemo}>
<div className={classNameMemo} {...setTestID(testID)}>
<input
ref={ref}
type="checkbox"
Expand All @@ -97,7 +97,6 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
onChange={handleChange}
onFocus={handleFocus}
onBlur={handleBlur}
{...setTestID(testID)}
{...rest}
/>

Expand Down
4 changes: 2 additions & 2 deletions src/app/atoms/Money.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ const FullAmountTippy: FC<FullAmountTippyProps> = ({
);

return (
<div className="contents">
<div className="contents" {...setTestID(testID)}>
{enabled ? (
<>
<span ref={ref} onClick={handleClick} {...rest} />
<input ref={fieldRef} value={fullAmountStr} readOnly className="sr-only" {...setTestID(testID)} />
<input ref={fieldRef} value={fullAmountStr} readOnly className="sr-only" />
</>
) : (
<span {...rest} />
Expand Down
3 changes: 2 additions & 1 deletion src/app/pages/Home/OtherComponents/Tokens/Tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,12 @@ const ManageButtonDropdown: FC<ManageButtonDropdownProps> = ({

<Divider className="my-2" />

<label className={buttonClassName} {...setTestID(AssetsSelectors.dropdownHideZeroBalancesCheckbox)}>
<label className={buttonClassName}>
<Checkbox
overrideClassNames="h-4 w-4 rounded"
checked={isZeroBalancesHidden}
onChange={toggleHideZeroBalances}
testID={AssetsSelectors.dropdownHideZeroBalancesCheckbox}
/>
<span className="text-sm text-gray-600 ml-2 leading-5">
<T id="hideZeroBalance" />
Expand Down

0 comments on commit b64115c

Please sign in to comment.