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/groups | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/features/groups')
8 files changed, 171 insertions, 11 deletions
diff --git a/spec/features/groups/board_sidebar_spec.rb b/spec/features/groups/board_sidebar_spec.rb index 690d661ba2f..e2dd2fecab7 100644 --- a/spec/features/groups/board_sidebar_spec.rb +++ b/spec/features/groups/board_sidebar_spec.rb @@ -19,8 +19,6 @@ RSpec.describe 'Group Issue Boards', :js do let(:card) { find('.board:nth-child(1)').first('.board-card') } before do - # stubbing until sidebar work is done: https://gitlab.com/gitlab-org/gitlab/-/issues/230711 - stub_feature_flags(graphql_board_lists: false) sign_in(user) visit group_board_path(group, board) @@ -32,6 +30,32 @@ RSpec.describe 'Group Issue Boards', :js do click_card(card) page.within('.labels') do + click_button 'Edit' + + wait_for_requests + + page.within('[data-testid="dropdown-content"]') do + expect(page).to have_content(project_1_label.title) + expect(page).to have_content(group_label.title) + expect(page).not_to have_content(project_2_label.title) + end + end + end + end + + context 'when graphql_board_lists FF disabled' do + before do + stub_feature_flags(graphql_board_lists: false) + sign_in(user) + + visit group_board_path(group, board) + wait_for_requests + end + + it 'only shows valid labels for the issue project and group' do + click_card(card) + + page.within('.labels') do click_link 'Edit' wait_for_requests diff --git a/spec/features/groups/board_spec.rb b/spec/features/groups/board_spec.rb index b4c60ff4fa3..afe36dabcb5 100644 --- a/spec/features/groups/board_spec.rb +++ b/spec/features/groups/board_spec.rb @@ -3,16 +3,21 @@ require 'spec_helper' RSpec.describe 'Group Boards' do - let(:group) { create(:group) } - let!(:project) { create(:project_empty_repo, group: group) } - let(:user) { create(:group_member, :maintainer, user: create(:user), group: group ).user } + include DragTo + include MobileHelpers + include BoardHelpers - before do - sign_in(user) - end + let_it_be(:group) { create(:group) } + let_it_be(:user) { create(:user) } + + context 'Creates an issue', :js do + let_it_be(:project) { create(:project_empty_repo, group: group) } - context 'Creates a an issue', :js do before do + group.add_maintainer(user) + + sign_in(user) + visit group_boards_path(group) end @@ -39,4 +44,58 @@ RSpec.describe 'Group Boards' do end end end + + context "when user is a Reporter in one of the group's projects", :js do + let_it_be(:board) { create(:board, group: group) } + + let_it_be(:backlog_list) { create(:backlog_list, board: board) } + let_it_be(:group_label1) { create(:group_label, title: "bug", group: group) } + let_it_be(:group_label2) { create(:group_label, title: "dev", group: group) } + let_it_be(:list1) { create(:list, board: board, label: group_label1, position: 0) } + let_it_be(:list2) { create(:list, board: board, label: group_label2, position: 1) } + + let_it_be(:project1) { create(:project_empty_repo, :private, group: group) } + let_it_be(:project2) { create(:project_empty_repo, :private, group: group) } + let_it_be(:issue1) { create(:issue, title: 'issue1', project: project1, labels: [group_label2]) } + let_it_be(:issue2) { create(:issue, title: 'issue2', project: project2) } + + before do + project1.add_guest(user) + project2.add_reporter(user) + + sign_in(user) + + inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do + visit group_boards_path(group) + end + end + + it 'allows user to move issue of project where they are a Reporter' do + expect(find('.board:nth-child(1)')).to have_content(issue2.title) + + drag(list_from_index: 0, from_index: 0, list_to_index: 1) + + expect(find('.board:nth-child(2)')).to have_content(issue2.title) + expect(issue2.reload.labels).to contain_exactly(group_label1) + end + + it 'does not allow user to move issue of project where they are a Guest' do + expect(find('.board:nth-child(3)')).to have_content(issue1.title) + + drag(list_from_index: 2, from_index: 0, list_to_index: 1) + + expect(find('.board:nth-child(3)')).to have_content(issue1.title) + expect(issue1.reload.labels).to contain_exactly(group_label2) + expect(issue2.reload.labels).to eq([]) + end + + it 'does not allow user to re-position lists' do + drag(list_from_index: 1, list_to_index: 2, selector: '.board-header') + + expect(find('.board:nth-child(2) [data-testid="board-list-header"]')).to have_content(group_label1.title) + expect(find('.board:nth-child(3) [data-testid="board-list-header"]')).to have_content(group_label2.title) + expect(list1.reload.position).to eq(0) + expect(list2.reload.position).to eq(1) + end + end end diff --git a/spec/features/groups/integrations/user_activates_mattermost_slash_command_spec.rb b/spec/features/groups/integrations/user_activates_mattermost_slash_command_spec.rb index 7703268af39..02aa418cd73 100644 --- a/spec/features/groups/integrations/user_activates_mattermost_slash_command_spec.rb +++ b/spec/features/groups/integrations/user_activates_mattermost_slash_command_spec.rb @@ -13,4 +13,9 @@ RSpec.describe 'User activates the group-level Mattermost Slash Command integrat let(:edit_path) { edit_group_settings_integration_path(group, :mattermost_slash_commands) } include_examples 'user activates the Mattermost Slash Command integration' + + it 'does not display the overrides tab' do + expect(page).not_to have_link('Settings', href: edit_path) + expect(page).not_to have_link('Projects using custom settings', href: overrides_admin_application_settings_integration_path(:mattermost_slash_commands)) + end end diff --git a/spec/features/groups/members/manage_members_spec.rb b/spec/features/groups/members/manage_members_spec.rb index 1d57d0a9103..38e829bafcc 100644 --- a/spec/features/groups/members/manage_members_spec.rb +++ b/spec/features/groups/members/manage_members_spec.rb @@ -84,6 +84,33 @@ RSpec.describe 'Groups > Members > Manage members' do property: 'existing_user', user: user1 ) + expect_no_snowplow_event( + category: 'Members::CreateService', + action: 'area_of_focus' + ) + end + + it 'adds a user to group with area_of_focus', :js, :snowplow, :aggregate_failures do + stub_experiments(member_areas_of_focus: :candidate) + group.add_owner(user1) + + visit group_group_members_path(group) + + invite_member(user2.name, role: 'Reporter', area_of_focus: true) + wait_for_requests + + expect_snowplow_event( + category: 'Members::CreateService', + action: 'area_of_focus', + label: 'Contribute to the codebase', + property: group.members.last.id.to_s + ) + expect_snowplow_event( + category: 'Members::CreateService', + action: 'area_of_focus', + label: 'Collaborate on open issues and merge requests', + property: group.members.last.id.to_s + ) end it 'do not disclose email addresses', :js do @@ -193,9 +220,36 @@ RSpec.describe 'Groups > Members > Manage members' do property: 'net_new_user', user: user1 ) + expect_no_snowplow_event( + category: 'Members::CreateService', + action: 'area_of_focus' + ) end end + it 'invite user to group with area_of_focus', :js, :snowplow, :aggregate_failures do + stub_experiments(member_areas_of_focus: :candidate) + group.add_owner(user1) + + visit group_group_members_path(group) + + invite_member('test@example.com', role: 'Reporter', area_of_focus: true) + wait_for_requests + + expect_snowplow_event( + category: 'Members::InviteService', + action: 'area_of_focus', + label: 'Contribute to the codebase', + property: group.members.last.id.to_s + ) + expect_snowplow_event( + category: 'Members::InviteService', + action: 'area_of_focus', + label: 'Collaborate on open issues and merge requests', + property: group.members.last.id.to_s + ) + end + context 'when user is a guest' do before do group.add_guest(user1) diff --git a/spec/features/groups/packages_spec.rb b/spec/features/groups/packages_spec.rb index 752303fdd78..9a7950266a5 100644 --- a/spec/features/groups/packages_spec.rb +++ b/spec/features/groups/packages_spec.rb @@ -52,6 +52,8 @@ RSpec.describe 'Group Packages' do it_behaves_like 'package details link' end + it_behaves_like 'package details link' + it 'allows you to navigate to the project page' do find('[data-testid="root-link"]', text: project.name).click diff --git a/spec/features/groups/settings/manage_applications_spec.rb b/spec/features/groups/settings/manage_applications_spec.rb new file mode 100644 index 00000000000..5f84f61678d --- /dev/null +++ b/spec/features/groups/settings/manage_applications_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'User manages applications' do + let_it_be(:group) { create(:group) } + let_it_be(:user) { create(:user) } + let_it_be(:new_application_path) { group_settings_applications_path(group) } + + before do + group.add_owner(user) + sign_in(user) + end + + include_examples 'manage applications' +end diff --git a/spec/features/groups/settings/packages_and_registries_spec.rb b/spec/features/groups/settings/packages_and_registries_spec.rb index 551a0bc5375..835555480dd 100644 --- a/spec/features/groups/settings/packages_and_registries_spec.rb +++ b/spec/features/groups/settings/packages_and_registries_spec.rb @@ -113,7 +113,7 @@ RSpec.describe 'Group Packages & Registries settings' do end def find_settings_menu - find('ul[data-testid="group-settings-menu"]') + find('.shortcuts-settings ul') end def visit_settings_page diff --git a/spec/features/groups/settings/user_searches_in_settings_spec.rb b/spec/features/groups/settings/user_searches_in_settings_spec.rb index c258dd41b03..abf56232aff 100644 --- a/spec/features/groups/settings/user_searches_in_settings_spec.rb +++ b/spec/features/groups/settings/user_searches_in_settings_spec.rb @@ -40,7 +40,7 @@ RSpec.describe 'User searches group settings', :js do visit group_settings_ci_cd_path(group) end - it_behaves_like 'can search settings', 'Variables', 'Runners' + it_behaves_like 'can search settings', 'Variables', 'Auto DevOps' end context 'in Packages & Registries page' do |