Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.46.0 #4494

Merged
merged 11 commits into from
Nov 7, 2024
1 change: 1 addition & 0 deletions cypress/e2e/pages/address_book.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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"]'
export const entryDialog = '[data-testid="entry-dialog"]'

//TODO Move to specific component
const moreActionIcon = '[data-testid="MoreHorizIcon"]'
Expand Down
13 changes: 13 additions & 0 deletions cypress/e2e/pages/create_tx.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ export function deleteTx() {
cy.get(deleteTxModalBtn).click()
}

export function deleteAllTx() {
cy.get('body').then(($body) => {
if ($body.find(transactionItem).length > 0) {
cy.get(transactionItem).then(($items) => {
for (let i = $items.length - 1; i >= 0; i--) {
cy.wrap($items[i]).click({ force: true })
deleteTx()
}
})
}
})
}

export function setTxType(type) {
cy.get(radioSelector).find('label').contains(type).click()
}
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/pages/main.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,7 @@ export function getAddedSafeAddressFromLocalStorage(chainId, index) {
return safeAddress
})
}

export function changeSafeChainName(originalChain, newChain) {
return originalChain.replace(/^[^:]+:/, newChain + ':')
}
2 changes: 1 addition & 1 deletion cypress/e2e/pages/safeapps.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const testBooleanValue3 = '3 testBooleanValue'
export const transfer2AssetsStr = 'Transfer 2 assets'

export const testTransfer1 = '1 transfer'
export const testTransfer2 = '2 transfer'
export const testTransfer2 = '2 MetaMultiSigWallet: transfer'
export const nativeTransfer2 = '2 native transfer'
export const nativeTransfer1 = '1 native transfer'

Expand Down
87 changes: 84 additions & 3 deletions cypress/e2e/pages/sidebar.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as navigation from './navigation.page.js'
import { safeHeaderInfo } from './import_export.pages.js'
import * as file from './import_export.pages.js'
import safes from '../../fixtures/safes/static.json'
import * as address_book from './address_book.page.js'

export const chainLogo = '[data-testid="chain-logo"]'
const safeIcon = '[data-testid="safe-icon"]'
Expand All @@ -20,8 +21,9 @@ const sideSafeListItem = '[data-testid="safe-list-item"]'
const sidebarSafeHeader = '[data-testid="safe-header-info"]'
const sidebarSafeContainer = '[data-testid="sidebar-safe-container"]'
const safeItemOptionsBtn = '[data-testid="safe-options-btn"]'
const safeItemOptionsRenameBtn = '[data-testid="rename-btn"]'
export const safeItemOptionsRenameBtn = '[data-testid="rename-btn"]'
const safeItemOptionsRemoveBtn = '[data-testid="remove-btn"]'
export const safeItemOptionsAddChainBtn = '[data-testid="add-chain-btn"]'
const nameInput = '[data-testid="name-input"]'
const saveBtn = '[data-testid="save-btn"]'
const cancelBtn = '[data-testid="cancel-btn"]'
Expand All @@ -34,6 +36,14 @@ const showMoreBtn = '[data-testid="show-more-btn" ]'
const importBtn = '[data-testid="import-btn"]'
export const pendingActivationIcon = '[data-testid="pending-activation-icon"]'
const safeItemMenuIcon = '[data-testid="MoreVertIcon"]'
const multichainItemSummary = '[data-testid="multichain-item-summary"]'
const addChainDialog = "[data-testid='add-chain-dialog']"
export const addNetworkBtn = "[data-testid='add-network-btn']"
const subAccountContainer = '[data-testid="subacounts-container"]'
const groupBalance = '[data-testid="group-balance"]'
const groupAddress = '[data-testid="group-address"]'
const groupSafeIcon = '[data-testid="group-safe-icon"]'
const multichainTooltip = '[data-testid="multichain-tooltip"]'
export const importBtnStr = 'Import'
export const exportBtnStr = 'Export'

Expand All @@ -60,6 +70,11 @@ const confirmTxStr = (number) => `${number} to confirm`
const pedningTxStr = (n) => `${n} pending transaction`
export const confirmGenStr = 'to confirm'

export const multichainSafes = {
polygon: 'Multichain polygon',
sepolia: 'Multichain Sepolia',
}

export function verifyNumberOfPendingTxTag(tx) {
cy.contains(pedningTxStr(tx))
}
Expand Down Expand Up @@ -206,10 +221,70 @@ export function verifyQueuedTx(safe) {
return getSafeItemByName(safe).find(queuedTxInfo).should('exist')
}

function clickOnSafeItemOptionsBtn(name) {
export function clickOnSafeItemOptionsBtn(name) {
getSafeItemByName(name).find(safeItemOptionsBtn).click()
}

export function clickOnSafeItemOptionsBtnByIndex(index) {
cy.get(safeItemOptionsBtn).eq(index).click()
}

export function clickOnMultichainItemOptionsBtn(index) {
cy.get(multichainItemSummary).eq(index).find(safeItemOptionsBtn).click()
}

export function checkMultichainTooltipExists(index) {
cy.get(multichainItemSummary).eq(index).find(chainLogo).eq(0).trigger('mouseover', { force: true })

cy.get(multichainTooltip).should('exist')
}

export function checkSafeGroupBalance(index, balance) {
cy.get(multichainItemSummary)
.eq(index)
.find(groupBalance)
.invoke('text')
.then((text) => {
expect(text).to.include(balance)
})
}

export function checkSafeGroupAddress(index, address) {
cy.get(multichainItemSummary)
.eq(index)
.find(groupAddress)
.invoke('text')
.then((text) => {
expect(text).to.include(address)
})
}
export function checkSafeGroupIconsExist(index, icons) {
cy.get(multichainItemSummary).eq(index).find(groupSafeIcon).should('have.length', 1)
cy.get(multichainItemSummary).eq(index).find(safeIcon).should('have.length', icons)
}

export function getSubAccountContainer(index) {
return cy.get(subAccountContainer).eq(index)
}

export function checkThereIsNoOptionsMenu(index) {
getSubAccountContainer(index).find(safeItemOptionsBtn).should('not.exist')
}

export function checkAddNetworkBtnPosition(index) {
cy.get(multichainItemSummary)
.eq(index)
.should('exist')
.within(() => {
cy.get(addNetworkBtn)
.should('exist')
.should('be.visible')
.then(($btn) => {
expect($btn.parent().children().last()[0]).to.equal($btn[0])
})
})
}

export function renameSafeItem(oldName, newName) {
clickOnSafeItemOptionsBtn(oldName)
clickOnRenameBtn()
Expand All @@ -227,8 +302,9 @@ function typeSafeName(name) {
cy.get(nameInput).find('input').clear().type(name)
}

function clickOnRenameBtn() {
export function clickOnRenameBtn() {
cy.get(safeItemOptionsRenameBtn).click()
cy.get(address_book.entryDialog).should('exist')
}

function clickOnRemoveBtn() {
Expand Down Expand Up @@ -298,3 +374,8 @@ export function checkBalanceExists() {
const balance = new RegExp(`\\s*\\d*\\.?\\d*\\s*`, 'i')
const element = cy.get(chainLogo).prev().contains(balance)
}

export function checkAddChainDialogDisplayed() {
cy.get(safeItemOptionsAddChainBtn).click()
cy.get(addChainDialog).should('be.visible')
}
Loading
Loading