regression: `onBeforeLoad` handler not called when overwriting `visit`
See original GitHub issueCurrent behavior:
onBeforeLoad
hook is only getting called when defined inline with cy.visit(url, { onBeforeLoad })
.
Desired behavior:
onBeforeLoad
hook should get called when defined with Cypress.Commands.overwrite('visit', ...)
How to reproduce:
git clone https://github.com/sokki/cypress-test-tiny
npm i
npm run cypress:run
or look at circleci build: https://circleci.com/gh/sokki/cypress-test-tiny/1
Additional Info (images, stack traces, etc)
It seems, like the Issue was fixed in a previous version: https://github.com/cypress-io/cypress/issues/640
Test is visiting a static site (https://github.com/sokki/cypress-test-tiny/tree/master/static), deployed at https://static-fiwmrcysbv.now.sh
The site just writes window.mocked || 'nope'
to the body
- Operating System: macOS 10.13.3 and Linux @ circleci
- Cypress Version: 2.0.2
- Browser Version: Chrome and Electron
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
onunload and onbeforeunload not triggered when location ...
Its working.. I have called the function 2 from a setTimeout and test with firefox and check in console with preserve option enable....
Read more >Changelog - Cypress Documentation
Fixed a regression introduced in the Electron browser in Cypress 10.8.0 where the CYPRESS_EVERY_NTH_FRAME environment variable was not being set ...
Read more >Allow extensions to intercept and handle onBeforeUnload
2. go to a website that has a window.onBeforeUnload-EventListener in place 3. click any link. What is the expected behavior? chrome.
Read more >A Race Condition when closing inactive tab with alerts in ...
I believe that the proposed solution to not allow alerts/confirm/prompts in onbeforeunload/onunload/onpagehide is not ideal (see bug 391834).
Read more >Cypress cy.intercept Problems - Gleb Bahmutov
visit command. By the time cy.intercept runs, the call is already in progress, and thus not intercepted. Cypress shows XHR calls by default...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This appears to be fixed. Tested in Cypress 3.4.0 and it passes. Closing as resolved.
@adamdicarlo you can find the test-repo here: https://github.com/sokki/cypress-test-tiny