Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Being able to reset browser history #8219

Closed
quentinus95 opened this issue Aug 7, 2020 · 2 comments
Closed

Being able to reset browser history #8219

quentinus95 opened this issue Aug 7, 2020 · 2 comments
Labels
type: duplicate This issue or pull request already exists

Comments

@quentinus95
Copy link

quentinus95 commented Aug 7, 2020

Hello, I'm looking for a solution to be able to validate that my app do not push pages in the browser history. Sadly, I can't find a way to reset it properly before testing.

Current behavior:

I'm currently reading the history length using the following piece of code:

 cy.window().then(window => {
    cy.wrap(window.history.length).should("equal", 2)
})

The main issue with this approach is that browser history is shared between tests. Consequently this test is now dependent of what was run before it.

Desired behavior:

I would expect two possible behaviors:

  • the browser history is reset between tests (to me it's a bug that Cypress does not do that by default)
  • Cypress provides a cy.clearHistory() method to clear tab history. It can be useful to run it before doing the assertion

Versions

Cypress 3.8.3.

@jennifer-shehane
Copy link
Member

Likely should be a part of #686

@jennifer-shehane
Copy link
Member

The team has confirmed that this is planned work as part of #686 - will be closing as duplicate.

@jennifer-shehane jennifer-shehane added the type: duplicate This issue or pull request already exists label Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants