Files
05cab32f0e tests(web): connect wallet via seeded storage in e2e (#8350)
* 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]>
2026-07-31 17:00:56 +02:00

111 lines
4.3 KiB
JavaScript

import * as constants from '../../support/constants.js'
import * as main from '../pages/main.page.js'
import * as createtx from '../pages/create_tx.pages.js'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import * as messages from '../pages/messages.pages.js'
import * as msg_confirmation_modal from '../pages/modals/message_confirmation.pages.js'
import * as navigation from '../pages/navigation.page'
import * as spendinglimit from '../pages/spending_limits.pages'
let staticSafes = []
const sendValue = 0.00002
const safe = 'sep:0xF184a243925Bf7fb1D64487339FF4F177Fb75644'
const txs = {
oneOfoneTx:
'&id=multisig_0xF184a243925Bf7fb1D64487339FF4F177Fb75644_0xccc6945d0d674ceb45f856841bfc3991b4da27ea578ffe9652bbc6835944b323',
}
const noteCreator = 'sep:0x96D4...5aC5'
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY
const signer2 = walletCredentials.OWNER_1_PRIVATE_KEY
const signerAddress = walletCredentials.OWNER_4_WALLET_ADDRESS
function happyPathToStepTwo() {
createtx.typeRecipientAddress(constants.EOA)
createtx.clickOnTokenselectorAndSelectSepoliaEth()
createtx.setSendValue(sendValue)
createtx.clickOnNextBtn()
}
describe('Transaction notes tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
it('Verify the tx notes field only allows 60 characters', () => {
wallet.connectSignerViaStorage(signer, constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_6)
createtx.clickOnNewtransactionBtn()
createtx.clickOnSendTokensBtn()
happyPathToStepTwo()
createtx.checkMaxNoteLength()
})
it('Verify the tx note information message', () => {
wallet.connectSignerViaStorage(signer, constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_6)
createtx.clickOnNewtransactionBtn()
createtx.clickOnSendTokensBtn()
happyPathToStepTwo()
createtx.checkNoteWarningMsg()
})
it('Verify in the transaction details the note is visible', () => {
cy.visit(constants.transactionUrl + safe + txs.oneOfoneTx)
createtx.checkNoteRecordedNote(createtx.recordedTxNote)
})
it('Verify hovering over the note tooltip shows note originator', () => {
cy.visit(constants.transactionUrl + safe + txs.oneOfoneTx)
createtx.checkNoteCreator(noteCreator)
})
it('Verify that after a tx was executed, the tx note is not editable', () => {
cy.visit(constants.transactionUrl + safe + txs.oneOfoneTx)
createtx.checkNoteRecordedNoteReadOnly()
})
it('Verify no tx note field is present when signing a message', () => {
wallet.connectSignerViaStorage(signer2, constants.transactionsMessagesUrl + staticSafes.SEP_STATIC_SAFE_26)
messages.clickOnMessageSignBtn(0)
msg_confirmation_modal.verifyMessagePresent(messages.offchainMessage)
main.verifyElementsCount(createtx.noteTextField, 0)
})
it('Verify no tx note field is present during the use of a spending limit', () => {
wallet.connectSignerViaStorage(signer, constants.setupUrl + staticSafes.SEP_STATIC_SAFE_8)
navigation.clickOnNewTxBtn()
createtx.clickOnSendTokensBtn()
createtx.typeRecipientAddress(constants.EOA)
spendinglimit.enterSpendingLimitAmount(0.00001)
spendinglimit.selectSpendingLimitOption()
createtx.clickOnNextBtn()
main.verifyElementsCount(createtx.noteTextField, 0)
})
it('Verify that in a send funds tx the note field shows up in the execution part of the form', () => {
wallet.connectSignerViaStorage(signer, constants.setupUrl + staticSafes.SEP_STATIC_SAFE_8)
navigation.clickOnNewTxBtn()
createtx.clickOnSendTokensBtn()
createtx.typeRecipientAddress(constants.EOA)
spendinglimit.enterSpendingLimitAmount(0.00001)
spendinglimit.selectStandardOption()
createtx.clickOnNextBtn()
main.verifyElementsCount(createtx.noteTextField, 1)
})
it('Verify no tx note is present during a recovery tx', () => {
wallet.connectSignerViaStorage(signer, constants.setupUrl + staticSafes.SEP_STATIC_SAFE_8)
navigation.clickOnNewTxBtn()
createtx.clickOnSendTokensBtn()
createtx.typeRecipientAddress(constants.EOA)
spendinglimit.enterSpendingLimitAmount(0.00001)
spendinglimit.selectStandardOption()
createtx.clickOnNextBtn()
main.verifyElementsCount(createtx.noteTextField, 1)
})
})