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
let(:user) { create(:user) }
let(:project) { create(:project) }
shared_examples 'combined_menu: feature flag examples' do
before do
stub_feature_flags(combined_menu: false)
project.add_maintainer(user)
sign_in(user)
......@@ -18,10 +17,39 @@ RSpec.describe 'Operations dropdown navbar EE' do
end
it 'has an `Operations` link' do
pending_on_combined_menu_flag
expect(page).to have_link('Operations', href: operations_path)
end
it 'has an `Environments` link' do
pending_on_combined_menu_flag
expect(page).to have_link('Environments', href: operations_environments_path)
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
......@@ -8,15 +8,16 @@ RSpec.describe 'Admin Mode Logout', :js do
let(:user) { create(:admin) }
shared_examples 'combined_menu: feature flag examples' do
before do
stub_feature_flags(combined_menu: false)
gitlab_sign_in(user)
gitlab_enable_admin_mode_sign_in(user)
visit admin_root_path
end
it 'disable removes admin mode and redirects to root page' do
pending_on_combined_menu_flag
gitlab_disable_admin_mode
expect(current_path).to eq root_path
......@@ -24,6 +25,8 @@ RSpec.describe 'Admin Mode Logout', :js do
end
it 'disable shows flash notice' do
pending_on_combined_menu_flag
gitlab_disable_admin_mode
expect(page).to have_selector('.flash-notice')
......@@ -35,10 +38,37 @@ RSpec.describe 'Admin Mode Logout', :js do
end
it 'disable removes admin mode and redirects to root page' do
pending_on_combined_menu_flag
gitlab_disable_admin_mode
expect(current_path).to eq root_path
expect(page).to have_link(href: new_admin_session_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
......@@ -8,9 +8,8 @@ RSpec.describe 'Admin mode' do
let(:admin) { create(:admin) }
shared_examples 'combined_menu: feature flag examples' do
before do
stub_feature_flags(combined_menu: false)
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
end
......@@ -21,6 +20,8 @@ RSpec.describe 'Admin mode' do
context 'when not in admin mode' do
it 'has no leave admin mode button' do
pending_on_combined_menu_flag
visit new_admin_session_path
page.within('.navbar-sub-nav') do
......@@ -29,6 +30,8 @@ RSpec.describe 'Admin mode' do
end
it 'can open pages not in admin scope' do
pending_on_combined_menu_flag
visit new_admin_session_path
page.within('.navbar-sub-nav') do
......@@ -77,12 +80,16 @@ RSpec.describe 'Admin mode' do
end
it 'contains link to leave admin mode' do
pending_on_combined_menu_flag
page.within('.navbar-sub-nav') do
expect(page).to have_link(href: destroy_admin_session_path)
end
end
it 'can leave admin mode using main dashboard link', :js do
pending_on_combined_menu_flag
page.within('.navbar-sub-nav') do
click_on 'Leave Admin Mode'
......@@ -91,6 +98,8 @@ RSpec.describe 'Admin mode' do
end
it 'can leave admin mode using dropdown menu on smaller screens', :js do
pending_on_combined_menu_flag
resize_screen_xs
visit root_dashboard_path
......@@ -106,6 +115,8 @@ RSpec.describe 'Admin mode' do
end
it 'can open pages not in admin scope' do
pending_on_combined_menu_flag
page.within('.navbar-sub-nav') do
find_all('a', text: 'Projects').first.click
......@@ -115,6 +126,8 @@ RSpec.describe 'Admin mode' do
context 'nav bar' do
it 'shows admin dashboard links on bigger screen' do
pending_on_combined_menu_flag
visit root_dashboard_path
page.within '.navbar' do
......@@ -124,11 +137,12 @@ RSpec.describe 'Admin mode' do
end
it 'relocates admin dashboard links to dropdown list on smaller screen', :js do
pending_on_combined_menu_flag
resize_screen_xs
visit root_dashboard_path
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)
end
......@@ -147,6 +161,8 @@ RSpec.describe 'Admin mode' do
end
it 'can leave admin mode', :js do
pending_on_combined_menu_flag
page.within('.navbar-sub-nav') do
click_on 'Leave Admin Mode'
......@@ -164,6 +180,8 @@ RSpec.describe 'Admin mode' do
end
it 'shows no admin mode buttons in navbar' do
pending_on_combined_menu_flag
visit admin_root_path
page.within('.navbar-sub-nav') do
......@@ -172,4 +190,29 @@ RSpec.describe 'Admin mode' 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
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
......@@ -3,14 +3,15 @@
require 'spec_helper'
RSpec.describe 'Dashboard Active Tab', :js do
shared_examples 'combined_menu: feature flag examples' do
before do
stub_feature_flags(combined_menu: false)
sign_in(create(:user))
end
shared_examples 'page has active tab' do |title|
it "#{title} tab" do
pending_on_combined_menu_flag
subject
expect(page).to have_selector('.navbar-sub-nav li.active', count: 1)
......@@ -29,4 +30,29 @@ RSpec.describe 'Dashboard Active Tab', :js do
subject { visit dashboard_groups_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
......@@ -7,14 +7,15 @@ RSpec.describe 'The group dashboard' do
let(:user) { create(:user) }
shared_examples 'combined_menu: feature flag examples' do
before do
stub_feature_flags(combined_menu: false)
sign_in user
end
describe 'The top navigation' do
it 'has all the expected links' do
pending_on_combined_menu_flag
visit dashboard_groups_path
within('.navbar') do
......@@ -27,6 +28,8 @@ RSpec.describe 'The group dashboard' do
end
it 'hides some links when an external authorization service is enabled' do
pending_on_combined_menu_flag
enable_external_authorization_service_check
visit dashboard_groups_path
......@@ -39,4 +42,29 @@ RSpec.describe 'The group dashboard' 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
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
......@@ -3,10 +3,7 @@
require 'spec_helper'
RSpec.describe 'Dashboard shortcuts', :js do
before do
stub_feature_flags(combined_menu: false)
end
shared_examples 'combined_menu: feature flag examples' do
context 'logged in' do
let(:user) { create(:user) }
let(:project) { create(:project) }
......@@ -18,6 +15,8 @@ RSpec.describe 'Dashboard shortcuts', :js do
end
it 'navigate to tabs' do
pending_on_combined_menu_flag
find('body').send_keys([:shift, 'I'])
check_page_title('Issues')
......@@ -50,6 +49,8 @@ RSpec.describe 'Dashboard shortcuts', :js do
end
it 'navigate to tabs' do
pending_on_combined_menu_flag
find('body').send_keys([:shift, 'G'])
find('.nothing-here-block')
......@@ -70,4 +71,29 @@ RSpec.describe 'Dashboard shortcuts', :js do
def check_page_title(title)
expect(find('.page-title')).to have_content(title)
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
......@@ -5,9 +5,8 @@ require 'spec_helper'
RSpec.describe 'Frequently visited items', :js do
let_it_be(:user) { create(:user) }
shared_examples 'combined_menu: feature flag examples' do
before do
stub_feature_flags(combined_menu: false)
sign_in(user)
end
......@@ -15,6 +14,8 @@ RSpec.describe 'Frequently visited items', :js do
let_it_be(:project) { create(:project, :public) }
it 'increments localStorage counter when visiting the project' do
pending_on_combined_menu_flag
visit project_path(project)
frequent_projects = nil
......@@ -33,6 +34,8 @@ RSpec.describe 'Frequently visited items', :js do
let_it_be(:group) { create(:group, :public) }
it 'increments localStorage counter when visiting the group' do
pending_on_combined_menu_flag
visit group_path(group)
frequent_groups = nil
......@@ -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))
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
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe 'New project', :js do
include Select2Helper
shared_examples 'combined_menu: feature flag examples' do
context 'as a user' do
let(:user) { create(:user) }
......@@ -43,12 +44,9 @@ RSpec.describe 'New project', :js do
expect(page).to have_selector('h3', text: 'Create blank project/repository')
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
pending_on_combined_menu_flag
stub_experiments(new_repo: :control)
visit new_project_path
......@@ -64,6 +62,8 @@ RSpec.describe 'New project', :js do
end
it 'when in candidate it renders "project/repository" in the new projects dropdown' do
pending_on_combined_menu_flag
stub_experiments(new_repo: :candidate)
visit new_project_path
......@@ -76,7 +76,6 @@ RSpec.describe 'New project', :js do
end
end
end
end
it 'shows a message if multiple levels are restricted' do
Gitlab::CurrentSettings.update!(
......@@ -133,7 +132,9 @@ RSpec.describe 'New project', :js do
find('[data-qa-selector="import_project_link"]').click
end
it { expect(page).to have_link('Manifest file') }
it 'has Manifest file' do
expect(page).to have_link('Manifest file')
end
end
context 'Visibility level selector', :js do
......@@ -419,4 +420,29 @@ RSpec.describe 'New project', :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
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
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