Skip to content
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

TW-844 [e2e] home page #998

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
"start:custom_node": "yarn start --tags @custom_node",
"start:unlock_screen": "yarn start --tags @unlock_screen",
"start:manage_assets": "yarn start --tags @manage_assets",
"start:home": "yarn start --tags @home",
"start:create_new_wallet": "yarn start --tags @create_new_wallet",
"start:delegate": "yarn start --tags @create_new_wallet",
"start:import_account_mnemonic": "yarn start --tags @import_account_mnemonic",
"start:import_account_private_key": "yarn start --tags @import_account_private_key",
"start:import_account_public_key": "yarn start --tags @import_account_public_key",
"start:import_wallet": "yarn start --tags @import_wallet",
"start:reveal_private_key": "yarn start --tags @reveal_private_key",
"start:reveal_mnemonic": "yarn start --tags @reveal_mnemonic",
"start:send": "yarn start --tags @send",
"start:swap": "yarn start --tags @swap",
"test": "yarn start --exit --tags 'not @dev'",
"ts": "tsc --pretty"
},
Expand Down
3 changes: 2 additions & 1 deletion e2e/src/features/create-new-wallet.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Create a new wallet

@create_new_wallet
Scenario: As a user, i'd like to create a new wallet
Given I am on the Welcome page
And I press Create New Wallet button on the Welcome page
Expand Down Expand Up @@ -31,7 +32,7 @@ Feature: Create a new wallet
Then I am on the Home page



@create_new_wallet
Scenario: As a user, I'd like to create a wallet and pass on-boarding
Given I am on the Welcome page
And I press Create New Wallet button on the Welcome page
Expand Down
1 change: 0 additions & 1 deletion e2e/src/features/custom-network.feature
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Feature: Add Custom Node


@custom_node
@dev
Scenario: Validation check on Add Asset page + other checks [Negative]
Given I have imported an existing account

Expand Down
1 change: 1 addition & 0 deletions e2e/src/features/delegate.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Delegate

@delegate
Scenario: As a user, i'd like to re-delegate TEZ to a baker
Given I have imported an existing account
And I press Selected Network Button on the Header page
Expand Down
28 changes: 28 additions & 0 deletions e2e/src/features/home.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Feature: Check functional on the Home page

@home
Scenario: As a user, i'd like to check functional on the main 'Home' page
Given I have imported an existing account

And The Fiat-Tez Switch Button on the Home page has correct $ value
And The Fiat-Tez Switch Text on the Home page has correct Total Equity Value value

And I press Fiat-Tez Switch Button on the Home page
And The Fiat-Tez Switch Text on the Home page has correct Tezos Balance value

And I enter shortRandomContent into Search Assets Input (Tokens) on the Assets page
# empty state error
And The Empty State Text on the Home page has correct No assets found value
And I clear Search Assets Input (Tokens) value on the Assets page

# hide 0 balances
And I press Manage Dropdown Button on the Assets page
And I press Hide Zero Balances Checkbox on the Assets (Manage Dropdown) page
# to hide manage drop-down list
And I press Manage Dropdown Button on the Assets page
And I scroll 900 pixels on the Home page

Then I check that tokens with zero balances are hidden



1 change: 1 addition & 0 deletions e2e/src/features/import-account-by-mnemonic.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Import Account by Mnemonic

@import_account_mnemonic
Scenario: As a user, I'd like to import account by mnemonic
Given I have imported an existing account

Expand Down
1 change: 1 addition & 0 deletions e2e/src/features/import-account-by-private-key.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Import Account by Private Key

@import_account_private_key
Scenario: As a user, I'd like to import account by private key
Given I have imported an existing account

Expand Down
1 change: 1 addition & 0 deletions e2e/src/features/import-account-by-public-key.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Import an account by public key (Watch-only)

@import_account_public_key
Scenario: As a user, I'd like to import an account by public key
Given I have imported an existing account

Expand Down
2 changes: 1 addition & 1 deletion e2e/src/features/import-existing-wallet.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Import existing wallet

@import_wallet
Scenario: As a user, I'd like to import account with existing seed phrase
Given I am on the Welcome page
And I press Import Existing Wallet button on the Welcome page
Expand Down Expand Up @@ -60,7 +61,6 @@ Feature: Import existing wallet
Then I am on the Home page


@dev
Scenario: As a user, I'd like to switch between onboarding pages and skip it [Negative]
Given I am on the Welcome page
And I press Import Existing Wallet button on the Welcome page
Expand Down
1 change: 0 additions & 1 deletion e2e/src/features/manage-tokens-collectibles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Feature: Manage tokens + collectibles


@manage_assets
@dev
Scenario: As a user, I'd like to hide and delete tokens [Positive]
Given I have imported an existing account
# hardcoded token
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/features/reveal-seed-phrase.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Feature: Reveal seed phrase

@reveal_mnemonic
Scenario: As a user, I'd like to reveal my seed phrase
Given I have imported an existing account

Expand Down
1 change: 1 addition & 0 deletions e2e/src/features/send.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Send

