webdrivers 4.4.2 → 4.7.0

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: 5a9aab40e8054bb95185ed1231b7f74757811afb4ad47553b7b78c2fc35ea936
4
- data.tar.gz: c77d486952c76061d5007030b8e02025a72870469043617ddb230c16b11d0f1f
3
+ metadata.gz: 124d154092dc8915735f459f0476c7700e47300bec986e9b88ba214b2db8b92c
4
+ data.tar.gz: 9db15712e5227ef9b92db34a7d1714ba9613ca2bd30563b85cf5dbeee5322063
5
5
  SHA512:
6
- metadata.gz: c9f29b0e62b33afe328f833ac8a8cb55e11e137938d22a7a66e9e72aa837ee58a9a00f94aa06977c78eac88bd3f446571753728536414b4a9b34a1ddfc0971bf
7
- data.tar.gz: 2b979a07116667932ee3e0ca71678f1eec119840b712a2d265a61b1c1585bc14134e1238829d336bedf8c1373bff08cd6f0a80c66bf8378d63123e53a3ab249b
6
+ metadata.gz: 727a676f6b025291ecc30fff84b16159820607f4dba0c1216b3c1487f56b5bb4da8679b69b464a5234dc78d872da4b63112b11d60efd3fbb72cfbaf61ea57223
7
+ data.tar.gz: 744f5a8173676d02b2f94ff3eda885ec77d47a4e2e04cbfaa04876262e500e906313f6280d0a12e93274ba7f558886a035879d72b0264903fc695c2139b4ca83
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # 4.7.0 (2021-10-14)
2
+ * Add support for Selenium 4.x #218 (thanks yahonda )
3
+ * Allow Edge on Linux
4
+ * Update required Selenium > 3.141 because of a change in 4.6
5
+ * Require Selenium 2.6+
6
+ * Fix IE downloads with the change in location of assets
7
+
8
+ # 4.6.1 (2021-08-19)
9
+ * Fix bug in IEdriver caused by bad formatting in recent release
10
+
11
+ # 4.6.0 (2021-02-26)
12
+ * Update `Edgedriver` naming to support Selenium 4 beta (([#206](https://github.com/titusfortner/webdrivers/pull/206))
13
+
14
+ # 4.5.0 (2021-01-19)
15
+ * Improve format of README usage section. Thanks, [okuramasafumi](https://github.com/okuramasafumi)!
16
+ * `chromedriver` - Add support for Apple M1 specific builds ([#193](https://github.com/titusfortner/webdrivers/pull/193)). Thanks, [MichaelHoste](https://github.com/MichaelHoste)!
17
+ * `msedgedriver` - Add support for Apple M1 specific builds.
18
+ * `msedgedriver` - Added automatic selection of 32-bit vs 64-bit builds on Windows and WSLv1.
19
+ * When using this gem in WSLv2, Chrome installed on the Linux filesystem will be automatically used ([#196](https://github.com/titusfortner/webdrivers/pull/196)).
20
+ WSLv1 continues to automatically use Chrome from the Windows filesystem though. Thanks, [fabioxgn](https://github.com/fabioxgn)!
21
+ * We'll aim to make the behavior consistent in a future release.
22
+
1
23
  ### 4.4.2 (2020-12-29)
2
24
  * Use new powershell if available to enhance WSL support ([#176](https://github.com/titusfortner/webdrivers/issues/176),
3
25
  [#186](https://github.com/titusfortner/webdrivers/pull/186)). Thanks, [G-Rath](https://github.com/G-Rath) and
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Webdrivers
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/webdrivers.svg)](https://badge.fury.io/rb/webdrivers)
4
- [![Build status](https://travis-ci.org/titusfortner/webdrivers.svg?branch=master)](https://travis-ci.org/titusfortner/webdrivers)
5
- [![AppVeyor status](https://ci.appveyor.com/api/projects/status/ejh90xqbvkphq4cy/branch/master?svg=true)](https://ci.appveyor.com/project/titusfortner/webdrivers/branch/master)
4
+ ![Tests](https://github.com/titusfortner/webdrivers/workflows/Tests/badge.svg)
6
5
 
7
6
  Run Selenium tests more easily with automatic installation and updates for all supported webdrivers.
8
7
 
@@ -15,13 +14,16 @@ Run Selenium tests more easily with automatic installation and updates for all s
15
14
  * [IEDriverServer](https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver)
16
15
  * [msedgedriver](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)
17
16
 
18
- Works on macOS, Linux, Windows, and Windows Subsystem for Linux (WSL) v1.
17
+ Works on macOS, Linux, Windows, and Windows Subsystem for Linux (WSL) v1 and v2. And do see the browser and OS specific
18
+ notes at the bottom.
19
19
 
20
20
  ## Usage
21
21
 
22
22
  In your Gemfile:
23
23
 
24
- `gem 'webdrivers', '~> 4.0', require: false`
24
+ ```ruby
25
+ gem 'webdrivers', '~> 4.0', require: false
26
+ ```
25
27
 
26
28
  In your project:
27
29
 
@@ -194,15 +196,7 @@ The logging level can be configured for debugging purpose:
194
196
  Webdrivers.logger.level = :DEBUG
195
197
  ```
196
198
 
197
- ### WSLv1 support
198
-
199
- While WSLv1 is not designed to run headful applications like Chrome, it can run exes; as such when found to be running
200
- in WSL, `webdrivers` will use the Windows `chromedriver.exe`.
201
-
202
- It's recommended that you install the new PowerShell (PS7) to avoid [a known issue](https://github.com/microsoft/terminal/issues/367)
203
- with the console font being changed when calling the old PowerShell (PS5).
204
-
205
- ### Browser Specific Notes
199
+ ### Browser & OS Specific Notes
206
200
 
207
201
  #### Chrome/Chromium
208
202
 
@@ -227,7 +221,7 @@ variable.
227
221
  This is also required if Google Chrome is not installed in its
228
222
  [default location](https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver).
229
223
 
230
- ##### Heroku Users
224
+ #### Chrome on Heroku
231
225
 
232
226
  Follow the specific instructions [here](https://github.com/titusfortner/webdrivers/wiki/Heroku-buildpack-google-chrome) if you're using `heroku-buildpack-google-chrome`.
233
227
 
@@ -239,6 +233,27 @@ section apply to this browser as well.
239
233
 
240
234
  Please note that `msedgedriver` requires `selenium-webdriver` v4.
241
235
 
236
+ #### WSLv1 support
237
+
238
+ While WSLv1 is not designed to run headful applications like Chrome, it can run exes; as such when found to be running
239
+ in WSL, `webdrivers` will use Chrome on the Windows filesystem.
240
+
241
+ It's recommended that you install the new PowerShell (PS7) to avoid [a known issue](https://github.com/microsoft/terminal/issues/367)
242
+ with the console font being changed when calling the old PowerShell (PS5).
243
+
244
+ #### WSLv2 support
245
+
246
+ Webdrivers will detect WSLv2 as running on Linux and use Chrome on the Linux filesystem.
247
+
248
+ WSLv2 doesn't support connecting to host ports out of the box, so it isn't possible to connect to Chromedriver on
249
+ Windows without extra configurations, see: https://github.com/microsoft/WSL/issues/4619. The simplest way to use
250
+ Chromedriver with WSLv2 is to run Chrome headless on Linux.
251
+
252
+ #### Chrome and Edge on Apple M1 (`arm64`)
253
+
254
+ If you're switching from Intel to M1, you'll have to manually delete the existing Intel (`mac64`) driver before the
255
+ M1 (`arm64`) build can be downloaded. Otherwise, you'll get an error: `Bad CPU type in executable - ~/.webdrivers/chromedriver (Errno::E086)`
256
+
242
257
  ## Wiki
243
258
 
244
259
  Please see the [wiki](https://github.com/titusfortner/webdrivers/wiki)
@@ -88,7 +88,7 @@ module Webdrivers
88
88
  end
89
89
 
90
90
  def linux_location
91
- return wsl_location if System.wsl?
91
+ return wsl_location if System.wsl_v1?
92
92
 
93
93
  directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/google/chrome]
94
94
  files = %w[google-chrome chrome chromium chromium-browser]
@@ -114,7 +114,7 @@ module Webdrivers
114
114
  end
115
115
 
116
116
  def linux_version(location)
117
- return wsl_version(location) if System.wsl?
117
+ return wsl_version(location) if System.wsl_v1?
118
118
 
119
119
  System.call(location, '--product-version')&.strip
120
120
  end
@@ -84,22 +84,34 @@ module Webdrivers
84
84
  end
85
85
 
86
86
  def file_name
87
- System.platform == 'win' || System.wsl? ? 'chromedriver.exe' : 'chromedriver'
87
+ System.platform == 'win' || System.wsl_v1? ? 'chromedriver.exe' : 'chromedriver'
88
88
  end
89
89
 
90
- def download_url
91
- return @download_url if @download_url
90
+ def apple_m1_compatible?(driver_version)
91
+ if System.apple_m1_architecture? && driver_version >= normalize_version('87.0.4280.88')
92
+ Webdrivers.logger.debug 'chromedriver version is Apple M1 compatible.'
93
+ return true
94
+ end
92
95
 
93
- version = if required_version == EMPTY_VERSION
94
- latest_version
95
- else
96
- normalize_version(required_version)
97
- end
96
+ Webdrivers.logger.debug 'chromedriver version is NOT Apple M1 compatible. Required >= 87.0.4280.88'
97
+ false
98
+ end
98
99
 
99
- file_name = System.platform == 'win' || System.wsl? ? 'win32' : "#{System.platform}64"
100
- url = "#{base_url}/#{version}/chromedriver_#{file_name}.zip"
101
- Webdrivers.logger.debug "chromedriver URL: #{url}"
102
- @download_url = url
100
+ def direct_url(driver_version)
101
+ "#{base_url}/#{driver_version}/chromedriver_#{driver_filename(driver_version)}.zip"
102
+ end
103
+
104
+ def driver_filename(driver_version)
105
+ if System.platform == 'win' || System.wsl_v1?
106
+ 'win32'
107
+ elsif System.platform == 'linux'
108
+ 'linux64'
109
+ elsif System.platform == 'mac'
110
+ apple_arch = apple_m1_compatible?(driver_version) ? '_m1' : ''
111
+ "mac64#{apple_arch}"
112
+ else
113
+ raise 'Failed to determine driver filename to download for your OS.'
114
+ end
103
115
  end
104
116
 
105
117
  # Returns major.minor.build version from the currently installed chromedriver version
@@ -134,17 +146,4 @@ module Webdrivers
134
146
  end
135
147
  end
136
148
 
137
- if ::Selenium::WebDriver::Service.respond_to? :driver_path=
138
- ::Selenium::WebDriver::Chrome::Service.driver_path = proc { ::Webdrivers::Chromedriver.update }
139
- else
140
- # v3.141.0 and lower
141
- module Selenium
142
- module WebDriver
143
- module Chrome
144
- def self.driver_path
145
- @driver_path ||= Webdrivers::Chromedriver.update
146
- end
147
- end
148
- end
149
- end
150
- end
149
+ ::Selenium::WebDriver::Chrome::Service.driver_path = proc { ::Webdrivers::Chromedriver.update }
@@ -118,12 +118,12 @@ module Webdrivers
118
118
 
119
119
  private
120
120
 
121
+ def download_version
122
+ required_version == EMPTY_VERSION ? latest_version : required_version
123
+ end
124
+
121
125
  def download_url
122
- @download_url ||= if required_version == EMPTY_VERSION
123
- downloads[downloads.keys.max]
124
- else
125
- downloads[normalize_version(required_version)]
126
- end
126
+ @download_url ||= direct_url(download_version).tap { |url| Webdrivers.logger.debug "#{file_name} URL: #{url}" }
127
127
  end
128
128
 
129
129
  def exists?
@@ -131,11 +131,7 @@ module Webdrivers
131
131
  end
132
132
 
133
133
  def correct_binary?
134
- current_version == if required_version == EMPTY_VERSION
135
- latest_version
136
- else
137
- normalize_version(required_version)
138
- end
134
+ current_version == download_version
139
135
  rescue ConnectionError, VersionError
140
136
  driver_path if sufficient_binary?
141
137
  end
@@ -24,15 +24,15 @@ module Webdrivers
24
24
  private
25
25
 
26
26
  def user_defined_location
27
- if Selenium::WebDriver::EdgeChrome.path
28
- Webdrivers.logger.debug "Selenium::WebDriver::EdgeChrome.path: #{Selenium::WebDriver::EdgeChrome.path}"
29
- return Selenium::WebDriver::EdgeChrome.path
27
+ if Selenium::WebDriver::Edge.path
28
+ Webdrivers.logger.debug "Selenium::WebDriver::Edge.path: #{Selenium::WebDriver::Edge.path}"
29
+ return Selenium::WebDriver::Edge.path
30
30
  end
31
31
 
32
- return if ENV['WD_EDGE_CHROME_PATH'].nil?
32
+ return if ENV['WD_EDGE_PATH'].nil?
33
33
 
34
- Webdrivers.logger.debug "WD_EDGE_CHROME_PATH: #{ENV['WD_EDGE_CHROME_PATH']}"
35
- ENV['WD_EDGE_CHROME_PATH']
34
+ Webdrivers.logger.debug "WD_EDGE_PATH: #{ENV['WD_EDGE_PATH']}"
35
+ ENV['WD_EDGE_PATH']
36
36
  end
37
37
 
38
38
  def win_location
@@ -69,6 +69,17 @@ module Webdrivers
69
69
  end
70
70
 
71
71
  def linux_location
72
+ # directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/google/chrome]
73
+ # files = %w[microsoft-edge] # Based on Microsoft Edge 89.0.760.0 dev
74
+ #
75
+ # directories.each do |dir|
76
+ # files.each do |file|
77
+ # option = "#{dir}/#{file}"
78
+ # return option if File.exist?(option)
79
+ # end
80
+ # end
81
+ #
82
+ # nil
72
83
  raise 'Default location not yet known'
73
84
  end
74
85
 
@@ -66,37 +66,39 @@ module Webdrivers
66
66
  System.platform == 'win' ? 'msedgedriver.exe' : 'msedgedriver'
67
67
  end
68
68
 
69
- def download_url
70
- return @download_url if @download_url
69
+ def apple_m1_compatible?(driver_version)
70
+ if System.apple_m1_architecture? && driver_version >= normalize_version('87.0.669.0')
71
+ Webdrivers.logger.debug 'msedgedriver version is Apple M1 compatible.'
72
+ return true
73
+ end
71
74
 
72
- version = if required_version == EMPTY_VERSION
73
- latest_version
74
- else
75
- normalize_version(required_version)
76
- end
75
+ Webdrivers.logger.debug 'msedgedriver version is NOT Apple M1 compatible. Required >= 87.0.669.0'
76
+ false
77
+ end
77
78
 
78
- file_name = System.platform == 'win' ? 'win32' : "#{System.platform}64"
79
- url = "#{base_url}/#{version}/edgedriver_#{file_name}.zip"
80
- Webdrivers.logger.debug "msedgedriver URL: #{url}"
81
- @download_url = url
79
+ def linux_compatible?(driver_version)
80
+ System.platform == 'linux' && driver_version >= normalize_version('89.0.731.0')
82
81
  end
83
- end
84
- end
85
- end
86
82
 
87
- if defined? Selenium::WebDriver::EdgeChrome
88
- if ::Selenium::WebDriver::Service.respond_to? :driver_path=
89
- ::Selenium::WebDriver::EdgeChrome::Service.driver_path = proc { ::Webdrivers::Edgedriver.update }
90
- else
91
- # v3.141.0 and lower
92
- module Selenium
93
- module WebDriver
94
- module EdgeChrome
95
- def self.driver_path
96
- @driver_path ||= Webdrivers::Edgedriver.update
97
- end
83
+ def driver_filename(driver_version)
84
+ if System.platform == 'win' || System.wsl_v1?
85
+ "win#{System.bitsize}" # 32 or 64-bit
86
+ elsif linux_compatible?(driver_version)
87
+ 'linux64'
88
+ elsif System.platform == 'mac'
89
+ # Determine M1 or Intel architecture
90
+ apple_arch = apple_m1_compatible?(driver_version) ? 'arm' : 'mac'
91
+ "#{apple_arch}64"
92
+ else
93
+ raise 'Failed to determine driver filename to download for your OS.'
98
94
  end
99
95
  end
96
+
97
+ def direct_url(driver_version)
98
+ "#{base_url}/#{driver_version}/edgedriver_#{driver_filename(driver_version)}.zip"
99
+ end
100
100
  end
101
101
  end
102
102
  end
103
+
104
+ ::Selenium::WebDriver::Edge::Service.driver_path = proc { ::Webdrivers::Edgedriver.update }
@@ -42,14 +42,6 @@ module Webdrivers
42
42
  System.platform == 'win' ? 'geckodriver.exe' : 'geckodriver'
43
43
  end
44
44
 
45
- def download_url
46
- @download_url ||= if required_version == EMPTY_VERSION
47
- direct_url(latest_version)
48
- else
49
- direct_url(required_version)
50
- end
51
- end
52
-
53
45
  def direct_url(version)
54
46
  "#{base_url}/download/v#{version}/geckodriver-v#{version}-#{platform_ext}"
55
47
  end
@@ -68,17 +60,4 @@ module Webdrivers
68
60
  end
69
61
  end
70
62
 
71
- if ::Selenium::WebDriver::Service.respond_to? :driver_path=
72
- ::Selenium::WebDriver::Firefox::Service.driver_path = proc { ::Webdrivers::Geckodriver.update }
73
- else
74
- # v3.141.0 and lower
75
- module Selenium
76
- module WebDriver
77
- module Firefox
78
- def self.driver_path
79
- @driver_path ||= Webdrivers::Geckodriver.update
80
- end
81
- end
82
- end
83
- end
84
- end
63
+ ::Selenium::WebDriver::Firefox::Service.driver_path = proc { ::Webdrivers::Geckodriver.update }
@@ -34,7 +34,7 @@ module Webdrivers
34
34
  #
35
35
  # @return [String]
36
36
  def base_url
37
- 'https://selenium-release.storage.googleapis.com/'
37
+ 'https://api.github.com/repos/seleniumhq/selenium/releases'
38
38
  end
39
39
 
40
40
  private
@@ -43,35 +43,26 @@ module Webdrivers
43
43
  'IEDriverServer.exe'
44
44
  end
45
45
 
46
+ def direct_url(version)
47
+ downloads[version]
48
+ end
49
+
46
50
  def downloads
47
51
  ds = download_manifest.each_with_object({}) do |item, hash|
48
- version = normalize_version item[/([^_]+)\.zip/, 1]
49
- hash[version] = "#{base_url}#{item}"
52
+ version = normalize_version item['name'][/\.?([^_]+)\.zip/, 1]
53
+ hash[version] = item['browser_download_url']
50
54
  end
51
55
  Webdrivers.logger.debug "Versions now located on downloads site: #{ds.keys}"
52
56
  ds
53
57
  end
54
58
 
55
59
  def download_manifest
56
- doc = Nokogiri::XML.parse(Network.get(base_url))
57
- items = doc.css('Key').collect(&:text)
58
- items.select { |item| item.include?('IEDriverServer_Win32') }
60
+ json = Network.get(base_url)
61
+ all_assets = JSON.parse(json).map { |release| release['assets'] }.flatten
62
+ all_assets.select { |asset| asset['name'].include?('IEDriverServer_Win32') }
59
63
  end
60
64
  end
61
65
  end
62
66
  end
63
67
 
64
- if ::Selenium::WebDriver::Service.respond_to? :driver_path=
65
- ::Selenium::WebDriver::IE::Service.driver_path = proc { ::Webdrivers::IEdriver.update }
66
- else
67
- # v3.141.0 and lower
68
- module Selenium
69
- module WebDriver
70
- module IE
71
- def self.driver_path
72
- @driver_path ||= Webdrivers::IEdriver.update
73
- end
74
- end
75
- end
76
- end
77
- end
68
+ ::Selenium::WebDriver::IE::Service.driver_path = proc { ::Webdrivers::IEdriver.update }
@@ -148,9 +148,19 @@ module Webdrivers
148
148
  end
149
149
  end
150
150
 
151
+ def apple_m1_architecture?
152
+ if platform == 'mac' && RUBY_PLATFORM.include?('arm64-darwin')
153
+ Webdrivers.logger.debug 'Apple architecture: M1 (arm64-darwin)'
154
+ return true
155
+ end
156
+
157
+ Webdrivers.logger.debug 'Apple architecture: Intel (mac64)'
158
+ false
159
+ end
160
+
151
161
  # @return [TrueClass, FalseClass]
152
- def wsl?
153
- platform == 'linux' && File.open('/proc/version').read.downcase.include?('microsoft')
162
+ def wsl_v1?
163
+ platform == 'linux' && File.open('/proc/version').read.include?('Microsoft')
154
164
  end
155
165
 
156
166
  # @param [String] path
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrivers
4
- VERSION = '4.4.2'
4
+ VERSION = '4.7.0'
5
5
  end
@@ -52,7 +52,7 @@ describe Webdrivers::ChromeFinder do
52
52
  before do
53
53
  skip "The current platform cannot be WSL, as it's not Linux" unless Selenium::WebDriver::Platform.linux?
54
54
 
55
- allow(Webdrivers::System).to receive(:wsl?).and_return(true)
55
+ allow(Webdrivers::System).to receive(:wsl_v1?).and_return(true)
56
56
  allow(Webdrivers::System).to receive(:to_wsl_path).and_return('')
57
57
  allow(Webdrivers::System).to receive(:to_win32_path).and_return('')
58
58
  end
@@ -6,10 +6,10 @@ describe Webdrivers::EdgeFinder do
6
6
  let(:edge_finder) { described_class }
7
7
 
8
8
  before(:all) do # rubocop:disable RSpec/BeforeAfterAll
9
- # Skip these tests if version of selenium-webdriver being tested with doesn't
10
- # have Chromium based Edge support
11
- unless defined?(Selenium::WebDriver::EdgeChrome)
12
- skip "The current selenium-webdriver doesn't include Chromium based Edge support"
9
+ if Selenium::WebDriver::VERSION[0].to_i < 4
10
+ skip 'The current selenium-webdriver does not include Chromium based Edge support'
11
+ elsif Webdrivers::System.platform == 'linux'
12
+ skip 'Edge is not yet supported on Linux'
13
13
  end
14
14
  end
15
15
 
@@ -20,8 +20,8 @@ describe Webdrivers::EdgeFinder do
20
20
  end
21
21
 
22
22
  context 'when the user provides a path to the Edge binary' do
23
- it 'uses Selenium::WebDriver::EdgeChrome.path when it is defined' do
24
- Selenium::WebDriver::EdgeChrome.path = edge_finder.location
23
+ it 'uses Selenium::WebDriver::Edge.path when it is defined' do
24
+ Selenium::WebDriver::Edge.path = edge_finder.location
25
25
  locations = %i[win_location mac_location linux_location]
26
26
  allow(edge_finder).to receive_messages(locations)
27
27
 
@@ -29,8 +29,8 @@ describe Webdrivers::EdgeFinder do
29
29
  locations.each { |loc| expect(edge_finder).not_to have_received(loc) }
30
30
  end
31
31
 
32
- it "uses ENV['WD_EDGE_CHROME_PATH'] when it is defined" do
33
- allow(ENV).to receive(:[]).with('WD_EDGE_CHROME_PATH').and_return(edge_finder.location)
32
+ it "uses ENV['WD_EDGE_PATH'] when it is defined" do
33
+ allow(ENV).to receive(:[]).with('WD_EDGE_PATH').and_return(edge_finder.location)
34
34
  locations = %i[win_location mac_location linux_location]
35
35
  allow(edge_finder).to receive_messages(locations)
36
36
 
@@ -38,11 +38,11 @@ describe Webdrivers::EdgeFinder do
38
38
  locations.each { |loc| expect(edge_finder).not_to have_received(loc) }
39
39
  end
40
40
 
41
- it 'uses Selenium::WebDriver::EdgeChrome.path over WD_EDGE_CHROME_PATH' do
42
- Selenium::WebDriver::EdgeChrome.path = edge_finder.location
43
- allow(ENV).to receive(:[]).with('WD_EDGE_CHROME_PATH').and_return('my_wd_chrome_path')
41
+ it 'uses Selenium::WebDriver::Edge.path over WD_EDGE_PATH' do
42
+ Selenium::WebDriver::Edge.path = edge_finder.location
43
+ allow(ENV).to receive(:[]).with('WD_EDGE_PATH').and_return('my_wd_chrome_path')
44
44
  expect(edge_finder.version).not_to be_nil
45
- expect(ENV).not_to have_received(:[]).with('WD_EDGE_CHROME_PATH')
45
+ expect(ENV).not_to have_received(:[]).with('WD_EDGE_PATH')
46
46
  end
47
47
  end
48
48
 
@@ -6,10 +6,10 @@ describe Webdrivers::Edgedriver do
6
6
  let(:edgedriver) { described_class }
7
7
 
8
8
  before(:all) do # rubocop:disable RSpec/BeforeAfterAll
9
- # Skip these tests if version of selenium-webdriver being tested with doesn't
10
- # have Chromium based Edge support
11
- unless defined?(Selenium::WebDriver::EdgeChrome)
12
- skip "The current selenium-webdriver doesn't include Chromium based Edge support"
9
+ if Selenium::WebDriver::VERSION[0].to_i < 4
10
+ skip 'The current selenium-webdriver does not include Chromium based Edge support'
11
+ elsif Webdrivers::System.platform == 'linux'
12
+ skip 'Edge is not yet supported on Linux'
13
13
  end
14
14
  end
15
15
 
@@ -180,8 +180,7 @@ describe Webdrivers::Edgedriver do
180
180
  end
181
181
 
182
182
  it 'raises VersionError for unknown version' do
183
- skip "MS doesn't yet support point release latest versioning."
184
- allow(edgedriver).to receive(:browser_version).and_return('77.0.9999.0000')
183
+ allow(edgedriver).to receive(:browser_version).and_return Gem::Version.new('77.0.9999')
185
184
  msg = 'Unable to find latest point release version for 77.0.9999. '\
186
185
  'Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` '\
187
186
  'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net/'
@@ -192,14 +192,12 @@ You can obtain a copy of the license at https://mozilla.org/MPL/2.0/"
192
192
  end
193
193
 
194
194
  it 'uses provided value' do
195
- begin
196
- install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
197
- Webdrivers.install_dir = install_dir
195
+ install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
196
+ Webdrivers.install_dir = install_dir
198
197
 
199
- expect(Webdrivers::System.install_dir).to eq install_dir
200
- ensure
201
- Webdrivers.install_dir = nil
202
- end
198
+ expect(Webdrivers::System.install_dir).to eq install_dir
199
+ ensure
200
+ Webdrivers.install_dir = nil
203
201
  end
204
202
  end
205
203
 
@@ -6,6 +6,10 @@ describe Webdrivers::IEdriver do
6
6
  let(:iedriver) { described_class }
7
7
 
8
8
  before do
9
+ if ENV['CI'] && !Selenium::WebDriver::Platform.windows?
10
+ skip('Only run IE tests on Windows on CI because rate limiting')
11
+ end
12
+
9
13
  iedriver.remove
10
14
  iedriver.required_version = nil
11
15
  end
@@ -69,7 +73,7 @@ describe Webdrivers::IEdriver do
69
73
  it 'raises ConnectionError if offline' do
70
74
  allow(Net::HTTP).to receive(:get_response).and_raise(SocketError)
71
75
 
72
- msg = %r{Can not reach https://selenium-release.storage.googleapis.com/}
76
+ msg = %r{Can not reach https://api.github.com/repos/seleniumhq/selenium/releases}
73
77
  expect { iedriver.update }.to raise_error(Webdrivers::ConnectionError, msg)
74
78
  end
75
79
  end
@@ -109,7 +113,8 @@ describe Webdrivers::IEdriver do
109
113
  end
110
114
 
111
115
  it 'creates cached file' do
112
- allow(Webdrivers::Network).to receive(:get).and_return('3.4.0')
116
+ json = '[{"assets": [{"name":"IEDriverServer_Win32_3.150.0.zip"}]}]'
117
+ allow(Webdrivers::Network).to receive(:get).and_return(json)
113
118
 
114
119
  iedriver.latest_version
115
120
  expect(File.exist?("#{Webdrivers::System.install_dir}/IEDriverServer.version")).to eq true
@@ -174,14 +179,12 @@ describe Webdrivers::IEdriver do
174
179
  end
175
180
 
176
181
  it 'uses provided value' do
177
- begin
178
- install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
179
- Webdrivers.install_dir = install_dir
182
+ install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
183
+ Webdrivers.install_dir = install_dir
180
184
 
181
- expect(Webdrivers::System.install_dir).to eq install_dir
182
- ensure
183
- Webdrivers.install_dir = nil
184
- end
185
+ expect(Webdrivers::System.install_dir).to eq install_dir
186
+ ensure
187
+ Webdrivers.install_dir = nil
185
188
  end
186
189
  end
187
190
 
@@ -2,36 +2,42 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- wsl_proc_contents = [
6
- 'Linux version 4.4.0-18362-Microsoft',
7
- '(Microsoft@Microsoft.com)',
8
- '(gcc version 5.4.0 (GCC) )',
9
- '#836-Microsoft',
10
- 'Mon May 05 16:04:00 PST 2020'
11
- ].join ' '
12
-
13
5
  describe Webdrivers::System do
14
- describe '#wsl?' do
15
- context 'when the current platform is linux' do
16
- before { allow(described_class).to receive(:platform).and_return 'linux' }
6
+ describe '#wsl_v1?' do
7
+ subject { described_class.wsl_v1? }
8
+
9
+ before do
10
+ allow(described_class).to receive(:platform).and_return(platform)
11
+ allow(File).to receive(:open).with('/proc/version').and_return(StringIO.new(wsl_proc_version_contents))
12
+ end
17
13
 
18
- it 'checks /proc/version' do
19
- allow(File).to receive(:open).with('/proc/version').and_return(StringIO.new(wsl_proc_contents))
14
+ let(:platform) { 'linux' }
15
+ let(:wsl_proc_version_contents) { '' }
20
16
 
21
- expect(described_class.wsl?).to eq true
17
+ context 'when the current platform is linux and WSL version is 1' do
18
+ let(:wsl_proc_version_contents) do
19
+ 'Linux version 4.4.0-18362-Microsoft'\
20
+ '(Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) )'\
21
+ '#836-Microsoft Mon May 05 16:04:00 PST 2020'
22
22
  end
23
+
24
+ it { is_expected.to eq true }
23
25
  end
24
26
 
25
- context 'when the current platform is mac' do
26
- before { allow(described_class).to receive(:platform).and_return 'mac' }
27
+ context 'when the current platform is linux and WSL version is 2' do
28
+ let(:wsl_proc_version_contents) do
29
+ 'Linux version 4.19.84-microsoft-standard '\
30
+ '(oe-user@oe-host) (gcc version 8.2.0 (GCC)) '\
31
+ '#1 SMP Wed Nov 13 11:44:37 UTC 2019'
32
+ end
27
33
 
28
- it 'does not bother checking proc' do
29
- allow(File).to receive(:open).and_call_original
34
+ it { is_expected.to eq false }
35
+ end
30
36
 
31
- expect(described_class.wsl?).to eq false
37
+ context 'when the current platform is mac' do
38
+ let(:platform) { 'mac' }
32
39
 
33
- expect(File).not_to have_received(:open).with('/proc/version')
34
- end
40
+ it { is_expected.to eq false }
35
41
  end
36
42
  end
37
43
 
@@ -49,37 +49,31 @@ describe Webdrivers do
49
49
  end
50
50
 
51
51
  it 'uses provided value' do
52
- begin
53
- install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
54
- described_class.install_dir = install_dir
52
+ install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
53
+ described_class.install_dir = install_dir
55
54
 
56
- expect(described_class.install_dir).to eq install_dir
57
- ensure
58
- described_class.install_dir = nil
59
- end
55
+ expect(described_class.install_dir).to eq install_dir
56
+ ensure
57
+ described_class.install_dir = nil
60
58
  end
61
59
 
62
60
  context 'when ENV variable WD_INSTALL_DIR is set and Webdrivers.install_dir is not' do
63
61
  it 'uses path from the ENV variable' do
64
- begin
65
- described_class.install_dir = nil
66
- allow(ENV).to receive(:[]).with('WD_INSTALL_DIR').and_return('custom_dir')
67
- expect(described_class.install_dir).to be('custom_dir')
68
- ensure
69
- described_class.install_dir = nil
70
- end
62
+ described_class.install_dir = nil
63
+ allow(ENV).to receive(:[]).with('WD_INSTALL_DIR').and_return('custom_dir')
64
+ expect(described_class.install_dir).to be('custom_dir')
65
+ ensure
66
+ described_class.install_dir = nil
71
67
  end
72
68
  end
73
69
 
74
70
  context 'when both ENV variable WD_INSTALL_DIR and Webdrivers.install_dir are set' do
75
71
  it 'uses path from Webdrivers.install_dir' do
76
- begin
77
- described_class.install_dir = 'my_install_dir_path'
78
- allow(ENV).to receive(:[]).with('WD_INSTALL_DIR').and_return('my_env_path')
79
- expect(described_class.install_dir).to be('my_install_dir_path')
80
- ensure
81
- described_class.install_dir = nil
82
- end
72
+ described_class.install_dir = 'my_install_dir_path'
73
+ allow(ENV).to receive(:[]).with('WD_INSTALL_DIR').and_return('my_env_path')
74
+ expect(described_class.install_dir).to be('my_install_dir_path')
75
+ ensure
76
+ described_class.install_dir = nil
83
77
  end
84
78
  end
85
79
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdrivers
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.2
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Titus Fortner
8
8
  - Lakshya Kapoor
9
9
  - Thomas Walpole
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-12-30 00:00:00.000000000 Z
13
+ date: 2021-10-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi
@@ -156,22 +156,22 @@ dependencies:
156
156
  name: selenium-webdriver
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - ">="
159
+ - - ">"
160
160
  - !ruby/object:Gem::Version
161
- version: '3.0'
161
+ version: '3.141'
162
162
  - - "<"
163
163
  - !ruby/object:Gem::Version
164
- version: '4.0'
164
+ version: '5.0'
165
165
  type: :runtime
166
166
  prerelease: false
167
167
  version_requirements: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - ">="
169
+ - - ">"
170
170
  - !ruby/object:Gem::Version
171
- version: '3.0'
171
+ version: '3.141'
172
172
  - - "<"
173
173
  - !ruby/object:Gem::Version
174
- version: '4.0'
174
+ version: '5.0'
175
175
  description: Run Selenium tests more easily with install and updates for all supported
176
176
  webdrivers.
177
177
  email:
@@ -218,9 +218,9 @@ licenses:
218
218
  metadata:
219
219
  bug_tracker_uri: https://github.com/titusfortner/webdrivers/issues
220
220
  changelog_uri: https://github.com/titusfortner/webdrivers/blob/master/CHANGELOG.md
221
- documentation_uri: https://www.rubydoc.info/gems/webdrivers/4.4.2
222
- source_code_uri: https://github.com/titusfortner/webdrivers/tree/v4.4.2
223
- post_install_message:
221
+ documentation_uri: https://www.rubydoc.info/gems/webdrivers/4.7.0
222
+ source_code_uri: https://github.com/titusfortner/webdrivers/tree/v4.7.0
223
+ post_install_message:
224
224
  rdoc_options: []
225
225
  require_paths:
226
226
  - lib
@@ -228,25 +228,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
228
  requirements:
229
229
  - - ">="
230
230
  - !ruby/object:Gem::Version
231
- version: 2.4.0
231
+ version: 2.6.0
232
232
  required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - ">="
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  requirements: []
238
- rubygems_version: 3.1.4
239
- signing_key:
238
+ rubygems_version: 3.2.22
239
+ signing_key:
240
240
  specification_version: 4
241
241
  summary: Easy download and use of browser drivers.
242
242
  test_files:
243
243
  - spec/spec_helper.rb
244
244
  - spec/webdrivers/chrome_finder_spec.rb
245
+ - spec/webdrivers/chromedriver_spec.rb
245
246
  - spec/webdrivers/edge_finder_spec.rb
246
- - spec/webdrivers/webdrivers_spec.rb
247
- - spec/webdrivers/system_spec.rb
248
247
  - spec/webdrivers/edgedriver_spec.rb
249
- - spec/webdrivers/i_edriver_spec.rb
250
248
  - spec/webdrivers/geckodriver_spec.rb
251
- - spec/webdrivers/chromedriver_spec.rb
249
+ - spec/webdrivers/i_edriver_spec.rb
250
+ - spec/webdrivers/system_spec.rb
251
+ - spec/webdrivers/webdrivers_spec.rb
252
252
  - spec/webdrivers_proxy_support_spec.rb