Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed May 28, 2019
1 parent 9db4cbf commit a940561
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/capybara/selenium/driver_specializations/chrome_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ def reset!
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
Expand Down

0 comments on commit a940561

Please sign in to comment.