Skip to content

Commit

Permalink
Add tests for chromedriver on apple machines (#240)
Browse files Browse the repository at this point in the history
Co-authored-by: Jay McCure <jmccure@gitlab.com>
  • Loading branch information
jmccure and Jay McCure authored Oct 22, 2022
1 parent 55481de commit b2a1dd5
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/webdrivers/chromedriver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,40 @@
expect(chromedriver.current_version.version).to eq('72.0.3626.7')
end
end

context 'when using an Apple machine' do
before do
allow(Webdrivers::System).to receive(:platform).and_return('mac')
allow(Webdrivers::System).to receive(:download)
end

it 'uses the correct chromedriver filename suffix for Intel' do
allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(false)
allow(chromedriver).to receive(:latest_version).and_return(Gem::Version.new('106.0.5249.61'))
chromedriver.required_version = nil

chromedriver.update
expect(Webdrivers::System).to have_received(:download).with(end_with('_mac64.zip'), anything)
end

it 'uses the correct chromedriver filename suffix from version 106.0.5249.61 for Silicon' do
allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(true)
allow(chromedriver).to receive(:latest_version).and_return(Gem::Version.new('106.0.5249.61'))
chromedriver.required_version = nil

chromedriver.update
expect(Webdrivers::System).to have_received(:download).with(end_with('_arm64.zip'), anything)
end

it 'uses the correct chromedriver filename suffix for versions less than 106.0.5249.61 for Silicon' do
allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(true)
allow(chromedriver).to receive(:latest_version).and_return(Gem::Version.new('106.0.5249.21'))
chromedriver.required_version = nil

chromedriver.update
expect(Webdrivers::System).to have_received(:download).with(end_with('_mac64_m1.zip'), anything)
end
end
end

describe '#current_version' do
Expand Down

0 comments on commit b2a1dd5

Please sign in to comment.