summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/sub_menus/operations.rb
blob: cf9fc4535651aa8a2b42464c06c7c8cec05272df (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
# frozen_string_literal: true

module QA
  module Page
    module Project
      module SubMenus
        module Operations
          def self.included(base)
            base.class_eval do
              view 'app/views/layouts/nav/sidebar/_project.html.haml' do
                element :link_operations
                element :operations_environments_link
              end
            end
          end

          def click_operations_environments
            hover_operations do
              within_submenu do
                click_element(:operations_environments_link)
              end
            end
          end

          def click_operations_kubernetes
            hover_operations do
              within_submenu do
                click_link('Kubernetes')
              end
            end
          end

          private

          def hover_operations
            within_sidebar do
              scroll_to_element(:link_operations)
              find_element(:link_operations).hover

              yield
            end
          end
        end
      end
    end
  end
end