summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/sub_menus/repository.rb
blob: 38fa57eacc84d983a0be2dc72c3940d72baa0c2f (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
50
51
52
53
54
55
56
57
58
59
# frozen_string_literal: true

module QA
  module Page
    module Project
      module SubMenus
        module Repository
          extend QA::Page::PageConcern

          def self.included(base)
            super

            base.class_eval do
              include QA::Page::Project::SubMenus::Common

              view 'app/views/layouts/nav/sidebar/_project_menus.html.haml' do
                element :repository_link
                element :branches_link
                element :tags_link
              end
            end
          end

          def click_repository
            within_sidebar do
              click_element(:repository_link)
            end
          end

          def go_to_repository_branches
            hover_repository do
              within_submenu do
                click_element(:branches_link)
              end
            end
          end

          def go_to_repository_tags
            hover_repository do
              within_submenu do
                click_element(:tags_link)
              end
            end
          end

          private

          def hover_repository
            within_sidebar do
              find_element(:repository_link).hover

              yield
            end
          end
        end
      end
    end
  end
end