Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit a933fef

Browse files
committed
refactor: cypress test data setup
1 parent 252913c commit a933fef

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cypress/support/commands.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ Cypress.Commands.add('profileIntercepts', () => {
144144
})
145145

146146
Cypress.Commands.add('setupProfile', () => {
147+
localforage.config({ storeName: 'nuxtLocalForage', name: 'nuxtJS' })
148+
localforage.setItem('profileData', LOCAL_FORAGE_DATA)
147149
cy.profileIntercepts()
148-
cy.on('window:before:load', async win => {
149-
localforage.config({ storeName: 'nuxtLocalForage', name: 'nuxtJS' })
150-
await localforage.setItem('profileData', LOCAL_FORAGE_DATA)
150+
cy.on('window:before:load', _win => {
151151
window.localStorage.setItem('authKey', FAKE_AUTH_KEY)
152152
window.localStorage.setItem('brightId', FAKE_BRIGHT_ID)
153153
window.localStorage.setItem('publicKey', FAKE_PUBLIC_KEY)
@@ -157,9 +157,9 @@ Cypress.Commands.add('setupProfile', () => {
157157
})
158158

159159
Cypress.Commands.add('clearProfile', () => {
160-
cy.on('window:before:load', async win => {
161-
localforage.config({ storeName: 'nuxtLocalForage', name: 'nuxtJS' })
162-
await localforage.removeItem('profileData')
160+
localforage.config({ storeName: 'nuxtLocalForage', name: 'nuxtJS' })
161+
localforage.removeItem('profileData')
162+
cy.on('window:before:load', _win => {
163163
window.localStorage.removeItem('authKey')
164164
window.localStorage.removeItem('brightId')
165165
window.localStorage.removeItem('publicKey')

0 commit comments

Comments
 (0)