summaryrefslogtreecommitdiff
path: root/qa/qa/page/group/sub_menus/common.rb
blob: a378db80e4b5102461d465d3d66ae1abc78b86fc (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
# frozen_string_literal: true

module QA
  module Page
    module Group
      module SubMenus
        module Common
          def self.included(base)
            base.class_eval do
              view 'app/views/layouts/nav/sidebar/_group.html.haml' do
                element :group_sidebar
              end
            end
          end

          def hover_element(element)
            within_sidebar do
              find_element(element).hover
              yield
            end
          end

          def within_sidebar
            within_element(:group_sidebar) do
              yield
            end
          end

          def within_submenu(element)
            within_element(element) do
              yield
            end
          end
        end
      end
    end
  end
end