Module: Capybara::DataConsent
- Defined in:
- decidim-dev/lib/decidim/dev/test/rspec_support/data_consent.rb
Instance Method Summary collapse
-
#data_consent(categories = "all", options = {}) ⇒ Object
Update data consent.
Instance Method Details
#data_consent(categories = "all", options = {}) ⇒ Object
Update data consent
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'decidim-dev/lib/decidim/dev/test/rspec_support/data_consent.rb', line 6 def (categories = "all", = {}) visit decidim.root_path if [:visit_root] dialog_present = begin find("#dc-dialog-wrapper") rescue Capybara::ElementNotFound => _e false end if dialog_present "Settings" else within ".footer" do click_link "Cookie settings" end end if [true, "all"].include?(categories) "Accept all" elsif categories.is_a?(Array) categories.each do |category| within "[data-id='#{category}']" do find(".switch-paddle").click end end "Save settings" elsif [false, "essential"].include?(categories) "Accept only essential" end end |