Skip to content

Commit

Permalink
Tests: Cypress tests cleanup (safe-global#4046)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike10ca authored Aug 6, 2024
1 parent 8c39108 commit b436d87
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 111 deletions.
15 changes: 5 additions & 10 deletions cypress/e2e/pages/safeapps.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,10 @@ export function verifyAppDescription(descr) {

export function clickOnOpenSafeAppBtn() {
cy.get(openSafeAppBtn).click()
cy.wait(2000)
}

export function verifyDisclaimerIsDisplayed() {
verifyDisclaimerIsVisible()
cy.wait(500)
}

function verifyDisclaimerIsVisible() {
Expand All @@ -249,20 +247,17 @@ export function verifyMicrofoneCheckBoxExists() {
return cy.findByRole('checkbox', { name: microfoneCheckBoxStr }).should('exist')
}

export function storeAndVerifyPermissions() {
export function verifyInfoModalAcceptance() {
cy.waitForSelector(() => {
return cy
.findByRole('button', { name: continueBtnStr })
.click()
.wait(500)
.should(() => {
const storedBrowserPermissions = JSON.parse(localStorage.getItem(constants.BROWSER_PERMISSIONS_KEY))
const browserPermissions = Object.values(storedBrowserPermissions)[0][0]
const storedInfoModal = JSON.parse(localStorage.getItem(constants.INFO_MODAL_KEY))

expect(browserPermissions.feature).to.eq('camera')
expect(browserPermissions.status).to.eq('granted')
expect(storedInfoModal['11155111'].consentsAccepted).to.eq(true)
const storedInfoModal = JSON.parse(
localStorage.getItem(constants.localStorageKeys.SAFE_v2__SafeApps__infoModal),
)
expect(storedInfoModal[constants.networkKeys.sepolia].consentsAccepted).to.eq(true)
})
})
}
Expand Down
5 changes: 5 additions & 0 deletions cypress/e2e/pages/sidebar.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ const emptyWatchListStr = 'Watch any Safe Account to keep an eye on its activity
const emptySafeListStr = "You don't have any Safe Accounts yet"
const myAccountsStr = 'My accounts'
const confirmTxStr = (number) => `${number} to confirm`
const pedningTxStr = (n) => `${n} pending transaction`
export const confirmGenStr = 'to confirm'

export function verifyNumberOfPendingTxTag(tx) {
cy.contains(pedningTxStr(tx))
}

export function getImportBtn() {
return cy.get(importBtn).scrollIntoView().should('be.visible')
}
Expand Down
19 changes: 0 additions & 19 deletions cypress/e2e/regression/address_book.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,6 @@ describe('Address book tests', () => {
})
})

//TODO: Rework to use Polygon. Replace Verify csv file can be imported (Goerli) with this test
it.skip('Verify that Sepolia and Polygon addresses can be imported', () => {
// Go to a Safe on Gnosis Chain
cy.get('header')
.contains(/^G(ö|oe)rli$/)
.click()
cy.contains('Gnosis Chain').click()

// Navigate to the Address Book page
cy.visit(`/address-book?safe=${constants.GNO_TEST_SAFE}`)

// Waits for the Address Book table to be in the page
cy.contains('p', 'Address book').should('be.visible')

// Finds the imported Gnosis Chain address
cy.contains(constants.GNO_CSV_ENTRY.name).should('exist')
cy.contains(constants.GNO_CSV_ENTRY.address).should('exist')
})

it('Verify the address book file can be exported', () => {
cy.wrap(null)
.then(() => main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__addressBook, ls.addressBookData.dataSet))
Expand Down
8 changes: 0 additions & 8 deletions cypress/e2e/regression/address_book_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ describe('Address book tests - 2', () => {
addressBook.verifyNameWasChanged(owner1, onwer3)
})

it.skip('Verify copy to clipboard/Etherscan work as expected', () => {
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__addressBook, ls.addressBookData.sepoliaAddress1)
cy.wait(1000)
cy.reload()
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)
Expand Down
26 changes: 0 additions & 26 deletions cypress/e2e/regression/beamer.cy.js

This file was deleted.

4 changes: 0 additions & 4 deletions cypress/e2e/regression/sidebar.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ describe('Sidebar tests', () => {
sideBar.verifyQRModalDisplayed()
})

it.skip('Verify Copy button copies the address', () => {
sideBar.verifyCopyAddressBtn(staticSafes.SEP_STATIC_SAFE_9.substring(4))
})

it('Verify Open blockexplorer button contain etherscan link', () => {
sideBar.verifyEtherscanLinkExists()
})
Expand Down
11 changes: 2 additions & 9 deletions cypress/e2e/regression/sidebar_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,8 @@ describe('Sidebar added sidebar tests', () => {
sideBar.checkCurrencyInHeader(assets.currency$)
})

// Waiting for endpoint from CGW
it.skip('Verify "wallet" tag counter if the safe has tx ready for execution', () => {
it('Verify "wallet" tag counter if the safe has tx ready for execution', () => {
sideBar.openSidebar()
sideBar.verifyMissingSignature(staticSafe200)
})

// Waiting for endpoint from CGW
it.skip('Verify "Wallet" tag counter only shows for owners', () => {
sideBar.openSidebar()
sideBar.verifyQueuedTx(staticSafe200)
sideBar.verifyNumberOfPendingTxTag(1)
})
})
5 changes: 0 additions & 5 deletions cypress/e2e/regression/spending_limits.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@ describe('Spending limits tests', () => {
})
})

it.skip('Verify that clicking on copy icon of a beneficiary works', () => {
tx.verifyNumberOfCopyIcons(3)
tx.verifyCopyIconWorks(0, constants.DEFAULT_OWNER_ADDRESS)
})

it('Verify explorer links contain Sepolia link', () => {
tx.verifyNumberOfExternalLinks(3)
})
Expand Down
13 changes: 0 additions & 13 deletions cypress/e2e/regression/tx_history.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,11 @@ describe('Tx history tests 1', () => {
])
})

