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

fix: Multichain AssetList e2e tests #28524

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b22b02c
chore: Incorporate e2e fixes from PR 28450
gambinish Nov 18, 2024
8db4d72
fix: Bump vulnerable package cross-spawn to 7.0.5
gambinish Nov 18, 2024
8fe3abf
fix: Update policy
gambinish Nov 18, 2024
aaa978a
chore: Dedupe startPolling methods in metamask-controller
gambinish Nov 18, 2024
bc72f5e
fix: deduplicate
gambinish Nov 18, 2024
60e94a7
fix: Another attempt at cross-spawn upgrade
gambinish Nov 18, 2024
b62fcda
fix: Downgrade cross-spawn version
gambinish Nov 18, 2024
a478875
fix: Lint unused import in selectors.js
gambinish Nov 18, 2024
17e88ba
fix: Suffix e2e hack
gambinish Nov 18, 2024
3162038
chore: Update snapshots
gambinish Nov 18, 2024
480584f
fix: Merge after qa-3
gambinish Nov 19, 2024
b947091
fix: Capizalize suffix in currency display
gambinish Nov 19, 2024
f280ff5
fix: Update expectation of capitalized currency suffix
gambinish Nov 19, 2024
a53af55
chore: Rebase, address conflicts
gambinish Nov 19, 2024
b2e9111
fix: Lint
gambinish Nov 19, 2024
86abc08
chore: Update integration test suite to handle SepoliaETH suffix
gambinish Nov 19, 2024
9fa4b96
fix: Import tokens is now a nested click process
gambinish Nov 19, 2024
e31e63f
fix: Update testId for import token dropdown
gambinish Nov 19, 2024
c47c743
fix: Selector for refresh button is now nested within two clicks
gambinish Nov 19, 2024
7dbc7de
fix: Remove exclusive test
gambinish Nov 19, 2024
c01cd5e
fix: typo in testId
gambinish Nov 19, 2024
01e098d
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 19, 2024
2e92c0d
chore: Cleanup
gambinish Nov 19, 2024
dbf60aa
Merge branch 'mmassets-432_network-filter-extension--e2e' of github.c…
gambinish Nov 19, 2024
4eb2da7
fix: Tweak formatWithThreshold
gambinish Nov 19, 2024
c3965fe
fix: Add test data storybook ci
gambinish Nov 19, 2024
33989eb
fix: Tweak code fencing to prevent undefined variables outside of fence
gambinish Nov 19, 2024
184e83c
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 20, 2024
c1cbb1f
Update LavaMoat policies
metamaskbot Nov 20, 2024
c850e6a
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 20, 2024
53b7c90
fix: Remove exclusive only test
gambinish Nov 20, 2024
3accb6a
fixed spec file for BTC Account - Overview has balance
NidhiKJha Nov 20, 2024
c3a5f27
nit fix
NidhiKJha Nov 20, 2024
7ee3fd3
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 20, 2024
d702ea0
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 20, 2024
c048152
chore: Rebase with feature branch
gambinish Nov 20, 2024
f08cbf7
fix: Legitimate fix to custom-token-send-transfer.spec.js made upstre…
gambinish Nov 20, 2024
492960f
fix: Remove exclusive only test
gambinish Nov 20, 2024
e6ce002
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 20, 2024
8ee5563
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 20, 2024
d932291
chore: Rebase develop
gambinish Nov 21, 2024
4c3779d
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 21, 2024
e51e545
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 21, 2024
2299eed
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 21, 2024
1bda96e
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 21, 2024
7606496
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 21, 2024
266e1a0
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 21, 2024
52a51ad
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 21, 2024
246641f
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 21, 2024
f356f4b
Merge branch 'mmassets-432_network-filter-extension--integration-unit…
gambinish Nov 21, 2024
a19a7e1
fix: Revert temp change to btc flask test
gambinish Nov 21, 2024
14a38e0
Merge branch 'mmassets-432_network-filter-extension--e2e' of github.c…
gambinish Nov 21, 2024
328413e
fix: Align upstream branch with flask changes
gambinish Nov 21, 2024
08e61d6
fix: Remove suffix override
gambinish Nov 21, 2024
1a11150
fix: Update snapshots from suffix shenanigans
gambinish Nov 21, 2024
53be791
fix: Remove optional chain diff. We may need to replace this for e2e
gambinish Nov 21, 2024
57cfbe2
fix: typo in e2e selector
gambinish Nov 21, 2024
1b17bec
fix: Fix duped import
gambinish Nov 21, 2024
1a8cb68
fix: Dedupe fixture builder
gambinish Nov 21, 2024
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 @@ -342,7 +342,6 @@
},
"TxController": {
"methodData": "object",
"submitHistory": "object",
"transactions": "object",
"lastFetchedBlockNumbers": "object",
"submitHistory": "object"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"isRedesignedConfirmationsDeveloperEnabled": "boolean",
"showConfirmationAdvancedDetails": false,
"tokenSortConfig": "object",
"tokenNetworkFilter": {},
"showMultiRpcModal": "boolean",
"shouldShowAggregatedBalancePopover": "boolean",
"tokenNetworkFilter": {}
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/tests/privacy-mode/privacy-mode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Privacy Mode', function () {
async ({ driver }) => {
async function checkForHeaderValue(value) {
const balanceElement = await driver.findElement(
'[data-testid="eth-overview__primary-currency"] .currency-display-component__text',
'[data-testid="account-value-and-suffix"]',
);
const surveyText = await balanceElement.getText();
assert.equal(
Expand All @@ -30,15 +30,15 @@ describe('Privacy Mode', function () {

async function checkForTokenValue(value) {
const balanceElement = await driver.findElement(
'[data-testid="multichain-token-list-item-secondary-value"]',
'[data-testid="multichain-token-list-item-value"]',
);
const surveyText = await balanceElement.getText();
assert.equal(surveyText, value, `Token balance should be "${value}"`);
}

async function checkForPrivacy() {
await checkForHeaderValue('••••••');
await checkForTokenValue('•••••••••');
await checkForTokenValue('••••••');
}

async function checkForNoPrivacy() {
Expand All @@ -48,7 +48,7 @@ describe('Privacy Mode', function () {

async function togglePrivacy() {
const balanceElement = await driver.findElement(
'[data-testid="eth-overview__primary-currency"] .currency-display-component__text',
'[data-testid="account-value-and-suffix"]',
);
const initialText = await balanceElement.getText();

Expand Down Expand Up @@ -81,7 +81,7 @@ describe('Privacy Mode', function () {

async function togglePrivacy() {
const balanceElement = await driver.findElement(
'[data-testid="eth-overview__primary-currency"] .currency-display-component__text',
'[data-testid="account-value-and-suffix"]',
);
const initialText = await balanceElement.getText();

Expand Down
14 changes: 4 additions & 10 deletions test/e2e/tests/tokens/token-sort.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ describe('Token List', function () {

assert.ok(tokenSymbolsBeforeSorting[0].includes('Ethereum'));

await await driver.clickElement(
'[data-testid="sort-by-popover-toggle"]',
);
await await driver.clickElement('[data-testid="sortByAlphabetically"]');
await driver.clickElement('[data-testid="sort-by-popover-toggle"]');
await driver.clickElement('[data-testid="sortByAlphabetically"]');

await driver.delay(regularDelayMs);
const tokenListAfterSortingAlphabetically = await driver.findElements(
Expand All @@ -85,12 +83,8 @@ describe('Token List', function () {
tokenListSymbolsAfterSortingAlphabetically[0].includes('ABC'),
);

await await driver.clickElement(
'[data-testid="sort-by-popover-toggle"]',
);
await await driver.clickElement(
'[data-testid="sortByDecliningBalance"]',
);
await driver.clickElement('[data-testid="sort-by-popover-toggle"]');
await driver.clickElement('[data-testid="sortByDecliningBalance"]');

await driver.delay(regularDelayMs);
const tokenListBeforeSortingByDecliningBalance =
Expand Down
1 change: 1 addition & 0 deletions test/jest/mock-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const createSwapsMockStore = () => {
preferences: {
showFiatInTestnets: true,
smartTransactionsOptInStatus: true,
tokenNetworkFilter: {},
showMultiRpcModal: false,
},
transactions: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => {
}, [currentNetwork.chainId, TEST_CHAINS]);

const allOpts: Record<string, boolean> = {};
Object.keys(allNetworks).forEach((chainId) => {
Object.keys(allNetworks || {}).forEach((chainId) => {
allOpts[chainId] = true;
});

const allNetworksFilterShown =
Object.keys(tokenNetworkFilter).length !== Object.keys(allOpts).length;
Object.keys(tokenNetworkFilter || {}).length !==
Object.keys(allOpts || {}).length;

useEffect(() => {
if (isTestNetwork) {
Expand All @@ -86,7 +87,7 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => {
// We need to set the default filter for all users to be all included networks, rather than defaulting to empty object
// This effect is to unblock and derisk in the short-term
useEffect(() => {
if (Object.keys(tokenNetworkFilter).length === 0) {
if (Object.keys(tokenNetworkFilter || {}).length === 0) {
dispatch(setTokenNetworkFilter(allOpts));
}
}, []);
Expand Down Expand Up @@ -162,7 +163,7 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => {
>
{process.env.PORTFOLIO_VIEW && (
<ButtonBase
data-testid="network-filter"
data-testid="sort-by-networks"
variant={TextVariant.bodyMdMedium}
className="asset-list-control-bar__button asset-list-control-bar__network_control"
onClick={toggleNetworkFilterPopover}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,23 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => {

useEffect(() => {
const testnetChains: string[] = TEST_CHAINS;
const mainnetChainIds = Object.keys(allNetworks).filter(
const mainnetChainIds = Object.keys(allNetworks || {}).filter(
(chain) => !testnetChains.includes(chain),
);
setChainsToShow(mainnetChainIds);
}, []);

const allOpts: Record<string, boolean> = {};
Object.keys(allNetworks).forEach((chain) => {
Object.keys(allNetworks || {}).forEach((chain) => {
allOpts[chain] = true;
});

return (
<>
<SelectableListItem
isSelected={
Object.keys(tokenNetworkFilter).length ===
Object.keys(allNetworks).length
Object.keys(tokenNetworkFilter || {}).length ===
Object.keys(allNetworks || {}).length
}
onClick={() => handleFilter(allOpts)}
testId="network-filter-all"
Expand Down Expand Up @@ -161,7 +161,7 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => {
<SelectableListItem
isSelected={
tokenNetworkFilter[chainId] &&
Object.keys(tokenNetworkFilter).length === 1
Object.keys(tokenNetworkFilter || {}).length === 1
}
onClick={() => handleFilter({ [chainId]: true })}
testId="network-filter-current"
Expand Down
Loading