diff options
Diffstat (limited to 'qa/qa/page')
-rw-r--r-- | qa/qa/page/group/menu.rb | 13 | ||||
-rw-r--r-- | qa/qa/page/group/sub_menus/common.rb | 21 | ||||
-rw-r--r-- | qa/qa/page/project/sub_menus/common.rb | 18 | ||||
-rw-r--r-- | qa/qa/page/sub_menus/common.rb | 50 |
4 files changed, 70 insertions, 32 deletions
diff --git a/qa/qa/page/group/menu.rb b/qa/qa/page/group/menu.rb index 2b3b872aff4..230511ce6f6 100644 --- a/qa/qa/page/group/menu.rb +++ b/qa/qa/page/group/menu.rb @@ -13,15 +13,22 @@ module QA element :contribution_analytics_link end + view 'app/views/layouts/nav/sidebar/_analytics_links.html.haml' do + element :analytics_link + element :analytics_sidebar_submenu + end + def click_group_members_item within_sidebar do click_element(:group_members_item) end end - def click_group_analytics_item - within_sidebar do - click_element(:contribution_analytics_link) + def click_contribution_analytics_item + hover_element(:analytics_link) do + within_submenu(:analytics_sidebar_submenu) do + click_element(:contribution_analytics_link) + end end end diff --git a/qa/qa/page/group/sub_menus/common.rb b/qa/qa/page/group/sub_menus/common.rb index a378db80e4b..96efc8da98d 100644 --- a/qa/qa/page/group/sub_menus/common.rb +++ b/qa/qa/page/group/sub_menus/common.rb @@ -5,6 +5,8 @@ module QA module Group module SubMenus module Common + include QA::Page::SubMenus::Common + def self.included(base) base.class_eval do view 'app/views/layouts/nav/sidebar/_group.html.haml' do @@ -13,23 +15,10 @@ module QA end end - def hover_element(element) - within_sidebar do - find_element(element).hover - yield - end - end + private - def within_sidebar - within_element(:group_sidebar) do - yield - end - end - - def within_submenu(element) - within_element(element) do - yield - end + def sidebar_element + :group_sidebar end end end diff --git a/qa/qa/page/project/sub_menus/common.rb b/qa/qa/page/project/sub_menus/common.rb index 3c9e8085748..da759398cff 100644 --- a/qa/qa/page/project/sub_menus/common.rb +++ b/qa/qa/page/project/sub_menus/common.rb @@ -5,20 +5,12 @@ module QA module Project module SubMenus module Common - def within_sidebar - within('.sidebar-top-level-items') do - yield - end - end + include QA::Page::SubMenus::Common + + private - def within_submenu - if has_css?('.fly-out-list') - within('.fly-out-list') do - yield - end - else - yield - end + def sidebar_element + :project_sidebar end end end diff --git a/qa/qa/page/sub_menus/common.rb b/qa/qa/page/sub_menus/common.rb new file mode 100644 index 00000000000..0eb1b100bd7 --- /dev/null +++ b/qa/qa/page/sub_menus/common.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module QA + module Page + module SubMenus + module Common + def hover_element(element) + within_sidebar do + find_element(element).hover + yield + end + end + + def within_sidebar + within_element(sidebar_element) do + yield + end + end + + def within_submenu(element = nil) + if element + within_element(element) do + yield + end + else + within_submenu_without_element do + yield + end + end + end + + private + + def within_submenu_without_element + if has_css?('.fly-out-list') + within('.fly-out-list') do + yield + end + else + yield + end + end + + def sidebar_element + raise NotImplementedError + end + end + end + end +end |