Skip to content

Commit

Permalink
Tests: add address book pagination tests (#3244)
Browse files Browse the repository at this point in the history
* tests: add address book pagination tests

* tests: update locator in sidebar tests
  • Loading branch information
mike10ca authored Feb 13, 2024
1 parent 6e78cf8 commit 9371cfe
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
13 changes: 13 additions & 0 deletions cypress/e2e/pages/address_book.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const saveBtn = '[data-testid="save-btn"]'
const divInput = '[data-testid="name-input"]'
const exportSummary = '[data-testid="export-summary"]'
const sendBtn = '[data-testid="send-btn"]'
const nextPageBtn = 'button[aria-label="Go to next page"]'
const previousPageBtn = 'button[aria-label="Go to previous page"]'

//TODO Move to specific component
const moreActionIcon = '[data-testid="MoreHorizIcon"]'
Expand Down Expand Up @@ -59,6 +61,17 @@ export const entries = [
'assets-test-sepolia',
]

export function clickOnNextPageBtn() {
cy.get(nextPageBtn).click()
}

export function clickOnPrevPageBtn() {
cy.get(previousPageBtn).click()
}

export function verifyCountOfSafes(count) {
main.verifyElementsCount(tableRow, count)
}
export function verifyRecipientData(data) {
main.verifyValuesExist(addressBookRecipient, data)
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/pages/navigation.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function clickOnNewTxBtn() {

export function clickOnWalletExpandMoreIcon() {
cy.get(expandMoreIcon).eq(0).click()
cy.get(sentinelStart).next().should('be.visible')
cy.get(sentinelStart).next().should('exist')
}

export function clickOnDisconnectBtn() {
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/pages/sidebar.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export function verifySafesByNetwork(netwrok, safes) {
cy.get(sidebarSafeContainer).within(() => {
cy.get(chainLogo)
.contains(netwrok)
.parent()
.next()
.within(() => {
main.verifyValuesExist(sideSafeListItem, safes)
Expand Down
17 changes: 17 additions & 0 deletions cypress/e2e/regression/address_book_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,21 @@ describe('Address book tests - 2', () => {
createtx.verifyCopyIconWorks(0, constants.RECIPIENT_ADDRESS)
createtx.verifyNumberOfExternalLinks(1)
})

it('Verify by default there 25 rows shown per page', () => {
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__addressBook, ls.addressBookData.pagination)
cy.wait(1000)
cy.reload()
addressBook.verifyCountOfSafes(25)
})

it('Verify that clicking on next and previous page buttons shows safes', () => {
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__addressBook, ls.addressBookData.pagination)
cy.wait(1000)
cy.reload()
addressBook.clickOnNextPageBtn()
addressBook.verifyCountOfSafes(1)
addressBook.clickOnPrevPageBtn()
addressBook.verifyCountOfSafes(25)
})
})
31 changes: 31 additions & 0 deletions cypress/support/localstorage_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,37 @@ export const addressBookData = {
'0x6a5602335a878ADDCa4BF63a050E34946B56B5bC': 'BB Safe',
},
},
pagination: {
11155111: {
'0xB8Bfd72663602dB33A454e3D899fb1ee95F54c26': 'Safe 1',
'0x368D6B0Aa605253D19AB7C1F006a61Aa46bbECEb': 'Safe 2',
'0x9190cc22D592dDcf396Fa616ce84a9978fD96Fc9': 'Safe 3',
'0x98705770aF3b18db0a64597F6d4DCe825915fec0': 'Safe 4',
'0xC23e061252BFc7967203D054136d8fA7c7df2fc4': 'Safe 5',
'0x0Ec5EF749cce5185900819A3457C0f9129a9a9a1': 'Safe 6',
'0x0A0EEb6fBCc7c82259E548Fc4617175A357b3e71': 'Safe 7',
'0x10B45a24640E2170B6AA63ea3A289D723a0C9cba': 'Safe 8',
'0xF21445699e91aC6F2EeeAF1a19510AC4197e59aB': 'Safe 9',
'0x9E6DAfe829431e1892EcF8461FDAd02665170c31': 'Safe 10',
'0x6d0b6F96f665Bb4490f9ddb2e450Da2f7e546dC1': 'Safe 11',
'0xB8Bfd72663602dB33A454e3D899fb1ee95F54c26': 'Safe 12',
'0x6E834E9D04ad6b26e1525dE1a37BFd9b215f40B7': 'Safe 13',
'0xBb26E3717172d5000F87DeFd391994f789D80aEB': 'Safe 14',
'0x905934aA8758c06B2422F0C90D97d2fbb6677811': 'Safe 15',
'0xf8D6450d6ae36328cBAA97B1998C741be498c5D3': 'Safe 16',
'0xBd69b0a9DC90eB6F9bAc3E4a5875f437348b6415': 'Safe 17',
'0x5912f6616c84024cD1aff0D5b55bb36F5180fFdb': 'Safe 18',
'0x81034C61a318649F7aD43f9e8C1051427e326443': 'Safe 19',
'0x06373d5e45AD31BD354CeBfA8dB4eD2c75B8708e': 'Safe 20',
'0x4DD4cB2299E491E1B469245DB589ccB2B16d7bde': 'Safe 21',
'0xD1571E8Cc4438aFef2836DD9a0E5D09fb63EDE9a': 'Safe 22',
'0x691B95d2531BFf662767839d668d3D7651524C21': 'Safe 23',
'0x39419cC835046D0c7beca69638eBBDD0F9FD85e4': 'Safe 24',
'0xBf30F749FC027a5d79c4710D988F0D3C8e217A4F': 'Safe 25',
'0x8A89C14ed0900a95fc94075D0823f8c744789a40': 'Safe 26',
'0xc2F3645bfd395516d1a18CA6ad9298299d328C01': 'Safe 27',
},
},
cookies: { necessary: true, updates: true, analytics: true },
}

Expand Down

0 comments on commit 9371cfe

Please sign in to comment.