question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow visiting `about:blank` during test / before each / after each

See original GitHub issue

Current 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:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
dbstraightcommented, Oct 8, 2020

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().

6reactions
jennifer-shehanecommented, Jun 30, 2021

Our new cy.session feature will enforce visiting about:blank in between tests. https://github.com/cypress-io/cypress/issues/8301

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visit The Blank Page Between Cypress Tests - Gleb Bahmutov
Stop the web application and clearly separate the end-to-end tests by visiting the blank about page after each test. When a Cypress test ......
Read more >
Visit The Blank Page Between The Tests - YouTube
We will visit the blank page at the start of each test to make sure all code callbacks and network calls from the...
Read more >
Blank page after running Cypress tests - Stack Overflow
I faced the same issue in Cypress version 12.0.0 and I solved it by adding this configuration to cypress.config.js. testIsolation: false,.
Read more >
What Is the about:blank Page? - AVG
If you're trying to visit a website and access is denied for security reasons, you may see about:blank#blocked in your browser. Like the...
Read more >
Setup and Teardown - Jest
For example, let's say that several tests interact with a ... beforeEach and afterEach can handle asynchronous code in the same ways that ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found