webdrivers 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f9dfef27ff9ab5bae476fa1b8667572f892ef8f4d6631d150bc95018d33d327
4
- data.tar.gz: a38a950bf647ec8d94fc7101d06a0325cac68568a2b0bcde65775fb64ee34a4e
3
+ metadata.gz: fa8f1d0b04f0eae3dc76133a1d473e524d78969a6905eaa4aaefb5b9262311d2
4
+ data.tar.gz: 685a871618bcd101c24a24cca0e31effd64634cd9a67bf66a0e5c863b922316f
5
5
  SHA512:
6
- metadata.gz: 27a4cdef15c93e2fee024e0314dcaa663aeaf1f33bc23a5caecf3143d73b958c5486d4b09e52b961ab9bd80273630957dec8e773a7d76a4c8f85533c1cded036
7
- data.tar.gz: bef2bc7580981a2444d5a8e5eb45c9be99c5bcdbe1f60029179cf0e28d3d2a3145bf608e06afec4da63d75041e4fdd47444a3a8e67c98b222b69e9a7095d5437
6
+ metadata.gz: 451f3117e49414c40bb6d1e422e81f79dc0203f9547d03eca7a7015768b6eff429a6478c1d9fc269ff4e44d0c750e617fbe1334bc2a421e5569abe353a604c93
7
+ data.tar.gz: 1b02b191b395b7defdf76b9f941747f8739a938c9725aa0f13345ea8dfe8ad832da76aa2050d4561382fe5ea7bbe4a7d561ed9a0ff3d27ff5c60a18c88f8e798
@@ -26,6 +26,8 @@ Metrics/BlockLength:
26
26
 
27
27
  Metrics/ClassLength:
28
28
  Max: 116
29
+ Exclude:
30
+ - 'lib/webdrivers/system.rb'
29
31
 
30
32
  Metrics/CyclomaticComplexity:
31
33
  Max: 8
