Commit 29819c49 authored by Walmyr Filho's avatar Walmyr Filho

Split `Page::Project::Menu` into separate submenus

https://gitlab.com/gitlab-org/quality/team-tasks/issues/84
parent a59563a1
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
%span= _('Details') %span= _('Details')
= nav_link(path: 'projects#activity') do = nav_link(path: 'projects#activity') do
= link_to activity_project_path(@project), title: _('Activity'), class: 'shortcuts-project-activity' do = link_to activity_project_path(@project), title: _('Activity'), class: 'shortcuts-project-activity qa-activity-link' do
%span= _('Activity') %span= _('Activity')
- if project_nav_tab?(:releases) - if project_nav_tab?(:releases)
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
- if project_nav_tab? :merge_requests - if project_nav_tab? :merge_requests
= nav_link(controller: @project.issues_enabled? ? :merge_requests : [:merge_requests, :labels, :milestones]) do = nav_link(controller: @project.issues_enabled? ? :merge_requests : [:merge_requests, :labels, :milestones]) do
= link_to project_merge_requests_path(@project), class: 'shortcuts-merge_requests' do = link_to project_merge_requests_path(@project), class: 'shortcuts-merge_requests qa-merge-requests-link' do
.nav-icon-container .nav-icon-container
= sprite_icon('git-merge') = sprite_icon('git-merge')
%span.nav-item-name %span.nav-item-name
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
- if project_nav_tab? :wiki - if project_nav_tab? :wiki
= nav_link(controller: :wikis) do = nav_link(controller: :wikis) do
= link_to get_project_wiki_path(@project), class: 'shortcuts-wiki' do = link_to get_project_wiki_path(@project), class: 'shortcuts-wiki qa-wiki-link' do
.nav-icon-container .nav-icon-container
= sprite_icon('book') = sprite_icon('book')
%span.nav-item-name %span.nav-item-name
......
...@@ -196,8 +196,12 @@ module QA ...@@ -196,8 +196,12 @@ module QA
end end
module SubMenus module SubMenus
autoload :CiCd, 'qa/page/project/sub_menus/ci_cd'
autoload :Common, 'qa/page/project/sub_menus/common' autoload :Common, 'qa/page/project/sub_menus/common'
autoload :Issues, 'qa/page/project/sub_menus/issues'
autoload :Operations, 'qa/page/project/sub_menus/operations'
autoload :Repository, 'qa/page/project/sub_menus/repository' autoload :Repository, 'qa/page/project/sub_menus/repository'
autoload :Settings, 'qa/page/project/sub_menus/settings'
end end
module Issue module Issue
......
...@@ -5,148 +5,34 @@ module QA ...@@ -5,148 +5,34 @@ module QA
module Project module Project
class Menu < Page::Base class Menu < Page::Base
include SubMenus::Common include SubMenus::Common
include SubMenus::CiCd
include SubMenus::Issues
include SubMenus::Operations
include SubMenus::Repository include SubMenus::Repository
include SubMenus::Settings
view 'app/views/layouts/nav/sidebar/_project.html.haml' do view 'app/views/layouts/nav/sidebar/_project.html.haml' do
element :settings_item element :activity_link
element :settings_link, 'link_to edit_project_path' # rubocop:disable QA/ElementWithPattern element :merge_requests_link
element :link_pipelines element :wiki_link
element :link_operations
element :link_members_settings
element :pipelines_settings_link, "title: _('CI / CD')" # rubocop:disable QA/ElementWithPattern
element :operations_kubernetes_link, "title: _('Kubernetes')" # rubocop:disable QA/ElementWithPattern
element :operations_environments_link
element :issues_link, /link_to.*shortcuts-issues/ # rubocop:disable QA/ElementWithPattern
element :issues_link_text, "Issues" # rubocop:disable QA/ElementWithPattern
element :merge_requests_link, /link_to.*shortcuts-merge_requests/ # rubocop:disable QA/ElementWithPattern
element :merge_requests_link_text, "Merge Requests" # rubocop:disable QA/ElementWithPattern
element :top_level_items, '.sidebar-top-level-items' # rubocop:disable QA/ElementWithPattern
element :activity_link, "title: _('Activity')" # rubocop:disable QA/ElementWithPattern
element :wiki_link_text, "Wiki" # rubocop:disable QA/ElementWithPattern
element :milestones_link
element :labels_link
end
view 'app/assets/javascripts/fly_out_nav.js' do
element :fly_out, "classList.add('fly-out-list')" # rubocop:disable QA/ElementWithPattern
end
def click_ci_cd_pipelines
within_sidebar do
click_element :link_pipelines
end
end
def click_ci_cd_settings
hover_settings do
within_submenu do
click_link('CI / CD')
end
end
end
def click_issues
within_sidebar do
click_link('Issues')
end
end
def click_members_settings
hover_settings do
within_submenu do
click_element :link_members_settings
end
end
end end
def click_merge_requests def click_merge_requests
within_sidebar do within_sidebar do
click_link('Merge Requests') click_element(:merge_requests_link)
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
def click_milestones
within_sidebar do
click_element :milestones_link
end
end
def click_repository_settings
hover_settings do
within_submenu do
click_link('Repository')
end
end end
end end
def click_wiki def click_wiki
within_sidebar do within_sidebar do
click_link('Wiki') click_element(:wiki_link)
end end
end end
def go_to_activity def go_to_activity
within_sidebar do within_sidebar do
click_on 'Activity' click_element(:activity_link)
end
end
def go_to_labels
hover_issues do
within_submenu do
click_element(:labels_link)
end
end
end
def go_to_settings
within_sidebar do
click_on 'Settings'
end
end
private
def hover_issues
within_sidebar do
scroll_to_element(:issues_item)
find_element(:issues_item).hover
yield
end
end
def hover_operations
within_sidebar do
scroll_to_element(:link_operations)
find_element(:link_operations).hover
yield
end
end
def hover_settings
within_sidebar do
scroll_to_element(:settings_item)
find_element(:settings_item).hover
yield
end end
end end
end end
......
# frozen_string_literal: true
module QA
module Page
module Project
module SubMenus
module CiCd
def self.included(base)
base.class_eval do
view 'app/views/layouts/nav/sidebar/_project.html.haml' do
element :link_pipelines
end
end
end
def click_ci_cd_pipelines
within_sidebar do
click_element :link_pipelines
end
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module Page
module Project
module SubMenus
module Issues
def self.included(base)
base.class_eval do
view 'app/views/layouts/nav/sidebar/_project.html.haml' do
element :issues_item
element :labels_link
element :milestones_link
end
end
end
def click_issues
within_sidebar do
click_link('Issues')
end
end
def click_milestones
within_sidebar do
click_element :milestones_link
end
end
def go_to_labels
hover_issues do
within_submenu do
click_element(:labels_link)
end
end
end
private
def hover_issues
within_sidebar do
scroll_to_element(:issues_item)
find_element(:issues_item).hover
yield
end
end
end
end
end
end
end
# 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
# frozen_string_literal: true
module QA
module Page
module Project
module SubMenus
module Settings
def self.included(base)
base.class_eval do
view 'app/views/layouts/nav/sidebar/_project.html.haml' do
element :settings_item
element :link_members_settings
end
end
end
def click_ci_cd_settings
hover_settings do
within_submenu do
click_link('CI / CD')
end
end
end
def click_members_settings
hover_settings do
within_submenu do
click_element :link_members_settings
end
end
end
def click_repository_settings
hover_settings do
within_submenu do
click_link('Repository')
end
end
end
def go_to_settings
within_sidebar do
click_on 'Settings'
end
end
private
def hover_settings
within_sidebar do
scroll_to_element(:settings_item)
find_element(:settings_item).hover
yield
end
end
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment