-
Notifications
You must be signed in to change notification settings - Fork 111
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
Default caching (documentation?) issues #132
Comments
You're right this default value didn't get updated for the 4.0 release. As for checking latest version, we still need to do that. If your browser updated, the cached driver version might not be compatible. We only skip that if you hard code a specific version, which we don't recommend unless you have a locked down testing platform. |
ah ok thanks that makes sense -- I was just surprised I needed to configure WebMock even though I had already installed the latest version by running the rake task within the cache window.. |
Hi @timdiggins, can you please test the fix from |
@kapoorlakshya debug output below (bold indicates non-duplicated lines AFAICT). with released version: 2019-06-11 17:27:09 DEBUG Webdrivers Checking current version 2019-06-11 17:27:09 DEBUG Webdrivers making System call: //Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version with master: 2019-06-11 17:27:53 DEBUG Webdrivers Checking current version 2019-06-11 17:27:54 DEBUG Webdrivers making System call: //Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version So this looks good to me, though it seems to contradict with earlier statement above: (but I'm still not convinced by this because, on reflection, it seems to me that if you don't use the cache time to prevent checking for latest version, I'm not sure what cache time is used for...)
|
@timdiggins The cache time is respected as long as a You can perform a short test to verify this if you want: Webdrivers::Chromedriver.remove
Webdrivers::Chromedriver.required_version = '72.0.3626.7' # Any old version will work
Webdrivers::Chromedriver.update Assuming you have Chrome v75, let's set cache time to 1 hour and trigger an update: Webdrivers.logger.level = :debug
Webdrivers.cache_time = 3600
Webdrivers::Chromedriver.update You should see the following lines in the log:
As you can see, the cache time was ignored and a network call was made to fetch a compatible driver version (v75) for Chrome. Now, if you want to test further, you rerun the test with cache time set to 1 hour and check the logs. You'll see that no network calls are made since we already have a compatible version.
Now, if you don't even want this to happen, you can pin the version and the gem will not make any network calls at all until you change the required version. Hope this helps. |
I have documented this special case in the README for the v4.0.1 release. EDIT: Fixed link. |
Thanks for superb explanation @kapoorlakshya -- very clear now. |
Summary
The docs (https://github.com/titusfortner/webdrivers#caching-drivers) suggest that the default caching is
set to 24 hours (86,400 seconds)
however from my experience and what I can see in the code, the default is only set for the rake tasks.see
webdrivers/lib/webdrivers/tasks/chromedriver.rake
Line 22 in 050e8ce
vs
webdrivers/lib/webdrivers/common.rb
Line 29 in 6603385
I think either the docs need to change ("the default is set for rake tasks...") or the code does (
(@cache_time || ENV.fetch('WD_CACHE_TIME', 86_400)).to_i
or possibly just dedupe the default config into one place)
There is one more documentation issue with caching: if you are not pinning the version you are using, then even with caching it will do a check for the latest version every time, which is surprising. (This is because
correct_binary?
needs to findlatest_version
whenrequired_version == EMPTY_VERSION
).The text was updated successfully, but these errors were encountered: