diff --git a/cypress/e2e/landing.test.ts b/cypress/e2e/landing.test.ts index df7fa9e43b..acdcd02a35 100644 --- a/cypress/e2e/landing.test.ts +++ b/cypress/e2e/landing.test.ts @@ -1,9 +1,9 @@ import { getTestSelector } from '../utils' -import { CONNECTED_WALLET_USER_STATE } from '../utils/user-state' +import { CONNECTED_WALLET_USER_STATE, DISCONNECTED_WALLET_USER_STATE } from '../utils/user-state' describe('Landing Page', () => { it('shows landing page when no user state exists', () => { - cy.visit('/', { userState: {} }) + cy.visit('/', { userState: DISCONNECTED_WALLET_USER_STATE }) cy.get(getTestSelector('landing-page')) cy.screenshot() }) diff --git a/cypress/e2e/wallet-connection/connect.test.ts b/cypress/e2e/wallet-connection/connect.test.ts index ace3d6b185..7e5e4a22fd 100644 --- a/cypress/e2e/wallet-connection/connect.test.ts +++ b/cypress/e2e/wallet-connection/connect.test.ts @@ -1,4 +1,5 @@ import { getTestSelector } from '../../utils' +import { DISCONNECTED_WALLET_USER_STATE } from '../../utils/user-state' describe('disconnect wallet', () => { it('should clear state', () => { @@ -27,7 +28,7 @@ describe('disconnect wallet', () => { describe('connect wallet', () => { it('should load state', () => { - cy.visit('/swap', { ethereum: 'hardhat', userState: {} }) + cy.visit('/swap', { ethereum: 'hardhat', userState: DISCONNECTED_WALLET_USER_STATE }) // Connect the wallet cy.get(getTestSelector('navbar-connect-wallet')).contains('Connect').click() diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 63ec3b47a6..99c75f5403 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -58,7 +58,7 @@ Cypress.Commands.overwrite( // Set initial user state. win.localStorage.setItem( 'redux_localstorage_simple_user', // storage key for the user reducer using 'redux-localstorage-simple' - JSON.stringify(options?.userState ?? CONNECTED_WALLET_USER_STATE) + JSON.stringify({ ...CONNECTED_WALLET_USER_STATE, ...(options?.userState ?? {}) }) ) // Set feature flags, if configured. diff --git a/cypress/utils/user-state.ts b/cypress/utils/user-state.ts index 1e44e9bf6b..0b4b54c1d6 100644 --- a/cypress/utils/user-state.ts +++ b/cypress/utils/user-state.ts @@ -1,3 +1,5 @@ import { UserState } from '../../src/state/user/reducer' export const CONNECTED_WALLET_USER_STATE: Partial = { selectedWallet: 'INJECTED' } + +export const DISCONNECTED_WALLET_USER_STATE: Partial = { selectedWallet: undefined }