Skip to content

Commit

Permalink
Tests: Add regex to handle my accounts (#4574)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike10ca authored Nov 28, 2024
1 parent ed631fc commit cc5374c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default defineConfig({
hideXHR: true,
defaultCommandTimeout: 10000,
pageLoadTimeout: 60000,
numTestsKeptInMemory: 0,
numTestsKeptInMemory: 20,
},

chromeWebSecurity: false,
Expand Down
11 changes: 9 additions & 2 deletions cypress/e2e/pages/sidebar.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const testSafeHeaderDetails = ['2/2', safes.SEP_STATIC_SAFE_9_SHORT]
const receiveAssetsStr = 'Receive assets'
const emptyPinnedListStr = 'Watch any Safe Account to keep an eye on its activity'
const emptySafeListStr = "You don't have any safes yet"
const accountsStr = 'Accounts'
const accountsRegex = /(My accounts|Accounts) \((\d+)\)/
const confirmTxStr = (number) => `${number} to confirm`
const pedningTxStr = (n) => `${n} pending`
export const confirmGenStr = 'to confirm'
Expand Down Expand Up @@ -464,7 +464,14 @@ export function verifySafeGiveNameOptionExists(index) {
}

export function checkAccountsCounter(value) {
cy.contains(accountsStr).should('contain', value)
cy.get(sidebarSafeContainer)
.should('exist')
.then(($el) => {
const text = $el.text()
const match = text.match(accountsRegex)
expect(match).not.to.be.null
expect(match[0]).to.exist
})
}

export function checkTxToConfirm(numberOfTx) {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/sidebar_3.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('[PROD] Sidebar tests 3', () => {
})
wallet.connectSigner(signer)
sideBar.openSidebar()
sideBar.checkAccountsCounter(2)
sideBar.checkAccountsCounter('2')
})

it('Verify pending signature is displayed in sidebar for unsigned tx', () => {
Expand Down

0 comments on commit cc5374c

Please sign in to comment.