summaryrefslogtreecommitdiff
path: root/qa/qa/page/admin/settings/component/snowplow.rb
blob: e05679feac38fc5c5c8234be00894f42aa4b7a72 (plain)
1
2
3
4
5
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# frozen_string_literal: true

module QA
  module Page
    module Admin
      module Settings
        module Component
          class Snowplow < Page::Base
            include QA::Page::Settings::Common

            view 'app/views/admin/application_settings/_snowplow.html.haml' do
              element :snowplow_settings_content
              element :snowplow_enabled_checkbox
              element :save_changes_button
            end

            def enable_snowplow_tracking
              expand_content(:snowplow_settings_content) do
                check_snowplow_enabled_checkbox
                click_save_changes_button
              end
            end

            def disable_snowplow_tracking
              expand_content(:snowplow_settings_content) do
                uncheck_snowplow_enabled_checkbox
                click_save_changes_button
              end
            end

            private

            def check_snowplow_enabled_checkbox
              check_element(:snowplow_enabled_checkbox)
            end

            def uncheck_snowplow_enabled_checkbox
              uncheck_element(:snowplow_enabled_checkbox)
            end

            def click_save_changes_button
              click_element :save_changes_button
            end
          end
        end
      end
    end
  end
end