Commit 384f980e authored by Chad Woolley's avatar Chad Woolley

Fix and unpend specs currently failing with :combined_menu flag on

- See https://gitlab.com/gitlab-org/gitlab/-/issues/331017
- Fix operations_nav_link_spec.rb for combined_menu flag on
- Fix frequently_visited_projects_and_groups_spec.rb for combined_menu on
- Fix admin_mode_spec.rb for combined_menu flag on
- Fix shortcuts_spec.rb for combined_menu flag on
- Fix admin mode specs for combined_menu flag on
- Fix group_dashboard_with_external_authorization_service_spec.rb
  for combined_menu flag on
- Fix new_project_spec.rb for combined_menu flag on
- Add pending for broken read-only examples
- Add TODO to remove active_tab_spec once :combined_menu flag is gone
- NOTE: "Leave Admin Mode" specs are failing, seems due to a
  regression with the feature flag on where it goes to a 404.
  It's reproducible in the app.
parent 76866598
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
<gl-nav-item-dropdown <gl-nav-item-dropdown
:text="navData.activeTitle" :text="navData.activeTitle"
icon="dot-grid" icon="dot-grid"
menu-class="gl-mt-3! gl-max-w-none! gl-max-h-none! gl-sm-w-auto!" menu-class="gl-mt-3! gl-max-w-none! gl-max-h-none! gl-sm-w-auto! js-top-nav-dropdown-menu"
toggle-class="top-nav-toggle js-top-nav-dropdown-toggle gl-px-3!" toggle-class="top-nav-toggle js-top-nav-dropdown-toggle gl-px-3!"
no-flip no-flip
> >
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Operations dropdown navbar EE' do RSpec.describe 'Operations dropdown navbar EE' do
include Spec::Support::Helpers::Features::TopNavSpecHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
...@@ -17,19 +19,19 @@ RSpec.describe 'Operations dropdown navbar EE' do ...@@ -17,19 +19,19 @@ RSpec.describe 'Operations dropdown navbar EE' do
end end
it 'has an `Operations` link' do it 'has an `Operations` link' do
pending_on_combined_menu_flag open_top_nav
expect(page).to have_link('Operations', href: operations_path) expect(page).to have_link('Operations', href: operations_path)
end end
it 'has an `Environments` link' do it 'has an `Environments` link' do
pending_on_combined_menu_flag open_top_nav
expect(page).to have_link('Environments', href: operations_environments_path) expect(page).to have_link('Environments', href: operations_environments_path)
end end
end end
context 'with combined_menu: feature flag on' do context 'with combined_menu feature flag on', :js do
let(:needs_rewrite_for_combined_menu_flag_on) { true } let(:needs_rewrite_for_combined_menu_flag_on) { true }
before do before do
...@@ -48,8 +50,4 @@ RSpec.describe 'Operations dropdown navbar EE' do ...@@ -48,8 +50,4 @@ RSpec.describe 'Operations dropdown navbar EE' do
it_behaves_like 'combined_menu: feature flag examples' it_behaves_like 'combined_menu: feature flag examples'
end end
def pending_on_combined_menu_flag
pending 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56587' if needs_rewrite_for_combined_menu_flag_on
end
end end
...@@ -5,28 +5,32 @@ require 'spec_helper' ...@@ -5,28 +5,32 @@ require 'spec_helper'
RSpec.describe 'Admin Mode Logout', :js do RSpec.describe 'Admin Mode Logout', :js do
include TermsHelper include TermsHelper
include UserLoginHelper include UserLoginHelper
include Spec::Support::Helpers::Features::TopNavSpecHelpers
let(:user) { create(:admin) } let(:user) { create(:admin) }
shared_examples 'combined_menu: feature flag examples' do shared_examples 'combined_menu: feature flag examples' do
before do before do
gitlab_sign_in(user) # TODO: This used to use gitlab_sign_in, instead of sign_in, but that is buggy. See
# this issue to look into why: https://gitlab.com/gitlab-org/gitlab/-/issues/331851
sign_in(user)
gitlab_enable_admin_mode_sign_in(user) gitlab_enable_admin_mode_sign_in(user)
visit admin_root_path visit admin_root_path
end end
it 'disable removes admin mode and redirects to root page' do it 'disable removes admin mode and redirects to root page' do
pending_on_combined_menu_flag
gitlab_disable_admin_mode gitlab_disable_admin_mode
expect(current_path).to eq root_path expect(current_path).to eq root_path
expect(page).to have_link(href: new_admin_session_path)
open_top_nav
within_top_nav do
expect(page).to have_link(href: new_admin_session_path)
end
end end
it 'disable shows flash notice' do it 'disable shows flash notice' do
pending_on_combined_menu_flag
gitlab_disable_admin_mode gitlab_disable_admin_mode
expect(page).to have_selector('.flash-notice') expect(page).to have_selector('.flash-notice')
...@@ -38,17 +42,20 @@ RSpec.describe 'Admin Mode Logout', :js do ...@@ -38,17 +42,20 @@ RSpec.describe 'Admin Mode Logout', :js do
end end
it 'disable removes admin mode and redirects to root page' do it 'disable removes admin mode and redirects to root page' do
pending_on_combined_menu_flag
gitlab_disable_admin_mode gitlab_disable_admin_mode
expect(current_path).to eq root_path expect(current_path).to eq root_path
expect(page).to have_link(href: new_admin_session_path)
open_top_nav
within_top_nav do
expect(page).to have_link(href: new_admin_session_path)
end
end end
end end
end end
context 'with combined_menu: feature flag on' do context 'with combined_menu feature flag on' do
let(:needs_rewrite_for_combined_menu_flag_on) { true } let(:needs_rewrite_for_combined_menu_flag_on) { true }
before do before do
...@@ -67,8 +74,4 @@ RSpec.describe 'Admin Mode Logout', :js do ...@@ -67,8 +74,4 @@ RSpec.describe 'Admin Mode Logout', :js do
it_behaves_like 'combined_menu: feature flag examples' it_behaves_like 'combined_menu: feature flag examples'
end end
def pending_on_combined_menu_flag
pending 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56587' if needs_rewrite_for_combined_menu_flag_on
end
end end
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe 'Admin mode' do RSpec.describe 'Admin mode' do
include MobileHelpers include MobileHelpers
include Spec::Support::Helpers::Features::TopNavSpecHelpers
include StubENV include StubENV
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
...@@ -21,6 +22,7 @@ RSpec.describe 'Admin mode' do ...@@ -21,6 +22,7 @@ RSpec.describe 'Admin mode' do
context 'when not in admin mode' do context 'when not in admin mode' do
it 'has no leave admin mode button' do it 'has no leave admin mode button' do
visit new_admin_session_path visit new_admin_session_path
open_top_nav
page.within('.navbar-sub-nav') do page.within('.navbar-sub-nav') do
expect(page).not_to have_link(href: destroy_admin_session_path) expect(page).not_to have_link(href: destroy_admin_session_path)
...@@ -28,12 +30,11 @@ RSpec.describe 'Admin mode' do ...@@ -28,12 +30,11 @@ RSpec.describe 'Admin mode' do
end end
it 'can open pages not in admin scope' do it 'can open pages not in admin scope' do
pending_on_combined_menu_flag
visit new_admin_session_path visit new_admin_session_path
open_top_nav_projects
page.within('.navbar-sub-nav') do within_top_nav do
find_all('a', text: 'Projects').first.click click_link('Your projects')
end end
expect(page).to have_current_path(dashboard_projects_path) expect(page).to have_current_path(dashboard_projects_path)
...@@ -78,71 +79,64 @@ RSpec.describe 'Admin mode' do ...@@ -78,71 +79,64 @@ RSpec.describe 'Admin mode' do
end end
it 'contains link to leave admin mode' do it 'contains link to leave admin mode' do
pending_on_combined_menu_flag open_top_nav
page.within('.navbar-sub-nav') do within_top_nav do
expect(page).to have_link(href: destroy_admin_session_path) expect(page).to have_link(href: destroy_admin_session_path)
end end
end end
it 'can leave admin mode using main dashboard link', :js do it 'can leave admin mode using main dashboard link', :js do
pending_on_combined_menu_flag gitlab_disable_admin_mode
page.within('.navbar-sub-nav') do open_top_nav
click_on 'Leave Admin Mode'
within_top_nav do
expect(page).to have_link(href: new_admin_session_path) expect(page).to have_link(href: new_admin_session_path)
end end
end end
it 'can leave admin mode using dropdown menu on smaller screens', :js do it 'can leave admin mode using dropdown menu on smaller screens', :js do
pending_on_combined_menu_flag
resize_screen_xs resize_screen_xs
visit root_dashboard_path visit root_dashboard_path
find('.header-more').click find('.header-more').click unless Feature.enabled?(:combined_menu)
page.within '.navbar-sub-nav' do gitlab_disable_admin_mode
click_on 'Leave Admin Mode'
find('.header-more').click open_top_nav
find('.header-more').click unless Feature.enabled?(:combined_menu)
expect(page).to have_link(href: new_admin_session_path) expect(page).to have_link(href: new_admin_session_path)
end
end end
it 'can open pages not in admin scope' do it 'can open pages not in admin scope' do
pending_on_combined_menu_flag open_top_nav_projects
page.within('.navbar-sub-nav') do within_top_nav do
find_all('a', text: 'Projects').first.click click_link('Your projects')
expect(page).to have_current_path(dashboard_projects_path)
end end
expect(page).to have_current_path(dashboard_projects_path)
end end
context 'nav bar' do context 'nav bar' do
it 'shows admin dashboard links on bigger screen' do it 'shows admin dashboard links on bigger screen' do
pending_on_combined_menu_flag
visit root_dashboard_path visit root_dashboard_path
open_top_nav
page.within '.navbar' do link_text = Feature.enabled?(:combined_menu) ? 'Admin' : 'Admin Area'
expect(page).to have_link(text: 'Admin Area', href: admin_root_path, visible: true) expect(page).to have_link(text: link_text, href: admin_root_path, visible: true)
expect(page).to have_link(text: 'Leave Admin Mode', href: destroy_admin_session_path, visible: true) expect(page).to have_link(text: 'Leave Admin Mode', href: destroy_admin_session_path, visible: true)
end
end end
it 'relocates admin dashboard links to dropdown list on smaller screen', :js do it 'relocates admin dashboard links to dropdown list on smaller screen', :js do
pending_on_combined_menu_flag skip('not applicable with :combined_menu feature flag enabled') if Feature.enabled?(:combined_menu)
resize_screen_xs resize_screen_xs
visit root_dashboard_path visit root_dashboard_path
page.within '.navbar' do expect(page).not_to have_link(text: 'Leave Admin Mode', href: destroy_admin_session_path, visible: true)
expect(page).not_to have_link(text: 'Leave Admin Mode', href: destroy_admin_session_path, visible: true)
end
find('.header-more').click find('.header-more').click
...@@ -159,11 +153,11 @@ RSpec.describe 'Admin mode' do ...@@ -159,11 +153,11 @@ RSpec.describe 'Admin mode' do
end end
it 'can leave admin mode', :js do it 'can leave admin mode', :js do
pending_on_combined_menu_flag gitlab_disable_admin_mode
page.within('.navbar-sub-nav') do open_top_nav
click_on 'Leave Admin Mode'
within_top_nav do
expect(page).to have_link(href: new_admin_session_path) expect(page).to have_link(href: new_admin_session_path)
end end
end end
...@@ -179,16 +173,15 @@ RSpec.describe 'Admin mode' do ...@@ -179,16 +173,15 @@ RSpec.describe 'Admin mode' do
it 'shows no admin mode buttons in navbar' do it 'shows no admin mode buttons in navbar' do
visit admin_root_path visit admin_root_path
open_top_nav
page.within('.navbar-sub-nav') do expect(page).not_to have_link(href: new_admin_session_path)
expect(page).not_to have_link(href: new_admin_session_path) expect(page).not_to have_link(href: destroy_admin_session_path)
expect(page).not_to have_link(href: destroy_admin_session_path)
end
end end
end end
end end
context 'with combined_menu: feature flag on' do context 'with combined_menu feature flag on', :js do
let(:needs_rewrite_for_combined_menu_flag_on) { true } let(:needs_rewrite_for_combined_menu_flag_on) { true }
before do before do
...@@ -207,8 +200,4 @@ RSpec.describe 'Admin mode' do ...@@ -207,8 +200,4 @@ RSpec.describe 'Admin mode' do
it_behaves_like 'combined_menu: feature flag examples' it_behaves_like 'combined_menu: feature flag examples'
end end
def pending_on_combined_menu_flag
pending 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56587' if needs_rewrite_for_combined_menu_flag_on
end
end end
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
require 'spec_helper' require 'spec_helper'
# TODO: This entire spec file can be deleted once the combined_menu feature is fully rolled
# out and the flag is removed, because it will then be irrelevant (there will be no more tabs).
# Feature flag removal issue: https://gitlab.com/gitlab-org/gitlab/-/issues/324086
RSpec.describe 'Dashboard Active Tab', :js do RSpec.describe 'Dashboard Active Tab', :js do
shared_examples 'combined_menu: feature flag examples' do shared_examples 'combined_menu: feature flag examples' do
before do before do
...@@ -10,8 +13,6 @@ RSpec.describe 'Dashboard Active Tab', :js do ...@@ -10,8 +13,6 @@ RSpec.describe 'Dashboard Active Tab', :js do
shared_examples 'page has active tab' do |title| shared_examples 'page has active tab' do |title|
it "#{title} tab" do it "#{title} tab" do
pending_on_combined_menu_flag
subject subject
expect(page).to have_selector('.navbar-sub-nav li.active', count: 1) expect(page).to have_selector('.navbar-sub-nav li.active', count: 1)
...@@ -32,27 +33,11 @@ RSpec.describe 'Dashboard Active Tab', :js do ...@@ -32,27 +33,11 @@ RSpec.describe 'Dashboard Active Tab', :js do
end end
end end
context 'with combined_menu: feature flag on' do
let(:needs_rewrite_for_combined_menu_flag_on) { true }
before do
stub_feature_flags(combined_menu: true)
end
it_behaves_like 'combined_menu: feature flag examples'
end
context 'with combined_menu feature flag off' do context 'with combined_menu feature flag off' do
let(:needs_rewrite_for_combined_menu_flag_on) { false }
before do before do
stub_feature_flags(combined_menu: false) stub_feature_flags(combined_menu: false)
end end
it_behaves_like 'combined_menu: feature flag examples' it_behaves_like 'combined_menu: feature flag examples'
end end
def pending_on_combined_menu_flag
pending 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56587' if needs_rewrite_for_combined_menu_flag_on
end
end end
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe 'The group dashboard' do RSpec.describe 'The group dashboard' do
include ExternalAuthorizationServiceHelpers include ExternalAuthorizationServiceHelpers
include Spec::Support::Helpers::Features::TopNavSpecHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -14,11 +15,11 @@ RSpec.describe 'The group dashboard' do ...@@ -14,11 +15,11 @@ RSpec.describe 'The group dashboard' do
describe 'The top navigation' do describe 'The top navigation' do
it 'has all the expected links' do it 'has all the expected links' do
pending_on_combined_menu_flag
visit dashboard_groups_path visit dashboard_groups_path
within('.navbar') do open_top_nav
within_top_nav do
expect(page).to have_button('Projects') expect(page).to have_button('Projects')
expect(page).to have_button('Groups') expect(page).to have_button('Groups')
expect(page).to have_link('Activity') expect(page).to have_link('Activity')
...@@ -28,12 +29,12 @@ RSpec.describe 'The group dashboard' do ...@@ -28,12 +29,12 @@ RSpec.describe 'The group dashboard' do
end end
it 'hides some links when an external authorization service is enabled' do it 'hides some links when an external authorization service is enabled' do
pending_on_combined_menu_flag
enable_external_authorization_service_check enable_external_authorization_service_check
visit dashboard_groups_path visit dashboard_groups_path
within('.navbar') do open_top_nav
within_top_nav do
expect(page).to have_button('Projects') expect(page).to have_button('Projects')
expect(page).to have_button('Groups') expect(page).to have_button('Groups')
expect(page).not_to have_link('Activity') expect(page).not_to have_link('Activity')
...@@ -44,7 +45,7 @@ RSpec.describe 'The group dashboard' do ...@@ -44,7 +45,7 @@ RSpec.describe 'The group dashboard' do
end end
end end
context 'with combined_menu: feature flag on' do context 'with combined_menu feature flag on', :js do
let(:needs_rewrite_for_combined_menu_flag_on) { true } let(:needs_rewrite_for_combined_menu_flag_on) { true }
before do before do
...@@ -63,8 +64,4 @@ RSpec.describe 'The group dashboard' do ...@@ -63,8 +64,4 @@ RSpec.describe 'The group dashboard' do
it_behaves_like 'combined_menu: feature flag examples' it_behaves_like 'combined_menu: feature flag examples'
end end
def pending_on_combined_menu_flag
pending 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56587' if needs_rewrite_for_combined_menu_flag_on
end
end end
...@@ -38,6 +38,10 @@ RSpec.describe 'Dashboard shortcuts', :js do ...@@ -38,6 +38,10 @@ RSpec.describe 'Dashboard shortcuts', :js do
find('body').send_keys([:shift, 'A']) find('body').send_keys([:shift, 'A'])
check_page_title('Activity') check_page_title('Activity')
find('body').send_keys([:shift, 'L'])
check_page_title('Milestones')
end end
end end
...@@ -69,7 +73,7 @@ RSpec.describe 'Dashboard shortcuts', :js do ...@@ -69,7 +73,7 @@ RSpec.describe 'Dashboard shortcuts', :js do
end end
end end
context 'with combined_menu: feature flag on' do context 'with combined_menu feature flag on' do
before do before do
stub_feature_flags(combined_menu: true) stub_feature_flags(combined_menu: true)
end end
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Frequently visited items', :js do RSpec.describe 'Frequently visited items', :js do
include Spec::Support::Helpers::Features::TopNavSpecHelpers
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
shared_examples 'combined_menu: feature flag examples' do shared_examples 'combined_menu: feature flag examples' do
...@@ -14,9 +16,8 @@ RSpec.describe 'Frequently visited items', :js do ...@@ -14,9 +16,8 @@ RSpec.describe 'Frequently visited items', :js do
let_it_be(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
it 'increments localStorage counter when visiting the project' do it 'increments localStorage counter when visiting the project' do
pending_on_combined_menu_flag
visit project_path(project) visit project_path(project)
open_top_nav_projects
frequent_projects = nil frequent_projects = nil
...@@ -34,9 +35,8 @@ RSpec.describe 'Frequently visited items', :js do ...@@ -34,9 +35,8 @@ RSpec.describe 'Frequently visited items', :js do
let_it_be(:group) { create(:group, :public) } let_it_be(:group) { create(:group, :public) }
it 'increments localStorage counter when visiting the group' do it 'increments localStorage counter when visiting the group' do
pending_on_combined_menu_flag
visit group_path(group) visit group_path(group)
open_top_nav_groups
frequent_groups = nil frequent_groups = nil
...@@ -51,7 +51,7 @@ RSpec.describe 'Frequently visited items', :js do ...@@ -51,7 +51,7 @@ RSpec.describe 'Frequently visited items', :js do
end end
end end
context 'with combined_menu: feature flag on' do context 'with combined_menu feature flag on' do
let(:needs_rewrite_for_combined_menu_flag_on) { true } let(:needs_rewrite_for_combined_menu_flag_on) { true }
before do before do
...@@ -70,8 +70,4 @@ RSpec.describe 'Frequently visited items', :js do ...@@ -70,8 +70,4 @@ RSpec.describe 'Frequently visited items', :js do
it_behaves_like 'combined_menu: feature flag examples' it_behaves_like 'combined_menu: feature flag examples'
end end
def pending_on_combined_menu_flag
pending 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56587' if needs_rewrite_for_combined_menu_flag_on
end
end end
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe 'New project', :js do RSpec.describe 'New project', :js do
include Select2Helper include Select2Helper
include Spec::Support::Helpers::Features::TopNavSpecHelpers
shared_examples 'combined_menu: feature flag examples' do shared_examples 'combined_menu: feature flag examples' do
context 'as a user' do context 'as a user' do
...@@ -45,34 +46,39 @@ RSpec.describe 'New project', :js do ...@@ -45,34 +46,39 @@ RSpec.describe 'New project', :js do
end end
it 'when in control it renders "project" in the new projects dropdown' do it 'when in control it renders "project" in the new projects dropdown' do
pending_on_combined_menu_flag
stub_experiments(new_repo: :control) stub_experiments(new_repo: :control)
visit new_project_path visit new_project_path
find('#nav-projects-dropdown').click open_top_nav_projects
page.within('#nav-projects-dropdown') do within_top_nav do
expect(page).to have_selector('a', text: 'Create blank project') if Feature.enabled?(:combined_menu)
expect(page).to have_selector('a', text: 'Import project') expect(page).to have_selector('a', text: 'Create new project')
expect(page).to have_no_selector('a', text: 'Create blank project/repository') expect(page).to have_no_selector('a', text: 'Create blank project/repository')
expect(page).to have_no_selector('a', text: 'Import project/repository') else
expect(page).to have_selector('a', text: 'Create blank project')
expect(page).to have_selector('a', text: 'Import project')
expect(page).to have_no_selector('a', text: 'Create blank project/repository')
expect(page).to have_no_selector('a', text: 'Import project/repository')
end
end end
end end
it 'when in candidate it renders "project/repository" in the new projects dropdown' do it 'when in candidate it renders "project/repository" in the new projects dropdown' do
pending_on_combined_menu_flag
stub_experiments(new_repo: :candidate) stub_experiments(new_repo: :candidate)
visit new_project_path visit new_project_path
find('#nav-projects-dropdown').click open_top_nav_projects
page.within('#nav-projects-dropdown') do within_top_nav do
expect(page).to have_selector('a', text: 'Create blank project/repository') if Feature.enabled?(:combined_menu)
expect(page).to have_selector('a', text: 'Import project/repository') expect(page).to have_selector('a', text: 'Create new project')
else
expect(page).to have_selector('a', text: 'Create blank project/repository')
expect(page).to have_selector('a', text: 'Import project/repository')
end
end end
end end
end end
...@@ -412,7 +418,7 @@ RSpec.describe 'New project', :js do ...@@ -412,7 +418,7 @@ RSpec.describe 'New project', :js do
end end
end end
context 'with combined_menu: feature flag on' do context 'with combined_menu feature flag on' do
let(:needs_rewrite_for_combined_menu_flag_on) { true } let(:needs_rewrite_for_combined_menu_flag_on) { true }
before do before do
...@@ -431,8 +437,4 @@ RSpec.describe 'New project', :js do ...@@ -431,8 +437,4 @@ RSpec.describe 'New project', :js do
it_behaves_like 'combined_menu: feature flag examples' it_behaves_like 'combined_menu: feature flag examples'
end end
def pending_on_combined_menu_flag
pending 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56587' if needs_rewrite_for_combined_menu_flag_on
end
end end
# frozen_string_literal: true
# These helpers help you interact within the Editor Lite (single-file editor, snippets, etc.).
#
module Spec
module Support
module Helpers
module Features
module TopNavSpecHelpers
def open_top_nav
return unless Feature.enabled?(:combined_menu)
find('.js-top-nav-dropdown-toggle').click
end
def within_top_nav
if Feature.enabled?(:combined_menu)
within('.js-top-nav-dropdown-menu') do
yield
end
else
within('.navbar-sub-nav') do
yield
end
end
end
def open_top_nav_projects
if Feature.enabled?(:combined_menu)
open_top_nav
within_top_nav do
click_button('Projects')
end
else
find('#nav-projects-dropdown').click
end
end
def open_top_nav_groups
return unless Feature.enabled?(:combined_menu)
open_top_nav
within_top_nav do
click_button('Groups')
end
end
end
end
end
end
end
...@@ -77,7 +77,11 @@ module LoginHelpers ...@@ -77,7 +77,11 @@ module LoginHelpers
# Requires Javascript driver. # Requires Javascript driver.
def gitlab_disable_admin_mode def gitlab_disable_admin_mode
click_on 'Leave Admin Mode' open_top_nav
within_top_nav do
click_on 'Leave Admin Mode'
end
end end
private private
......
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