Skip to content

Commit

Permalink
[rb] use file detector for uploading add-ons if one is set
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Sep 28, 2021
1 parent bc5aed6 commit 9e8c7b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rb/lib/selenium/webdriver/firefox/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def commands(command)
end

def install_addon(path, temporary)
if @file_detector
local_file = @file_detector.call(path)
path = upload(local_file) if local_file
end

payload = {path: path}
payload[:temporary] = temporary unless temporary.nil?
execute :install_addon, {}, payload
Expand Down
6 changes: 6 additions & 0 deletions rb/spec/integration/selenium/webdriver/firefox/driver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ module Firefox
page: {width: 30})).to include(magic_number)
end

it 'can add and remove addons' do
ext = File.expand_path('../../../../../../third_party/firebug/favourite_colour-1.1-an+fx.xpi', __dir__)
driver.install_addon(ext)
driver.uninstall_addon('[email protected]')
end

it 'should print full page' do
path = "#{Dir.tmpdir}/test#{SecureRandom.urlsafe_base64}.png"
screenshot = driver.save_full_page_screenshot(path)
Expand Down

0 comments on commit 9e8c7b3

Please sign in to comment.