diff --git a/cypress/e2e/happypath/sendfunds_connected_wallet.cy.js b/cypress/e2e/happypath/sendfunds_connected_wallet.cy.js index c465ead4b1..108d09c1dc 100644 --- a/cypress/e2e/happypath/sendfunds_connected_wallet.cy.js +++ b/cypress/e2e/happypath/sendfunds_connected_wallet.cy.js @@ -13,8 +13,8 @@ import { createSafes } from '../../support/api/utils_protocolkit' import { contracts, abi_qtrust, abi_nft_pc2 } from '../../support/api/contracts' import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js' -const safeBalanceEth = 305220000000000000n -const qtrustBanance = 95000000000000000025n +const safeBalanceEth = 305230000000000000n +const qtrustBanance = 99000000000000000025n const transferAmount = '1' const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS')) diff --git a/cypress/e2e/pages/create_wallet.pages.js b/cypress/e2e/pages/create_wallet.pages.js index 342330fa96..b8a0ed5b57 100644 --- a/cypress/e2e/pages/create_wallet.pages.js +++ b/cypress/e2e/pages/create_wallet.pages.js @@ -29,6 +29,16 @@ const cancelBtn = '[data-testid="cancel-btn"]' const dialogConfirmBtn = '[data-testid="dialog-confirm-btn"]' const safeActivationSection = '[data-testid="activation-section"]' const addressAutocompleteOptions = '[data-testid="address-item"]' +export const qrCode = '[data-testid="qr-code"]' +export const addressInfo = '[data-testid="address-info"]' +const choiceBtn = '[data-testid="choice-btn"]' +const addFundsBtn = '[data-testid="add-funds-btn"]' +const createTxBtn = '[data-testid="create-tx-btn"]' +const qrCodeSwitch = '[data-testid="qr-code-switch"]' +export const activateAccountBtn = '[data-testid="activate-account-btn"]' +const notificationsSwitch = '[data-testid="notifications-switch"]' +export const addFundsSection = '[data-testid="add-funds-section"]' +export const noTokensAlert = '[data-testid="no-tokens-alert"]' const sponsorStr = 'Your account is sponsored by Goerli' const safeCreationProcessing = 'Transaction is being executed' @@ -38,11 +48,52 @@ const policy1_2 = '1/1 policy' export const walletName = 'test1-sepolia-safe' export const defaultSepoliaPlaceholder = 'Sepolia Safe' const welcomeToSafeStr = 'Welcome to Safe' +const initialSteps = '0 of 2 steps completed' +export const addSignerStr = 'Add signer' +export const accountRecoveryStr = 'Account recovery' +export const sendTokensStr = 'Send tokens' + +export function checkNotificationsSwitchIs(status) { + cy.get(notificationsSwitch).find('input').should(`be.${status}`) +} + +export function clickOnActivateAccountBtn() { + cy.get(activateAccountBtn).click() +} + +export function clickOnQRCodeSwitch() { + cy.get(qrCodeSwitch).click() +} + +export function checkQRCodeSwitchStatus(state) { + cy.get(qrCodeSwitch).find('input').should(state) +} + +export function checkInitialStepsDisplayed() { + cy.contains(initialSteps).should('be.visible') +} + +export function clickOnAddFundsBtn() { + cy.get(addFundsBtn).click() +} + +export function clickOnCreateTxBtn() { + cy.get(createTxBtn).click() + main.verifyElementsCount(choiceBtn, 6) +} + +export function checkAllTxTypesOrder(expectedOrder) { + main.checkTextOrder(choiceBtn, expectedOrder) +} + +export function clickOnTxType(tx) { + cy.get(choiceBtn).contains(tx).click() +} export function verifyNewSafeDialogModal() { main.verifyElementsIsVisible([dialogConfirmBtn]) } -// + export function verifyCFSafeCreated() { main.verifyElementsIsVisible([sidebar.pendingActivationIcon, safeActivationSection]) } diff --git a/cypress/e2e/pages/main.page.js b/cypress/e2e/pages/main.page.js index b8547b1318..5e05873b53 100644 --- a/cypress/e2e/pages/main.page.js +++ b/cypress/e2e/pages/main.page.js @@ -273,7 +273,7 @@ export function addToLocalStorage(key, jsonValue) { export function checkTextOrder(selector, expectedTextArray) { cy.get(selector).each((element, index) => { const text = Cypress.$(element).text().trim() - expect(text).to.eq(expectedTextArray[index]) + expect(text).to.include(expectedTextArray[index]) }) } diff --git a/cypress/e2e/regression/create_safe_cf.cy.js b/cypress/e2e/regression/create_safe_cf.cy.js new file mode 100644 index 0000000000..94583c88dc --- /dev/null +++ b/cypress/e2e/regression/create_safe_cf.cy.js @@ -0,0 +1,152 @@ +import * as constants from '../../support/constants' +import * as main from '../pages/main.page' +import * as createwallet from '../pages/create_wallet.pages' +import * as owner from '../pages/owners.pages' +import * as navigation from '../pages/navigation.page.js' +import * as ls from '../../support/localstorage_data.js' +import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js' +import * as safeapps from '../pages/safeapps.pages' + +let staticSafes = [] +const txOrder = [ + 'Activate Safe now', + 'Add another signer', + 'Set up recovery', + 'Swap tokens', + 'Custom transaction', + 'Send token', +] + +describe('CF Safe regression tests', () => { + before(async () => { + staticSafes = await getSafes(CATEGORIES.static) + }) + + beforeEach(() => { + cy.clearLocalStorage() + cy.visit(constants.homeUrl + staticSafes.SEP_STATIC_SAFE_14) + main.acceptCookies() + }) + + it('Verify Add native assets and Create tx modals can be opened', () => { + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + owner.waitForConnectionStatus() + createwallet.clickOnAddFundsBtn() + main.verifyElementsIsVisible([createwallet.qrCode]) + navigation.clickOnModalCloseBtn() + + createwallet.clickOnCreateTxBtn() + navigation.clickOnModalCloseBtn() + }) + + it('Verify "0 out of 2 step completed" is shown in the dashboard', () => { + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + owner.waitForConnectionStatus() + createwallet.checkInitialStepsDisplayed() + }) + + it('Verify "Add native assets" button opens a modal with a QR code and the safe address', () => { + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + owner.waitForConnectionStatus() + createwallet.clickOnAddFundsBtn() + main.verifyElementsIsVisible([createwallet.qrCode, createwallet.addressInfo]) + }) + + it('Verify QR code switch status change works in "Add native assets" modal', () => { + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + owner.waitForConnectionStatus() + createwallet.clickOnAddFundsBtn() + createwallet.checkQRCodeSwitchStatus(constants.checkboxStates.checked) + createwallet.clickOnQRCodeSwitch() + createwallet.checkQRCodeSwitchStatus(constants.checkboxStates.unchecked) + }) + + it('Verify "Create new transaction" modal contains tx types in sequence', () => { + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + owner.waitForConnectionStatus() + createwallet.clickOnCreateTxBtn() + createwallet.checkAllTxTypesOrder(txOrder) + }) + + it('Verify "Add safe now" button takes to a tx "Activate account"', () => { + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + owner.waitForConnectionStatus() + createwallet.clickOnCreateTxBtn() + createwallet.clickOnTxType(txOrder[0]) + main.verifyElementsIsVisible([createwallet.activateAccountBtn]) + }) + + it('Verify "Add another Owner" takes to a tx Add owner', () => { + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + owner.waitForConnectionStatus() + createwallet.clickOnCreateTxBtn() + createwallet.clickOnTxType(txOrder[1]) + main.verifyTextVisibility([createwallet.addSignerStr]) + }) + + it('Verify "Setup recovery" button takes to the "Account recovery" flow', () => { + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + owner.waitForConnectionStatus() + createwallet.clickOnCreateTxBtn() + createwallet.clickOnTxType(txOrder[2]) + main.verifyTextVisibility([createwallet.accountRecoveryStr]) + }) + + it('Verify "Send token" takes to the tx form to send tokens', () => { + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + owner.waitForConnectionStatus() + createwallet.clickOnCreateTxBtn() + createwallet.clickOnTxType(txOrder[5]) + main.verifyTextVisibility([createwallet.sendTokensStr]) + }) + + it('Verify "Custom transaction" takes to the tx builder app ', () => { + const iframeSelector = `iframe[id="iframe-${constants.TX_Builder_url}"]` + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + main.addToLocalStorage( + constants.localStorageKeys.SAFE_v2__SafeApps__infoModal, + ls.appPermissions(constants.safeTestAppurl).infoModalAccepted, + ) + cy.reload() + owner.waitForConnectionStatus() + createwallet.clickOnCreateTxBtn() + createwallet.clickOnTxType(txOrder[4]) + main.getIframeBody(iframeSelector).within(() => { + cy.contains(safeapps.transactionBuilderStr) + }) + }) + + it('Verify "Notifications" in the settings are disabled', () => { + owner.waitForConnectionStatus() + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + cy.visit(constants.notificationsUrl + staticSafes.SEP_STATIC_SAFE_14) + createwallet.checkNotificationsSwitchIs(constants.enabledStates.disabled) + }) + + it('Verify in assets, that a "Add funds" block is present', () => { + owner.waitForConnectionStatus() + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + cy.visit(constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_14) + main.verifyElementsIsVisible([createwallet.addFundsSection, createwallet.noTokensAlert]) + }) + + it('Verify clicking on "Activate now" button opens safe activation flow', () => { + owner.waitForConnectionStatus() + main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__undeployedSafes, ls.undeployedSafe.safe1) + cy.reload() + cy.visit(constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_14) + createwallet.clickOnActivateAccountBtn() + main.verifyElementsIsVisible([createwallet.activateAccountBtn]) + }) +}) diff --git a/cypress/e2e/regression/spending_limits.cy.js b/cypress/e2e/regression/spending_limits.cy.js index c99b764779..ad8ea980ab 100644 --- a/cypress/e2e/regression/spending_limits.cy.js +++ b/cypress/e2e/regression/spending_limits.cy.js @@ -19,7 +19,7 @@ describe('Spending limits tests', () => { }) beforeEach(() => { - cy.visit(constants.securityUrl + staticSafes.SEP_STATIC_SAFE_8) + cy.visit(constants.setupUrl + staticSafes.SEP_STATIC_SAFE_8) cy.clearLocalStorage() main.acceptCookies() owner.waitForConnectionStatus() diff --git a/cypress/e2e/regression/spending_limits_nonowner.cy.js b/cypress/e2e/regression/spending_limits_nonowner.cy.js index bd2d2dc1cc..fb2e0eaeed 100644 --- a/cypress/e2e/regression/spending_limits_nonowner.cy.js +++ b/cypress/e2e/regression/spending_limits_nonowner.cy.js @@ -12,7 +12,7 @@ describe('Spending limits non-owner tests', () => { }) beforeEach(() => { - cy.visit(constants.securityUrl + staticSafes.SEP_STATIC_SAFE_3) + cy.visit(constants.setupUrl + staticSafes.SEP_STATIC_SAFE_3) cy.clearLocalStorage() main.acceptCookies() owner.waitForConnectionStatus() diff --git a/cypress/e2e/smoke/spending_limits.cy.js b/cypress/e2e/smoke/spending_limits.cy.js index ad815a8f39..e21de79926 100644 --- a/cypress/e2e/smoke/spending_limits.cy.js +++ b/cypress/e2e/smoke/spending_limits.cy.js @@ -12,7 +12,7 @@ describe('[SMOKE] Spending limits tests', () => { }) beforeEach(() => { - cy.visit(constants.securityUrl + staticSafes.SEP_STATIC_SAFE_8) + cy.visit(constants.setupUrl + staticSafes.SEP_STATIC_SAFE_8) cy.clearLocalStorage() main.acceptCookies() owner.waitForConnectionStatus() diff --git a/cypress/fixtures/safes/static.json b/cypress/fixtures/safes/static.json index 14e88c853e..3a470ab92b 100644 --- a/cypress/fixtures/safes/static.json +++ b/cypress/fixtures/safes/static.json @@ -12,5 +12,6 @@ "SEP_STATIC_SAFE_10": "sep:0xc2F3645bfd395516d1a18CA6ad9298299d328C01", "SEP_STATIC_SAFE_11": "sep:0x10B45a24640E2170B6AA63ea3A289D723a0C9cba", "SEP_STATIC_SAFE_12": "sep:0xFFfaC243A24EecE6553f0Da278322aCF1Fb6CeF1", - "SEP_STATIC_SAFE_13": "sep:0x027bBe128174F0e5e5d22ECe9623698E01cd3970" + "SEP_STATIC_SAFE_13": "sep:0x027bBe128174F0e5e5d22ECe9623698E01cd3970", + "SEP_STATIC_SAFE_14": "sep:0xe41D568F5040FD9adeE8B64200c6B7C363C68c41" } diff --git a/cypress/fixtures/txhistory_data_data.json b/cypress/fixtures/txhistory_data_data.json index c0b15960a5..b5b2d020d9 100644 --- a/cypress/fixtures/txhistory_data_data.json +++ b/cypress/fixtures/txhistory_data_data.json @@ -130,11 +130,11 @@ } }, "deleteSpendingLimit": { - "title": "Contract interaction", + "title": "AllowanceModule", "summaryTxInfo": "deleteAllowance", "summaryTime": "11:08 AM", "description": "Delete spending limit", - "altImage": "Contract interaction", + "altImage": "AllowanceModule", "beneficiary": "Beneficiary", "beneficiaryAddress": "sep:0xC16Db0251654C0a72E91B190d81eAD367d2C6fED", "transactionHash": "0xd6e8...de8b", diff --git a/cypress/support/constants.js b/cypress/support/constants.js index 8b883c0224..ddd4bdf3ab 100644 --- a/cypress/support/constants.js +++ b/cypress/support/constants.js @@ -62,7 +62,8 @@ export const getPermissionsUrl = '/get-permissions' export const appSettingsUrl = '/settings/safe-apps' export const setupUrl = '/settings/setup?safe=' export const dataSettingsUrl = '/settings/data?safe=' -export const securityUrl = '/settings/setup?safe=' +export const securityUrl = '/settings/security?safe=' +export const notificationsUrl = '/settings/notifications?safe=' export const invalidAppUrl = 'https://my-invalid-custom-app.com/manifest.json' export const validAppUrlJson = 'https://my-valid-custom-app.com/manifest.json' export const validAppUrl = 'https://my-valid-custom-app.com' @@ -235,6 +236,7 @@ export const localStorageKeys = { SAFE_v2__customSafeApps_11155111: 'SAFE_v2__customSafeApps-11155111', SAFE_v2__SafeApps__browserPermissions: 'SAFE_v2__SafeApps__browserPermissions', SAFE_v2__SafeApps__infoModal: 'SAFE_v2__SafeApps__infoModal', + SAFE_v2__undeployedSafes: 'SAFE_v2__undeployedSafes', } export const connectWalletNames = { diff --git a/cypress/support/localstorage_data.js b/cypress/support/localstorage_data.js index 7972fa2db0..a2f56569a3 100644 --- a/cypress/support/localstorage_data.js +++ b/cypress/support/localstorage_data.js @@ -656,3 +656,21 @@ export const cookies = { acceptedCookies: { necessary: true, updates: true, analytics: true }, acceptedTokenListOnboarding: true, } + +export const undeployedSafe = { + safe1: { + 11155111: { + '0xe41D568F5040FD9adeE8B64200c6B7C363C68c41': { + props: { + safeAccountConfig: { + threshold: 1, + owners: ['0xC16Db0251654C0a72E91B190d81eAD367d2C6fED'], + fallbackHandler: '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804', + }, + safeDeploymentConfig: { saltNonce: '20', safeVersion: '1.3.0' }, + }, + status: { status: 'AWAITING_EXECUTION' }, + }, + }, + }, +} diff --git a/src/components/common/AddFunds/index.tsx b/src/components/common/AddFunds/index.tsx index f7c6d6dd22..b9e549f9df 100644 --- a/src/components/common/AddFunds/index.tsx +++ b/src/components/common/AddFunds/index.tsx @@ -16,7 +16,7 @@ const AddFundsCTA = () => { const qrCode = `${qrPrefix}${safeAddress}` return ( - +
diff --git a/src/components/common/ChoiceButton/index.tsx b/src/components/common/ChoiceButton/index.tsx index 8e5dbec291..9a99c8b178 100644 --- a/src/components/common/ChoiceButton/index.tsx +++ b/src/components/common/ChoiceButton/index.tsx @@ -21,7 +21,7 @@ const ChoiceButton = ({ chip?: string }) => { return ( - + { {(isOk) => ( diff --git a/src/features/counterfactual/CheckBalance.tsx b/src/features/counterfactual/CheckBalance.tsx index 1cc5cc9018..6424ea57ee 100644 --- a/src/features/counterfactual/CheckBalance.tsx +++ b/src/features/counterfactual/CheckBalance.tsx @@ -16,7 +16,12 @@ const CheckBalance = () => { const blockExplorerLink = chain ? getBlockExplorerLink(chain, safeAddress) : undefined return ( - + Don't see your tokens?