You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow reload page for component testing. Currently when you trying to reload page it start over entire test and got stuck in loop.
Desired behavior
Reload page and re-init all runtime values. I think it good to have ability to reload page because imports in JS behaves as singleton every time when you mount without refresh basically updating the same object.
Test code to reproduce
My test:
it("mounts 1",()=>{cy.mount(MyComponent);});it("mounts 2",()=>{cy.reload();// If I'm adding reload it's start over with mount 1 and getting stuck in loopcy.mount(MyComponent);});
importstorefrom"./store";import{mount}from"cypress/vue";Cypress.Commands.add("mount",(component,options={})=>{// Add Vuex pluginoptions.global=options.global||{};options.global.plugins=options.global.plugins||[];options.global.plugins.push({install(app){app.use(store);console.log(store.state.test);// If I don't have reload. 1st mount null, 2nd mount value will be 1 from prev mountstore.commit("setTest",1);},});returnmount(component,options);});
Cypress Version
13.6.0
Node version
v18.17.1
Operating System
WSL2
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered:
maxkopych
changed the title
Reload page for component testing
Reload page getting stuck in loop for component testing
Dec 15, 2023
Ran into this and was pretty surprised by it. Not easy to fix because the reload in my case is coming from a library, so it's not as simple as adding some kind of mocking or should reload boolean to the root component props. Can't just stub window.reload() itself out either, for the same reason mentioned in #8266 (comment).
julia-jordan-712
added a commit
to julia-jordan-712/sudoku-solver-angular
that referenced
this issue
Nov 24, 2024
Current behavior
Allow reload page for component testing. Currently when you trying to reload page it start over entire test and got stuck in loop.
Desired behavior
Reload page and re-init all runtime values. I think it good to have ability to reload page because imports in JS behaves as singleton every time when you mount without refresh basically updating the same object.
Test code to reproduce
My test:
store.js
commands.js
Cypress Version
13.6.0
Node version
v18.17.1
Operating System
WSL2
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: