webdrivers 5.0.0 → 5.1.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: f4c9d9a6544732e58eb7a88d34e39b188b5ff658caaa14fbdff15931a69d1e2d
4
- data.tar.gz: 92a4997e99508bb79374838461cd2fee48591185b271dd6ce170628c51a02c2c
3
+ metadata.gz: 366e7e4f90b5bd54a2f5f1cbe2df6074f6cad56026502ec6d9f0ceddd4a269c8
4
+ data.tar.gz: '09439fb8a5f6e550ab6562891e1b11daa43f13694e21740e8e7141916b02641d'
5
5
  SHA512:
6
- metadata.gz: fb469a584a66b14097ec87b6a8f2ad30e2cbefdaeef91efd2a50f16ff0451c8a748f8607d53d06ceed3506d61e54ef31b9997e068f9e55dfe9136f8012570234
7
- data.tar.gz: ed61ff78edd17f205673242eeba0fa76dcb2df9675a7d8dc4c813e8dd056799a44b13c1a10b238eeb36bae96cc188ca20c4edd71aebf9ec48e9a78e613136f17
6
+ metadata.gz: d7b1a0e9791e985716d7e887c23e7346752218c108ac1bc11c1833c087ecfbf43f5eab718968ab6ddbce1b313740af6d8758a9568cb058edcbe06ae08583a44d
7
+ data.tar.gz: 98fe42f01271e270387795e0dd30ec943d5c0937d413f8ddedf96946ac00b7686a9cf2aee4ce78e52510ff08e2dffb963dd6a282c9abb6267d003a2704f9cfe1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 5.1.0 (2022-09-19)
2
+ * Improve error messages (#232, thanks dan-jensen)
3
+ * Fix circular require bug with railtie (#233, thanks amatsuda)
4
+ * Support downloading correct geckodriver on Apple silicon (#234 thanks stephannv)
5
+ * Update linux locations for Chrome to latest chromedriver finder (thanks entretechno-jeremiah)
6
+ * Add support for Microsoft Edge on Linux (#236)
7
+
1
8
  # 5.0.0 (2021-10-19)
2
9
  * Require Selenium 4+
3
10
  * Remove custom Logger and use the one in Selenium 4
@@ -8,7 +8,7 @@ module Webdrivers
8
8
  class << self
9
9
  def version
10
10
  version = send("#{System.platform}_version", location)
11
- raise VersionError, 'Failed to find Chrome version.' if version.nil? || version.empty?
11
+ raise VersionError, 'Failed to determine Chrome version.' if version.nil? || version.empty?
12
12
 
13
13
  Webdrivers.logger.debug "Browser version: #{version}"
14
14
  version[/\d+\.\d+\.\d+\.\d+/] # Google Chrome 73.0.3683.75 -> 73.0.3683.75
@@ -18,7 +18,7 @@ module Webdrivers
18
18
  chrome_bin = user_defined_location || send("#{System.platform}_location")
19
19
  return chrome_bin unless chrome_bin.nil?
20
20
 
21
- raise BrowserNotFound, 'Failed to find Chrome binary.'
21
+ raise BrowserNotFound, 'Failed to determine Chrome binary location.'
22
22
  end
23
23
 
24
24
  private
@@ -90,7 +90,17 @@ module Webdrivers
90
90
  def linux_location
91
91
  return wsl_location if System.wsl_v1?
92
92
 
93
- directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/google/chrome]
93
+ directories = %w[
94
+ /usr/local/sbin
95
+ /usr/local/bin
96
+ /usr/sbin
97
+ /usr/bin
98
+ /sbin
99
+ /bin
100
+ /snap/bin
101
+ /opt/google/chrome
102
+ /opt/chromium.org/chromium
103
+ ]
94
104
  files = %w[google-chrome chrome chromium chromium-browser]
95
105
 
96
106
  directories.each do |dir|
@@ -69,18 +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
83
- raise 'Default location not yet known'
72
+ directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/microsoft/edge]
73
+ files = %w[microsoft-edge microsoft-edge-beta microsoft-edge-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
84
83
  end
85
84
 
86
85
  def win_version(location)
@@ -22,8 +22,7 @@ module Webdrivers
22
22
  #
23
23
  # @return [String]
24
24
  def base_url
25
- # 'https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/'
26
- 'https://msedgedriver.azureedge.net/'
25
+ 'https://msedgedriver.azureedge.net'
27
26
  end
28
27
 
29
28
  private
@@ -76,14 +75,10 @@ module Webdrivers
76
75
  false
77
76
  end
78
77
 
79
- def linux_compatible?(driver_version)
80
- System.platform == 'linux' && driver_version >= normalize_version('89.0.731.0')
81
- end
82
-
83
78
  def driver_filename(driver_version)
84
79
  if System.platform == 'win' || System.wsl_v1?
85
80
  "win#{System.bitsize}" # 32 or 64-bit
86
- elsif linux_compatible?(driver_version)
81
+ elsif System.platform == 'linux'
87
82
  'linux64'
88
83
  elsif System.platform == 'mac'
89
84
  # Determine M1 or Intel architecture
@@ -51,7 +51,7 @@ module Webdrivers
51
51
  when 'linux'
52
52
  "linux#{System.bitsize}.tar.gz"
53
53
  when 'mac'
54
- 'macos.tar.gz'
54
+ System.apple_m1_architecture? ? 'macos-aarch64.tar.gz' : 'macos.tar.gz'
55
55
  when 'win'
56
56
  "win#{System.bitsize}.zip"
57
57
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'webdrivers'
4
3
  require 'rails'
5
4
 
6
5
  module Webdrivers
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrivers
4
- VERSION = '5.0.0'
4
+ VERSION = '5.1.0'
5
5
  end
@@ -168,8 +168,8 @@ describe Webdrivers::Chromedriver do
168
168
  end
169
169
 
170
170
  it 'raises VersionError for beta version' do
171
- allow(chromedriver).to receive(:browser_version).and_return Gem::Version.new('100.0.0')
172
- msg = 'Unable to find latest point release version for 100.0.0. '\
171
+ allow(chromedriver).to receive(:browser_version).and_return Gem::Version.new('999.0.0')
172
+ msg = 'Unable to find latest point release version for 999.0.0. '\
173
173
  'You appear to be using a non-production version of Chrome. '\
174
174
  'Please set `Webdrivers::Chromedriver.required_version = <desired driver version>` '\
175
175
  'to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html'
@@ -6,7 +6,6 @@ describe Webdrivers::Edgedriver do
6
6
  let(:edgedriver) { described_class }
7
7
 
8
8
  before do
9
- skip 'Edge is not yet supported on Linux' if Webdrivers::System.platform == 'linux'
10
9
  edgedriver.remove
11
10
  end
12
11
 
@@ -123,19 +122,19 @@ describe Webdrivers::Edgedriver do
123
122
 
124
123
  context 'when required version is 0' do
125
124
  it 'downloads the latest version' do
126
- allow(edgedriver).to receive(:latest_version).and_return(Gem::Version.new('77.0.207.0'))
125
+ allow(edgedriver).to receive(:latest_version).and_return(Gem::Version.new('98.0.1089.1'))
127
126
  edgedriver.required_version = 0
128
127
  edgedriver.update
129
- expect(edgedriver.current_version.version).to eq('77.0.207.0')
128
+ expect(edgedriver.current_version.version).to eq('98.0.1089.1')
130
129
  end
131
130
  end
132
131
 
133
132
  context 'when required version is nil' do
134
133
  it 'downloads the latest version' do
135
- allow(edgedriver).to receive(:latest_version).and_return(Gem::Version.new('77.0.207.0'))
134
+ allow(edgedriver).to receive(:latest_version).and_return(Gem::Version.new('98.0.1089.1'))
136
135
  edgedriver.required_version = nil
137
136
  edgedriver.update
138
- expect(edgedriver.current_version.version).to eq('77.0.207.0')
137
+ expect(edgedriver.current_version.version).to eq('98.0.1089.1')
139
138
  end
140
139
  end
141
140
  end
@@ -165,11 +164,11 @@ describe Webdrivers::Edgedriver do
165
164
  end
166
165
 
167
166
  it 'raises VersionError for beta version' do
168
- allow(edgedriver).to receive(:browser_version).and_return Gem::Version.new('100.0.0')
169
- msg = 'Unable to find latest point release version for 100.0.0. '\
167
+ allow(edgedriver).to receive(:browser_version).and_return Gem::Version.new('999.0.0')
168
+ msg = 'Unable to find latest point release version for 999.0.0. '\
170
169
  'You appear to be using a non-production version of Edge. '\
171
170
  'Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` '\
172
- 'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net/'
171
+ 'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net'
173
172
 
174
173
  expect { edgedriver.latest_version }.to raise_exception(Webdrivers::VersionError, msg)
175
174
  end
@@ -178,7 +177,7 @@ describe Webdrivers::Edgedriver do
178
177
  allow(edgedriver).to receive(:browser_version).and_return Gem::Version.new('77.0.9999')
179
178
  msg = 'Unable to find latest point release version for 77.0.9999. '\
180
179
  'Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` '\
181
- 'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net/'
180
+ 'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net'
182
181
 
183
182
  expect { edgedriver.latest_version }.to raise_exception(Webdrivers::VersionError, msg)
184
183
  end
@@ -92,6 +92,40 @@ describe Webdrivers::Geckodriver do
92
92
  msg = /Net::HTTPServerException: 404 "Not Found"/
93
93
  expect { geckodriver.update }.to raise_error(StandardError, msg)
94
94
  end
95
+
96
+ context 'when platform is Apple Sillicon' do
97
+ it 'downloads aarch64 binary' do
98
+ allow(Webdrivers::System).to receive(:platform).and_return('mac')
99
+ allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(true)
100
+ base = 'https://github.com/mozilla/geckodriver/releases/download'
101
+ binary = 'geckodriver-v0.31.0-macos-aarch64.tar.gz'
102
+ url = "#{base}/v0.31.0/#{binary}"
103
+
104
+ allow(Webdrivers::System).to receive(:download).with(url, geckodriver.driver_path)
105
+
106
+ geckodriver.required_version = '0.31.0'
107
+ geckodriver.update
108
+
109
+ expect(Webdrivers::System).to have_received(:download).with(url, geckodriver.driver_path)
110
+ end
111
+ end
112
+
113
+ context 'when platform isn\'t Apple Sillicon' do
114
+ it 'downloads default binary' do
115
+ allow(Webdrivers::System).to receive(:platform).and_return('mac')
116
+ allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(false)
117
+ base = 'https://github.com/mozilla/geckodriver/releases/download'
118
+ binary = 'geckodriver-v0.31.0-macos.tar.gz'
119
+ url = "#{base}/v0.31.0/#{binary}"
120
+
121
+ allow(Webdrivers::System).to receive(:download).with(url, geckodriver.driver_path)
122
+
123
+ geckodriver.required_version = '0.31.0'
124
+ geckodriver.update
125
+
126
+ expect(Webdrivers::System).to have_received(:download).with(url, geckodriver.driver_path)
127
+ end
128
+ end
95
129
  end
96
130
 
97
131
  describe '#current_version' do
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: 5.0.0
4
+ version: 5.1.0
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: 2021-10-20 00:00:00.000000000 Z
13
+ date: 2022-09-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi
@@ -212,8 +212,8 @@ licenses:
212
212
  metadata:
213
213
  bug_tracker_uri: https://github.com/titusfortner/webdrivers/issues
214
214
  changelog_uri: https://github.com/titusfortner/webdrivers/blob/master/CHANGELOG.md
215
- documentation_uri: https://www.rubydoc.info/gems/webdrivers/5.0.0
216
- source_code_uri: https://github.com/titusfortner/webdrivers/tree/v5.0.0
215
+ documentation_uri: https://www.rubydoc.info/gems/webdrivers/5.1.0
216
+ source_code_uri: https://github.com/titusfortner/webdrivers/tree/v5.1.0
217
217
  post_install_message:
218
218
  rdoc_options: []
219
219
  require_paths:
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  - !ruby/object:Gem::Version
230
230
  version: '0'
231
231
  requirements: []
232
- rubygems_version: 3.2.22
232
+ rubygems_version: 3.3.7
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: Easy download and use of browser drivers.