mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-11-02 06:23:25 +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]>
80 lines
2.9 KiB
JavaScript
80 lines
2.9 KiB
JavaScript
import * as constants from '../../support/constants.js'
|
|
import * as main from '../pages/main.page.js'
|
|
import * as modal from '../pages/modals.page.js'
|
|
import * as apps from '../pages/safeapps.pages.js'
|
|
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
|
|
import * as ls from '../../support/localstorage_data.js'
|
|
import * as messages from '../pages/messages.pages.js'
|
|
import * as msg_confirmation_modal from '../pages/modals/message_confirmation.pages.js'
|
|
|
|
let staticSafes = []
|
|
const safeApp = 'Safe Test App'
|
|
const onchainMessage = 'Message 1'
|
|
let iframeSelector
|
|
|
|
describe('Messages popup window tests', () => {
|
|
before(async () => {
|
|
staticSafes = await getSafes(CATEGORIES.static)
|
|
})
|
|
|
|
beforeEach(() => {
|
|
cy.visit(constants.appsCustomUrl + staticSafes.SEP_STATIC_SAFE_10, {
|
|
onBeforeLoad(win) {
|
|
win.localStorage.setItem(
|
|
constants.localStorageKeys.SAFE_v2__customSafeApps_11155111,
|
|
JSON.stringify(ls.customApps(constants.safeTestAppurl).safeTestApp),
|
|
)
|
|
win.localStorage.setItem(
|
|
constants.localStorageKeys.SAFE_v2__SafeApps__browserPermissions,
|
|
JSON.stringify(ls.appPermissions(constants.safeTestAppurl).grantedPermissions),
|
|
)
|
|
},
|
|
})
|
|
iframeSelector = `iframe[id="iframe-${encodeURIComponent(constants.safeTestAppurl)}"]`
|
|
})
|
|
|
|
it('Verify off-chain message popup window can be triggered', () => {
|
|
apps.clickOnApp(safeApp)
|
|
apps.clickOnOpenSafeAppBtn()
|
|
main.getIframeBody(iframeSelector).within(() => {
|
|
apps.triggetOffChainTx()
|
|
})
|
|
msg_confirmation_modal.verifyConfirmationWindowTitle(modal.modalTitiles.confirmTx)
|
|
msg_confirmation_modal.verifySafeAppInPopupWindow(safeApp)
|
|
})
|
|
|
|
it('Verify on-chain message popup window can be triggered', () => {
|
|
apps.clickOnApp(safeApp)
|
|
apps.clickOnOpenSafeAppBtn()
|
|
main.getIframeBody(iframeSelector).within(() => {
|
|
apps.enterMessage(onchainMessage)
|
|
//messages.enterOnchainMessage(onchainMessage)
|
|
apps.triggetOnChainTx()
|
|
})
|
|
msg_confirmation_modal.verifyConfirmationWindowTitle(modal.modalTitiles.confirmMsg)
|
|
msg_confirmation_modal.verifySafeAppInPopupWindow(safeApp)
|
|
msg_confirmation_modal.verifyMessagePresent(onchainMessage)
|
|
})
|
|
|
|
it('Verify warning message is displayed when 0x0000000 is used as a message', () => {
|
|
const msgHash = '0x0000000'
|
|
apps.clickOnApp(safeApp)
|
|
apps.clickOnOpenSafeAppBtn()
|
|
main.getIframeBody(iframeSelector).within(() => {
|
|
apps.enterMessage(msgHash)
|
|
apps.triggetSignMsg()
|
|
})
|
|
apps.verifyBlindSigningEnabled(true)
|
|
apps.clickOnBlindSigningOption()
|
|
cy.visit(constants.appsCustomUrl + staticSafes.SEP_STATIC_SAFE_10)
|
|
apps.clickOnApp(safeApp)
|
|
apps.clickOnOpenSafeAppBtn()
|
|
main.getIframeBody(iframeSelector).within(() => {
|
|
apps.enterMessage(msgHash)
|
|
apps.triggetSignMsg()
|
|
})
|
|
apps.verifyBlindSigningEnabled(false)
|
|
apps.verifySignBtnDisabled()
|
|
})
|
|
})
|