From 30557945b7b40b2459a14cfddcca4c9c50f9d4aa Mon Sep 17 00:00:00 2001 From: mike10ca Date: Fri, 20 Oct 2023 12:13:14 +0200 Subject: [PATCH 1/3] Migrate tests to Seplia --- cypress/e2e/pages/balances.pages.js | 6 +- cypress/e2e/pages/batches.pages.js | 5 +- cypress/e2e/pages/create_tx.pages.js | 29 +++-- cypress/e2e/pages/dashboard.pages.js | 29 +++-- cypress/e2e/pages/import_export.pages.js | 11 +- cypress/e2e/pages/load_safe.pages.js | 12 +- cypress/e2e/pages/main.page.js | 4 + cypress/e2e/smoke/address_book.cy.js | 4 +- cypress/e2e/smoke/assets.cy.js | 2 +- cypress/e2e/smoke/balances.cy.js | 70 ++++++------ cypress/e2e/smoke/batch_tx.cy.js | 7 +- cypress/e2e/smoke/beamer.cy.js | 2 +- cypress/e2e/smoke/create_tx.cy.js | 10 +- cypress/e2e/smoke/dashboard.cy.js | 3 +- cypress/e2e/smoke/import_export_data.cy.js | 4 +- cypress/e2e/smoke/load_safe.cy.js | 14 +-- cypress/e2e/smoke/tx_history.cy.js | 124 ++++++++++++--------- cypress/fixtures/address_book_test.csv | 8 +- cypress/fixtures/data_import.json | 28 +++++ cypress/support/constants.js | 21 +++- 20 files changed, 228 insertions(+), 165 deletions(-) diff --git a/cypress/e2e/pages/balances.pages.js b/cypress/e2e/pages/balances.pages.js index 84a95a5a2d..e3e6d14dbc 100644 --- a/cypress/e2e/pages/balances.pages.js +++ b/cypress/e2e/pages/balances.pages.js @@ -1,6 +1,6 @@ import * as main from '../pages/main.page' -let etherscanLink = 'a[aria-label="View on goerli.etherscan.io"]' +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"]' @@ -45,6 +45,8 @@ export const tokenListOptions = { export const currencyEUR = 'EUR' export const currencyUSD = 'USD' +export const currentcySepoliaFormat = '0.1 ETH' + export const currencyAave = 'AAVE' export const currencyAaveAlttext = 'AAVE' export const currentcyAaveFormat = '27 AAVE' @@ -68,7 +70,7 @@ export const currentcyLinkFormat = '35.94 LINK' export const currencyDai = 'Dai' export const currencyDaiCap = 'DAI' export const currencyDaiAlttext = 'DAI' -export const currentcyDaiFormat = '120,496.61 DAI' +export const currentcyDaiFormat = '82 DAI' export const currencyDaiFormat_2 = '82 DAI' export const currencyEther = 'Wrapped Ether' diff --git a/cypress/e2e/pages/batches.pages.js b/cypress/e2e/pages/batches.pages.js index 1b5631c6fb..dfbb34d7ef 100644 --- a/cypress/e2e/pages/batches.pages.js +++ b/cypress/e2e/pages/batches.pages.js @@ -1,3 +1,5 @@ +import * as constants from '../../support/constants' + const tokenSelectorText = 'G(ö|oe)rli Ether' const noLaterString = 'No, later' const yesExecuteString = 'Yes, execute' @@ -39,7 +41,7 @@ function fillTransactionData(EOA, amount) { cy.get(recipientInput).type(EOA, { delay: 1 }) // Click on the Token selector cy.get(tokenAddressInput).prev().click() - cy.get(listBox).contains(new RegExp(tokenSelectorText)).click() + cy.get(listBox).contains(constants.tokenNames.sepoliaEther).click() cy.get(amountInput).type(amount) cy.contains(nextBtn).click() } @@ -59,7 +61,6 @@ function executeTransaction() { } function addToBatchButton() { - cy.contains(noLaterString, { timeout: 4000 }).click() cy.contains(addToBatchBtn).should('be.visible').and('not.be.disabled').click() } diff --git a/cypress/e2e/pages/create_tx.pages.js b/cypress/e2e/pages/create_tx.pages.js index 11b7bb78e7..ce133801ec 100644 --- a/cypress/e2e/pages/create_tx.pages.js +++ b/cypress/e2e/pages/create_tx.pages.js @@ -9,11 +9,12 @@ const nonceInput = 'input[name="nonce"]' const gasLimitInput = '[name="gasLimit"]' const rotateLeftIcon = '[data-testid="RotateLeftIcon"]' const transactionItemExpandable = 'div[id^="transfer"]' +const expandItemIcon = '[data-testid="ExpandMoreIcon"]' const viewTransactionBtn = 'View transaction' const transactionDetailsTitle = 'Transaction details' const QueueLabel = 'needs to be executed first' -const TransactionSummary = 'Send' +const TransactionSummary = 'Send ' const maxAmountBtnStr = 'Max' const nextBtnStr = 'Next' @@ -50,9 +51,9 @@ export function clickOnSendTokensBtn() { cy.contains(sendTokensBtnStr).click() } -export function clickOnTokenselectorAndSelectGoerli() { +export function clickOnTokenselectorAndSelectSepolia() { cy.get(tokenAddressInput).prev().click() - cy.get('ul[role="listbox"]').contains(constants.goerliToken).click() + cy.get('ul[role="listbox"]').contains(constants.tokenNames.sepoliaEther).click() } export function setMaxAmount() { @@ -66,8 +67,11 @@ export function verifyMaxAmount(token, tokenAbbreviation) { .contains(token) .next() .then((element) => { - const maxBalance = element.text().replace(tokenAbbreviation, '').trim() - cy.get(amountInput).should('have.value', maxBalance) + const maxBalance = parseFloat(element.text().replace(tokenAbbreviation, '').trim()) + cy.get(amountInput).should(($input) => { + const actualValue = parseFloat($input.val()) + expect(actualValue).to.be.closeTo(maxBalance, 0.1) + }) console.log(maxBalance) }) } @@ -99,9 +103,7 @@ export function verifyConfirmTransactionData() { // Asserting the sponsored info is present cy.contains(executeStr).scrollIntoView().should('be.visible') - cy.get('span').contains(estimatedFeeStr).next().should('have.css', 'text-decoration-line', 'line-through') - cy.contains(transactionsPerHrStr) - cy.contains(transactionsPerHr5Of5Str) + cy.get('span').contains(estimatedFeeStr) } export function openExecutionParamsModal() { @@ -112,10 +114,9 @@ export function openExecutionParamsModal() { export function verifyAndSubmitExecutionParams() { cy.contains(executionParamsStr).parents('form').as('Paramsform') - // Only gaslimit should be editable when the relayer is selected - const arrayNames = ['Wallet nonce', 'Max priority fee (Gwei)', 'Max fee (Gwei)'] + const arrayNames = ['Wallet nonce', 'Max priority fee (Gwei)', 'Max fee (Gwei)', 'Gas limit'] arrayNames.forEach((element) => { - cy.get('@Paramsform').find('label').contains(`${element}`).next().find('input').should('be.disabled') + cy.get('@Paramsform').find('label').contains(`${element}`).next().find('input').should('not.be.disabled') }) cy.get('@Paramsform').find(gasLimitInput).clear().type('300000').invoke('prop', 'value').should('equal', '300000') @@ -150,7 +151,7 @@ export function verifyQueueLabel() { } export function verifyTransactionSummary(sendValue) { - cy.contains(TransactionSummary + `${sendValue} ${constants.tokenAbbreviation.gor}`).should('exist') + cy.contains(TransactionSummary + `${sendValue} ${constants.tokenAbbreviation.sep}`).should('exist') } export function verifyDateExists(date) { @@ -189,3 +190,7 @@ export function clickOnExpandAllBtn() { export function clickOnCollapseAllBtn() { cy.contains(collapseAllBtnStr).click() } + +export function clickOnExpandIcon() { + cy.get(expandItemIcon).click() +} diff --git a/cypress/e2e/pages/dashboard.pages.js b/cypress/e2e/pages/dashboard.pages.js index e6a3f216cb..17be9494d0 100644 --- a/cypress/e2e/pages/dashboard.pages.js +++ b/cypress/e2e/pages/dashboard.pages.js @@ -27,9 +27,11 @@ export function verifyOverviewWidgetData() { cy.get('@overviewSection').within(() => { // Prefix is separated across elements in EthHashInfo - cy.contains(constants.TEST_SAFE).should('exist') + cy.contains(constants.SEPOLIA_TEST_SAFE_5).should('exist') cy.contains('1/2') - cy.get(`a[href="${constants.BALANCE_URL}${encodeURIComponent(constants.TEST_SAFE)}"]`).contains(viewAssetsStr) + cy.get(`a[href="${constants.BALANCE_URL}${encodeURIComponent(constants.SEPOLIA_TEST_SAFE_5)}"]`).contains( + viewAssetsStr, + ) // Text next to Tokens contains a number greater than 0 cy.contains('p', tokensStr).next().contains('1') cy.contains('p', nftStr).next().contains('0') @@ -45,9 +47,15 @@ export function verifyTxQueueWidget() { cy.contains(noTransactionStr).should('not.exist') // Queued txns - cy.contains(`a[href^="/transactions/tx?id=multisig_0x"]`, '13' + 'Send' + '-0.00002 GOR' + '1/1').should('exist') - - cy.contains(`a[href="${constants.transactionQueueUrl}${encodeURIComponent(constants.TEST_SAFE)}"]`, viewAllStr) + cy.contains( + `a[href^="/transactions/tx?id=multisig_0x"]`, + '13' + 'Send' + `-0.00002 ${constants.tokenAbbreviation.sep}` + '1/1', + ).should('exist') + + cy.contains( + `a[href="${constants.transactionQueueUrl}${encodeURIComponent(constants.SEPOLIA_TEST_SAFE_5)}"]`, + viewAllStr, + ) }) } @@ -71,17 +79,6 @@ export function verifyFeaturedAppsSection() { } export function verifySafeAppsSection() { - // Create an alias for the Safe Apps section cy.contains('h2', safeAppStr).parents('section').as('safeAppsSection') - cy.get('@safeAppsSection').contains(exploreSafeApps) - - // Regular safe apps - cy.get('@safeAppsSection').within(() => { - // Find exactly 5 Safe Apps cards inside the Safe Apps section - cy.get(`a[href^="${constants.openAppsUrl}${encodeURIComponent(constants.TEST_SAFE)}&appUrl=http"]`).should( - 'have.length', - 5, - ) - }) } diff --git a/cypress/e2e/pages/import_export.pages.js b/cypress/e2e/pages/import_export.pages.js index bbd76cdcbe..e5b49348ba 100644 --- a/cypress/e2e/pages/import_export.pages.js +++ b/cypress/e2e/pages/import_export.pages.js @@ -1,3 +1,4 @@ +import * as constants from '../../support/constants' import { format } from 'date-fns' const path = require('path') @@ -33,8 +34,8 @@ export function uploadFile(filePath) { export function verifyImportModalData() { //verifies that the modal says the amount of chains/addressbook values it uploaded for file ../fixtures/data_import.json - cy.contains('Added Safe Accounts on 3 chains').should('be.visible') - cy.contains('Address book for 3 chains').should('be.visible') + cy.contains('Added Safe Accounts on 4 chains').should('be.visible') + cy.contains('Address book for 4 chains').should('be.visible') cy.contains('Settings').should('be.visible') cy.contains('Bookmarked Safe Apps').should('be.visible') } @@ -55,10 +56,8 @@ export function clickOnAddressBookBtn() { export function verifyImportedAddressBookData() { //Verifies imported owners in the Address book for file ../fixtures/data_import.json - cy.get('tbody tr:nth-child(1) td:nth-child(1)').contains('test1') - cy.get('tbody tr:nth-child(1) td:nth-child(2)').contains('0x61a0c717d18232711bC788F19C9Cd56a43cc8872') - cy.get('tbody tr:nth-child(2) td:nth-child(1)').contains('test2') - cy.get('tbody tr:nth-child(2) td:nth-child(2)').contains('0x7724b234c9099C205F03b458944942bcEBA13408') + cy.get('tbody tr:nth-child(1) td:nth-child(1)').contains(constants.SEPOLIA_CSV_ENTRY.name) + cy.get('tbody tr:nth-child(1) td:nth-child(2)').contains(constants.SEPOLIA_CSV_ENTRY.address.substring(4)) } export function clickOnAppsBtn() { diff --git a/cypress/e2e/pages/load_safe.pages.js b/cypress/e2e/pages/load_safe.pages.js index 3d36669e48..6f89e64a89 100644 --- a/cypress/e2e/pages/load_safe.pages.js +++ b/cypress/e2e/pages/load_safe.pages.js @@ -1,4 +1,5 @@ import * as constants from '../../support/constants' +import * as createwallet from '../pages/create_wallet.pages' const addExistingAccountBtnStr = 'Add existing Account' const contactStr = 'Name, address & network' @@ -29,15 +30,16 @@ export function selectGoerli() { cy.contains('span', constants.networks.goerli) } +export function selectSepolia() { + cy.get('ul li').contains(constants.networks.sepolia).click() + cy.contains('span', constants.networks.sepolia) +} + export function selectPolygon() { cy.get('ul li').contains(constants.networks.polygon).click() cy.contains('span', constants.networks.polygon) } -export function verifyNameInputHasPlceholder() { - cy.get(nameInput).should('have.attr', 'placeholder').should('match', constants.goerlySafeName) -} - export function inputName(name) { cy.get(nameInput).type(name).should('have.value', name) } @@ -53,7 +55,7 @@ export function inputAddress(address) { export function verifyAddressInputValue() { // The address field should be filled with the "bare" QR code's address - const [, address] = constants.GOERLI_TEST_SAFE.split(':') + const [, address] = constants.SEPOLIA_TEST_SAFE_1.split(':') cy.get('input[name="address"]').should('have.value', address) } diff --git a/cypress/e2e/pages/main.page.js b/cypress/e2e/pages/main.page.js index 2ea448bf23..303a4fc953 100644 --- a/cypress/e2e/pages/main.page.js +++ b/cypress/e2e/pages/main.page.js @@ -2,6 +2,10 @@ import * as constants from '../../support/constants' const acceptSelection = 'Accept selection' +export function clickOnSideMenuItem(item) { + cy.get('p').contains(item).click() +} + export function acceptCookies() { cy.wait(1000) cy.get('button') diff --git a/cypress/e2e/smoke/address_book.cy.js b/cypress/e2e/smoke/address_book.cy.js index e8439857a4..21481837e4 100644 --- a/cypress/e2e/smoke/address_book.cy.js +++ b/cypress/e2e/smoke/address_book.cy.js @@ -11,7 +11,7 @@ const EDITED_NAME = 'Edited Owner1' describe('Address book tests', () => { before(() => { cy.clearLocalStorage() - cy.visit(constants.addressBookUrl + constants.GOERLI_TEST_SAFE) + cy.visit(constants.addressBookUrl + constants.SEPOLIA_TEST_SAFE_1) main.acceptCookies() }) @@ -41,7 +41,7 @@ describe('Address book tests', () => { addressBook.clickOnImportFileBtn() addressBook.importFile() addressBook.verifyImportModalIsClosed() - addressBook.verifyDataImported(constants.GOERLI_CSV_ENTRY.name, constants.GOERLI_CSV_ENTRY.address) + addressBook.verifyDataImported(constants.SEPOLIA_CSV_ENTRY.name, constants.SEPOLIA_CSV_ENTRY.address) }) it.skip('Verify Gnosis Chain imported address can be found [C56066]', () => { diff --git a/cypress/e2e/smoke/assets.cy.js b/cypress/e2e/smoke/assets.cy.js index 075ac1bd20..d7007df2f3 100644 --- a/cypress/e2e/smoke/assets.cy.js +++ b/cypress/e2e/smoke/assets.cy.js @@ -11,7 +11,7 @@ describe('Assets tests', () => { const fiatRegex = balances.fiatRegex beforeEach(() => { - cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) + cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_4) cy.clearLocalStorage() main.acceptCookies() balances.acceptSpamWarning() diff --git a/cypress/e2e/smoke/balances.cy.js b/cypress/e2e/smoke/balances.cy.js index 70efad56d5..e87d423346 100644 --- a/cypress/e2e/smoke/balances.cy.js +++ b/cypress/e2e/smoke/balances.cy.js @@ -2,7 +2,7 @@ import * as constants from '../../support/constants' import * as balances from '../pages/balances.pages' import * as main from '../../e2e/pages/main.page' -const ASSETS_LENGTH = 8 +const ASSETS_LENGTH = 7 const ASSET_NAME_COLUMN = 0 const TOKEN_AMOUNT_COLUMN = 1 const FIAT_AMOUNT_COLUMN = 2 @@ -13,42 +13,36 @@ describe('Balance tests', () => { before(() => { cy.clearLocalStorage() - // Open the Safe used for testing - cy.visit(constants.BALANCE_URL + constants.GOERLI_TEST_SAFE) + cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) main.acceptCookies() - // Table is loaded - cy.contains('Görli Ether') - - cy.contains('button', 'Got it').click() - + balances.acceptSpamWarning() + cy.contains('Assets') cy.get(balances.balanceSingleRow).should('have.length.lessThan', ASSETS_LENGTH) - cy.contains('div', 'Default tokens').click() - cy.wait(100) - cy.contains('div', 'All tokens').click() + balances.selectTokenList(balances.tokenListOptions.allTokens) cy.get(balances.balanceSingleRow).should('have.length', ASSETS_LENGTH) }) it('Verify that token is present: Dai [C56074]', () => { - balances.verityTokenAltImageIsVisible(balances.currencyDai, balances.currencyDaiAlttext) - balances.verifyAssetNameHasExplorerLink(balances.currencyDai, ASSET_NAME_COLUMN) - balances.verifyBalance(balances.currencyDai, TOKEN_AMOUNT_COLUMN, balances.currencyDaiAlttext) + 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: Wrapped Ether [C56075]', () => { - balances.verityTokenAltImageIsVisible(balances.currencyEther, balances.currencyEtherAlttext) - balances.verifyAssetNameHasExplorerLink(balances.currencyEther, ASSET_NAME_COLUMN) - balances.verifyBalance(balances.currencyEther, TOKEN_AMOUNT_COLUMN, balances.currencyEtherAlttext) + it('Verify that token is present: AAVE [C56075]', () => { + 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: USD Coin [C56076]', () => { - balances.verityTokenAltImageIsVisible(balances.currencyUSDCoin, balances.currencyUSDAlttext) - balances.verifyAssetNameHasExplorerLink(balances.currencyUSDCoin, ASSET_NAME_COLUMN) - balances.verifyBalance(balances.currencyUSDCoin, TOKEN_AMOUNT_COLUMN, balances.currencyUSDAlttext) + it('Verify that token is present: LINK [C56076]', () => { + 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 [C56077]', () => { balances.verifyTokenBalanceFormat( - balances.currencyDai, + balances.currencyDaiCap, balances.currentcyDaiFormat, TOKEN_AMOUNT_COLUMN, FIAT_AMOUNT_COLUMN, @@ -56,48 +50,48 @@ describe('Balance tests', () => { ) balances.verifyTokenBalanceFormat( - balances.currencyEther, - balances.currentcyEtherFormat, + balances.currencyAave, + balances.currentcyAaveFormat, TOKEN_AMOUNT_COLUMN, FIAT_AMOUNT_COLUMN, fiatRegex, ) balances.verifyTokenBalanceFormat( - balances.currencyGörliEther, - balances.currentcyGörliEtherFormat, + balances.currencyLink, + balances.currentcyLinkFormat, TOKEN_AMOUNT_COLUMN, FIAT_AMOUNT_COLUMN, fiatRegex, ) balances.verifyTokenBalanceFormat( - balances.currencyUniswap, - balances.currentcyUniswapFormat, + balances.currencyTestTokenA, + balances.currentcyTestTokenAFormat, TOKEN_AMOUNT_COLUMN, FIAT_AMOUNT_COLUMN, fiatRegex, ) balances.verifyTokenBalanceFormat( - balances.currencyUSDCoin, - balances.currentcyUSDFormat, + balances.currencyTestTokenB, + balances.currentcyTestTokenBFormat, TOKEN_AMOUNT_COLUMN, FIAT_AMOUNT_COLUMN, fiatRegex, ) balances.verifyTokenBalanceFormat( - balances.currencyGnosis, - balances.currentcyGnosisFormat, + balances.currencyUSDC, + balances.currentcyTestUSDCFormat, TOKEN_AMOUNT_COLUMN, FIAT_AMOUNT_COLUMN, fiatRegex, ) balances.verifyTokenBalanceFormat( - balances.currencyOx, - balances.currentcyOxFormat, + constants.tokenNames.sepoliaEther, + balances.currentcySepoliaFormat, TOKEN_AMOUNT_COLUMN, FIAT_AMOUNT_COLUMN, fiatRegex, @@ -117,14 +111,14 @@ describe('Balance tests', () => { }) it('Verify a token can be hidden [C56080]', () => { - balances.hideAsset(balances.currencyDai) + balances.hideAsset(balances.currencyDaiCap) }) it('Verify a token can be unhidden [C56081]', () => { balances.openHideTokenMenu() - balances.clickOnTokenCheckbox(balances.currencyDai) + balances.clickOnTokenCheckbox(balances.currencyDaiCap) balances.saveHiddenTokenSelection() - balances.verifyTokenIsVisible(balances.currencyDai) + balances.verifyTokenIsVisible(balances.currencyDaiCap) balances.verifyMenuButtonLabelIsDefault() }) }) diff --git a/cypress/e2e/smoke/batch_tx.cy.js b/cypress/e2e/smoke/batch_tx.cy.js index c1c367d17f..9ed34130fc 100644 --- a/cypress/e2e/smoke/batch_tx.cy.js +++ b/cypress/e2e/smoke/batch_tx.cy.js @@ -1,6 +1,7 @@ import * as batch from '../pages/batches.pages' import * as constants from '../../support/constants' import * as main from '../../e2e/pages/main.page' +import * as balances from '../pages/balances.pages' const currentNonce = 3 const funds_first_tx = '0.001' @@ -9,9 +10,9 @@ const funds_second_tx = '0.002' describe('Batch transaction tests', () => { before(() => { cy.clearLocalStorage() - cy.visit(constants.homeUrl + constants.TEST_SAFE) + cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) main.acceptCookies() - cy.contains(constants.goerlyE2EWallet, { timeout: 10000 }) + balances.acceptSpamWarning() }) it('Verify empty batch list can be opened [C56082]', () => { @@ -21,7 +22,7 @@ describe('Batch transaction tests', () => { it('Verify the Add batch button is present in a transaction form [C56084]', () => { //The "true" is to validate that the add to batch button is not visible if "Yes, execute" is selected - batch.addToBatch(constants.EOA, currentNonce, funds_first_tx, true) + batch.addToBatch(constants.EOA, currentNonce, funds_first_tx) }) it('Verify a transaction can be added to the batch [C56085]', () => { diff --git a/cypress/e2e/smoke/beamer.cy.js b/cypress/e2e/smoke/beamer.cy.js index 034e70e9e5..ab0ee152b9 100644 --- a/cypress/e2e/smoke/beamer.cy.js +++ b/cypress/e2e/smoke/beamer.cy.js @@ -5,7 +5,7 @@ import * as main from '../../e2e/pages/main.page' describe('Beamer tests', () => { before(() => { cy.clearLocalStorage() - cy.visit(constants.addressBookUrl + constants.GOERLI_TEST_SAFE) + cy.visit(constants.addressBookUrl + constants.SEPOLIA_TEST_SAFE_1) main.acceptCookies() }) diff --git a/cypress/e2e/smoke/create_tx.cy.js b/cypress/e2e/smoke/create_tx.cy.js index b79a6afac8..033d61f3ca 100644 --- a/cypress/e2e/smoke/create_tx.cy.js +++ b/cypress/e2e/smoke/create_tx.cy.js @@ -1,24 +1,26 @@ import * as constants from '../../support/constants' import * as main from '../../e2e/pages/main.page' import * as createtx from '../../e2e/pages/create_tx.pages' +import * as balances from '../pages/balances.pages' const sendValue = 0.00002 -const currentNonce = 3 +const currentNonce = 1 describe('Create transactions tests', () => { before(() => { cy.clearLocalStorage() - cy.visit(constants.homeUrl + constants.TEST_SAFE) + cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) main.acceptCookies() + balances.acceptSpamWarning() }) it('Verify a new send token transaction can be created [C56104]', () => { createtx.clickOnNewtransactionBtn() createtx.clickOnSendTokensBtn() createtx.typeRecipientAddress(constants.EOA) - createtx.clickOnTokenselectorAndSelectGoerli() + createtx.clickOnTokenselectorAndSelectSepolia() createtx.setMaxAmount() - createtx.verifyMaxAmount(constants.goerliToken, constants.tokenAbbreviation.gor) + createtx.verifyMaxAmount(constants.tokenNames.sepoliaEther, constants.tokenAbbreviation.sep) createtx.setSendValue(sendValue) createtx.clickOnNextBtn() }) diff --git a/cypress/e2e/smoke/dashboard.cy.js b/cypress/e2e/smoke/dashboard.cy.js index 73a52ebca8..c3cded3269 100644 --- a/cypress/e2e/smoke/dashboard.cy.js +++ b/cypress/e2e/smoke/dashboard.cy.js @@ -5,8 +5,9 @@ import * as main from '../pages/main.page' describe('Dashboard tests', () => { before(() => { cy.clearLocalStorage() - cy.visit(constants.homeUrl + constants.TEST_SAFE) + cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) main.acceptCookies() + main.clickOnSideMenuItem(constants.mainSideMenuOptions.home) dashboard.verifyConnectTransactStrIsVisible() }) diff --git a/cypress/e2e/smoke/import_export_data.cy.js b/cypress/e2e/smoke/import_export_data.cy.js index 4d3c405991..1c41ff5ab8 100644 --- a/cypress/e2e/smoke/import_export_data.cy.js +++ b/cypress/e2e/smoke/import_export_data.cy.js @@ -13,7 +13,7 @@ describe('Import Export Data tests', () => { it('Verify Safe can be accessed after test file upload [C56111]', () => { const filePath = '../fixtures/data_import.json' - const safe = 'safe 1 goerli' + const safe = constants.SEPOLIA_CSV_ENTRY.name file.clickOnImportBtn() file.uploadFile(filePath) @@ -29,7 +29,7 @@ describe('Import Export Data tests', () => { }) it('Verify pinned apps [C56113]', () => { - const appNames = ['Drain Account', 'Transaction Builder'] + const appNames = ['Transaction Builder'] file.clickOnAppsBtn() file.clickOnBookmarkedAppsBtn() diff --git a/cypress/e2e/smoke/load_safe.cy.js b/cypress/e2e/smoke/load_safe.cy.js index 4ea6015380..0ff6a0c0c8 100644 --- a/cypress/e2e/smoke/load_safe.cy.js +++ b/cypress/e2e/smoke/load_safe.cy.js @@ -21,28 +21,28 @@ const OWNER_ADDRESS = constants.EOA describe('Load Safe tests', () => { before(() => { cy.clearLocalStorage() - cy.visit(constants.welcomeUrl) + cy.visit(constants.loadNewSafeSepoliaUrl) main.acceptCookies() - safe.openLoadSafeForm() cy.wait(2000) }) it('Verify a network can be selected in the Safe [C56117]', () => { - safe.clickNetworkSelector(constants.networks.goerli) + safe.clickNetworkSelector(constants.networks.sepolia) safe.selectPolygon() cy.wait(2000) safe.clickNetworkSelector(constants.networks.polygon) - safe.selectGoerli() + safe.selectSepolia() }) it('Verify only valid Safe name can be accepted [C56118]', () => { // alias the address input label cy.get('input[name="address"]').parent().prev('label').as('addressLabel') - safe.verifyNameInputHasPlceholder(testSafeName) + createwallet.verifyDefaultWalletName(createwallet.defaltSepoliaPlaceholder) + safe.inputName(testSafeName) safe.verifyIncorrectAddressErrorMessage() - safe.inputAddress(constants.GOERLI_TEST_SAFE) + safe.inputAddress(constants.SEPOLIA_TEST_SAFE_1) // Type an invalid address // cy.get('input[name="address"]').clear().type(EOA_ADDRESS) @@ -75,7 +75,7 @@ describe('Load Safe tests', () => { }) it('Verify the custom Safe name is successfully loaded [C56122]', () => { - main.verifyHomeSafeUrl(constants.GOERLI_TEST_SAFE) + main.verifyHomeSafeUrl(constants.SEPOLIA_TEST_SAFE_1) safe.veriySidebarSafeNameIsVisible(testSafeName) safe.verifyOwnerNamePresentInSettings(testOwnerName) }) diff --git a/cypress/e2e/smoke/tx_history.cy.js b/cypress/e2e/smoke/tx_history.cy.js index a379ac27c5..cb827e6115 100644 --- a/cypress/e2e/smoke/tx_history.cy.js +++ b/cypress/e2e/smoke/tx_history.cy.js @@ -6,28 +6,33 @@ const INCOMING = 'Received' const OUTGOING = 'Sent' const CONTRACT_INTERACTION = 'Contract interaction' -const str1 = 'True' -const str2 = '1337' -const str3 = '5688' +const str1 = 'Received' +const str2 = 'Executed' +const str3 = 'Transaction hash' describe('Transaction history tests', () => { before(() => { cy.clearLocalStorage() // Go to the test Safe transaction history - cy.visit(constants.transactionsHistoryUrl + constants.GOERLI_TEST_SAFE) + cy.visit(constants.transactionsHistoryUrl + constants.SEPOLIA_TEST_SAFE_5) main.acceptCookies() }) it('Verify October 9th transactions are displayed [C56128]', () => { - const DATE = 'Oct 9, 2022' - const NEXT_DATE_LABEL = 'Feb 8, 2022' - const amount = '0.25 GOR' - const amount2 = '0.11 WETH' - const amount3 = '120,497.61 DAI' - const time = '4:56 PM' - const time2 = '4:59 PM' - const time3 = '5:00 PM' - const time4 = '5:01 PM' + const DATE = 'Oct 9, 2023' + const NEXT_DATE_LABEL = 'Oct 11, 2023' + const amount = '0.1 ETH' + const amount2 = '15 TT_A' + const amount3 = '21 TT_B' + const amount4 = '82 DAI' + const amount5 = '73 USDC' + const amount6 = '27 AAVE' + const amount7 = '35.94 LINK' + const amount8 = '< 0.00001 ETH' + const time = '2:56 AM' + const time2 = '12:59 AM' + const time3 = '1:00 AM' + const time4 = '1:01 AM' const success = 'Success' createTx.verifyDateExists(DATE) @@ -36,84 +41,93 @@ describe('Transaction history tests', () => { // Transaction summaries from October 9th const rows = cy.contains('div', DATE).nextUntil(`div:contains(${NEXT_DATE_LABEL})`) - rows.should('have.length', 19) + rows.should('have.length', 9) rows - // Receive 0.25 GOR .last() + .prev() .within(() => { // Type createTx.verifyImageAltTxt(0, INCOMING) createTx.verifyStatus(constants.transactionStatus.received) // Info - createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.gor) + createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.sep) createTx.verifyTransactionStrExists(amount) createTx.verifyTransactionStrExists(time) createTx.verifyTransactionStrExists(success) }) - // CowSwap deposit of Wrapped Ether .prev() .within(() => { - createTx.verifyTransactionStrExists('0') - // TODO: update next line after fixing the logo - // cy.find('img').should('have.attr', 'src').should('include', WRAPPED_ETH) - createTx.verifyTransactionStrExists(constants.tokenNames.wrappedEther) - createTx.verifyTransactionStrExists(constants.transactionStatus.deposit) + createTx.verifyImageAltTxt(0, INCOMING) + createTx.verifyStatus(constants.transactionStatus.received) + createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.tta) + createTx.verifyTransactionStrExists(amount2) createTx.verifyTransactionStrExists(time2) - createTx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyTransactionStrExists(success) }) - // CowSwap approval of Wrapped Ether .prev() .within(() => { - createTx.verifyTransactionStrExists('1') - // Type - // TODO: update next line after fixing the logo - // cy.find('img').should('have.attr', 'src').should('include', WRAPPED_ETH) - createTx.verifyTransactionStrExists(constants.transactionStatus.approve) + createTx.verifyImageAltTxt(0, INCOMING) + createTx.verifyStatus(constants.transactionStatus.received) + createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.ttb) + createTx.verifyTransactionStrExists(amount3) + createTx.verifyTransactionStrExists(time2) + createTx.verifyTransactionStrExists(success) + }) + .prev() + .within(() => { + createTx.verifyImageAltTxt(0, INCOMING) + createTx.verifyStatus(constants.transactionStatus.received) + createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.dai) + createTx.verifyTransactionStrExists(amount4) + createTx.verifyTransactionStrExists(time2) + createTx.verifyTransactionStrExists(success) + }) + .prev() + .within(() => { + createTx.verifyImageAltTxt(0, INCOMING) + createTx.verifyStatus(constants.transactionStatus.received) + createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.usds) + createTx.verifyTransactionStrExists(amount5) createTx.verifyTransactionStrExists(time3) - createTx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyTransactionStrExists(success) }) - // Contract interaction .prev() .within(() => { - createTx.verifyTransactionStrExists('2') - createTx.verifyTransactionStrExists(constants.transactionStatus.interaction) - createTx.verifyTransactionStrExists(time4) - createTx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyImageAltTxt(0, INCOMING) + createTx.verifyStatus(constants.transactionStatus.received) + createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.aave) + createTx.verifyTransactionStrExists(amount6) + createTx.verifyTransactionStrExists(time3) + createTx.verifyTransactionStrExists(success) }) - // Send 0.11 WETH .prev() .within(() => { - createTx.verifyImageAltTxt(0, OUTGOING) - createTx.verifyTransactionStrExists(constants.transactionStatus.sent) - createTx.verifyTransactionStrExists(amount2) - createTx.verifyTransactionStrExists(time4) - createTx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyImageAltTxt(0, INCOMING) + createTx.verifyStatus(constants.transactionStatus.received) + createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.link) + createTx.verifyTransactionStrExists(amount7) + createTx.verifyTransactionStrExists(time3) + createTx.verifyTransactionStrExists(success) }) - // Receive 120 DAI .prev() .within(() => { - createTx.verifyTransactionStrExists(constants.transactionStatus.received) - createTx.verifyTransactionStrExists(amount3) + createTx.verifyImageAltTxt(0, INCOMING) + createTx.verifyStatus(constants.transactionStatus.received) + createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.sep) + createTx.verifyTransactionStrExists(amount8) createTx.verifyTransactionStrExists(time4) - createTx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyTransactionStrExists(success) }) }) - it('Verify all actions can be expanded/collapsed [C56129]', () => { - createTx.clickOnTransactionExpandableItem('Mar 24, 2023', () => { - createTx.verifyTransactionStrNotVible(str1) - createTx.verifyTransactionStrNotVible(str2) - createTx.verifyTransactionStrNotVible(str3) - createTx.clickOnExpandAllBtn() + it('Verify transaction can be expanded/collapsed [C56129]', () => { + createTx.clickOnTransactionExpandableItem('Oct 9, 2023', () => { createTx.verifyTransactionStrExists(str1) createTx.verifyTransactionStrExists(str2) createTx.verifyTransactionStrExists(str3) - createTx.clickOnCollapseAllBtn() - createTx.verifyTransactionStrNotVible(str1) - createTx.verifyTransactionStrNotVible(str2) - createTx.verifyTransactionStrNotVible(str3) + createTx.clickOnExpandIcon() }) }) }) diff --git a/cypress/fixtures/address_book_test.csv b/cypress/fixtures/address_book_test.csv index 1b0547cff1..a5090a64f4 100644 --- a/cypress/fixtures/address_book_test.csv +++ b/cypress/fixtures/address_book_test.csv @@ -1,5 +1,5 @@ address,name,chainId -0x730F87dA2A3C6721e2196DFB990759e9bdfc5083,goerli user 1,5 -0xFD71c1ABadBD37F60E4C8F208386dDFC4d2Bf01f,goerli user 2,5 -0x61a0c717d18232711bC788F19C9Cd56a43cc8872,gno user 1,100 -0x66bE167c36B3b75D1130BBbDec69f9f04E7DA4fC,gno user 2,100 +0x6E834E9D04ad6b26e1525dE1a37BFd9b215f40B7,test-sepolia-3,11155111 +0xf405BC611F4a4c89CCB3E4d083099f9C36D966f8,sepolia-test-4,11155111 +0x03042B890b99552b60A073F808100517fb148F60,sepolia-test-5,11155111 +0xBd69b0a9DC90eB6F9bAc3E4a5875f437348b6415,assets-test-sepolia,11155111 diff --git a/cypress/fixtures/data_import.json b/cypress/fixtures/data_import.json index b1e4a31395..7e9a518053 100644 --- a/cypress/fixtures/data_import.json +++ b/cypress/fixtures/data_import.json @@ -17,12 +17,34 @@ "0x8aEf2f5c3F17261F6F1C4dA058D022BE92776af8": "ow1", "0x0D65139Da4B36a8A39BF1b63e950038D42231b2e": "ow 2" }, + "11155111":{ + "0x6E834E9D04ad6b26e1525dE1a37BFd9b215f40B7":"test-sepolia-3" + }, "137": { "0xC680d44F526f4372693CAc21dcab255b77bc58F4": "Safe 1 Poly", "0x61a0c717d18232711bC788F19C9Cd56a43cc8872": "Test1 Poly" } }, "addedSafes": { + "11155111":{ + + "0x6E834E9D04ad6b26e1525dE1a37BFd9b215f40B7":{ + "owners":[ + { + "value":"0xC16Db0251654C0a72E91B190d81eAD367d2C6fED", + "name":null, + "logoUri":null + }, + { + "value":"0x96D4c6fFC338912322813a77655fCC926b9A5aC5", + "name":null, + "logoUri":null + } + ], + "threshold":1, + "ethBalance":"0" + } + }, "5": { "0x10f999F150a2E7fd356Aa471bCBf0b75aA7b0e2A": { "owners": [ @@ -135,6 +157,12 @@ } }, "safeApps": { + "11155111": { + "pinned": [ + 24 + + ] + }, "5": { "pinned": [ 36, diff --git a/cypress/support/constants.js b/cypress/support/constants.js index ea548667fd..79f92d1a62 100644 --- a/cypress/support/constants.js +++ b/cypress/support/constants.js @@ -10,7 +10,7 @@ export const SEPOLIA_TEST_SAFE_5 = 'sep:0xBd69b0a9DC90eB6F9bAc3E4a5875f437348b64 export const GNO_TEST_SAFE = 'gno:0xB8d760a90a5ed54D3c2b3EFC231277e99188642A' export const PAGINATION_TEST_SAFE = 'gor:0x850493a15914aAC05a821A3FAb973b4598889A7b' export const TEST_SAFE = 'gor:0x04f8b1EA3cBB315b87ced0E32deb5a43cC151a91' -export const EOA = '0xE297437d6b53890cbf004e401F3acc67c8b39665' +export const EOA = '0x03042B890b99552b60A073F808100517fb148F60' export const DEFAULT_OWNER_ADDRESS = '0xC16Db0251654C0a72E91B190d81eAD367d2C6fED' export const SEPOLIA_OWNER_2 = '0x96D4c6fFC338912322813a77655fCC926b9A5aC5' export const TEST_SAFE_2 = 'gor:0xE96C43C54B08eC528e9e815fC3D02Ea94A320505' @@ -24,6 +24,7 @@ export const INFO_MODAL_KEY = `${LS_NAMESPACE}SafeApps__infoModal` export const goerlyE2EWallet = /E2E Wallet @ G(ö|oe)rli/ export const goerlySafeName = /g(ö|oe)rli-safe/ +export const sepoliaSafeName = 'sepolia-safe' export const goerliToken = /G(ö|oe)rli Ether/ export const testAppUrl = 'https://safe-test-app.com' @@ -37,6 +38,7 @@ export const homeUrl = '/home?safe=' export const welcomeUrl = '/welcome' export const chainMaticUrl = '/welcome?chain=matic' export const createNewSafeSepoliaUrl = '/new-safe/create?chain=sep' +export const loadNewSafeSepoliaUrl = '/new-safe/load?chain=sep' export const appsUrl = '/apps' export const requestPermissionsUrl = '/request-permissions' export const getPermissionsUrl = '/get-permissions' @@ -49,10 +51,14 @@ export const validAppUrl = 'https://my-valid-custom-app.com' export const proposeEndpoint = '/**/propose' export const appsEndpoint = '/**/safe-apps' -export const GOERLI_CSV_ENTRY = { - name: 'goerli user 1', - address: '0x730F87dA2A3C6721e2196DFB990759e9bdfc5083', +export const mainSideMenuOptions = { + home: 'Home', } +export const SEPOLIA_CSV_ENTRY = { + name: 'test-sepolia-3', + address: SEPOLIA_TEST_SAFE_3, +} + export const GNO_CSV_ENTRY = { name: 'gno user 1', address: '0x61a0c717d18232711bC788F19C9Cd56a43cc8872', @@ -67,6 +73,13 @@ export const networks = { export const tokenAbbreviation = { gor: 'GOR', + sep: 'ETH', + tta: 'TT_A', + ttb: 'TT_B', + dai: 'DAI', + usds: 'USDC', + aave: 'AAVE', + link: 'LINK', } export const appNames = { From b2a3a6b2675f3853fc991c9a7414d7fe9ec5b480 Mon Sep 17 00:00:00 2001 From: mike10ca Date: Fri, 20 Oct 2023 12:21:59 +0200 Subject: [PATCH 2/3] Remove unused import --- cypress/e2e/pages/load_safe.pages.js | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/pages/load_safe.pages.js b/cypress/e2e/pages/load_safe.pages.js index 6f89e64a89..9ad46717d5 100644 --- a/cypress/e2e/pages/load_safe.pages.js +++ b/cypress/e2e/pages/load_safe.pages.js @@ -1,5 +1,4 @@ import * as constants from '../../support/constants' -import * as createwallet from '../pages/create_wallet.pages' const addExistingAccountBtnStr = 'Add existing Account' const contactStr = 'Name, address & network' From 1633adb82bc30981c480aea110eafa29fbb8c427 Mon Sep 17 00:00:00 2001 From: mike10ca Date: Fri, 20 Oct 2023 13:19:36 +0200 Subject: [PATCH 3/3] Fix tests --- cypress/e2e/pages/dashboard.pages.js | 5 +---- cypress/e2e/smoke/assets.cy.js | 2 +- cypress/support/constants.js | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/pages/dashboard.pages.js b/cypress/e2e/pages/dashboard.pages.js index 17be9494d0..43ad81fa8a 100644 --- a/cypress/e2e/pages/dashboard.pages.js +++ b/cypress/e2e/pages/dashboard.pages.js @@ -28,13 +28,10 @@ export function verifyOverviewWidgetData() { cy.get('@overviewSection').within(() => { // Prefix is separated across elements in EthHashInfo cy.contains(constants.SEPOLIA_TEST_SAFE_5).should('exist') - cy.contains('1/2') + cy.get('h2').contains('Overview') cy.get(`a[href="${constants.BALANCE_URL}${encodeURIComponent(constants.SEPOLIA_TEST_SAFE_5)}"]`).contains( viewAssetsStr, ) - // Text next to Tokens contains a number greater than 0 - cy.contains('p', tokensStr).next().contains('1') - cy.contains('p', nftStr).next().contains('0') }) } diff --git a/cypress/e2e/smoke/assets.cy.js b/cypress/e2e/smoke/assets.cy.js index d7007df2f3..075ac1bd20 100644 --- a/cypress/e2e/smoke/assets.cy.js +++ b/cypress/e2e/smoke/assets.cy.js @@ -11,7 +11,7 @@ describe('Assets tests', () => { const fiatRegex = balances.fiatRegex beforeEach(() => { - cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_4) + cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5) cy.clearLocalStorage() main.acceptCookies() balances.acceptSpamWarning() diff --git a/cypress/support/constants.js b/cypress/support/constants.js index 79f92d1a62..8aff12d459 100644 --- a/cypress/support/constants.js +++ b/cypress/support/constants.js @@ -1,6 +1,7 @@ import { LS_NAMESPACE } from '../../src/config/constants' export const RECIPIENT_ADDRESS = '0x6a5602335a878ADDCa4BF63a050E34946B56B5bC' export const GOERLI_TEST_SAFE = 'gor:0x97d314157727D517A706B5D08507A1f9B44AaaE9' +// SEPOLIA_TEST_SAFE_1 should always have no transactions, tokens and NFTs export const SEPOLIA_TEST_SAFE_1 = 'sep:0xBb26E3717172d5000F87DeFd391994f789D80aEB' // SEPOLIA_TEST_SAFE_2 Has no transactions, 1 owner, using for verificatons only export const SEPOLIA_TEST_SAFE_2 = 'sep:0x33C4AA5729D91FfB3B87AEf8a324bb6304Fb905c'