Commit cb865727 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'combined-menu-flag-feature-specs' into 'master'

combined_menu flag feature specs [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!60335
parents 977b92b5 fbecfe82
...@@ -6,9 +6,8 @@ RSpec.describe 'Operations dropdown navbar EE' do ...@@ -6,9 +6,8 @@ RSpec.describe 'Operations dropdown navbar EE' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
shared_examples 'combined_menu: feature flag examples' do
before do before do
stub_feature_flags(combined_menu: false)
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
...@@ -18,10 +17,39 @@ RSpec.describe 'Operations dropdown navbar EE' do ...@@ -18,10 +17,39 @@ 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
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
expect(page).to have_link('Environments', href: operations_environments_path) expect(page).to have_link('Environments', href: operations_environments_path)
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
let(:needs_rewrite_for_combined_menu_flag_on) { false }
before do
stub_feature_flags(combined_menu: false)
end
it_behaves_like 'combined_menu: feature flag examples'
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
...@@ -8,15 +8,16 @@ RSpec.describe 'Admin Mode Logout', :js do ...@@ -8,15 +8,16 @@ RSpec.describe 'Admin Mode Logout', :js do
let(:user) { create(:admin) } let(:user) { create(:admin) }
shared_examples 'combined_menu: feature flag examples' do
before do before do
stub_feature_flags(combined_menu: false)
gitlab_sign_in(user) gitlab_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
...@@ -24,6 +25,8 @@ RSpec.describe 'Admin Mode Logout', :js do ...@@ -24,6 +25,8 @@ RSpec.describe 'Admin Mode Logout', :js do
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')
...@@ -35,10 +38,37 @@ RSpec.describe 'Admin Mode Logout', :js do ...@@ -35,10 +38,37 @@ 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) expect(page).to have_link(href: new_admin_session_path)
end 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
let(:needs_rewrite_for_combined_menu_flag_on) { false }
before do
stub_feature_flags(combined_menu: false)
end
it_behaves_like 'combined_menu: feature flag examples'
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
...@@ -8,9 +8,8 @@ RSpec.describe 'Admin mode' do ...@@ -8,9 +8,8 @@ RSpec.describe 'Admin mode' do
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
shared_examples 'combined_menu: feature flag examples' do
before do before do
stub_feature_flags(combined_menu: false)
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
end end
...@@ -21,6 +20,8 @@ RSpec.describe 'Admin mode' do ...@@ -21,6 +20,8 @@ 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
pending_on_combined_menu_flag
visit new_admin_session_path visit new_admin_session_path
page.within('.navbar-sub-nav') do page.within('.navbar-sub-nav') do
...@@ -29,6 +30,8 @@ RSpec.describe 'Admin mode' do ...@@ -29,6 +30,8 @@ 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
page.within('.navbar-sub-nav') do page.within('.navbar-sub-nav') do
...@@ -77,12 +80,16 @@ RSpec.describe 'Admin mode' do ...@@ -77,12 +80,16 @@ 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
page.within('.navbar-sub-nav') do page.within('.navbar-sub-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
page.within('.navbar-sub-nav') do page.within('.navbar-sub-nav') do
click_on 'Leave Admin Mode' click_on 'Leave Admin Mode'
...@@ -91,6 +98,8 @@ RSpec.describe 'Admin mode' do ...@@ -91,6 +98,8 @@ RSpec.describe 'Admin mode' do
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
...@@ -106,6 +115,8 @@ RSpec.describe 'Admin mode' do ...@@ -106,6 +115,8 @@ 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
page.within('.navbar-sub-nav') do page.within('.navbar-sub-nav') do
find_all('a', text: 'Projects').first.click find_all('a', text: 'Projects').first.click
...@@ -115,6 +126,8 @@ RSpec.describe 'Admin mode' do ...@@ -115,6 +126,8 @@ RSpec.describe 'Admin mode' do
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
page.within '.navbar' do page.within '.navbar' do
...@@ -124,11 +137,12 @@ RSpec.describe 'Admin mode' do ...@@ -124,11 +137,12 @@ RSpec.describe 'Admin mode' do
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
resize_screen_xs resize_screen_xs
visit root_dashboard_path visit root_dashboard_path
page.within '.navbar' do page.within '.navbar' do
expect(page).not_to have_link(text: 'Admin Area', href: admin_root_path, visible: true)
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 end
...@@ -147,6 +161,8 @@ RSpec.describe 'Admin mode' do ...@@ -147,6 +161,8 @@ 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
page.within('.navbar-sub-nav') do page.within('.navbar-sub-nav') do
click_on 'Leave Admin Mode' click_on 'Leave Admin Mode'
...@@ -164,6 +180,8 @@ RSpec.describe 'Admin mode' do ...@@ -164,6 +180,8 @@ RSpec.describe 'Admin mode' do
end end
it 'shows no admin mode buttons in navbar' do it 'shows no admin mode buttons in navbar' do
pending_on_combined_menu_flag
visit admin_root_path visit admin_root_path
page.within('.navbar-sub-nav') do page.within('.navbar-sub-nav') do
...@@ -172,4 +190,29 @@ RSpec.describe 'Admin mode' do ...@@ -172,4 +190,29 @@ RSpec.describe 'Admin mode' do
end end
end 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
let(:needs_rewrite_for_combined_menu_flag_on) { false }
before do
stub_feature_flags(combined_menu: false)
end
it_behaves_like 'combined_menu: feature flag examples'
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
...@@ -3,14 +3,15 @@ ...@@ -3,14 +3,15 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Dashboard Active Tab', :js do RSpec.describe 'Dashboard Active Tab', :js do
shared_examples 'combined_menu: feature flag examples' do
before do before do
stub_feature_flags(combined_menu: false)
sign_in(create(:user)) sign_in(create(:user))
end end
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)
...@@ -29,4 +30,29 @@ RSpec.describe 'Dashboard Active Tab', :js do ...@@ -29,4 +30,29 @@ RSpec.describe 'Dashboard Active Tab', :js do
subject { visit dashboard_groups_path } subject { visit dashboard_groups_path }
end 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
let(:needs_rewrite_for_combined_menu_flag_on) { false }
before do
stub_feature_flags(combined_menu: false)
end
it_behaves_like 'combined_menu: feature flag examples'
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
...@@ -7,14 +7,15 @@ RSpec.describe 'The group dashboard' do ...@@ -7,14 +7,15 @@ RSpec.describe 'The group dashboard' do
let(:user) { create(:user) } let(:user) { create(:user) }
shared_examples 'combined_menu: feature flag examples' do
before do before do
stub_feature_flags(combined_menu: false)
sign_in user sign_in user
end end
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 within('.navbar') do
...@@ -27,6 +28,8 @@ RSpec.describe 'The group dashboard' do ...@@ -27,6 +28,8 @@ 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
...@@ -39,4 +42,29 @@ RSpec.describe 'The group dashboard' do ...@@ -39,4 +42,29 @@ RSpec.describe 'The group dashboard' do
end end
end 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
let(:needs_rewrite_for_combined_menu_flag_on) { false }
before do
stub_feature_flags(combined_menu: false)
end
it_behaves_like 'combined_menu: feature flag examples'
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
...@@ -3,10 +3,7 @@ ...@@ -3,10 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Dashboard shortcuts', :js do RSpec.describe 'Dashboard shortcuts', :js do
before do shared_examples 'combined_menu: feature flag examples' do
stub_feature_flags(combined_menu: false)
end
context 'logged in' do context 'logged in' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
...@@ -18,6 +15,8 @@ RSpec.describe 'Dashboard shortcuts', :js do ...@@ -18,6 +15,8 @@ RSpec.describe 'Dashboard shortcuts', :js do
end end
it 'navigate to tabs' do it 'navigate to tabs' do
pending_on_combined_menu_flag
find('body').send_keys([:shift, 'I']) find('body').send_keys([:shift, 'I'])
check_page_title('Issues') check_page_title('Issues')
...@@ -50,6 +49,8 @@ RSpec.describe 'Dashboard shortcuts', :js do ...@@ -50,6 +49,8 @@ RSpec.describe 'Dashboard shortcuts', :js do
end end
it 'navigate to tabs' do it 'navigate to tabs' do
pending_on_combined_menu_flag
find('body').send_keys([:shift, 'G']) find('body').send_keys([:shift, 'G'])
find('.nothing-here-block') find('.nothing-here-block')
...@@ -70,4 +71,29 @@ RSpec.describe 'Dashboard shortcuts', :js do ...@@ -70,4 +71,29 @@ RSpec.describe 'Dashboard shortcuts', :js do
def check_page_title(title) def check_page_title(title)
expect(find('.page-title')).to have_content(title) expect(find('.page-title')).to have_content(title)
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
let(:needs_rewrite_for_combined_menu_flag_on) { false }
before do
stub_feature_flags(combined_menu: false)
end
it_behaves_like 'combined_menu: feature flag examples'
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,9 +5,8 @@ require 'spec_helper' ...@@ -5,9 +5,8 @@ require 'spec_helper'
RSpec.describe 'Frequently visited items', :js do RSpec.describe 'Frequently visited items', :js do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
shared_examples 'combined_menu: feature flag examples' do
before do before do
stub_feature_flags(combined_menu: false)
sign_in(user) sign_in(user)
end end
...@@ -15,6 +14,8 @@ RSpec.describe 'Frequently visited items', :js do ...@@ -15,6 +14,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)
frequent_projects = nil frequent_projects = nil
...@@ -33,6 +34,8 @@ RSpec.describe 'Frequently visited items', :js do ...@@ -33,6 +34,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)
frequent_groups = nil frequent_groups = nil
...@@ -46,4 +49,29 @@ RSpec.describe 'Frequently visited items', :js do ...@@ -46,4 +49,29 @@ RSpec.describe 'Frequently visited items', :js do
expect(Gitlab::Json.parse(frequent_groups)).to contain_exactly(a_hash_including('id' => group.id, 'frequency' => 1)) expect(Gitlab::Json.parse(frequent_groups)).to contain_exactly(a_hash_including('id' => group.id, 'frequency' => 1))
end 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
let(:needs_rewrite_for_combined_menu_flag_on) { false }
before do
stub_feature_flags(combined_menu: false)
end
it_behaves_like 'combined_menu: feature flag examples'
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,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe 'New project', :js do RSpec.describe 'New project', :js do
include Select2Helper include Select2Helper
shared_examples 'combined_menu: feature flag examples' do
context 'as a user' do context 'as a user' do
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -43,12 +44,9 @@ RSpec.describe 'New project', :js do ...@@ -43,12 +44,9 @@ RSpec.describe 'New project', :js do
expect(page).to have_selector('h3', text: 'Create blank project/repository') expect(page).to have_selector('h3', text: 'Create blank project/repository')
end end
context 'with combined_menu feature disabled' do
before do
stub_feature_flags(combined_menu: false)
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
...@@ -64,6 +62,8 @@ RSpec.describe 'New project', :js do ...@@ -64,6 +62,8 @@ RSpec.describe 'New project', :js do
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
...@@ -76,7 +76,6 @@ RSpec.describe 'New project', :js do ...@@ -76,7 +76,6 @@ RSpec.describe 'New project', :js do
end end
end end
end end
end
it 'shows a message if multiple levels are restricted' do it 'shows a message if multiple levels are restricted' do
Gitlab::CurrentSettings.update!( Gitlab::CurrentSettings.update!(
...@@ -133,7 +132,9 @@ RSpec.describe 'New project', :js do ...@@ -133,7 +132,9 @@ RSpec.describe 'New project', :js do
find('[data-qa-selector="import_project_link"]').click find('[data-qa-selector="import_project_link"]').click
end end
it { expect(page).to have_link('Manifest file') } it 'has Manifest file' do
expect(page).to have_link('Manifest file')
end
end end
context 'Visibility level selector', :js do context 'Visibility level selector', :js do
...@@ -419,4 +420,29 @@ RSpec.describe 'New project', :js do ...@@ -419,4 +420,29 @@ RSpec.describe 'New project', :js do
end end
end 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
let(:needs_rewrite_for_combined_menu_flag_on) { false }
before do
stub_feature_flags(combined_menu: false)
end
it_behaves_like 'combined_menu: feature flag examples'
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
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