Skip to content

Commit 9e8c7b3

Browse files
committed
[rb] use file detector for uploading add-ons if one is set
1 parent bc5aed6 commit 9e8c7b3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

rb/lib/selenium/webdriver/firefox/features.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ def commands(command)
3535
end
3636

3737
def install_addon(path, temporary)
38+
if @file_detector
39+
local_file = @file_detector.call(path)
40+
path = upload(local_file) if local_file
41+
end
42+
3843
payload = {path: path}
3944
payload[:temporary] = temporary unless temporary.nil?
4045
execute :install_addon, {}, payload

rb/spec/integration/selenium/webdriver/firefox/driver_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ module Firefox
4242
page: {width: 30})).to include(magic_number)
4343
end
4444

45+
it 'can add and remove addons' do
46+
ext = File.expand_path('../../../../../../third_party/firebug/favourite_colour-1.1-an+fx.xpi', __dir__)
47+
driver.install_addon(ext)
48+
driver.uninstall_addon('favourite-colour-examples@mozilla.org')
49+
end
50+
4551
it 'should print full page' do
4652
path = "#{Dir.tmpdir}/test#{SecureRandom.urlsafe_base64}.png"
4753
screenshot = driver.save_full_page_screenshot(path)

0 commit comments

Comments
 (0)