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

allow to disable cache when running tests in browser #1315

Closed
gr2m opened this issue Feb 15, 2018 · 3 comments
Closed

allow to disable cache when running tests in browser #1315

gr2m opened this issue Feb 15, 2018 · 3 comments

Comments

@gr2m
Copy link

gr2m commented Feb 15, 2018

Current behavior:

When testing 301 redirect behavior that differs based on passed headers the tests will fail after first run because a browser caches 301 redirects

Desired behavior:

It would be nice to test each run in isolation by disabling the browser cache

How to reproduce:

https://github.com/gr2m/cypress-test-tiny/tree/cypress-1315

Test code:

See link to repository above

Additional Info (images, stack traces, etc)

Browser redirects based on cached 301 redirect

image

Which makes test fail

image

Test pass when "disable cache" flag is checked (in the network tab of developer tools)

  • Operating System: Mac OS 10.11
  • Cypress Version:
    • Cypress package version: 1.4.2
    • Cypress binary version: 1.4.2
  • Browser Version: Chrome 64.0.3282.140
gr2m added a commit to gr2m/cypress-test-tiny that referenced this issue Feb 15, 2018
@brian-mann
Copy link
Member

This is true. We intend to do this as part of the Lifecycle Events Epic. #686

We also just closed an issue today related to this - we are now clearing the cache once when the browser is launched - but not in between tests. We'll do that as per the Lifecycle events.

#1124

As for testing this today - there's not really any reason to do a browser test to do this as per your repo - you can just use cy.request() or just an API test for this.

@gr2m
Copy link
Author

gr2m commented Feb 15, 2018

Thanks feel free to close if you like, I worked around the issue in my case.

@jennifer-shehane
Copy link
Member

Was just reminded that cy.reload(true) should reload the page without using the cache. May be a solution for some. https://on.cypress.io/reload#Requirements

@jennifer-shehane jennifer-shehane added the stage: proposal 💡 No work has been done of this issue label Apr 24, 2018
@jennifer-shehane jennifer-shehane removed the stage: proposal 💡 No work has been done of this issue label May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants