Module: Capybara::DataConsent
- Defined in:
- 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 '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_by_id("dc-dialog-wrapper") rescue Capybara::ElementNotFound => _e false end if dialog_present click_on "Settings" else within "footer" do click_on "Cookie settings" end end if [true, "all"].include?(categories) click_on "Accept all" elsif categories.is_a?(Array) categories.each do |category| within "[data-id='#{category}']" do find(".cookies__category-toggle").click end end click_on "Save settings" elsif [false, "essential"].include?(categories) click_on "Accept only essential" end end |