Skip to content

Commit b2a1dd5

Browse files
jmccureJay McCure
andauthored
Add tests for chromedriver on apple machines (#240)
Co-authored-by: Jay McCure <jmccure@gitlab.com>
1 parent 55481de commit b2a1dd5

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

spec/webdrivers/chromedriver_spec.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,40 @@
135135
expect(chromedriver.current_version.version).to eq('72.0.3626.7')
136136
end
137137
end
138+
139+
context 'when using an Apple machine' do
140+
before do
141+
allow(Webdrivers::System).to receive(:platform).and_return('mac')
142+
allow(Webdrivers::System).to receive(:download)
143+
end
144+
145+
it 'uses the correct chromedriver filename suffix for Intel' do
146+
allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(false)
147+
allow(chromedriver).to receive(:latest_version).and_return(Gem::Version.new('106.0.5249.61'))
148+
chromedriver.required_version = nil
149+
150+
chromedriver.update
151+
expect(Webdrivers::System).to have_received(:download).with(end_with('_mac64.zip'), anything)
152+
end
153+
154+
it 'uses the correct chromedriver filename suffix from version 106.0.5249.61 for Silicon' do
155+
allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(true)
156+
allow(chromedriver).to receive(:latest_version).and_return(Gem::Version.new('106.0.5249.61'))
157+
chromedriver.required_version = nil
158+
159+
chromedriver.update
160+
expect(Webdrivers::System).to have_received(:download).with(end_with('_arm64.zip'), anything)
161+
end
162+
163+
it 'uses the correct chromedriver filename suffix for versions less than 106.0.5249.61 for Silicon' do
164+
allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(true)
165+
allow(chromedriver).to receive(:latest_version).and_return(Gem::Version.new('106.0.5249.21'))
166+
chromedriver.required_version = nil
167+
168+
chromedriver.update
169+
expect(Webdrivers::System).to have_received(:download).with(end_with('_mac64_m1.zip'), anything)
170+
end
171+
end
138172
end
139173

140174
describe '#current_version' do

0 commit comments

Comments
 (0)