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

Dealing with Webmock #4

Closed
mltsy opened this issue Oct 5, 2017 · 4 comments
Closed

Dealing with Webmock #4

mltsy opened this issue Oct 5, 2017 · 4 comments

Comments

@mltsy
Copy link

mltsy commented Oct 5, 2017

I'm using webmock in my tests and I can't figure out a good way to deal with it blocking webdrivers' requests. I've tried not requiring webmock in the gem file, and explicitly requiring it after webdrivers in test_helper.rb and it still blocks the request... do you have a good method for avoiding this problem?

Where do you normally require 'webdrivers' ? Do you use webmock? Is there a command I can call to make it download the drivers immediately so it doesn't get caught after webmock is initialized?

@titusfortner
Copy link
Owner

I do not use webmock, but it should let you stub only the internet calls you want?

I think it black lists by default, but you can whitelist: https://github.com/mozilla/geckodriver/releases, http://chromedriver.storage.googleapis.com

I require it in spec_helper.rb

@mltsy
Copy link
Author

mltsy commented Nov 20, 2017

Well that sounds simple enough :) Pokes a couple holes in the webmock wall, but I guess as long as you're not testing anything to do with webdrivers, it shouldn't be a problem!

I ended up just adding the webdrivers I needed to the image I was using rather than installing them as part of the test run. But this solution certainly seems like it should work 👍

@mltsy mltsy closed this as completed Nov 20, 2017
@Crisfole
Copy link

For future viewers of this:

WebMock.disable_net_connect!({
  allow_localhost: true,
  allow: 'chromedriver.storage.googleapis.com'
})

@jrochkind
Copy link

I ran into this switching from chromedriver-helper to webdrivers.

It is a gotcha. If the URLs that webdrivers tries to contact change in the future, of course the Webmock setup would have to be changed too.

This is related to #29

The allow: 'chromedriver.storage.googleapis.com' worked. Of course if webdrivers ever changes what urls it has to contact, or contacts different URLs in different configurations (if I switch to FF instead of Chrome say?), it would have to be adjusted.

edwardkerry added a commit to alphagov/govuk_test that referenced this issue Apr 24, 2019
`webdrivers` causes an issue with `webmock`. This is therefore a breaking change, and
the Readme now has instructions on how to address this.

titusfortner/webdrivers#4
edwardkerry added a commit to alphagov/govuk_test that referenced this issue Apr 24, 2019
`webdrivers` causes an issue with `webmock`. This is therefore a breaking change, and
the Readme now has instructions on how to address this.

titusfortner/webdrivers#4
edwardkerry added a commit to alphagov/govuk_test that referenced this issue Apr 24, 2019
`webdrivers` causes an issue with `webmock`. This is therefore a breaking change, and
the Readme now has instructions on how to address this.

titusfortner/webdrivers#4
andysellick added a commit to alphagov/government-frontend that referenced this issue Mar 25, 2022
- add manifest.js, this is now needed as part of the upgrade to sprockets, see https://github.com/rails/sprockets/blob/master/UPGRADING.md
- adjust test helper to allow URL for chromedriver, otherwise tests fail with webmock connect not allowed error, note that if this URL ever changes this file will need to be updated titusfortner/webdrivers#4
andysellick added a commit to alphagov/government-frontend that referenced this issue Mar 25, 2022
- add manifest.js, this is now needed as part of the upgrade to sprockets, see https://github.com/rails/sprockets/blob/master/UPGRADING.md
- adjust test helper to allow URL for chromedriver, otherwise tests fail with webmock connect not allowed error, note that if this URL ever changes this file will need to be updated titusfortner/webdrivers#4
andysellick added a commit to alphagov/government-frontend that referenced this issue Mar 25, 2022
- add manifest.js, this is now needed as part of the upgrade to sprockets, see https://github.com/rails/sprockets/blob/master/UPGRADING.md
- adjust test helper to allow URL for chromedriver, otherwise tests fail with webmock connect not allowed error, note that if this URL ever changes this file will need to be updated titusfortner/webdrivers#4
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

4 participants