mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
small refactor
This commit is contained in:
parent
9db4cbf9ea
commit
a9405612c3
1 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue