webdrivers 4.5.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/LICENSE.txt +0 -0
  4. data/README.md +26 -20
  5. data/lib/webdrivers/Rakefile +0 -0
  6. data/lib/webdrivers/chrome_finder.rb +0 -0
  7. data/lib/webdrivers/chromedriver.rb +3 -26
  8. data/lib/webdrivers/common.rb +7 -11
  9. data/lib/webdrivers/edge_finder.rb +6 -6
  10. data/lib/webdrivers/edgedriver.rb +8 -33
  11. data/lib/webdrivers/geckodriver.rb +1 -22
  12. data/lib/webdrivers/iedriver.rb +11 -20
  13. data/lib/webdrivers/logger.rb +2 -93
  14. data/lib/webdrivers/network.rb +0 -0
  15. data/lib/webdrivers/railtie.rb +0 -0
  16. data/lib/webdrivers/system.rb +0 -0
  17. data/lib/webdrivers/tasks/chromedriver.rake +0 -0
  18. data/lib/webdrivers/tasks/edgedriver.rake +0 -0
  19. data/lib/webdrivers/tasks/geckodriver.rake +0 -0
  20. data/lib/webdrivers/tasks/iedriver.rake +0 -0
  21. data/lib/webdrivers/version.rb +1 -1
  22. data/lib/webdrivers.rb +0 -0
  23. data/spec/spec_helper.rb +0 -0
  24. data/spec/webdrivers/chrome_finder_spec.rb +0 -0
  25. data/spec/webdrivers/chromedriver_spec.rb +0 -0
  26. data/spec/webdrivers/edge_finder_spec.rb +9 -15
  27. data/spec/webdrivers/edgedriver_spec.rb +4 -10
  28. data/spec/webdrivers/geckodriver_spec.rb +5 -7
  29. data/spec/webdrivers/i_edriver_spec.rb +12 -9
  30. data/spec/webdrivers/system_spec.rb +0 -0
  31. data/spec/webdrivers/webdrivers_spec.rb +15 -21
  32. data/spec/webdrivers_proxy_support_spec.rb +0 -0
  33. metadata +13 -69
  34. data/spec/webdrivers/coverage/assets/0.10.2/application.css +0 -799
  35. data/spec/webdrivers/coverage/assets/0.10.2/application.js +0 -1707
  36. data/spec/webdrivers/coverage/assets/0.10.2/colorbox/border.png +0 -0
  37. data/spec/webdrivers/coverage/assets/0.10.2/colorbox/controls.png +0 -0
  38. data/spec/webdrivers/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
  39. data/spec/webdrivers/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
  40. data/spec/webdrivers/coverage/assets/0.10.2/favicon_green.png +0 -0
  41. data/spec/webdrivers/coverage/assets/0.10.2/favicon_red.png +0 -0
  42. data/spec/webdrivers/coverage/assets/0.10.2/favicon_yellow.png +0 -0
  43. data/spec/webdrivers/coverage/assets/0.10.2/loading.gif +0 -0
  44. data/spec/webdrivers/coverage/assets/0.10.2/magnify.png +0 -0
  45. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  46. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  47. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  48. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  49. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  50. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  51. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  52. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  53. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
  54. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  55. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
  56. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
  57. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  58. data/spec/webdrivers/coverage/index.html +0 -3512
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb33edccefe82002bbea2a0ca410d050bbf12f3b8e3a7a7721147f75ffed9c97
4
- data.tar.gz: 2a30c004082f6788096d0d18de559aeea99560a1a96a022b4e9b53c9e4232b12
3
+ metadata.gz: f4c9d9a6544732e58eb7a88d34e39b188b5ff658caaa14fbdff15931a69d1e2d
4
+ data.tar.gz: 92a4997e99508bb79374838461cd2fee48591185b271dd6ce170628c51a02c2c
5
5
  SHA512:
6
- metadata.gz: 78187b37c392f86a3ef9b788e39c00b81f48acca6de9f9c64a619c28c4f7b29d71a57f099478786ac903ac0ea199735832324fcde5c50f32635b78ce532cddf1
7
- data.tar.gz: 3bd31fda8f71d31238d8b73b2468677d5eb23ffe956bb82a74e382ce99a750dce5127ea8328e868c9a795015517c27f8fb208eee4fcdf0b81fa572b5200c1158
6
+ metadata.gz: fb469a584a66b14097ec87b6a8f2ad30e2cbefdaeef91efd2a50f16ff0451c8a748f8607d53d06ceed3506d61e54ef31b9997e068f9e55dfe9136f8012570234
7
+ data.tar.gz: ed61ff78edd17f205673242eeba0fa76dcb2df9675a7d8dc4c813e8dd056799a44b13c1a10b238eeb36bae96cc188ca20c4edd71aebf9ec48e9a78e613136f17
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ # 5.0.0 (2021-10-19)
2
+ * Require Selenium 4+
3
+ * Remove custom Logger and use the one in Selenium 4
4
+
5
+ # 4.7.0 (2021-10-14)
6
+ * Add support for Selenium 4.x #218 (thanks yahonda )
7
+ * Allow Edge on Linux
8
+ * Update required Selenium > 3.141 because of a change in 4.6
9
+ * Require Ruby 2.6+
10
+ * Fix IE downloads with the change in location of assets
11
+
12
+ # 4.6.1 (2021-08-19)
13
+ * Fix bug in IEdriver caused by bad formatting in recent release
14
+
15
+ # 4.6.0 (2021-02-26)
16
+ * Update `Edgedriver` naming to support Selenium 4 beta (([#206](https://github.com/titusfortner/webdrivers/pull/206))
17
+
1
18
  # 4.5.0 (2021-01-19)
2
19
  * Improve format of README usage section. Thanks, [okuramasafumi](https://github.com/okuramasafumi)!
3
20
  * `chromedriver` - Add support for Apple M1 specific builds ([#193](https://github.com/titusfortner/webdrivers/pull/193)). Thanks, [MichaelHoste](https://github.com/MichaelHoste)!
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -1,8 +1,6 @@
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)
6
4
  ![Tests](https://github.com/titusfortner/webdrivers/workflows/Tests/badge.svg)
7
5
 
8
6
  Run Selenium tests more easily with automatic installation and updates for all supported webdrivers.
@@ -16,14 +14,15 @@ Run Selenium tests more easily with automatic installation and updates for all s
16
14
  * [IEDriverServer](https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver)
17
15
  * [msedgedriver](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)
18
16
 
19
- 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.
20
19
 
21
20
  ## Usage
22
21
 
23
22
  In your Gemfile:
24
23
 
25
24
  ```ruby
26
- gem 'webdrivers', '~> 4.0', require: false
25
+ gem 'webdrivers', '~> 5.0', require: false
27
26
  ```
28
27
 
29
28
  In your project:
@@ -197,21 +196,7 @@ The logging level can be configured for debugging purpose:
197
196
  Webdrivers.logger.level = :DEBUG
198
197
  ```
199
198
 
200
- ### WSLv1 support
201
-
202
- While WSLv1 is not designed to run headful applications like Chrome, it can run exes; as such when found to be running
203
- in WSL, `webdrivers` will use the Windows `chromedriver.exe`.
204
-
205
- It's recommended that you install the new PowerShell (PS7) to avoid [a known issue](https://github.com/microsoft/terminal/issues/367)
206
- with the console font being changed when calling the old PowerShell (PS5).
207
-
208
- ### WSLv2 support
209
-
210
- Webdrivers will detect WSLv2 as running on Linux.
211
-
212
- WSLv2 doesn't support connecting to host ports out of the box, so it isn't possible to connect to Chromedriver on Windows without extra configurations, see: https://github.com/microsoft/WSL/issues/4619. The simplest way to use Chromedriver with WSLv2 is to run Chrome headless on Linux.
213
-
214
- ### Browser Specific Notes
199
+ ### Browser & OS Specific Notes
215
200
 
216
201
  #### Chrome/Chromium
217
202
 
@@ -236,7 +221,7 @@ variable.
236
221
  This is also required if Google Chrome is not installed in its
237
222
  [default location](https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver).
238
223
 
239
- ##### Heroku Users
224
+ #### Chrome on Heroku
240
225
 
241
226
  Follow the specific instructions [here](https://github.com/titusfortner/webdrivers/wiki/Heroku-buildpack-google-chrome) if you're using `heroku-buildpack-google-chrome`.
242
227
 
@@ -248,6 +233,27 @@ section apply to this browser as well.
248
233
 
249
234
  Please note that `msedgedriver` requires `selenium-webdriver` v4.
250
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
+
251
257
  ## Wiki
252
258
 
253
259
  Please see the [wiki](https://github.com/titusfortner/webdrivers/wiki)
File without changes
File without changes
@@ -97,18 +97,8 @@ module Webdrivers
97
97
  false
98
98
  end
99
99
 
100
- def download_url
101
- return @download_url if @download_url
102
-
103
- driver_version = if required_version == EMPTY_VERSION
104
- latest_version
105
- else
106
- normalize_version(required_version)
107
- end
108
- filename = driver_filename(driver_version)
109
- url = "#{base_url}/#{driver_version}/chromedriver_#{filename}.zip"
110
- Webdrivers.logger.debug "chromedriver URL: #{url}"
111
- @download_url = url
100
+ def direct_url(driver_version)
101
+ "#{base_url}/#{driver_version}/chromedriver_#{driver_filename(driver_version)}.zip"
112
102
  end
113
103
 
114
104
  def driver_filename(driver_version)
@@ -156,17 +146,4 @@ module Webdrivers
156
146
  end
157
147
  end
158
148
 
159
- if ::Selenium::WebDriver::Service.respond_to? :driver_path=
160
- ::Selenium::WebDriver::Chrome::Service.driver_path = proc { ::Webdrivers::Chromedriver.update }
161
- else
162
- # v3.141.0 and lower
163
- module Selenium
164
- module WebDriver
165
- module Chrome
166
- def self.driver_path
167
- @driver_path ||= Webdrivers::Chromedriver.update
168
- end
169
- end
170
- end
171
- end
172
- end
149
+ ::Selenium::WebDriver::Chrome::Service.driver_path = proc { ::Webdrivers::Chromedriver.update }
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rubygems/package'
4
- require 'webdrivers/logger'
5
4
  require 'webdrivers/network'
6
5
  require 'webdrivers/system'
7
6
  require 'selenium-webdriver'
7
+ require 'webdrivers/logger'
8
8
  require 'webdrivers/version'
9
9
 
10
10
  module Webdrivers
@@ -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
@@ -76,15 +76,15 @@ module Webdrivers
76
76
  false
77
77
  end
78
78
 
79
- # def linux_compatible?(driver_version)
80
- # System.platform == 'linux' && driver_version >= normalize_version('89.0.731.0')
81
- # end
79
+ def linux_compatible?(driver_version)
80
+ System.platform == 'linux' && driver_version >= normalize_version('89.0.731.0')
81
+ end
82
82
 
83
83
  def driver_filename(driver_version)
84
84
  if System.platform == 'win' || System.wsl_v1?
85
85
  "win#{System.bitsize}" # 32 or 64-bit
86
- # elsif linux_compatible?(driver_version)
87
- # 'linux64'
86
+ elsif linux_compatible?(driver_version)
87
+ 'linux64'
88
88
  elsif System.platform == 'mac'
89
89
  # Determine M1 or Intel architecture
90
90
  apple_arch = apple_m1_compatible?(driver_version) ? 'arm' : 'mac'
@@ -94,36 +94,11 @@ module Webdrivers
94
94
  end
95
95
  end
96
96
 
97
- def download_url
98
- return @download_url if @download_url
99
-
100
- driver_version = if required_version == EMPTY_VERSION
101
- latest_version
102
- else
103
- normalize_version(required_version)
104
- end
105
- filename = driver_filename(driver_version)
106
- url = "#{base_url}/#{driver_version}/edgedriver_#{filename}.zip"
107
- Webdrivers.logger.debug "msedgedriver URL: #{url}"
108
- @download_url = url
97
+ def direct_url(driver_version)
98
+ "#{base_url}/#{driver_version}/edgedriver_#{driver_filename(driver_version)}.zip"
109
99
  end
110
100
  end
111
101
  end
112
102
  end
113
103
 
114
- if defined? Selenium::WebDriver::EdgeChrome
115
- if ::Selenium::WebDriver::Service.respond_to? :driver_path=
116
- ::Selenium::WebDriver::EdgeChrome::Service.driver_path = proc { ::Webdrivers::Edgedriver.update }
117
- else
118
- # v3.141.0 and lower
119
- module Selenium
120
- module WebDriver
121
- module EdgeChrome
122
- def self.driver_path
123
- @driver_path ||= Webdrivers::Edgedriver.update
124
- end
125
- end
126
- end
127
- end
128
- end
129
- end
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 }
@@ -1,11 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'forwardable'
4
- require 'logger'
5
-
6
- # Code adapted from Selenium Implementation
7
- # https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/common/logger.rb
8
-
9
3
  module Webdrivers
10
4
  #
11
5
  # @example Enable full logging
@@ -18,94 +12,9 @@ module Webdrivers
18
12
  # Webdrivers.logger.info('This is info message')
19
13
  # Webdrivers.logger.warn('This is warning message')
20
14
  #
21
- class Logger
22
- extend Forwardable
23
- include ::Logger::Severity
24
-
25
- def_delegators :@logger, :debug, :debug?,
26
- :info, :info?,
27
- :warn, :warn?,
28
- :error, :error?,
29
- :fatal, :fatal?,
30
- :level
31
-
15
+ class Logger < Selenium::WebDriver::Logger
32
16
  def initialize
33
- @logger = create_logger($stdout)
34
- end
35
-
36
- def output=(io)
37
- # `Logger#reopen` was added in Ruby 2.3
38
- if @logger.respond_to?(:reopen)
39
- @logger.reopen(io)
40
- else
41
- @logger = create_logger(io)
42
- end
43
- end
44
-
45
- #
46
- # For Ruby < 2.3 compatibility
47
- # Based on https://github.com/ruby/ruby/blob/ruby_2_3/lib/logger.rb#L250
48
- #
49
-
50
- def level=(severity)
51
- if severity.is_a?(Integer)
52
- @logger.level = severity
53
- else
54
- case severity.to_s.downcase
55
- when 'debug'
56
- @logger.level = DEBUG
57
- when 'info'
58
- @logger.level = INFO
59
- when 'warn'
60
- @logger.level = WARN
61
- when 'error'
62
- @logger.level = ERROR
63
- when 'fatal'
64
- @logger.level = FATAL
65
- when 'unknown'
66
- @logger.level = UNKNOWN
67
- else
68
- raise ArgumentError, "invalid log level: #{severity}"
69
- end
70
- end
71
- end
72
-
73
- #
74
- # Returns IO object used by logger internally.
75
- #
76
- # Normally, we would have never needed it, but we want to
77
- # use it as IO object for all child processes to ensure their
78
- # output is redirected there.
79
- #
80
- # It is only used in debug level, in other cases output is suppressed.
81
- #
82
- # @api private
83
- #
84
- def io
85
- @logger.instance_variable_get(:@logdev).instance_variable_get(:@dev)
86
- end
87
-
88
- #
89
- # Marks code as deprecated with replacement.
90
- #
91
- # @param [String] old
92
- # @param [String] new
93
- #
94
- def deprecate(old, new)
95
- warn "[DEPRECATION] #{old} is deprecated. Use #{new} instead."
96
- end
97
-
98
- private
99
-
100
- def create_logger(output)
101
- logger = ::Logger.new(output)
102
- logger.progname = 'Webdrivers'
103
- logger.level = ($DEBUG ? DEBUG : WARN)
104
- logger.formatter = proc do |severity, time, progname, msg|
105
- "#{time.strftime('%F %T')} #{severity} #{progname} #{msg}\n"
106
- end
107
-
108
- logger
17
+ super('Webdrivers')
109
18
  end
110
19
  end
111
20
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrivers
4
- VERSION = '4.5.0'
4
+ VERSION = '5.0.0'
5
5
  end
data/lib/webdrivers.rb CHANGED
File without changes
data/spec/spec_helper.rb CHANGED
File without changes
File without changes
File without changes
@@ -5,13 +5,7 @@ require 'spec_helper'
5
5
  describe Webdrivers::EdgeFinder do
6
6
  let(:edge_finder) { described_class }
7
7
 
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"
13
- end
14
- end
8
+ before { skip 'Edge is not yet supported on Linux' if Webdrivers::System.platform == 'linux' }
15
9
 
16
10
  context 'when the user relies on the gem to figure out the location of Edge' do
17
11
  it 'determines the location correctly based on the current OS' do
@@ -20,8 +14,8 @@ describe Webdrivers::EdgeFinder do
20
14
  end
21
15
 
22
16
  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
17
+ it 'uses Selenium::WebDriver::Edge.path when it is defined' do
18
+ Selenium::WebDriver::Edge.path = edge_finder.location
25
19
  locations = %i[win_location mac_location linux_location]
26
20
  allow(edge_finder).to receive_messages(locations)
27
21
 
@@ -29,8 +23,8 @@ describe Webdrivers::EdgeFinder do
29
23
  locations.each { |loc| expect(edge_finder).not_to have_received(loc) }
30
24
  end
31
25
 
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)
26
+ it "uses ENV['WD_EDGE_PATH'] when it is defined" do
27
+ allow(ENV).to receive(:[]).with('WD_EDGE_PATH').and_return(edge_finder.location)
34
28
  locations = %i[win_location mac_location linux_location]
35
29
  allow(edge_finder).to receive_messages(locations)
36
30
 
@@ -38,11 +32,11 @@ describe Webdrivers::EdgeFinder do
38
32
  locations.each { |loc| expect(edge_finder).not_to have_received(loc) }
39
33
  end
40
34
 
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')
35
+ it 'uses Selenium::WebDriver::Edge.path over WD_EDGE_PATH' do
36
+ Selenium::WebDriver::Edge.path = edge_finder.location
37
+ allow(ENV).to receive(:[]).with('WD_EDGE_PATH').and_return('my_wd_chrome_path')
44
38
  expect(edge_finder.version).not_to be_nil
45
- expect(ENV).not_to have_received(:[]).with('WD_EDGE_CHROME_PATH')
39
+ expect(ENV).not_to have_received(:[]).with('WD_EDGE_PATH')
46
40
  end
47
41
  end
48
42
 
@@ -5,16 +5,11 @@ require 'spec_helper'
5
5
  describe Webdrivers::Edgedriver do
6
6
  let(:edgedriver) { described_class }
7
7
 
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"
13
- end
8
+ before do
9
+ skip 'Edge is not yet supported on Linux' if Webdrivers::System.platform == 'linux'
10
+ edgedriver.remove
14
11
  end
15
12
 
16
- before { edgedriver.remove }
17
-
18
13
  describe '#update' do
19
14
  context 'when evaluating #correct_binary?' do
20
15
  it 'does not download when latest version and current version match' do
@@ -180,8 +175,7 @@ describe Webdrivers::Edgedriver do
180
175
  end
181
176
 
182
177
  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')
178
+ allow(edgedriver).to receive(:browser_version).and_return Gem::Version.new('77.0.9999')
185
179
  msg = 'Unable to find latest point release version for 77.0.9999. '\
186
180
  'Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` '\
187
181
  '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