Files
VaryaandGitHub 69b7318abe fix(tests): Adjust Cypress tests to the latest UI changes (#8248)
* fix: copilot tests: remove overlapping element

* fix: tx_history_4 tests: adjust tests to the latest UI

* fix: tx_history and tx_history_2 tests adjusted to the new ui

* refactor: replace  the data-fragile Cypress E2E with unit tests for the "Safe App tx shows icon + name" behavior

* refactor: adjust Proposers test to the latest UI changes

* refactor: adjust batch_tx tests to the latest ui changes

* refactor: adjust safe creation tests to the latest ui changes

* refactor: adjust tx creation tests to the latest ui changes

* refactor: adjust multichain setup tests to the latest ui changes

* fix: correct string text in the Proposers test

* fix: swap link as per FF

* fix: multichain creation (add a login step; block overlapping beamer)

* chore: bring back the swap prod link

* fix: relay test: use sepolia instead of polygon

* fix: proposers test assertion

* feat: harden the CF tests assertions to distinct newly created safes from existing in the space

* fix: add missing login step to the Multichain Create Safe Flow tests

* feat: add a page function to use the old UI

* chore: remove obsolete healthcheck Cypress tests; adjust comments

* fix: harden the token tests (get token name + value separately from a cell instead of full row); compare both

* fix: adjust swap test with a blocked recipient to the cow widget changes

* refactor: replace browser permission e2e tests with unit / component tests

* fix: recovery tests: bypass Spaces login by setting a classic UI session storage key

* fix: bring back the Custom Recipient logic for swap tests

* fix: flaky multichain network tests
2026-07-08 12:35:54 +02:00

146 lines
4.3 KiB
JavaScript

import * as main from './main.page'
import * as addressBook from './address_book.page'
import * as batch from './batches.pages'
import * as create_tx from './create_tx.pages'
export const proposersSection = '[data-testid="proposer-section"]'
const addProposerBtn = '[data-testid="add-proposer-btn"]'
const deleteProposerBtn = '[data-testid="delete-proposer-btn"]'
const editProposerBtn = '[data-testid="edit-proposer-btn"]'
const confrimDeleteProposerBtn = '[data-testid="confirm-delete-proposer-btn"]'
const submitProposerBtn = '[data-testid="submit-proposer-btn"]'
const safeAsProposerMessage = 'Cannot add Safe account itself as proposer'
const proposedTxMessage = 'This transaction was created by a proposer. Please review and either confirm or reject it.'
const proposerAddedMsg = 'Proposer added successfully!'
export function verifyPropsalStatusExists() {
cy.get(create_tx.proposalStatus).should('exist')
}
export function verifyProposerInTxActionList(address) {
cy.get(create_tx.transactionSideList).within(() => {
cy.contains(address)
})
}
export function verifyProposedTxMsgVisible() {
cy.contains(proposedTxMessage).should('be.visible')
}
export function clickOnAddProposerBtn() {
cy.get(addProposerBtn).click()
}
export function enterProposerName(name) {
addressBook.typeInNameInput(name)
}
export function enterProposerData(address, name) {
addressBook.typeInAddress(address)
enterProposerName(name)
}
export function clickOnSubmitProposerBtn() {
cy.get(submitProposerBtn).click()
verifyProposerSuccessMsgDisplayed()
}
export function checkCreatorAddress(data) {
cy.get(proposersSection).within(() => {
Object.entries(data).forEach(([key, value]) => {
let found = false
cy.get(addressBook.tableRow)
.each(($row) => {
cy.wrap($row)
.find('td')
.eq(1)
.then(($cell) => {
if ($cell.text().includes(value)) {
found = true
}
})
})
.then(() => {
expect(found, `Value "${value}" should be found in td:eq(1) within proposersSection`).to.be.true
})
})
})
}
export function checkProposerData(data) {
cy.get(proposersSection).within(() => {
Object.entries(data).forEach(([key, value]) => {
let found = false
cy.get(addressBook.tableRow)
.each(($row) => {
cy.wrap($row)
.find('td')
.eq(0)
.then(($cell) => {
if ($cell.text().includes(value)) {
found = true
}
})
})
.then(() => {
expect(found, `Value "${value}" should be found in td:eq(0) within proposersSection`).to.be.true
})
})
})
}
export function clickOnEditProposerBtn(address) {
cy.get(proposersSection).within(() => {
cy.get(addressBook.tableRow).contains(address).parents('tr').find(editProposerBtn).click()
})
}
export function confirmProposerDeletion(index) {
cy.get(confrimDeleteProposerBtn).eq(index).click()
}
export function deleteAllProposers() {
cy.get('body').then(($body) => {
if ($body.find(deleteProposerBtn).length > 0) {
cy.get(deleteProposerBtn)
.should('be.enabled')
.then(($items) => {
for (let i = 0; i < $items.length; i++) {
cy.wrap($items[i]).click({ force: true })
confirmProposerDeletion(0)
}
})
}
main.verifyElementsCount(deleteProposerBtn, 0)
})
}
export function verifyAddProposerBtnIsDisabled() {
cy.get(addProposerBtn).should('exist').and('be.disabled')
}
export function checkSafeAsProposerErrorMessage() {
cy.contains('label', safeAsProposerMessage).should('exist')
}
export function verifyBatchDoesNotExist() {
main.verifyElementsCount(batch.batchTxTopBar, 0)
}
export function verifyProposerSuccessMsgDisplayed() {
cy.contains(proposerAddedMsg).should('exist')
}
export function verifyEditProposerBtnDisabled(address) {
cy.get(proposersSection).within(() => {
cy.get(addressBook.tableRow).contains(address).parents('tr').find(editProposerBtn).should('be.disabled')
})
}
export function verifyDeleteProposerBtnIsDisabled(address) {
cy.get(proposersSection).within(() => {
cy.get(addressBook.tableRow).contains(address).parents('tr').find(deleteProposerBtn).should('be.disabled')
})
}