Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes downloading on m1 macs from version 106.0.5249.61 onwards #241

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/webdrivers/chromedriver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ def apple_m1_compatible?(driver_version)
false
end

def apple_filename(driver_version)
def apple_m1_filename(driver_version)
if apple_m1_compatible?(driver_version)
driver_version >= normalize_version('106.0.5249.61') ? 'mac_arm64' : 'mac64_m1'
driver_version >= normalize_version('106.0.5249.61') ? "mac_arm64" : "mac64_m1"
else
'mac64'
"mac64"
end
end

Expand All @@ -115,7 +115,7 @@ def driver_filename(driver_version)
elsif System.platform == 'linux'
'linux64'
elsif System.platform == 'mac'
apple_filename(driver_version)
apple_m1_filename(driver_version)
else
raise 'Failed to determine driver filename to download for your OS.'
end
Expand Down
38 changes: 38 additions & 0 deletions spec/webdrivers/chromedriver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,42 @@
expect(chromedriver.browser_version).to be Gem::Version.new('72.0.0.0')
end
end

describe "private methods" do
describe "#direct_url" do
context "with mac platform" do

before do
allow(Webdrivers::System).to receive(:platform) { 'mac' }
end

context "when version is lower than 106.0.5249.61" do
it do
version_string = '71.0.3578.137'
version = Gem::Version.new(version_string)

expect(chromedriver.send(:direct_url, version)).to eq "#{chromedriver.base_url}/#{version_string}/chromedriver_mac64.zip"
end
end

context "when version is 106.0.5249.61" do
it do
version_string = '106.0.5249.61'
version = Gem::Version.new(version_string)

expect(chromedriver.send(:direct_url, version)).to eq "#{chromedriver.base_url}/#{version_string}/chromedriver_mac_arm64.zip"
end
end

context "when version is higher than 106.0.5249.61" do
it do
version_string = '106.0.5249.21'
version = Gem::Version.new(version_string)

expect(chromedriver.send(:direct_url, version)).to eq "#{chromedriver.base_url}/#{version_string}/chromedriver_mac64_m1.zip"
end
end
end
end
end
end