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

blacklistHosts configuration not working with chrome #1154

Closed
sravan-s opened this issue Jan 5, 2018 · 9 comments
Closed

blacklistHosts configuration not working with chrome #1154

sravan-s opened this issue Jan 5, 2018 · 9 comments
Assignees
Labels
type: unexpected behavior User expected result, but got another
Milestone

Comments

@sravan-s
Copy link

sravan-s commented Jan 5, 2018

  • Operating System: mac os 10.13.2
  • Cypress Version: 1.4.1
  • Browser Version: Chrome 63

Is this a Feature or Bug?

Bug

Current behaviour:

https://docs.cypress.io/guides/references/configuration.html#blacklistHosts
blacklistHosts works well with Electron but isn't working with chrome.
i.e. - wouldn't block desired websites if we are using chrome for testing

Desired behavior:

blacklistHosts should work well with all browsers

How to reproduce:

Test code:

Additional Info (images, stack traces, etc)

screen recording

@brian-mann
Copy link
Member

This is a known issue that we just haven't had time to fix yet. I wrote these tests and they could be better. However, this has nothing to do with blacklistHosts - they work just fine. We have a boat load of tests around them. This is failing due to a different issue.

@brian-mann
Copy link
Member

brian-mann commented Jan 7, 2018

Closing because this is an issue with the recipes, not Cypress itself.

cypress-io/cypress-example-recipes#88

@brian-mann
Copy link
Member

After investigating it does appear that blacklistHosts are not working under specific conditions that need investigation. I can see via the logs that when running locally it is applying, but under 3 different CI providers it is not. It could be an issue with Cypress itself.

@sravan-s
Copy link
Author

One more pointer, blacklist hosts work with chrome on cypress 1.2.0(we found it out recently)

@brian-mann
Copy link
Member

I figured out the root cause and will post back here with more information shortly.

@brian-mann
Copy link
Member

The root cause of this has to do with browser caching to disk.

What's happening in the Recipes is that because we utilize the same Cypress profile in between runs - that a previous test was first causing a request to https://www.google-analytics.com/analytics.js.

Then the browser would then cache the response to disk.

In subsequent runs of the browser, the Cache had not expired yet - so instead of making a real HTTP request to the server (which would have been blacklisted), the browser serves the file immediately from the disk cache.

We're going to be updating Cypress to automatically clear the disk cache whenever the browser is first spawned.

The related issue is here: #1124

@brian-mann brian-mann self-assigned this Feb 14, 2018
@brian-mann brian-mann added the type: unexpected behavior User expected result, but got another label Feb 14, 2018
@brian-mann brian-mann added this to the 2.0.0 milestone Feb 14, 2018
@bahmutov
Copy link
Contributor

bahmutov commented Feb 14, 2018 via email

@brian-mann
Copy link
Member

Fixed by #1310

@brian-mann
Copy link
Member

Released in 2.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: unexpected behavior User expected result, but got another
Projects
None yet
Development

No branches or pull requests

4 participants