mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
* tests(web): connect wallet via seeded storage in e2e Replace the UI-driven connectSigner flow with storage-seeded auto-reconnect across the Cypress suite. Adds connectSignerViaStorage (seed on visit, or seed + reload) and migrates 139 entry connects; keeps UI connectSigner for the 27 connect/switch-flow sites that act on in-page state. * tests(web): seed batch via single page load in batch e2e Add optional extraStorage to connectSignerViaStorage so localStorage is seeded in onBeforeLoad on the initial visit. Split batch_tx into build-via-UI and pre-seeded describes, dropping addToLocalStorage + cy.reload() double-loads. * tests(web): seed state on a single page load across e2e specs Replace visit-then-write-then-reload double-loads with a single seeded load (extraStorage on connectSignerViaStorage, or onBeforeLoad on cy.visit), and drop the arbitrary post-reload settle waits. Covers the multichain, nested-safes, batch, address-book, safe-selector and create-safe specs (regression, smoke, visual). * tests(web): seed state on a single page load in more e2e specs Fold pre-seeded localStorage into the initial visit (extraStorage / onBeforeLoad) and drop the follow-up reloads across the address-book, messages-popup, CF-safe, import/export and load-safe specs. Split specs whose shared beforeEach served both seeding and non-seeding tests into nested describes so no test double-loads. * tests(web): remove redundant wallet reconnect reloads in e2e specs Pass the URL to connectSignerViaStorage so the wallet is seeded on the initial visit instead of visiting then reconnecting (which reloaded). Where a shared beforeEach served both connected and disconnected (or differently-seeded) tests, split into nested describes so no test double-loads. Covers proposers, swaps, twaps, assets, swaps_tokens, sidebar, spending_limits, bulk_execution, proposers_2, safe_selector. * tests(web): single-load owner-management e2e specs Split add/remove/replace-owner specs into connected / disconnected / non-owner / pre-seeded describes so the wallet is seeded on the initial visit (no reconnect reload) without forcing a connect onto tests that assert disconnected or non-owner state. * tests(web): wait for wallet connection after seeded connect The last wallet reconnects asynchronously after the page loads, so connectSignerViaStorage now waits for the connected-wallet header chip (open-account-center) before resolving, instead of letting tests proceed while still disconnected. Opt out via waitForConnection:false for pages without that chip (welcome/accounts in safe_selector). * tests(web): address review on seeded-connect PR - Drop the explicit 30s timeout on the connected-wallet wait; the repo default (10s) is plenty for the post-load reconnect and fails faster. - Make recovery.cy.js consistent: the remaining connectSigner calls now use connectSignerViaStorage like the rest of the file. All connects are at test start (none mid-flow), matching the already-converted tests. * fix: wait for the wallet connection to establish to avoid failing tests due to disconnected wallet --------- Co-authored-by: vmosharova <[email protected]>
85 lines
3.4 KiB
JavaScript
85 lines
3.4 KiB
JavaScript
import * as constants from '../../support/constants.js'
|
|
import * as addressBook from '../pages/address_book.page.js'
|
|
import * as ls from '../../support/localstorage_data.js'
|
|
import * as createtx from '../../e2e/pages/create_tx.pages'
|
|
import * as data from '../../fixtures/txhistory_data_data.json'
|
|
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
|
|
|
|
let staticSafes = []
|
|
|
|
const typeReceive = data.type.receive
|
|
|
|
const owner1 = 'Automation owner'
|
|
const onwer2 = 'Changed Automation owner'
|
|
const onwer3 = 'New Automation owner'
|
|
|
|
describe('Address book tests - 2', () => {
|
|
before(async () => {
|
|
staticSafes = await getSafes(CATEGORIES.static)
|
|
})
|
|
|
|
const seedAddressBook = (value) => (win) =>
|
|
win.localStorage.setItem(constants.localStorageKeys.SAFE_v2__addressBook, JSON.stringify(value))
|
|
|
|
it('Verify Name and Address columns sorting works', () => {
|
|
cy.visit(constants.addressBookUrl + staticSafes.SEP_STATIC_SAFE_4, {
|
|
onBeforeLoad: seedAddressBook(ls.addressBookData.sortingData),
|
|
})
|
|
addressBook.clickOnNameSortBtn()
|
|
addressBook.verifyEntriesOrder()
|
|
addressBook.clickOnNameSortBtn()
|
|
addressBook.verifyEntriesOrder('descending')
|
|
|
|
// Clicking twice is required to trigger actual click after swtiching from Name
|
|
addressBook.clickOnAddrressSortBtn()
|
|
addressBook.clickOnAddrressSortBtn()
|
|
addressBook.verifyEntriesOrder()
|
|
addressBook.clickOnAddrressSortBtn()
|
|
addressBook.verifyEntriesOrder('descending')
|
|
})
|
|
|
|
it('Verify that edit owners name changes the name in the settings', () => {
|
|
cy.visit(constants.addressBookUrl + staticSafes.SEP_STATIC_SAFE_4, {
|
|
onBeforeLoad: seedAddressBook(ls.addressBookData.sepoliaAddress2),
|
|
})
|
|
addressBook.clickOnEditEntryBtn()
|
|
addressBook.typeInNameInput(onwer2)
|
|
addressBook.clickOnSaveEntryBtn()
|
|
addressBook.verifyNameWasChanged(owner1, onwer2)
|
|
cy.visit(constants.setupUrl + staticSafes.SEP_STATIC_SAFE_4)
|
|
addressBook.verifyNameWasChanged(owner1, onwer2)
|
|
})
|
|
|
|
it('Verify that editing an entry from the transaction details updates the name in address book', () => {
|
|
cy.intercept('GET', constants.transactionHistoryEndpoint).as('History')
|
|
cy.visit(constants.transactionsHistoryUrl + staticSafes.SEP_STATIC_SAFE_7)
|
|
cy.wait('@History', { timeout: 20000 })
|
|
console.log(typeReceive.summaryTitle)
|
|
createtx.clickOnTransactionItemByName(typeReceive.summaryTitle, typeReceive.summaryTxInfo)
|
|
addressBook.clickOnMoreActionsBtn()
|
|
addressBook.clickOnAddToAddressBookBtn()
|
|
addressBook.typeInNameInput(onwer3)
|
|
addressBook.clickOnSaveEntryBtn()
|
|
addressBook.verifyNameWasChanged(owner1, onwer3)
|
|
cy.visit(constants.addressBookUrl + staticSafes.SEP_STATIC_SAFE_7)
|
|
addressBook.verifyNameWasChanged(owner1, onwer3)
|
|
})
|
|
|
|
it('Verify by default there 25 rows shown per page', () => {
|
|
cy.visit(constants.addressBookUrl + staticSafes.SEP_STATIC_SAFE_4, {
|
|
onBeforeLoad: seedAddressBook(ls.addressBookData.pagination),
|
|
})
|
|
addressBook.verifyCountOfSafes(25)
|
|
})
|
|
|
|
it('Verify that clicking on next and previous page buttons shows safes', () => {
|
|
cy.visit(constants.addressBookUrl + staticSafes.SEP_STATIC_SAFE_4, {
|
|
onBeforeLoad: seedAddressBook(ls.addressBookData.pagination),
|
|
})
|
|
addressBook.clickOnNextPageBtn()
|
|
addressBook.verifyCountOfSafes(1)
|
|
addressBook.clickOnPrevPageBtn()
|
|
addressBook.verifyCountOfSafes(25)
|
|
})
|
|
})
|