it.skip('Verify copy bottons work as expected for account creation', () => {
createTx.clickOnTransactionItemByName(typeCreateAccount.title)
createTx.verifyNumberOfCopyIcons(4)
createTx.verifyCopyIconWorks(0, typeCreateAccount.creator.address)
})

it('Verify external links exist for account creation', () => {
createTx.clickOnTransactionItemByName(typeCreateAccount.title)
createTx.verifyNumberOfExternalLinks(4)
})

// Token receipt
it.skip('Verify copy button copies tx hash', () => {
createTx.clickOnTransactionItemByName(typeReceive.summaryTitle, typeReceive.summaryTxInfo)
createTx.verifyNumberOfCopyIcons(2)
createTx.verifyCopyIconWorks(1, typeReceive.transactionHashCopied)
})

// Token send
it('Verify exapanded details for token send', () => {
createTx.clickOnTransactionItemByName(typeSend.title, typeSend.summaryTxInfo)
Expand Down
15 changes: 5 additions & 10 deletions cypress/e2e/safe-apps/info_modal.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ describe('Info modal tests', () => {
safeapps.verifyDisclaimerIsDisplayed()
})

// Skip tests due to changed logic
// TODO: Discuss furthers
it.skip('Verify the permissions slide is shown if the app require permissions', () => {
safeapps.clickOnContinueBtn()
cy.wait(500) // wait for the animation to finish
safeapps.verifyCameraCheckBoxExists()
})

it.skip('Verify the permissions and consents decision are stored when accepted', () => {
safeapps.storeAndVerifyPermissions()
it('Verify info modal consent is stored when accepted', () => {
safeapps.clickOnApp(safeapps.transactionBuilderStr)
safeapps.clickOnOpenSafeAppBtn()
safeapps.verifyDisclaimerIsDisplayed()
safeapps.verifyInfoModalAcceptance()
})
})
6 changes: 3 additions & 3 deletions cypress/e2e/safe-apps/tx-builder.spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ describe('Transaction Builder tests', { defaultCommandTimeout: 20000 }, () => {
})
})

it.skip('Verify a batch cannot be created without asset amount', () => {
it('Verify a batch cannot be created without asset amount', () => {
cy.enter(iframeSelector).then((getBody) => {
getBody().findByLabelText(safeapps.enterAddressStr).type(safeAppSafes.SEP_SAFEAPP_SAFE_2)
getBody().findByText(safeapps.keepProxiABIStr).click()
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('Transaction Builder tests', { defaultCommandTimeout: 20000 }, () => {
})
})

it.skip('Verify a valid batch as successful can be simulated', () => {
it('Verify a valid batch as successful can be simulated', () => {
cy.enter(iframeSelector).then((getBody) => {
getBody().findByLabelText(safeapps.enterAddressStr).type(safeAppSafes.SEP_SAFEAPP_SAFE_2)
getBody().findByText(safeapps.keepProxiABIStr).click()
Expand All @@ -293,7 +293,7 @@ describe('Transaction Builder tests', { defaultCommandTimeout: 20000 }, () => {
})
})

it.skip('Verify an invalid batch as failed can be simulated', () => {
it('Verify an invalid batch as failed can be simulated', () => {
cy.enter(iframeSelector).then((getBody) => {
getBody().findByLabelText(safeapps.enterAddressStr).type(safeAppSafes.SEP_SAFEAPP_SAFE_2)
getBody().findByText(safeapps.keepProxiABIStr).click()
Expand Down
4 changes: 0 additions & 4 deletions cypress/e2e/smoke/dashboard.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ describe('[SMOKE] Dashboard tests', { defaultCommandTimeout: 20000 }, () => {
dashboard.verifySafeAppsSection()
})

it.skip('[SMOKE] Verify clicking on the share icon copies the app URL to the clipboard', () => {
dashboard.verifyShareBtnWorks(0, dashboard.copiedAppUrl)
})

it('[SMOKE] Verify clicking on Explore Safe apps button opens list of all apps', () => {
dashboard.clickOnExploreAppsBtn()
})
Expand Down

0 comments on commit b436d87

Please sign in to comment.