diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/features/dashboard | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/features/dashboard')
4 files changed, 88 insertions, 148 deletions
diff --git a/spec/features/dashboard/active_tab_spec.rb b/spec/features/dashboard/active_tab_spec.rb deleted file mode 100644 index aa767d75c00..00000000000 --- a/spec/features/dashboard/active_tab_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -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 - shared_examples 'combined_menu: feature flag examples' do - before do - sign_in(create(:user)) - end - - shared_examples 'page has active tab' do |title| - it "#{title} tab" do - subject - - expect(page).to have_selector('.navbar-sub-nav li.active', count: 1) - expect(find('.navbar-sub-nav li.active')).to have_content(title) - end - end - - context 'on dashboard projects' do - it_behaves_like 'page has active tab', 'Projects' do - subject { visit dashboard_projects_path } - end - end - - context 'on dashboard groups' do - it_behaves_like 'page has active tab', 'Groups' do - subject { visit dashboard_groups_path } - end - end - end - - context 'with combined_menu feature flag off' do - before do - stub_feature_flags(combined_menu: false) - end - - it_behaves_like 'combined_menu: feature flag examples' - end -end diff --git a/spec/features/dashboard/group_dashboard_with_external_authorization_service_spec.rb b/spec/features/dashboard/group_dashboard_with_external_authorization_service_spec.rb index 3dd993b4bb5..6861fac3cc2 100644 --- a/spec/features/dashboard/group_dashboard_with_external_authorization_service_spec.rb +++ b/spec/features/dashboard/group_dashboard_with_external_authorization_service_spec.rb @@ -2,66 +2,44 @@ require 'spec_helper' -RSpec.describe 'The group dashboard' do +RSpec.describe 'The group dashboard', :js do include ExternalAuthorizationServiceHelpers include Spec::Support::Helpers::Features::TopNavSpecHelpers let(:user) { create(:user) } - shared_examples 'combined_menu: feature flag examples' do - before do - sign_in user - end - - describe 'The top navigation' do - it 'has all the expected links' do - visit dashboard_groups_path - - open_top_nav - - within_top_nav do - expect(page).to have_button('Projects') - expect(page).to have_button('Groups') - expect(page).to have_link('Activity') - expect(page).to have_link('Milestones') - expect(page).to have_link('Snippets') - end - end + before do + sign_in user + end - it 'hides some links when an external authorization service is enabled' do - enable_external_authorization_service_check - visit dashboard_groups_path + describe 'The top navigation' do + it 'has all the expected links' do + visit dashboard_groups_path - open_top_nav + open_top_nav - within_top_nav do - expect(page).to have_button('Projects') - expect(page).to have_button('Groups') - expect(page).not_to have_link('Activity') - expect(page).not_to have_link('Milestones') - expect(page).to have_link('Snippets') - end + within_top_nav do + expect(page).to have_button('Projects') + expect(page).to have_button('Groups') + expect(page).to have_link('Activity') + expect(page).to have_link('Milestones') + expect(page).to have_link('Snippets') end end - end - context 'with combined_menu feature flag on', :js do - let(:needs_rewrite_for_combined_menu_flag_on) { true } + it 'hides some links when an external authorization service is enabled' do + enable_external_authorization_service_check + visit dashboard_groups_path - before do - stub_feature_flags(combined_menu: true) - end - - it_behaves_like 'combined_menu: feature flag examples' - end + open_top_nav - 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) + within_top_nav do + expect(page).to have_button('Projects') + expect(page).to have_button('Groups') + expect(page).not_to have_link('Activity') + expect(page).not_to have_link('Milestones') + expect(page).to have_link('Snippets') + end end - - it_behaves_like 'combined_menu: feature flag examples' end end diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index 1f0981de7e1..27419479479 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -194,6 +194,29 @@ RSpec.describe 'Dashboard Projects' do end end + describe 'with topics' do + context 'when project has topics' do + before do + project.update_attribute(:topic_list, 'topic1') + end + + it 'shows project topics if exist' do + visit dashboard_projects_path + + expect(page).to have_selector('[data-testid="project_topic_list"]') + expect(page).to have_link('topic1', href: explore_projects_path(topic: 'topic1')) + end + end + + context 'when project does not have topics' do + it 'does not show project topics' do + visit dashboard_projects_path + + expect(page).not_to have_selector('[data-testid="project_topic_list"]') + end + end + end + context 'last push widget', :use_clean_rails_memory_store_caching do before do event = create(:push_event, project: project, author: user) diff --git a/spec/features/dashboard/shortcuts_spec.rb b/spec/features/dashboard/shortcuts_spec.rb index 7439bfd334b..3f3ab4218f2 100644 --- a/spec/features/dashboard/shortcuts_spec.rb +++ b/spec/features/dashboard/shortcuts_spec.rb @@ -3,89 +3,71 @@ require 'spec_helper' RSpec.describe 'Dashboard shortcuts', :js do - shared_examples 'combined_menu: feature flag examples' do - context 'logged in' do - let(:user) { create(:user) } - let(:project) { create(:project) } + context 'logged in' do + let(:user) { create(:user) } + let(:project) { create(:project) } - before do - project.add_developer(user) - sign_in(user) - visit root_dashboard_path - end + before do + project.add_developer(user) + sign_in(user) + visit root_dashboard_path + end - it 'navigate to tabs' do - find('body').send_keys([:shift, 'I']) + it 'navigate to tabs' do + find('body').send_keys([:shift, 'I']) - check_page_title('Issues') + check_page_title('Issues') - find('body').send_keys([:shift, 'M']) + find('body').send_keys([:shift, 'M']) - check_page_title('Merge requests') + check_page_title('Merge requests') - find('body').send_keys([:shift, 'T']) + find('body').send_keys([:shift, 'T']) - check_page_title('To-Do List') + check_page_title('To-Do List') - find('body').send_keys([:shift, 'G']) + find('body').send_keys([:shift, 'G']) - check_page_title('Groups') + check_page_title('Groups') - find('body').send_keys([:shift, 'P']) + find('body').send_keys([:shift, 'P']) - check_page_title('Projects') + check_page_title('Projects') - 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']) + find('body').send_keys([:shift, 'L']) - check_page_title('Milestones') - end + check_page_title('Milestones') end + end - context 'logged out' do - before do - visit explore_root_path - end - - it 'navigate to tabs' do - find('body').send_keys([:shift, 'G']) + context 'logged out' do + before do + visit explore_root_path + end - find('.nothing-here-block') - expect(page).to have_content('No public groups') + it 'navigate to tabs' do + find('body').send_keys([:shift, 'G']) - find('body').send_keys([:shift, 'S']) + find('.nothing-here-block') + expect(page).to have_content('No public groups') - find('.nothing-here-block') - expect(page).to have_content('No snippets found') + find('body').send_keys([:shift, 'S']) - find('body').send_keys([:shift, 'P']) + find('.nothing-here-block') + expect(page).to have_content('No snippets found') - find('.nothing-here-block') - expect(page).to have_content('Explore public groups to find projects to contribute to.') - end - end + find('body').send_keys([:shift, 'P']) - def check_page_title(title) - expect(find('.page-title')).to have_content(title) + find('.nothing-here-block') + expect(page).to have_content('Explore public groups to find projects to contribute to.') end end - context 'with combined_menu feature flag on' do - 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 - before do - stub_feature_flags(combined_menu: false) - end - - it_behaves_like 'combined_menu: feature flag examples' + def check_page_title(title) + expect(find('.page-title')).to have_content(title) end end |