1# frozen_string_literal: true
2
3module QA
4  module Page
5    module Project
6      module SubMenus
7        module Repository
8          extend QA::Page::PageConcern
9
10          def self.included(base)
11            super
12
13            base.class_eval do
14              include QA::Page::Project::SubMenus::Common
15            end
16          end
17
18          def click_repository
19            within_sidebar do
20              click_element(:sidebar_menu_link, menu_item: 'Repository')
21            end
22          end
23
24          def go_to_repository_branches
25            hover_repository do
26              within_submenu do
27                click_element(:sidebar_menu_item_link, menu_item: 'Branches')
28              end
29            end
30          end
31
32          def go_to_repository_tags
33            hover_repository do
34              within_submenu do
35                click_element(:sidebar_menu_item_link, menu_item: 'Tags')
36              end
37            end
38          end
39
40          private
41
42          def hover_repository
43            within_sidebar do
44              find_element(:sidebar_menu_link, menu_item: 'Repository').hover
45
46              yield
47            end
48          end
49        end
50      end
51    end
52  end
53end
54