diff options
author | Walmyr Filho <wlsf82@gmail.com> | 2019-01-19 01:48:26 +0300 |
---|---|---|
committer | Walmyr Filho <wlsf82@gmail.com> | 2019-01-24 18:43:21 +0300 |
commit | 29819c49c79d8af468c28714c5340d5ea8448ec7 (patch) | |
tree | 8496ef29e268182dccea764154de10cdc96b15c6 | |
parent | a59563a1043dae27790779bd47a01ca509c6b875 (diff) |
Split `Page::Project::Menu` into separate submenus
https://gitlab.com/gitlab-org/quality/team-tasks/issues/84
-rw-r--r-- | app/views/layouts/nav/sidebar/_project.html.haml | 6 | ||||
-rw-r--r-- | qa/qa.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/project/menu.rb | 136 | ||||
-rw-r--r-- | qa/qa/page/project/sub_menus/ci_cd.rb | 25 | ||||
-rw-r--r-- | qa/qa/page/project/sub_menus/issues.rb | 52 | ||||
-rw-r--r-- | qa/qa/page/project/sub_menus/operations.rb | 47 | ||||
-rw-r--r-- | qa/qa/page/project/sub_menus/settings.rb | 61 |
7 files changed, 203 insertions, 128 deletions
diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index 1eab7813865..6f3909e0a1d 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -26,7 +26,7 @@ %span= _('Details') = 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') - if project_nav_tab?(:releases) @@ -146,7 +146,7 @@ - if project_nav_tab? :merge_requests = 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 = sprite_icon('git-merge') %span.nav-item-name @@ -283,7 +283,7 @@ - if project_nav_tab? :wiki = 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 = sprite_icon('book') %span.nav-item-name @@ -196,8 +196,12 @@ module QA end module SubMenus + autoload :CiCd, 'qa/page/project/sub_menus/ci_cd' 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 :Settings, 'qa/page/project/sub_menus/settings' end module Issue diff --git a/qa/qa/page/project/menu.rb b/qa/qa/page/project/menu.rb index eb3426b1ac0..46dfe87fe25 100644 --- a/qa/qa/page/project/menu.rb +++ b/qa/qa/page/project/menu.rb @@ -5,148 +5,34 @@ module QA module Project class Menu < Page::Base include SubMenus::Common + + include SubMenus::CiCd + include SubMenus::Issues + include SubMenus::Operations include SubMenus::Repository + include SubMenus::Settings view 'app/views/layouts/nav/sidebar/_project.html.haml' do - element :settings_item - element :settings_link, 'link_to edit_project_path' # rubocop:disable QA/ElementWithPattern - element :link_pipelines - 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 + element :activity_link + element :merge_requests_link + element :wiki_link end def click_merge_requests within_sidebar do - click_link('Merge Requests') - 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 + click_element(:merge_requests_link) end end def click_wiki within_sidebar do - click_link('Wiki') + click_element(:wiki_link) end end def go_to_activity within_sidebar do - click_on 'Activity' - 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 + click_element(:activity_link) end end end diff --git a/qa/qa/page/project/sub_menus/ci_cd.rb b/qa/qa/page/project/sub_menus/ci_cd.rb new file mode 100644 index 00000000000..adae2ce08c4 --- /dev/null +++ b/qa/qa/page/project/sub_menus/ci_cd.rb @@ -0,0 +1,25 @@ +# 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 diff --git a/qa/qa/page/project/sub_menus/issues.rb b/qa/qa/page/project/sub_menus/issues.rb new file mode 100644 index 00000000000..f81e4f34909 --- /dev/null +++ b/qa/qa/page/project/sub_menus/issues.rb @@ -0,0 +1,52 @@ +# 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 diff --git a/qa/qa/page/project/sub_menus/operations.rb b/qa/qa/page/project/sub_menus/operations.rb new file mode 100644 index 00000000000..cf9fc453565 --- /dev/null +++ b/qa/qa/page/project/sub_menus/operations.rb @@ -0,0 +1,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 diff --git a/qa/qa/page/project/sub_menus/settings.rb b/qa/qa/page/project/sub_menus/settings.rb new file mode 100644 index 00000000000..62c594c0210 --- /dev/null +++ b/qa/qa/page/project/sub_menus/settings.rb @@ -0,0 +1,61 @@ +# 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 |