Allow visiting `about:blank` during test / before each / after each
See original GitHub issueCurrent behavior:
cy.visit('about:blank')
navigates to http://url/base/about:blank
Desired behavior:
cy.visit('about:blank')
navigates to about:blank
Versions
3.4.1
Background
In our application we register some listener on storage events. During before each cypress cleans the storage. This results into failing in our application, because our application is still running from the previous test case.
It should be possible to leave our application for example in after each by visiting about:blank
.
I think the easiest way would be adding another option parameter to the visit command to skip adding base url to the target url: https://github.com/cypress-io/cypress/blob/49f5b3e80c56e382b3cbd37c6deedda7389c32b7/packages/driver/src/cy/commands/navigation.coffee#L555-L563
Our current workaround is patching the register event listener method on window:load
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:8 (3 by maintainers)
I just spent quite a while debugging a similar issue. It’s very unexpected that the page from a previous test is still open causing things to happen and can fail the current test. Hugely in favor of a
cy.reset()
.Our new cy.session feature will enforce visiting about:blank in between tests. https://github.com/cypress-io/cypress/issues/8301