From 16cd21a73bf302a2cc3cbdf066500bc686c98178 Mon Sep 17 00:00:00 2001 From: francovenica Date: Thu, 1 Feb 2024 17:30:35 +0000 Subject: [PATCH] Tests: E2e Assets - Adding the token test file (#3077) * remove balances file, add tokens file * remove 'only' from test * Send button disabled verification * solving clonflict with test safes * fix balances test * Change safe in token test * adding verifyOwner method * renaming method --- .../{balances.pages.js => assets.pages.js} | 15 +- cypress/e2e/pages/main.page.js | 5 + cypress/e2e/regression/assets.cy.js | 185 ------------------ cypress/e2e/regression/balances.cy.js | 125 ------------ .../e2e/regression/balances_pagination.cy.js | 18 +- cypress/e2e/regression/tokens.cy.js | 185 ++++++++++++++++++ cypress/e2e/smoke/assets.cy.js | 36 ++-- cypress/support/constants.js | 2 + 8 files changed, 228 insertions(+), 343 deletions(-) rename cypress/e2e/pages/{balances.pages.js => assets.pages.js} (97%) delete mode 100644 cypress/e2e/regression/assets.cy.js delete mode 100644 cypress/e2e/regression/balances.cy.js create mode 100644 cypress/e2e/regression/tokens.cy.js diff --git a/cypress/e2e/pages/balances.pages.js b/cypress/e2e/pages/assets.pages.js similarity index 97% rename from cypress/e2e/pages/balances.pages.js rename to cypress/e2e/pages/assets.pages.js index ebd08d0de9..2509eefb30 100644 --- a/cypress/e2e/pages/balances.pages.js +++ b/cypress/e2e/pages/assets.pages.js @@ -1,6 +1,5 @@ -import * as main from '../pages/main.page' +import * as main from './main.page' -let etherscanLink = 'a[aria-label="View on sepolia.etherscan.io"]' let etherscanLinkSepolia = 'a[aria-label="View on sepolia.etherscan.io"]' export const balanceSingleRow = '[aria-labelledby="tableTitle"] > tbody tr' const currencyDropdown = '[id="currency"]' @@ -109,6 +108,10 @@ export function showSendBtn(index) { }) } +export function VerifySendButtonIsDisabled() { + cy.get('button').contains(sendBtnStr).should('be.disabled') +} + export function verifyTableRows(assetsLength) { cy.get(balanceSingleRow).should('have.length', assetsLength) } @@ -207,14 +210,14 @@ export function verityTokenAltImageIsVisible(currency, alttext) { }) } -export function verifyAssetNameHasExplorerLink(currency, columnName, sepolia = false) { - if (sepolia) etherscanLink = etherscanLinkSepolia +export function verifyAssetNameHasExplorerLink(currency, columnName) { + etherscanLinkSepolia cy.get(tokenListTable) .contains(currency) .parents('tr') .find('td') .eq(columnName) - .find(etherscanLink) + .find(etherscanLinkSepolia) .should('be.visible') } @@ -225,7 +228,7 @@ export function verifyAssetExplorerLinkNotAvailable(currency, columnName) { .find('td') .eq(columnName) .within(() => { - cy.get(etherscanLink).should('not.exist') + cy.get(etherscanLinkSepolia).should('not.exist') }) } diff --git a/cypress/e2e/pages/main.page.js b/cypress/e2e/pages/main.page.js index 75d5bb5cba..f77d74b050 100644 --- a/cypress/e2e/pages/main.page.js +++ b/cypress/e2e/pages/main.page.js @@ -2,6 +2,7 @@ import * as constants from '../../support/constants' const acceptSelection = 'Save settings' const executeStr = 'Execute' +const connectedOwnerBlock = '[data-testid="open-account-center"]' export const modalDialogCloseBtn = '[data-testid="modal-dialog-close-btn"]' export function clickOnExecuteBtn() { @@ -41,6 +42,10 @@ export function acceptCookies(index = 0) { }) } +export function verifyOwnerConnected(prefix = 'sep:') { + cy.get(connectedOwnerBlock).should('contain', prefix) +} + export function verifyHomeSafeUrl(safe) { cy.location('href', { timeout: 10000 }).should('include', constants.homeUrl + safe) } diff --git a/cypress/e2e/regression/assets.cy.js b/cypress/e2e/regression/assets.cy.js deleted file mode 100644 index d50cb2be18..0000000000 --- a/cypress/e2e/regression/assets.cy.js +++ /dev/null @@ -1,185 +0,0 @@ -import * as constants from '../../support/constants' -import * as main from '../../e2e/pages/main.page' -import * as balances from '../pages/balances.pages' -import * as owner from '../pages/owners.pages' - -const ASSET_NAME_COLUMN = 0 -const TOKEN_AMOUNT_COLUMN = 1 -const FIAT_AMOUNT_COLUMN = 2 - -describe('Assets tests', () => { - const fiatRegex = balances.fiatRegex - - beforeEach(() => { - cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) - cy.clearLocalStorage() - main.acceptCookies() - }) - - it('Verify that non-native tokens are present and have balance', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.verifyBalance(balances.currencyDaiCap, TOKEN_AMOUNT_COLUMN, balances.currencyDaiAlttext) - balances.verifyTokenBalanceFormat( - balances.currencyDaiCap, - balances.currencyDaiFormat_2, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyBalance(balances.currencyAave, TOKEN_AMOUNT_COLUMN, balances.currencyAaveAlttext) - balances.verifyTokenBalanceFormat( - balances.currencyAave, - balances.currentcyAaveFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyBalance(balances.currencyLink, TOKEN_AMOUNT_COLUMN, balances.currencyLinkAlttext) - balances.verifyTokenBalanceFormat( - balances.currencyLink, - balances.currentcyLinkFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyBalance(balances.currencyTestTokenA, TOKEN_AMOUNT_COLUMN, balances.currencyTestTokenAAlttext) - balances.verifyTokenBalanceFormat( - balances.currencyTestTokenA, - balances.currentcyTestTokenAFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyBalance(balances.currencyTestTokenB, TOKEN_AMOUNT_COLUMN, balances.currencyTestTokenBAlttext) - balances.verifyTokenBalanceFormat( - balances.currencyTestTokenB, - balances.currentcyTestTokenBFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyBalance(balances.currencyUSDC, TOKEN_AMOUNT_COLUMN, balances.currencyTestUSDCAlttext) - balances.verifyTokenBalanceFormat( - balances.currencyUSDC, - balances.currentcyTestUSDCFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - }) - - it('Verify that every token except the native token has a "go to blockexplorer link"', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - // Specifying true for Sepolia. Will delete the flag once completely migrate to Sepolia - balances.verifyAssetNameHasExplorerLink(balances.currencyUSDC, ASSET_NAME_COLUMN, true) - balances.verifyAssetNameHasExplorerLink(balances.currencyTestTokenB, ASSET_NAME_COLUMN, true) - balances.verifyAssetNameHasExplorerLink(balances.currencyTestTokenA, ASSET_NAME_COLUMN, true) - balances.verifyAssetNameHasExplorerLink(balances.currencyLink, ASSET_NAME_COLUMN, true) - balances.verifyAssetNameHasExplorerLink(balances.currencyAave, ASSET_NAME_COLUMN, true) - balances.verifyAssetNameHasExplorerLink(balances.currencyDaiCap, ASSET_NAME_COLUMN, true) - balances.verifyAssetExplorerLinkNotAvailable(constants.tokenNames.sepoliaEther, ASSET_NAME_COLUMN) - }) - - it('Verify the default Fiat currency and the effects after changing it', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.verifyFirstRowDoesNotContainCurrency(balances.currencyEUR, FIAT_AMOUNT_COLUMN) - balances.verifyFirstRowContainsCurrency(balances.currencyUSD, FIAT_AMOUNT_COLUMN) - balances.clickOnCurrencyDropdown() - balances.selectCurrency(balances.currencyEUR) - balances.verifyFirstRowDoesNotContainCurrency(balances.currencyUSD, FIAT_AMOUNT_COLUMN) - balances.verifyFirstRowContainsCurrency(balances.currencyEUR, FIAT_AMOUNT_COLUMN) - }) - - it('Verify that a tool tip is shown pointing to "Token list" dropdown', () => { - //Spam warning message is removed in beforeEach hook - cy.reload() - }) - - it('Verify that checking the checkboxes increases the token selected counter', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.openHideTokenMenu() - balances.clickOnTokenCheckbox(balances.currencyLink) - balances.checkTokenCounter(1) - }) - - it('Verify that selecting tokens and saving hides them from the table', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.openHideTokenMenu() - balances.clickOnTokenCheckbox(balances.currencyLink) - balances.saveHiddenTokenSelection() - main.verifyValuesDoNotExist(balances.tokenListTable, [balances.currencyLink]) - }) - - it('Verify that Cancel closes the menu and does not change the table status', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.openHideTokenMenu() - balances.clickOnTokenCheckbox(balances.currencyLink) - balances.clickOnTokenCheckbox(balances.currencyAave) - balances.saveHiddenTokenSelection() - main.verifyValuesDoNotExist(balances.tokenListTable, [balances.currencyLink, balances.currencyAave]) - balances.openHideTokenMenu() - balances.clickOnTokenCheckbox(balances.currencyLink) - balances.clickOnTokenCheckbox(balances.currencyAave) - balances.cancelSaveHiddenTokenSelection() - main.verifyValuesDoNotExist(balances.tokenListTable, [balances.currencyLink, balances.currencyAave]) - }) - - it('Verify that Deselect All unchecks all tokens from the list', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.openHideTokenMenu() - balances.clickOnTokenCheckbox(balances.currencyLink) - balances.clickOnTokenCheckbox(balances.currencyAave) - balances.deselecAlltHiddenTokenSelection() - balances.verifyEachRowHasCheckbox(constants.checkboxStates.unchecked) - }) - - it('Verify the Hidden tokens counter works for spam tokens', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.openHideTokenMenu() - balances.clickOnTokenCheckbox(balances.currencyLink) - balances.saveHiddenTokenSelection() - balances.checkHiddenTokenBtnCounter(1) - }) - - it('Verify the Hidden tokens counter works for native tokens', () => { - balances.openHideTokenMenu() - balances.clickOnTokenCheckbox(constants.tokenNames.sepoliaEther) - balances.saveHiddenTokenSelection() - balances.checkHiddenTokenBtnCounter(1) - }) - - it('Verify you can hide tokens from the eye icon in the table rows', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.hideAsset(balances.currencyLink) - }) - - it('Verify the sorting of "Assets" and "Balance" in the table', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.verifyTableRows(7) - balances.clickOnTokenNameSortBtn() - balances.verifyTokenNamesOrder() - balances.clickOnTokenNameSortBtn() - balances.verifyTokenNamesOrder('descending') - balances.clickOnTokenBalanceSortBtn() - balances.verifyTokenBalanceOrder() - balances.clickOnTokenBalanceSortBtn() - balances.verifyTokenBalanceOrder('descending') - }) - - // TODO: New title: "Verify that when owner is disconnected, Send button is disabled". - // Modify test accordingly. Include in smoke. - it('Verify that the Send button shows when hovering a row', () => { - owner.clickOnWalletExpandMoreIcon() - owner.clickOnDisconnectBtn() - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.showSendBtn(0) - owner.verifyTooltiptext(owner.disconnectedUserErrorMsg) - // Removed the part that checks for a non owner error message in the tooltip - // because the safe has no assets, and we don't have a safe with assets where e2e wallet is not an owner - }) -}) diff --git a/cypress/e2e/regression/balances.cy.js b/cypress/e2e/regression/balances.cy.js deleted file mode 100644 index 9638173827..0000000000 --- a/cypress/e2e/regression/balances.cy.js +++ /dev/null @@ -1,125 +0,0 @@ -import * as constants from '../../support/constants' -import * as balances from '../pages/balances.pages' -import * as main from '../../e2e/pages/main.page' - -const ASSETS_LENGTH = 7 -const ASSET_NAME_COLUMN = 0 -const TOKEN_AMOUNT_COLUMN = 1 -const FIAT_AMOUNT_COLUMN = 2 - -describe('Balance tests', () => { - // Fiat balance regex - const fiatRegex = balances.fiatRegex - - beforeEach(() => { - cy.clearLocalStorage() - cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) - main.acceptCookies() - cy.contains('Assets') - balances.selectTokenList(balances.tokenListOptions.default) - cy.get(balances.balanceSingleRow).should('have.length.lessThan', ASSETS_LENGTH) - balances.selectTokenList(balances.tokenListOptions.allTokens) - cy.get(balances.balanceSingleRow).should('have.length', ASSETS_LENGTH) - }) - - it('Verify that token is present: Dai', () => { - balances.verityTokenAltImageIsVisible(balances.currencyDaiCap, balances.currencyDaiAlttext) - balances.verifyAssetNameHasExplorerLink(balances.currencyDaiCap, ASSET_NAME_COLUMN) - balances.verifyBalance(balances.currencyDaiCap, TOKEN_AMOUNT_COLUMN, balances.currencyDaiAlttext) - }) - - it('Verify that token is present: AAVE', () => { - balances.verityTokenAltImageIsVisible(balances.currencyAave, balances.currencyAaveAlttext) - balances.verifyAssetNameHasExplorerLink(balances.currencyAave, ASSET_NAME_COLUMN) - balances.verifyBalance(balances.currencyAave, TOKEN_AMOUNT_COLUMN, balances.currencyAaveAlttext) - }) - - it('Verify that token is present: LINK', () => { - balances.verityTokenAltImageIsVisible(balances.currencyLink, balances.currencyLinkAlttext) - balances.verifyAssetNameHasExplorerLink(balances.currencyLink, ASSET_NAME_COLUMN) - balances.verifyBalance(balances.currencyLink, TOKEN_AMOUNT_COLUMN, balances.currencyLinkAlttext) - }) - - it('Verify Token and Fiat balances formatted as per specification', () => { - balances.verifyTokenBalanceFormat( - balances.currencyDaiCap, - balances.currentcyDaiFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyTokenBalanceFormat( - balances.currencyAave, - balances.currentcyAaveFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyTokenBalanceFormat( - balances.currencyLink, - balances.currentcyLinkFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyTokenBalanceFormat( - balances.currencyTestTokenA, - balances.currentcyTestTokenAFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyTokenBalanceFormat( - balances.currencyTestTokenB, - balances.currentcyTestTokenBFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyTokenBalanceFormat( - balances.currencyUSDC, - balances.currentcyTestUSDCFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - - balances.verifyTokenBalanceFormat( - constants.tokenNames.sepoliaEther, - balances.currentcySepoliaFormat, - TOKEN_AMOUNT_COLUMN, - FIAT_AMOUNT_COLUMN, - fiatRegex, - ) - }) - - it('Verify USD is default currency', () => { - balances.verifyFirstRowDoesNotContainCurrency(balances.currencyEUR, FIAT_AMOUNT_COLUMN) - balances.verifyFirstRowContainsCurrency(balances.currencyUSD, FIAT_AMOUNT_COLUMN) - }) - - it('Verify currency can be changed to EUR', () => { - balances.clickOnCurrencyDropdown() - balances.selectCurrency(balances.currencyEUR) - balances.verifyFirstRowDoesNotContainCurrency(balances.currencyUSD, FIAT_AMOUNT_COLUMN) - balances.verifyFirstRowContainsCurrency(balances.currencyEUR, FIAT_AMOUNT_COLUMN) - }) - - it('Verify a token can be hidden', () => { - balances.hideAsset(balances.currencyDaiCap) - }) - - it('Verify a token can be unhidden', () => { - balances.hideAsset(balances.currencyDaiCap) - balances.openHideTokenMenu() - balances.clickOnTokenCheckbox(balances.currencyDaiCap) - balances.saveHiddenTokenSelection() - balances.verifyTokenIsVisible(balances.currencyDaiCap) - balances.verifyMenuButtonLabelIsDefault() - }) -}) diff --git a/cypress/e2e/regression/balances_pagination.cy.js b/cypress/e2e/regression/balances_pagination.cy.js index 767780c633..a0569de6cc 100644 --- a/cypress/e2e/regression/balances_pagination.cy.js +++ b/cypress/e2e/regression/balances_pagination.cy.js @@ -1,5 +1,5 @@ import * as constants from '../../support/constants' -import * as balances from '../pages/balances.pages' +import * as assets from '../pages/assets.pages' import * as main from '../../e2e/pages/main.page' const ASSETS_LENGTH = 8 @@ -11,16 +11,16 @@ describe('Balance pagination tests', () => { cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_6) main.acceptCookies() - balances.selectTokenList(balances.tokenListOptions.allTokens) + assets.selectTokenList(assets.tokenListOptions.allTokens) }) it('Verify a user can change rows per page and navigate to next and previous page', () => { - balances.verifyInitialTableState() - balances.changeTo10RowsPerPage() - balances.verifyTableHas10Rows() - balances.navigateToNextPage() - balances.verifyTableHasNRows(ASSETS_LENGTH) - balances.navigateToPreviousPage() - balances.verifyTableHas10RowsAgain() + assets.verifyInitialTableState() + assets.changeTo10RowsPerPage() + assets.verifyTableHas10Rows() + assets.navigateToNextPage() + assets.verifyTableHasNRows(ASSETS_LENGTH) + assets.navigateToPreviousPage() + assets.verifyTableHas10RowsAgain() }) }) diff --git a/cypress/e2e/regression/tokens.cy.js b/cypress/e2e/regression/tokens.cy.js new file mode 100644 index 0000000000..927c8e149c --- /dev/null +++ b/cypress/e2e/regression/tokens.cy.js @@ -0,0 +1,185 @@ +import * as constants from '../../support/constants' +import * as main from '../pages/main.page' +import * as assets from '../pages/assets.pages' +import * as owner from '../pages/owners.pages' + +const ASSET_NAME_COLUMN = 0 +const TOKEN_AMOUNT_COLUMN = 1 +const FIAT_AMOUNT_COLUMN = 2 + +describe('Tokens tests', () => { + const fiatRegex = assets.fiatRegex + + beforeEach(() => { + cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) + cy.clearLocalStorage() + main.acceptCookies() + }) + + it('Verify that non-native tokens are present and have balance', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.verifyBalance(assets.currencyDaiCap, TOKEN_AMOUNT_COLUMN, assets.currencyDaiAlttext) + assets.verifyTokenBalanceFormat( + assets.currencyDaiCap, + assets.currencyDaiFormat_2, + TOKEN_AMOUNT_COLUMN, + FIAT_AMOUNT_COLUMN, + fiatRegex, + ) + + assets.verifyBalance(assets.currencyAave, TOKEN_AMOUNT_COLUMN, assets.currencyAaveAlttext) + assets.verifyTokenBalanceFormat( + assets.currencyAave, + assets.currentcyAaveFormat, + TOKEN_AMOUNT_COLUMN, + FIAT_AMOUNT_COLUMN, + fiatRegex, + ) + + assets.verifyBalance(assets.currencyLink, TOKEN_AMOUNT_COLUMN, assets.currencyLinkAlttext) + assets.verifyTokenBalanceFormat( + assets.currencyLink, + assets.currentcyLinkFormat, + TOKEN_AMOUNT_COLUMN, + FIAT_AMOUNT_COLUMN, + fiatRegex, + ) + + assets.verifyBalance(assets.currencyTestTokenA, TOKEN_AMOUNT_COLUMN, assets.currencyTestTokenAAlttext) + assets.verifyTokenBalanceFormat( + assets.currencyTestTokenA, + assets.currentcyTestTokenAFormat, + TOKEN_AMOUNT_COLUMN, + FIAT_AMOUNT_COLUMN, + fiatRegex, + ) + + assets.verifyBalance(assets.currencyTestTokenB, TOKEN_AMOUNT_COLUMN, assets.currencyTestTokenBAlttext) + assets.verifyTokenBalanceFormat( + assets.currencyTestTokenB, + assets.currentcyTestTokenBFormat, + TOKEN_AMOUNT_COLUMN, + FIAT_AMOUNT_COLUMN, + fiatRegex, + ) + + assets.verifyBalance(assets.currencyUSDC, TOKEN_AMOUNT_COLUMN, assets.currencyTestUSDCAlttext) + assets.verifyTokenBalanceFormat( + assets.currencyUSDC, + assets.currentcyTestUSDCFormat, + TOKEN_AMOUNT_COLUMN, + FIAT_AMOUNT_COLUMN, + fiatRegex, + ) + }) + + it('Verify that every token except the native token has a "go to blockexplorer link"', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.verifyAssetNameHasExplorerLink(assets.currencyUSDC, ASSET_NAME_COLUMN) + assets.verifyAssetNameHasExplorerLink(assets.currencyTestTokenB, ASSET_NAME_COLUMN) + assets.verifyAssetNameHasExplorerLink(assets.currencyTestTokenA, ASSET_NAME_COLUMN) + assets.verifyAssetNameHasExplorerLink(assets.currencyLink, ASSET_NAME_COLUMN) + assets.verifyAssetNameHasExplorerLink(assets.currencyAave, ASSET_NAME_COLUMN) + assets.verifyAssetNameHasExplorerLink(assets.currencyDaiCap, ASSET_NAME_COLUMN) + assets.verifyAssetExplorerLinkNotAvailable(constants.tokenNames.sepoliaEther, ASSET_NAME_COLUMN) + }) + + it('Verify the default Fiat currency and the effects after changing it', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.verifyFirstRowDoesNotContainCurrency(assets.currencyEUR, FIAT_AMOUNT_COLUMN) + assets.verifyFirstRowContainsCurrency(assets.currencyUSD, FIAT_AMOUNT_COLUMN) + assets.clickOnCurrencyDropdown() + assets.selectCurrency(assets.currencyEUR) + assets.verifyFirstRowDoesNotContainCurrency(assets.currencyUSD, FIAT_AMOUNT_COLUMN) + assets.verifyFirstRowContainsCurrency(assets.currencyEUR, FIAT_AMOUNT_COLUMN) + }) + + it('Verify that checking the checkboxes increases the token selected counter', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.openHideTokenMenu() + assets.clickOnTokenCheckbox(assets.currencyLink) + assets.checkTokenCounter(1) + }) + + it('Verify that selecting tokens and saving hides them from the table', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.openHideTokenMenu() + assets.clickOnTokenCheckbox(assets.currencyLink) + assets.saveHiddenTokenSelection() + main.verifyValuesDoNotExist(assets.tokenListTable, [assets.currencyLink]) + }) + + it('Verify that Cancel closes the menu and does not change the table status', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.openHideTokenMenu() + assets.clickOnTokenCheckbox(assets.currencyLink) + assets.clickOnTokenCheckbox(assets.currencyAave) + assets.saveHiddenTokenSelection() + main.verifyValuesDoNotExist(assets.tokenListTable, [assets.currencyLink, assets.currencyAave]) + assets.openHideTokenMenu() + assets.clickOnTokenCheckbox(assets.currencyLink) + assets.clickOnTokenCheckbox(assets.currencyAave) + assets.cancelSaveHiddenTokenSelection() + main.verifyValuesDoNotExist(assets.tokenListTable, [assets.currencyLink, assets.currencyAave]) + }) + + it('Verify that Deselect All unchecks all tokens from the list', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.openHideTokenMenu() + assets.clickOnTokenCheckbox(assets.currencyLink) + assets.clickOnTokenCheckbox(assets.currencyAave) + assets.deselecAlltHiddenTokenSelection() + assets.verifyEachRowHasCheckbox(constants.checkboxStates.unchecked) + }) + + it('Verify the Hidden tokens counter works for spam tokens', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.openHideTokenMenu() + assets.clickOnTokenCheckbox(assets.currencyLink) + assets.saveHiddenTokenSelection() + assets.checkHiddenTokenBtnCounter(1) + }) + + it('Verify the Hidden tokens counter works for native tokens', () => { + assets.openHideTokenMenu() + assets.clickOnTokenCheckbox(constants.tokenNames.sepoliaEther) + assets.saveHiddenTokenSelection() + assets.checkHiddenTokenBtnCounter(1) + }) + + it('Verify you can hide tokens from the eye icon in the table rows', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.hideAsset(assets.currencyLink) + }) + + it('Verify the sorting of "Assets" and "Balance" in the table', () => { + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.verifyTableRows(7) + assets.clickOnTokenNameSortBtn() + assets.verifyTokenNamesOrder() + assets.clickOnTokenNameSortBtn() + assets.verifyTokenNamesOrder('descending') + assets.clickOnTokenBalanceSortBtn() + assets.verifyTokenBalanceOrder() + assets.clickOnTokenBalanceSortBtn() + assets.verifyTokenBalanceOrder('descending') + }) + + //Include in smoke. + it('Verify that when owner is disconnected, Send button is disabled', () => { + //waits for the user to look connected. Sends a default prefix "sep:" if it is called with no params + main.verifyOwnerConnected() + owner.clickOnWalletExpandMoreIcon() + owner.clickOnDisconnectBtn() + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.showSendBtn(0) + assets.VerifySendButtonIsDisabled() + }) + + it('Verify that when connected user is not owner, Send button is disabled', () => { + cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_15_TOKEN) + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.showSendBtn(0) + assets.VerifySendButtonIsDisabled() + }) +}) diff --git a/cypress/e2e/smoke/assets.cy.js b/cypress/e2e/smoke/assets.cy.js index 7eb9e311f2..c7fcafcfee 100644 --- a/cypress/e2e/smoke/assets.cy.js +++ b/cypress/e2e/smoke/assets.cy.js @@ -1,13 +1,13 @@ import * as constants from '../../support/constants' import * as main from '../../e2e/pages/main.page' -import * as balances from '../pages/balances.pages' +import * as assets from '../pages/assets.pages' const ASSET_NAME_COLUMN = 0 const TOKEN_AMOUNT_COLUMN = 1 const FIAT_AMOUNT_COLUMN = 2 describe('[SMOKE] Assets tests', () => { - const fiatRegex = balances.fiatRegex + const fiatRegex = assets.fiatRegex beforeEach(() => { cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) @@ -16,37 +16,37 @@ describe('[SMOKE] Assets tests', () => { }) it('[SMOKE] Verify that the token tab is selected by default and the table is visible', () => { - balances.verifyTokensTabIsSelected('true') + assets.verifyTokensTabIsSelected('true') }) it('[SMOKE] Verify that the native token is visible', () => { - balances.verifyTokenIsPresent(constants.tokenNames.sepoliaEther) + assets.verifyTokenIsPresent(constants.tokenNames.sepoliaEther) }) it('[SMOKE] Verify that Token list dropdown down options show/hide spam tokens', () => { let spamTokens = [ - balances.currencyAave, - balances.currencyTestTokenA, - balances.currencyTestTokenB, - balances.currencyUSDC, - balances.currencyLink, - balances.currencyDaiCap, + assets.currencyAave, + assets.currencyTestTokenA, + assets.currencyTestTokenB, + assets.currencyUSDC, + assets.currencyLink, + assets.currencyDaiCap, ] - main.verifyValuesDoNotExist(balances.tokenListTable, spamTokens) - balances.selectTokenList(balances.tokenListOptions.allTokens) + main.verifyValuesDoNotExist(assets.tokenListTable, spamTokens) + assets.selectTokenList(assets.tokenListOptions.allTokens) spamTokens.push(constants.tokenNames.sepoliaEther) - main.verifyValuesExist(balances.tokenListTable, spamTokens) + main.verifyValuesExist(assets.tokenListTable, spamTokens) }) it('[SMOKE] Verify that "Hide token" button is present and opens the "Hide tokens menu"', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.openHideTokenMenu() - balances.verifyEachRowHasCheckbox() + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.openHideTokenMenu() + assets.verifyEachRowHasCheckbox() }) it('[SMOKE] Verify that clicking the button with an owner opens the Send funds form', () => { - balances.selectTokenList(balances.tokenListOptions.allTokens) - balances.clickOnSendBtn(0) + assets.selectTokenList(assets.tokenListOptions.allTokens) + assets.clickOnSendBtn(0) }) }) diff --git a/cypress/support/constants.js b/cypress/support/constants.js index 0de3273b1e..afc376aba8 100644 --- a/cypress/support/constants.js +++ b/cypress/support/constants.js @@ -26,6 +26,8 @@ export const SEPOLIA_TEST_SAFE_12 = 'sep:0x9190cc22D592dDcf396Fa616ce84a9978fD96 export const SEPOLIA_TEST_SAFE_13 = 'sep:0x98705770aF3b18db0a64597F6d4DCe825915fec0' export const SEPOLIA_TEST_SAFE_13_SHORT = '0x9870...fec0' export const SEPOLIA_TEST_SAFE_14 = 'sep:0xC23e061252BFc7967203D054136d8fA7c7df2fc4' +// SAFE 15 is a safe with native tokens but the automation user is not its owner +export const SEPOLIA_TEST_SAFE_15_TOKEN = 'sep:0xfC0A7ac73Fde7547ac0792Cca1D8A50CE0AFC4Df' export const SEPOLIA_CONTRACT_SHORT = '0x11AB...34aF' export const SEPOLIA_RECIPIENT_ADDR_SHORT = '0x4DD4...7bde' export const GNO_TEST_SAFE = 'gno:0xB8d760a90a5ed54D3c2b3EFC231277e99188642A'