Bug
Commands.overwrite seems to break onBeforeLoad for visit command
Cypress.Commands.add('visitRoute', (route) => {
cy.visit(route, {
onBeforeLoad(win) {
console.log('this will happen');
}
});
});
// However if I replace visitRoute with visit and the above with
Cypress.Commands.overwrite('visit', (visit, route) => {
console.log('this will happen');
visit(route, {
onBeforeLoad(win) {
console.log('this will not happen');
}
});
});
Duplicate of https://github.com/cypress-io/cypress/issues/640. The fix is coming out today.
Bah. I think I just searched open issues. You guys are quick.
Yeah we made a decision to close issues once the code is merged even though it may not be released.
We're close to having more automations in our build pipeline which will enable us to release more often with smaller fixes.
@paulfalgout FYI this is the issue we ran into with the new visibility algorithm. https://github.com/cypress-io/cypress/issues/655
I have Cypress updated and running all the tests and projects now.
@brian-mann I聽am running into the same issue though I聽am using the last release of cypress v2.1.0:
Cypress.Commands.overwrite('visit', (visit, url, options) => {
console.log('overwritten visit')
return visit(url, {
onBeforeLoad: (win) => {
console.log('onBeforeLoad')
},
})
})
onBeforeLoad does not get triggered, thanks.
Unfortunately, this still isn't working as of v3.0.3 @brian-mann.
I'm seeing this same behavior in version 3.8.2
This issue will be closed to further comment as the exact issue here was resolved and tested in 0.20.1
@RobbinHabermehl If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.
Most helpful comment
@brian-mann I聽am running into the same issue though I聽am using the last release of
cypressv2.1.0:onBeforeLoaddoes not get triggered, thanks.