1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

small refactor

This commit is contained in:
Thomas Walpole 2019-05-28 15:16:04 -07:00
parent 9db4cbf9ea
commit a9405612c3

View file

@ -45,13 +45,17 @@ module Capybara::Selenium::Driver::ChromeDriver
retry
end
types = ['cookies']
types << 'local_storage' if clear_all_storage?
execute_cdp('Storage.clearDataForOrigin', origin: '*', storageTypes: types.join(','))
execute_cdp('Storage.clearDataForOrigin', origin: '*', storageTypes: storage_types_to_clear)
end
private
def storage_types_to_clear
types = ['cookies']
types << 'local_storage' if clear_all_storage?
types.join(',')
end
def clear_all_storage?
options.values_at(:clear_session_storage, :clear_local_storage).none? { |s| s == false }
end