@@ -1,24 +1,24 @@
1
- language: ruby
2
- cache: bundler
3
- addons:
4
- apt:
5
- packages:
6
- - chromium-browser
7
- - libgconf-2-4
8
- chrome: stable
9
- script: bundle exec rake $RAKE_TASK
10
- matrix:
11
- include:
12
- - rvm: 2.6.3
13
- env: RAKE_TASK=spec
14
- - rvm: 2.5.5
15
- env: RAKE_TASK=spec
16
- - rvm: 2.4.6
17
- env: RAKE_TASK=spec
18
- - rvm: 2.4.6
19
- os: osx
20
- env: RAKE_TASK=spec
21
- - rvm: 2.4.6
22
- env: RAKE_TASK=rubocop
23
- - rvm: jruby-9.2.7.0
24
- env: RAKE_TASK=spec
1
+ language: ruby
2
+ cache: bundler
3
+ addons:
4
+ apt:
5
+ packages:
6
+ - chromium-browser
7
+ - libgconf-2-4
8
+ chrome: stable
9
+ script: bundle exec rake $RAKE_TASK
10
+ matrix:
11
+ include:
12
+ - rvm: 2.6.3
13
+ env: RAKE_TASK=spec
14
+ - rvm: 2.5.5
15
+ env: RAKE_TASK=spec
16
+ - rvm: 2.4.6
17
+ env: RAKE_TASK=spec
18
+ - rvm: 2.4.6
19
+ os: osx
20
+ env: RAKE_TASK=spec
21
+ - rvm: 2.4.6
22
+ env: RAKE_TASK=rubocop
23
+ - rvm: jruby-9.2.7.0
24
+ env: RAKE_TASK=spec
@@ -1,3 +1,8 @@
1
+ ### 4.0.1 (2019-06-12)
2
+ * Cache time now defaults to 86,400 Seconds (24 hours). Please note the special exception for `chromedriver` in the [README](https://github.com/titusfortner/webdrivers#special-exception-for-chromedriver) (issue [#132](https://github.com/titusfortner/webdrivers/issues/132))
3
+ * Properly escape Chrome binary path when using JRuby on Windows (issue [#130](https://github.com/titusfortner/webdrivers/issues/130))
4
+ * Allow use of `selenium-webdriver` v4 (pre-releases only)
5
+
1
6
  ### 4.0.0 (2019-05-28)
2
7
 
3
8
  No changes since rc2. Please report any issues [here](https://github.com/titusfortner/webdrivers/issues)
@@ -1,23 +1,23 @@
1
- (The MIT License)
2
-
3
- Copyright (c) 2017-2019: Titus Fortner
4
- Copyright (c) 2019: Lakshya Kapoor, Thomas Walpole
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining
7
- a copy of this software and associated documentation files (the
8
- 'Software'), to deal in the Software without restriction, including
9
- without limitation the rights to use, copy, modify, merge, publish,
10
- distribute, sublicense, and/or sell copies of the Software, and to
11
- permit persons to whom the Software is furnished to do so, subject to
12
- the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be
15
- included in all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2019: Titus Fortner
4
+ Copyright (c) 2019: Lakshya Kapoor, Thomas Walpole
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ 'Software'), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -82,13 +82,19 @@ You can set Webdrivers to only look for updates if the previous check
82
82
  was longer ago than a specified number of seconds.
83
83
 
84
84
  ```ruby
85
- Webdrivers.cache_time = 86_400
85
+ Webdrivers.cache_time = 86_400 # Default: 86,400 Seconds (24 hours)
86
86
  ```
87
87
 
88
88
  Alternatively, you can define this value via the `WD_CACHE_TIME` environment
89
- variable.
89
+ variable, which takes precedence over the `Webdrivers.cache_time` value.
90
+ **Only set one to avoid confusion**.
90
91
 
91
- The default is set to 24 hours (86,400 seconds).
92
+ ##### Special exception for chromedriver
93
+
94
+ Cache time will be respected as long as a `chromedriver` binary exists and the major versions of
95
+ Chrome and `chromedriver` match. For example, if you update Chrome to v76 and `chromedriver` is
96
+ still at v75, `webdrivers` will ignore the cache time and update `chromedriver` to make sure you're
97
+ using a compatible version.
92
98
 
93
99
  ### Proxy
94
100
 
@@ -144,6 +150,13 @@ rake webdrivers:iedriver:update[version] # Remove and download updated IEDr
144
150
  rake webdrivers:iedriver:version # Print current IEDriverServer version
145
151
  ```
146
152
 
153
+ If you are not using Rails, you'll need to load them into your Rakefile like this:
154
+
155
+ ```ruby
156
+ require 'webdrivers'
157
+ load 'webdrivers/Rakefile'
158
+ ```
159
+
147
160
  These tasks respect the `WD_INSTALL_DIR` and `WD_CACHE_TIME` environment
148
161
  variables which can also be passed through the `rake` command:
149
162
 
@@ -1,23 +1,41 @@
1
- build: off
2
- cache:
3
- - vendor/bundle
4
- environment:
5
- matrix:
6
- - RUBY_VERSION: 24
7
- RAKE_TASK: spec
8
- - RUBY_VERSION: 24
9
- RAKE_TASK: rubocop
10
- - RUBY_VERSION: 25
11
- RAKE_TASK: spec
12
- - RUBY_VERSION: 26
13
- RAKE_TASK: spec
14
- install:
15
- - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
16
- - bundle config --local path vendor/bundle
17
- - bundle install
18
- before_test:
19
- - ruby -v
20
- - gem -v
21
- - bundle -v
22
- test_script:
23
- - bundle exec rake %RAKE_TASK%
1
+ build: off
2
+ cache:
3
+ - vendor/bundle
4
+ environment:
5
+ matrix:
6
+ - RUBY_VERSION: Ruby24
7
+ RUBY_BIN: ruby
8
+ RAKE_TASK: spec
9
+ SCRIPT_CONTEXT: bundle exec
10
+ - RUBY_VERSION: Ruby24
11
+ RUBY_BIN: ruby
12
+ RAKE_TASK: rubocop
13
+ SCRIPT_CONTEXT: bundle exec
14
+ - RUBY_VERSION: Ruby25
15
+ RUBY_BIN: ruby
16
+ RAKE_TASK: spec
17
+ SCRIPT_CONTEXT: bundle exec
18
+ - RUBY_VERSION: Ruby26
19
+ RUBY_BIN: ruby
20
+ RAKE_TASK: spec
21
+ SCRIPT_CONTEXT: bundle exec
22
+ - RUBY_VERSION: jruby-9.2.7.0
23
+ RUBY_BIN: jruby
24
+ RAKE_TASK: spec
25
+ SCRIPT_CONTEXT: jruby -G -S
26
+ install:
27
+ - ps: |
28
+ if ($env:RUBY_BIN -eq 'jruby')
29
+ {
30
+ support\install_jruby.ps1
31
+ }
32
+ - set PATH=C:\%RUBY_VERSION%\bin;%PATH%
33
+ - '%RUBY_BIN% -S gem update --system'
34
+ - '%RUBY_BIN% -S gem install bundler'
35
+ - '%RUBY_BIN% -S bundle install'
36
+ before_test:
37
+ - '%RUBY_BIN% -v'
38
+ - '%RUBY_BIN% -S gem -v'
39
+ - '%RUBY_BIN% -S bundle -v'
40
+ test_script:
41
+ - '%SCRIPT_CONTEXT% rake %RAKE_TASK%'
@@ -23,7 +23,13 @@ module Webdrivers
23
23
  directories.each do |dir|
24
24
  envs.each do |root|
25
25
  option = "#{ENV[root]}\\#{dir}\\#{file}"
26
- return option if File.exist?(option)
26
+ next unless File.exist?(option)
27
+
28
+ # Fix for JRuby on Windows - #41 and #130.
29
+ # Escape space and parenthesis with backticks.
30
+ option = option.gsub(/([\s()])/, '`\1') if RUBY_PLATFORM == 'java'
31
+
32
+ return System.escape_path(option)
27
33
  end
28
34
  end
29
35
  end
@@ -36,7 +42,7 @@ module Webdrivers
36
42
  directories.each do |dir|
37
43
  files.each do |file|
38
44
  option = "#{dir}/#{file}"
39
- return option if File.exist?(option)
45
+ return System.escape_path(option) if File.exist?(option)
40
46
  end
41
47
  end
42
48
  end
@@ -48,7 +54,7 @@ module Webdrivers
48
54
  directories.each do |dir|
49
55
  files.each do |file|
50
56
  option = "#{dir}/#{file}"
51
- return option if File.exist?(option)
57
+ return System.escape_path(option) if File.exist?(option)
52
58
  end
53
59
  end
54
60
  end
@@ -58,11 +64,11 @@ module Webdrivers
58
64
  end
59
65
 
60
66
  def linux_version(location)
61
- System.call("#{Shellwords.escape location} --product-version")&.strip
67
+ System.call("#{location} --product-version")&.strip
62
68
  end
63
69
 
64
70
  def mac_version(location)
65
- System.call("#{Shellwords.escape location} --version")&.strip
71
+ System.call("#{location} --version")&.strip
66
72
  end
67
73
  end
68
74
  end
@@ -18,15 +18,19 @@ module Webdrivers
18
18
  class NetworkError < StandardError
19
19
  end
20
20
 
21
+ DEFAULT_CACHE_TIME = 86_400 # 24 hours
22
+
21
23
  class << self
22
24
  attr_accessor :proxy_addr, :proxy_port, :proxy_user, :proxy_pass
23
25
  attr_writer :install_dir, :cache_time
24
26
 
25
27
  #
26
28
  # Returns the amount of time (Seconds) the gem waits between two update checks.
29
+ # @note Value from the environment variable "WD_CACHE_TIME" takes precedence over Webdrivers.cache_time. If neither
30
+ # are set, it defaults to 86,400 Seconds (24 hours).
27
31
  #
28
32
  def cache_time
29
- (@cache_time || ENV['WD_CACHE_TIME']).to_i
33
+ (ENV['WD_CACHE_TIME'] || @cache_time || DEFAULT_CACHE_TIME).to_i
30
34
  end
31
35
 
32
36
  #
@@ -105,7 +109,7 @@ end
105
109
  #
106
110
  # @return [String]
107
111
  def driver_path
108
- File.join System.install_dir, file_name
112
+ System.escape_path File.join(System.install_dir, file_name)
109
113
  end
110
114
 
111
115
  private
@@ -149,6 +149,12 @@ module Webdrivers
149
149
  Webdrivers.logger.debug "making System call: #{cmd}"
150
150
  `#{cmd}`
151
151
  end
152
+
153
+ def escape_path(path)
154
+ return path.tr('/', '\\') if platform == 'win' # Windows
155
+
156
+ Shellwords.escape(path) # Linux and macOS
157
+ end
152
158
  end
153
159
  end
154
160
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrivers
4
- VERSION = '4.0.0'
4
+ VERSION = '4.0.1'
5
5
  end
@@ -114,7 +114,7 @@ describe Webdrivers::Chromedriver do
114
114
 
115
115
  chromedriver.update
116
116
 
117
- expect(Webdrivers::Network).to have_received(:get).twice
117
+ expect(Webdrivers::Network).to have_received(:get).once
118
118
  end
119
119
 
120
120
  context 'when required version is 0' do
@@ -252,7 +252,9 @@ describe Webdrivers::Chromedriver do
252
252
 
253
253
  describe '#driver_path' do
254
254
  it 'returns full location of binary' do
255
- expect(chromedriver.driver_path).to match("#{File.join(ENV['HOME'])}/.webdrivers/chromedriver")
255
+ expected_bin = "chromedriver#{'.exe' if Selenium::WebDriver::Platform.windows?}"
256
+ expected_path = Webdrivers::System.escape_path("#{File.join(ENV['HOME'])}/.webdrivers/#{expected_bin}")
257
+ expect(chromedriver.driver_path).to eq(expected_path)
256
258
  end
257
259
  end
258
260
  end
@@ -204,7 +204,9 @@ You can obtain a copy of the license at https://mozilla.org/MPL/2.0/"
204
204
 
205
205
  describe '#driver_path' do
206
206
  it 'returns full location of binary' do
207
- expect(geckodriver.driver_path).to match("#{File.join(ENV['HOME'])}/.webdrivers/geckodriver")
207
+ expected_bin = "geckodriver#{'.exe' if Selenium::WebDriver::Platform.windows?}"
208
+ expected_path = Webdrivers::System.escape_path("#{File.join(ENV['HOME'])}/.webdrivers/#{expected_bin}")
209
+ expect(geckodriver.driver_path).to eq(expected_path)
208
210
  end
209
211
  end
210
212
  end
@@ -186,7 +186,8 @@ describe Webdrivers::IEdriver do
186
186
 
187
187
  describe '#driver_path' do
188
188
  it 'returns full location of binary' do
189
- expect(iedriver.driver_path).to eq("#{File.join(ENV['HOME'])}/.webdrivers/IEDriverServer.exe")
189
+ expected_path = Webdrivers::System.escape_path("#{File.join(ENV['HOME'])}/.webdrivers/IEDriverServer.exe")
190
+ expect(iedriver.driver_path).to eq(expected_path)
190
191
  end
191
192
  end
192
193
  end
@@ -6,32 +6,38 @@ describe Webdrivers do
6
6
  describe '#cache_time' do
7
7
  before { Webdrivers::Chromedriver.remove }
8
8
 
9
- after { described_class.cache_time = 0 }
9
+ after { described_class.cache_time = nil }
10
10
 
11
- it 'does not warn if cache time is set' do
12
- described_class.cache_time = 50
11
+ context 'when cache time is not set' do
12
+ before { described_class.cache_time = nil }
13
13
 
14
- msg = /Webdrivers Driver caching is turned off in this version, but will be enabled by default in 4\.x/
15
- expect { Webdrivers::Chromedriver.update }.not_to output(msg).to_stdout_from_any_process
14
+ it 'defaults cache time to 86,400 Seconds (24 hours)' do
15
+ expect(described_class.cache_time).to eq(86_400)
16
+ end
16
17
  end
17
18
 
18
- context 'when ENV variable WD_CACHE_TIME is set and Webdrivers.cache_time is not' do
19
- before { described_class.cache_time = nil }
19
+ context 'when Webdrivers.cache_time is set' do
20
+ before { described_class.cache_time = '999' }
20
21
 
21
- it 'uses cache time value from ENV variable' do
22
- allow(ENV).to receive(:[]).with('WD_CACHE_TIME').and_return('999')
23
- expect(described_class.cache_time).to be(999)
22
+ it 'returns user defined cache time' do
23
+ expect(described_class.cache_time).to eq(999)
24
24
  end
25
25
 
26
26
  it 'returns cache time as an Integer' do
27
- allow(ENV).to receive(:[]).with('WD_CACHE_TIME').and_return('999')
28
27
  expect(described_class.cache_time).to be_an_instance_of(Integer)
29
28
  end
30
29
  end
31
30
 
32
- context 'when Webdrivers.cache_time is set' do
31
+ context 'when ENV variable WD_CACHE_TIME is set' do
32
+ before { described_class.cache_time = 86_400 }
33
+
34
+ it 'uses cache time value from ENV variable over the Webdrivers.cache_time value' do
35
+ allow(ENV).to receive(:[]).with('WD_CACHE_TIME').and_return(999)
36
+ expect(described_class.cache_time).to be(999)
37
+ end
38
+
33
39
  it 'returns cache time as an Integer' do
34
- described_class.cache_time = '999'
40
+ allow(ENV).to receive(:fetch).with('WD_CACHE_TIME', 86_400).and_return('999')
35
41
  expect(described_class.cache_time).to be_an_instance_of(Integer)
36
42
  end
37
43
  end
@@ -0,0 +1,7 @@
1
+ $downloadLink = "https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.2.7.0/jruby-dist-9.2.7.0-bin.zip"
2
+ $zipPath = "c:\jruby-dist-9.2.7.0-bin.zip"
3
+
4
+ Write-Host "Installing $($env:RUBY_VERSION)" -ForegroundColor cyan
5
+ appveyor DownloadFile "$($downloadLink)" -FileName "$($zipPath)"
6
+ 7z x "$($zipPath)" -oc:\ -y # Unzip to c:\
7
+ Write-Host "JRuby installed.`n" -ForegroundColor green
@@ -29,5 +29,5 @@ Gem::Specification.new do |s|
29
29
 
30
30
  s.add_runtime_dependency 'nokogiri', '~> 1.6'
31
31
  s.add_runtime_dependency 'rubyzip', '~> 1.0'
32
- s.add_runtime_dependency 'selenium-webdriver', '~> 3.0'
32
+ s.add_runtime_dependency 'selenium-webdriver', '>= 3.0', '< 4.0'
33
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdrivers
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Titus Fortner
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-05-28 00:00:00.000000000 Z
13
+ date: 2019-06-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi
@@ -142,16 +142,22 @@ dependencies:
142
142
  name: selenium-webdriver
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - "~>"
145
+ - - ">="
146
146
  - !ruby/object:Gem::Version
147
147
  version: '3.0'
148
+ - - "<"
149
+ - !ruby/object:Gem::Version
150
+ version: '4.0'
148
151
  type: :runtime
149
152
  prerelease: false
150
153
  version_requirements: !ruby/object:Gem::Requirement
151
154
  requirements:
152
- - - "~>"
155
+ - - ">="
153
156
  - !ruby/object:Gem::Version
154
157
  version: '3.0'
158
+ - - "<"
159
+ - !ruby/object:Gem::Version
160
+ version: '4.0'
155
161
  description: Run Selenium tests more easily with install and updates for all supported
156
162
  webdrivers.
157
163
  email:
@@ -192,6 +198,7 @@ files:
192
198
  - spec/webdrivers/i_edriver_spec.rb
193
199
  - spec/webdrivers/webdrivers_spec.rb
194
200
  - spec/webdrivers_proxy_support_spec.rb
201
+ - support/install_jruby.ps1
195
202
  - webdrivers.gemspec
196
203
  homepage: https://github.com/titusfortner/webdrivers
197
204
  licenses: