Skip to content

Commit

Permalink
Add using of mock safe address
Browse files Browse the repository at this point in the history
  • Loading branch information
mike10ca committed Nov 29, 2024
1 parent d595f12 commit e832b72
Show file tree
Hide file tree
Showing 22 changed files with 65 additions and 69 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/prodhealthcheck/nfts.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as nfts from '../pages/nfts.pages'
import * as createTx from '../pages/create_tx.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import { getMockAddress } from '../../support/utils/ethers.js'

const multipleNFT = ['multiSend']
const multipleNFTAction = 'safeTransferFrom'
Expand Down Expand Up @@ -32,14 +33,13 @@ describe('[PROD] NFTs tests', () => {
nfts.waitForNftItems(2)
})

// TODO: Add Sign action
it('Verify multipls NFTs can be selected and reviewed', () => {
nfts.verifyInitialNFTData()
nfts.selectNFTs(3)
nfts.deselectNFTs([2], 3)
nfts.sendNFT()
nfts.verifyNFTModalData()
nfts.typeRecipientAddress(staticSafes.SEP_STATIC_SAFE_1)
nfts.typeRecipientAddress(getMockAddress())
nfts.clikOnNextBtn()
nfts.verifyReviewModalData(2)
})
Expand All @@ -48,7 +48,7 @@ describe('[PROD] NFTs tests', () => {
nfts.verifyInitialNFTData()
nfts.selectNFTs(2)
nfts.sendNFT()
nfts.typeRecipientAddress(staticSafes.SEP_STATIC_SAFE_1)
nfts.typeRecipientAddress(getMockAddress())
nfts.clikOnNextBtn()
nfts.verifyTxDetails(multipleNFT)
nfts.verifyCountOfActions(2)
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/prodhealthcheck/spending_limits.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as navigation from '../pages/navigation.page'
import * as tx from '../pages/create_tx.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import { getMockAddress } from '../../support/utils/ethers.js'

let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
Expand All @@ -24,12 +25,12 @@ describe('[PROD] Spending limits tests', () => {
//Assume that default reset time is set to One time
wallet.connectSigner(signer)
spendinglimit.clickOnNewSpendingLimitBtn()
spendinglimit.enterBeneficiaryAddress(staticSafes.SEP_STATIC_SAFE_6)
spendinglimit.enterBeneficiaryAddress(getMockAddress())
spendinglimit.enterSpendingLimitAmount(0.1)
spendinglimit.clickOnNextBtn()
spendinglimit.checkReviewData(
tokenAmount,
staticSafes.SEP_STATIC_SAFE_6,
getMockAddress(),
spendinglimit.timePeriodOptions.oneTime.split(' ').join('-'),
)
})
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/regression/add_owner.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import * as owner from '../pages/owners.pages'
import * as addressBook from '../pages/address_book.page'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import * as createTx from '../pages/create_tx.pages.js'
import * as navigation from '../pages/navigation.page'
import { getEvents, events, checkDataLayerEvents } from '../../support/utils/gtag.js'
import { getMockAddress } from '../../support/utils/ethers.js'

let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
Expand Down Expand Up @@ -58,7 +56,7 @@ describe('Add Owners tests', () => {
it('Verify that Name field not mandatory', () => {
wallet.connectSigner(signer)
owner.openAddOwnerWindow()
owner.typeOwnerAddress(constants.SEPOLIA_OWNER_2)
owner.typeOwnerAddress(getMockAddress())
owner.clickOnNextBtn()
owner.verifyConfirmTransactionWindowDisplayed()
})
Expand Down
7 changes: 4 additions & 3 deletions cypress/e2e/regression/batch_tx.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import * as ls from '../../support/localstorage_data.js'
import * as navigation from '../pages/navigation.page.js'
import { getMockAddress } from '../../support/utils/ethers.js'

const currentNonce = 3
const funds_first_tx = '0.001'
Expand All @@ -29,13 +30,13 @@ describe('Batch transaction tests', { defaultCommandTimeout: 30000 }, () => {

it('Verify the Add batch button is present in a transaction form', () => {
//The "true" is to validate that the add to batch button is not visible if "Yes, execute" is selected
batch.addNewTransactionToBatch(constants.EOA, currentNonce, funds_first_tx)
batch.addNewTransactionToBatch(getMockAddress(), currentNonce, funds_first_tx)
})

it('Verify a second transaction can be added to the batch', () => {
batch.addNewTransactionToBatch(constants.EOA, currentNonce, funds_first_tx)
batch.addNewTransactionToBatch(getMockAddress(), currentNonce, funds_first_tx)
cy.wait(1000)
batch.addNewTransactionToBatch(constants.EOA, currentNonce, funds_first_tx)
batch.addNewTransactionToBatch(getMockAddress(), currentNonce, funds_first_tx)
batch.verifyBatchIconCount(2)
batch.clickOnBatchCounter()
batch.verifyAmountTransactionsInBatch(2)
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/regression/create_safe_simple.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as createwallet from '../pages/create_wallet.pages'
import * as owner from '../pages/owners.pages'
import * as ls from '../../support/localstorage_data.js'
import * as wallet from '../../support/utils/wallet.js'
import { getMockAddress } from '../../support/utils/ethers.js'

const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY
Expand Down Expand Up @@ -107,7 +108,7 @@ describe('Safe creation tests', () => {
createwallet.typeOwnerAddress(constants.DEFAULT_OWNER_ADDRESS, 1)
owner.verifyErrorMsgInvalidAddress(constants.addressBookErrrMsg.ownerAdded)

createwallet.typeOwnerAddress(constants.DEFAULT_OWNER_ADDRESS.toUpperCase(), 1)
createwallet.typeOwnerAddress(getMockAddress().replace('A', 'a'), 1)
owner.verifyErrorMsgInvalidAddress(constants.addressBookErrrMsg.invalidChecksum)

createwallet.typeOwnerAddress(constants.ENS_TEST_SEPOLIA_INVALID, 1)
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/regression/load_safe_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as safe from '../pages/load_safe.pages'
import * as ls from '../../support/localstorage_data.js'
import * as owner from '../pages/owners.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import { getMockAddress } from '../../support/utils/ethers.js'

let staticSafes,
fundSafes = []
Expand Down Expand Up @@ -91,7 +92,7 @@ describe('Load Safe tests 2', () => {
})

it('Verify a valid address can be entered', () => {
safe.inputAddress(staticSafes.SEP_STATIC_SAFE_13)
safe.inputAddress(getMockAddress())
safe.verifyAddresFormatIsValid()
})

Expand All @@ -107,7 +108,7 @@ describe('Load Safe tests 2', () => {
})

it('Verify that the wrong prefix is not allowed', () => {
safe.inputAddress(fundSafes.ETH_FUNDS_SAFE_13)
safe.inputAddress(`eth:${getMockAddress()}`)
owner.verifyErrorMsgInvalidAddress(constants.addressBookErrrMsg.prefixMismatch)
safe.verifyNextButtonStatus(constants.enabledStates.disabled)
})
Expand Down
12 changes: 3 additions & 9 deletions cypress/e2e/regression/multichain_create_safe.cy.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
import * as constants from '../../support/constants.js'
import * as main from '../pages/main.page.js'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import * as createwallet from '../pages/create_wallet.pages'
import * as createtx from '../pages/create_tx.pages.js'
import * as tx from '../pages/transactions.page.js'
import * as owner from '../pages/owners.pages'

let staticSafes = []
import { getMockAddress } from '../../support/utils/ethers.js'

const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Multichain safe creation tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.welcomeUrl + '?chain=sep')
cy.wait(2000)
Expand Down Expand Up @@ -61,7 +55,7 @@ describe('Multichain safe creation tests', () => {
createwallet.selectMultiNetwork(1, constants.networks.polygon.toLowerCase())
createwallet.clickOnNextBtn()
owner.clickOnAddSignerBtn()
owner.typeOwnerAddressCreateSafeStep(1, constants.SEPOLIA_OWNER_2)
owner.typeOwnerAddressCreateSafeStep(1, getMockAddress())
owner.clickOnThresholdDropdown()
owner.getThresholdOptions().eq(1).click()
createwallet.clickOnNextBtn()
Expand All @@ -79,7 +73,7 @@ describe('Multichain safe creation tests', () => {
createwallet.selectMultiNetwork(1, constants.networks.polygon.toLowerCase())
createwallet.clickOnNextBtn()
owner.clickOnAddSignerBtn()
owner.typeOwnerAddressCreateSafeStep(1, constants.SEPOLIA_OWNER_2)
owner.typeOwnerAddressCreateSafeStep(1, getMockAddress())
owner.clickOnThresholdDropdown()
owner.getThresholdOptions().eq(0).click()
createwallet.clickOnNextBtn()
Expand Down
10 changes: 2 additions & 8 deletions cypress/e2e/regression/multichain_create_safe_flow.cy.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import * as constants from '../../support/constants.js'
import * as main from '../pages/main.page.js'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import * as createwallet from '../pages/create_wallet.pages.js'
import * as owner from '../pages/owners.pages.js'

let staticSafes = []
import { getMockAddress } from '../../support/utils/ethers.js'

const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Multichain safe creation flow tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.welcomeUrl + '?chain=sep')
cy.wait(2000)
Expand Down Expand Up @@ -54,7 +48,7 @@ describe('Multichain safe creation flow tests', () => {
createwallet.selectMultiNetwork(1, constants.networks.polygon.toLowerCase())
createwallet.clickOnNextBtn()
owner.clickOnAddSignerBtn()
owner.typeOwnerAddressCreateSafeStep(1, constants.SEPOLIA_OWNER_2)
owner.typeOwnerAddressCreateSafeStep(1, getMockAddress())
createwallet.clickOnNextBtn()
createwallet.clickOnReviewStepNextBtn()
main.verifyElementsExist([createwallet.cfSafeActivationMsg, createwallet.cfSafeCreationSuccessMsg])
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/regression/multichain_network.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Multichain add network tests', () => {
// Skip due to issues with Polygon
describe.skip('Multichain add network tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/regression/multichain_networkswitch.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const signer = walletCredentials.OWNER_4_PRIVATE_KEY
// DO NOT use OWNER_2_PRIVATE_KEY for safe creation. Used for CF safes.
const signer2 = walletCredentials.OWNER_2_PRIVATE_KEY

describe('Multichain header network switch tests', { defaultCommandTimeout: 30000 }, () => {
// Skip due to issues with Polygon
describe.skip('Multichain header network switch tests', { defaultCommandTimeout: 30000 }, () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/regression/multichain_setup.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const signer = walletCredentials.OWNER_4_PRIVATE_KEY
// DO NOT use OWNER_2_PRIVATE_KEY for safe creation. Used for CF safes.
const signer2 = walletCredentials.OWNER_2_PRIVATE_KEY

describe('Multichain setup tests', { defaultCommandTimeout: 30000 }, () => {
// Skip due to issues with Polygon
describe.skip('Multichain setup tests', { defaultCommandTimeout: 30000 }, () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/regression/nfts.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as navigation from '../pages/navigation.page'
import * as createTx from '../pages/create_tx.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import { getMockAddress } from '../../support/utils/ethers.js'

const singleNFT = ['safeTransferFrom']
const multipleNFT = ['multiSend']
Expand Down Expand Up @@ -35,14 +36,13 @@ describe('NFTs tests', () => {
})

// Added to prod
// TODO: Add Sign action
it('Verify multipls NFTs can be selected and reviewed', () => {
nfts.verifyInitialNFTData()
nfts.selectNFTs(3)
nfts.deselectNFTs([2], 3)
nfts.sendNFT()
nfts.verifyNFTModalData()
nfts.typeRecipientAddress(staticSafes.SEP_STATIC_SAFE_1)
nfts.typeRecipientAddress(getMockAddress())
nfts.clikOnNextBtn()
nfts.verifyReviewModalData(2)
})
Expand All @@ -51,7 +51,7 @@ describe('NFTs tests', () => {
nfts.verifyInitialNFTData()
nfts.selectNFTs(1)
nfts.sendNFT()
nfts.typeRecipientAddress(staticSafes.SEP_STATIC_SAFE_1)
nfts.typeRecipientAddress(getMockAddress())
nfts.clikOnNextBtn()
nfts.verifyTxDetails(singleNFT)
nfts.verifyCountOfActions(0)
Expand All @@ -62,7 +62,7 @@ describe('NFTs tests', () => {
nfts.verifyInitialNFTData()
nfts.selectNFTs(2)
nfts.sendNFT()
nfts.typeRecipientAddress(staticSafes.SEP_STATIC_SAFE_1)
nfts.typeRecipientAddress(getMockAddress())
nfts.clikOnNextBtn()
nfts.verifyTxDetails(multipleNFT)
nfts.verifyCountOfActions(2)
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/regression/proposers.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as wallet from '../../support/utils/wallet.js'
import * as navigation from '../pages/navigation.page.js'
import * as ls from '../../support/localstorage_data.js'
import * as proposer from '../pages/proposers.pages.js'
import { getMockAddress } from '../../support/utils/ethers.js'

let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
Expand Down Expand Up @@ -50,10 +51,7 @@ describe('Proposers tests', () => {

it('Verify that a proposer address must be checksummed', () => {
proposer.clickOnAddProposerBtn()
proposer.enterProposerData(
staticSafes.SEP_STATIC_SAFE_31.substring(4).replace('E', 'e'),
main.generateRandomString(5),
)
proposer.enterProposerData(getMockAddress().replace('A', 'a'), main.generateRandomString(5))
owner.verifyErrorMsgInvalidAddress(constants.addressBookErrrMsg.invalidChecksum)
})

Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/regression/proposers_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as wallet from '../../support/utils/wallet.js'
import * as proposer from '../pages/proposers.pages.js'
import * as createtx from '../pages/create_tx.pages.js'
import * as tx from '../pages/transactions.page.js'
import { getMockAddress } from '../../support/utils/ethers.js'

let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
Expand All @@ -26,7 +27,7 @@ describe('Proposers 2 tests', () => {
wallet.connectSigner(signer)
createtx.clickOnNewtransactionBtn()
createtx.clickOnSendTokensBtn()
createtx.typeRecipientAddress(constants.EOA)
createtx.typeRecipientAddress(getMockAddress())
createtx.setSendValue(sendValue)
createtx.clickOnNextBtn()
tx.selectExecuteNow()
Expand All @@ -41,7 +42,7 @@ describe('Proposers 2 tests', () => {
wallet.connectSigner(signer2)
createtx.clickOnNewtransactionBtn()
createtx.clickOnSendTokensBtn()
createtx.typeRecipientAddress(constants.EOA)
createtx.typeRecipientAddress(getMockAddress())
createtx.setSendValue(sendValue)
createtx.clickOnNextBtn()
createtx.verifySubmitBtnIsEnabled()
Expand Down
7 changes: 4 additions & 3 deletions cypress/e2e/regression/recovery.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import * as modules from '../pages/modules.page.js'
import * as navigation from '../pages/navigation.page.js'
import { getMockAddress } from '../../support/utils/ethers.js'

let recoverySafes,
staticSafes = []
Expand Down Expand Up @@ -144,7 +145,7 @@ describe('Recovery regression tests', { defaultCommandTimeout: 50000 }, () => {
recovery.clickOnSetupRecoveryBtn()
recovery.clickOnSetupRecoveryModalBtn()
recovery.clickOnNextBtn()
recovery.enterRecovererAddress(constants.SEPOLIA_OWNER_2)
recovery.enterRecovererAddress(getMockAddress())
recovery.agreeToTerms()
recovery.clickOnNextBtn()
navigation.clickOnModalCloseBtn(0)
Expand Down Expand Up @@ -186,7 +187,7 @@ describe('Recovery regression tests', { defaultCommandTimeout: 50000 }, () => {
recovery.enterRecovererAddress(main.generateRandomString(10), 1)
owner.verifyErrorMsgInvalidAddress(constants.addressBookErrrMsg.invalidFormat)

recovery.enterRecovererAddress(constants.DEFAULT_OWNER_ADDRESS.toUpperCase(), 1)
recovery.enterRecovererAddress(getMockAddress().replace('A', 'a'), 1)
owner.verifyErrorMsgInvalidAddress(constants.addressBookErrrMsg.invalidChecksum)

recovery.enterRecovererAddress(constants.ENS_TEST_SEPOLIA_INVALID, 1)
Expand All @@ -206,7 +207,7 @@ describe('Recovery regression tests', { defaultCommandTimeout: 50000 }, () => {
recovery.clickOnRecoverLaterBtn()
cy.visit(constants.homeUrl + recoverySafes.SEP_RECOVERY_SAFE_4)
recovery.clickOnStartRecoveryBtn()
recovery.enterRecovererAddress(constants.SEPOLIA_OWNER_2)
recovery.enterRecovererAddress(getMockAddress())
navigation.clickOnWalletExpandMoreIcon()
navigation.clickOnDisconnectBtn()
})
Expand Down
Loading

0 comments on commit e832b72

Please sign in to comment.