chromedriver-helper 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +52 -5
- data/lib/chromedriver-helper.rb +2 -0
- data/lib/chromedriver/helper/google_code_parser.rb +3 -5
- data/lib/chromedriver/helper/version.rb +1 -1
- data/spec/google_code_parser_spec.rb +9 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00d7bfc33c3feb7a50b220782801f8b1bb619a368ee5d6dd5a901621341c5d0d
|
4
|
+
data.tar.gz: e5e3f2d16b4f1a778cfc0afc9b4f2448ec1157ff67bf7dfdfce90a355c473341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8cd6b73b42605d7a0ddd66d8b5230b34a8dc38ae7c532477620c7595e2821aebb040c4d5dc267bf8e16f58de24781505715f83239b84b2d68b38d253876038d
|
7
|
+
data.tar.gz: '09805d4ffa96dd170d1ebfceadf3ba4e917504c7f614bff69cb334a4cd90c31b6cdf7a271d240ae33c5ae509bf21d8db1d939eca3cf5160ab41cb2d2fb9e53ff'
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
chromedriver-helper changelog
|
2
2
|
==========
|
3
3
|
|
4
|
+
2.1.0 - 2018-09-18
|
5
|
+
----------
|
6
|
+
|
7
|
+
Enhancement:
|
8
|
+
|
9
|
+
* Use the `LATEST_RELEASE` file to determine the newest version, to avoid downloading the experimental versions the Chrome team is posting recently. [#62](https://github.com/flavorjones/chromedriver-helper/issues/62) (Thanks, @ibrahima!)
|
10
|
+
|
11
|
+
Bug fix:
|
12
|
+
|
13
|
+
* `lib/chromedriver-helper.rb` explicitly requires `chromedriver/helper` to avoid "uninitialized constant Chromedriver" exception when calling `Chromedriver.set_version` in a default-configured Rails app. [#65](https://github.com/flavorjones/chromedriver-helper/issues/65)
|
14
|
+
|
15
|
+
|
4
16
|
2.0.1 - 2019-09-17
|
5
17
|
----------
|
6
18
|
|
7
19
|
Bug fix:
|
8
20
|
|
9
|
-
* Explicitly require 'selenium-webdriver' for projects who don't have the default Rails ordering in their Gemfile. [#60](https://github.com/flavorjones/chromedriver-helper/issues/60)
|
21
|
+
* Explicitly require 'selenium-webdriver' for projects who don't have the default Rails ordering in their Gemfile. [#60](https://github.com/flavorjones/chromedriver-helper/issues/60) (Thanks, @mattbrictson!)
|
10
22
|
|
11
23
|
|
12
24
|
2.0.0 - 2019-09-15
|
data/README.md
CHANGED
@@ -16,16 +16,63 @@ Individual projects can even select which version of `chromedriver` they want to
|
|
16
16
|
|
17
17
|
# Usage
|
18
18
|
|
19
|
-
|
19
|
+
## In a Rails project
|
20
|
+
|
21
|
+
If you're using Bundler and Capybara in a Rails project, it's as easy as:
|
22
|
+
|
23
|
+
``` ruby
|
24
|
+
# Gemfile
|
25
|
+
gem "selenium-webdriver"
|
26
|
+
gem "chromedriver-helper"
|
27
|
+
```
|
28
|
+
|
29
|
+
then, in your spec setup:
|
30
|
+
|
31
|
+
``` ruby
|
32
|
+
Capybara.register_driver :selenium do |app|
|
33
|
+
Capybara::Selenium::Driver.new(app, :browser => :chrome)
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
|
38
|
+
## Standalone
|
39
|
+
|
40
|
+
If you're using it standlone just to manage chromedriver binaries,
|
20
41
|
|
21
42
|
# Gemfile
|
22
43
|
gem "chromedriver-helper"
|
23
44
|
|
24
|
-
|
45
|
+
Then just run the executable script:
|
46
|
+
|
47
|
+
chromedriver-helper
|
25
48
|
|
26
|
-
|
27
|
-
|
28
|
-
|
49
|
+
which will download `chromedriver` if necessary and exec it.
|
50
|
+
|
51
|
+
|
52
|
+
# Configuration
|
53
|
+
|
54
|
+
There are some commandline options that can be sent to `chromedriver` as options to `Capybara::Selenium::Driver.new`. The supported options can be discovered by looking at the Selenium source code here:
|
55
|
+
|
56
|
+
https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/chrome/service.rb
|
57
|
+
|
58
|
+
As of this writing, the supported options are:
|
59
|
+
|
60
|
+
* `log_path`
|
61
|
+
* `url_base`
|
62
|
+
* `port_server`
|
63
|
+
* `whitelisted_ips`
|
64
|
+
* `verbose`
|
65
|
+
* `silent`
|
66
|
+
|
67
|
+
An example usage would be:
|
68
|
+
|
69
|
+
``` ruby
|
70
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome,
|
71
|
+
driver_opts: {
|
72
|
+
log_path: '/tmp/chrome.log',
|
73
|
+
verbose: true
|
74
|
+
})
|
75
|
+
```
|
29
76
|
|
30
77
|
|
31
78
|
# Updating to latest `chromedriver`
|
data/lib/chromedriver-helper.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
require 'nokogiri'
|
2
2
|
require 'open-uri'
|
3
|
+
require 'uri'
|
3
4
|
|
4
5
|
module Chromedriver
|
5
6
|
class Helper
|
6
7
|
class GoogleCodeParser
|
7
8
|
BUCKET_URL = 'https://chromedriver.storage.googleapis.com'
|
8
9
|
|
9
|
-
attr_reader :source, :platform
|
10
|
+
attr_reader :source, :platform, :newest_download_version
|
10
11
|
|
11
12
|
def initialize(platform, open_uri_provider=OpenURI)
|
12
13
|
@platform = platform
|
13
14
|
@source = open_uri_provider.open_uri(BUCKET_URL)
|
15
|
+
@newest_download_version = Gem::Version.new(open_uri_provider.open_uri(URI.join(BUCKET_URL, "LATEST_RELEASE")).read)
|
14
16
|
end
|
15
17
|
|
16
18
|
def downloads
|
@@ -22,10 +24,6 @@ module Chromedriver
|
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
def newest_download_version
|
26
|
-
@newest_download_version ||= downloads.map { |download| version_of(download) }.max
|
27
|
-
end
|
28
|
-
|
29
27
|
def version_download_url(version)
|
30
28
|
gem_version = Gem::Version.new(version)
|
31
29
|
downloads.find { |download_url| version_of(download_url) == gem_version }
|
@@ -3,7 +3,14 @@ require "spec_helper"
|
|
3
3
|
describe Chromedriver::Helper::GoogleCodeParser do
|
4
4
|
let!(:open_uri_provider) do
|
5
5
|
double("open_uri_provider").tap do |oup|
|
6
|
-
allow(oup).to receive(:open_uri)
|
6
|
+
allow(oup).to receive(:open_uri) do |uri|
|
7
|
+
case uri.to_s
|
8
|
+
when "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
|
9
|
+
StringIO.new("2.42")
|
10
|
+
when "https://chromedriver.storage.googleapis.com"
|
11
|
+
StringIO.new(File.read(File.join(File.dirname(__FILE__), "assets/google-code-bucket.xml")))
|
12
|
+
end
|
13
|
+
end
|
7
14
|
end
|
8
15
|
end
|
9
16
|
let!(:parser) { Chromedriver::Helper::GoogleCodeParser.new('mac', open_uri_provider) }
|
@@ -21,22 +28,7 @@ describe Chromedriver::Helper::GoogleCodeParser do
|
|
21
28
|
|
22
29
|
describe "#newest_download_version" do
|
23
30
|
it "returns the last URL for the platform" do
|
24
|
-
expect(parser.newest_download_version).to eq Gem::Version.new("2.
|
25
|
-
end
|
26
|
-
|
27
|
-
context "out-of-order versions" do
|
28
|
-
before do
|
29
|
-
allow(parser).to receive(:downloads).and_return([
|
30
|
-
"https://chromedriver.storage.googleapis.com/2.3/chromedriver_mac32.zip",
|
31
|
-
"https://chromedriver.storage.googleapis.com/2.4/chromedriver_mac32.zip",
|
32
|
-
"https://chromedriver.storage.googleapis.com/2.14/chromedriver_mac32.zip",
|
33
|
-
"https://chromedriver.storage.googleapis.com/2.2/chromedriver_mac32.zip",
|
34
|
-
])
|
35
|
-
end
|
36
|
-
|
37
|
-
it "returns the newest version" do
|
38
|
-
expect(parser.newest_download_version).to eq(Gem::Version.new("2.14"))
|
39
|
-
end
|
31
|
+
expect(parser.newest_download_version).to eq Gem::Version.new("2.42")
|
40
32
|
end
|
41
33
|
end
|
42
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chromedriver-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|