@send
Scenario: As a user, I'd like to send my funds to another account
Given I have imported an existing account
And I press Selected Network Button on the Header page
Expand Down
1 change: 1 addition & 0 deletions e2e/src/features/swap.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Feature: Swap

@swap
Scenario: As a user, i'd like to swap assets
Given I have imported an existing account
And I press Selected Network Button on the Header page
Expand Down
16 changes: 15 additions & 1 deletion e2e/src/page-objects/pages/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AssetsSelectors } from 'src/app/pages/Home/OtherComponents/Assets.selec
import { RETRY_OPTIONS, VERY_SHORT_TIMEOUT } from 'e2e/src/utils/timing.utils';

import { Page } from '../../classes/page.class';
import { createPageElement, findElement } from '../../utils/search.utils';
import { createPageElement, findElement, findElements, getElementText } from '../../utils/search.utils';

export class HomePage extends Page {
ReceiveButton = createPageElement(HomeSelectors.receiveButton);
Expand Down Expand Up @@ -53,4 +53,18 @@ export class HomePage extends Page {
RETRY_OPTIONS
);
}

async isZeroBalanceHidden() {
const tokenList = await findElements(AssetsSelectors.assetItemCryptoBalanceButton);
alex-tsx marked this conversation as resolved.
Show resolved Hide resolved

/* 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]);

if (Number(tokenBalance) === 0) {
throw new Error(`Token with zero balance is not hidden`);
}
}
}
}
8 changes: 8 additions & 0 deletions e2e/src/step-definitions/home.steps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Given } from '@cucumber/cucumber';

import { Pages } from 'e2e/src/page-objects';
import { MEDIUM_TIMEOUT } from 'e2e/src/utils/timing.utils';

Given(/I check that tokens with zero balances are hidden/, { timeout: MEDIUM_TIMEOUT }, async () => {
await Pages.Home.isZeroBalanceHidden();
});
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" {...setTestID(testID)}>
<div className="contents">
{enabled ? (
<>
<span ref={ref} onClick={handleClick} {...rest} />
<input ref={fieldRef} value={fullAmountStr} readOnly className="sr-only" />
<input ref={fieldRef} value={fullAmountStr} readOnly className="sr-only" {...setTestID(testID)} />
</>
) : (
<span {...rest} />
Expand Down
4 changes: 3 additions & 1 deletion src/app/pages/Home/Home.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export enum HomeSelectors {
collectiblesTab = 'Home/Collectibles Tab',
publicAddressButton = 'Home/Public Address Button',
fiatTezSwitchButton = 'Home/Fiat-Tez Switch Button',
fiatTezSwitchText = 'Home/Fiat-Tez Switch Text',
notificationIconButton = 'Home/Notification Icon Button',
delegateButton = 'Home/Delegate Button',
addressModeSwitchButton = 'Home/Address Mode Switch Button',
accountNameText = 'Home/Account Name Text'
accountNameText = 'Home/Account Name Text',
emptyStateText = 'Home/Empty State Text'
}
2 changes: 1 addition & 1 deletion src/app/pages/Home/OtherComponents/MainBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const BalanceInfo: FC = () => {
</Button>
)}

<div className="text-sm font-medium text-gray-700">
<div className="text-sm font-medium text-gray-700" {...setTestID(HomeSelectors.fiatTezSwitchText)}>
{shouldShowFiatBanner ? (
<T id="totalEquityValue" />
) : (
Expand Down
7 changes: 4 additions & 3 deletions src/app/pages/Home/OtherComponents/Tokens/Tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useShouldShowPartnersPromoSelector } from 'app/store/partners-promotion
import { useIsEnabledAdsBannerSelector } from 'app/store/settings/selectors';
import { ButtonForManageDropdown } from 'app/templates/ManageDropdown';
import SearchAssetField from 'app/templates/SearchAssetField';
import { setTestID } from 'lib/analytics';
import { OptimalPromoVariantEnum } from 'lib/apis/optimal';
import { TEMPLE_TOKEN_SLUG, TEZ_TOKEN_SLUG } from 'lib/assets';
import { useFilteredAssetsSlugs } from 'lib/assets/use-filtered';
Expand All @@ -28,6 +29,7 @@ import { useLocalStorage } from 'lib/ui/local-storage';
import Popper, { PopperRenderProps } from 'lib/ui/Popper';
import { Link, navigate } from 'lib/woozie';

import { HomeSelectors } from '../../Home.selectors';
import { AssetsSelectors } from '../Assets.selectors';
import { AcceptAdsBanner } from './AcceptAdsBanner';
import { ListItem } from './components/ListItem';
Expand Down Expand Up @@ -181,7 +183,7 @@ export const TokensTab: FC = () => {
<p className="mb-2 flex items-center justify-center text-gray-600 text-base font-light">
{searchValueExist && <SearchIcon className="w-5 h-auto mr-1 stroke-current" />}

<span>
<span {...setTestID(HomeSelectors.emptyStateText)}>
<T id="noAssetsFound" />
</span>
</p>
Expand Down Expand Up @@ -240,12 +242,11 @@ const ManageButtonDropdown: FC<ManageButtonDropdownProps> = ({

<Divider className="my-2" />

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