diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/features/groups | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/features/groups')
9 files changed, 156 insertions, 145 deletions
diff --git a/spec/features/groups/board_spec.rb b/spec/features/groups/board_spec.rb index b25aa26d906..aab3f5e68d5 100644 --- a/spec/features/groups/board_spec.rb +++ b/spec/features/groups/board_spec.rb @@ -20,14 +20,19 @@ RSpec.describe 'Group Boards' do page.within(find('.board', match: :first)) do issue_title = 'New Issue' find(:css, '.issue-count-badge-add-button').click + + wait_for_requests + expect(find('.board-new-issue-form')).to be_visible fill_in 'issue_title', with: issue_title - find('.dropdown-menu-toggle').click - wait_for_requests + page.within("[data-testid='project-select-dropdown']") do + find('button.gl-dropdown-toggle').click + + find('.gl-new-dropdown-item button').click + end - click_link(project.name) click_button 'Submit issue' expect(page).to have_content(issue_title) diff --git a/spec/features/groups/import_export/connect_instance_spec.rb b/spec/features/groups/import_export/connect_instance_spec.rb index c0f967fd0b9..2e1bf27ba8b 100644 --- a/spec/features/groups/import_export/connect_instance_spec.rb +++ b/spec/features/groups/import_export/connect_instance_spec.rb @@ -24,7 +24,7 @@ RSpec.describe 'Import/Export - Connect to another instance', :js do pat = 'demo-pat' stub_path = 'stub-group' - stub_request(:get, "%{url}/api/v4/groups?page=1&per_page=30&top_level_only=true" % { url: source_url }).to_return( + stub_request(:get, "%{url}/api/v4/groups?page=1&per_page=30&top_level_only=true&min_access_level=40" % { url: source_url }).to_return( body: [{ id: 2595438, web_url: 'https://gitlab.com/groups/auto-breakfast', diff --git a/spec/features/groups/members/manage_groups_spec.rb b/spec/features/groups/members/manage_groups_spec.rb index 31a2c868cac..e9bbe9de3c9 100644 --- a/spec/features/groups/members/manage_groups_spec.rb +++ b/spec/features/groups/members/manage_groups_spec.rb @@ -17,6 +17,7 @@ RSpec.describe 'Groups > Members > Manage groups', :js do let_it_be(:group_to_add) { create(:group) } before do + stub_feature_flags(invite_members_group_modal: false) group.add_owner(user) visit group_group_members_path(group) end diff --git a/spec/features/groups/members/manage_members_spec.rb b/spec/features/groups/members/manage_members_spec.rb index e6da05c4873..c27d0afba6f 100644 --- a/spec/features/groups/members/manage_members_spec.rb +++ b/spec/features/groups/members/manage_members_spec.rb @@ -11,9 +11,37 @@ RSpec.describe 'Groups > Members > Manage members' do let(:group) { create(:group) } before do + stub_feature_flags(invite_members_group_modal: false) sign_in(user1) end + shared_examples 'includes the correct Invite Members link' do |should_include, should_not_include| + it 'includes either the form or the modal trigger' do + group.add_owner(user1) + + visit group_group_members_path(group) + + expect(page).to have_selector(should_include) + expect(page).not_to have_selector(should_not_include) + end + end + + context 'when Invite Members modal is enabled' do + before do + stub_feature_flags(invite_members_group_modal: true) + end + + it_behaves_like 'includes the correct Invite Members link', '.js-invite-members-trigger', '.invite-users-form' + end + + context 'when Invite Members modal is disabled' do + before do + stub_feature_flags(invite_members_group_modal: false) + end + + it_behaves_like 'includes the correct Invite Members link', '.invite-users-form', '.js-invite-members-trigger' + end + it 'update user to owner level', :js do group.add_owner(user1) group.add_developer(user2) diff --git a/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb index de9b32e00aa..38deee547a3 100644 --- a/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb +++ b/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb @@ -11,6 +11,7 @@ RSpec.describe 'Groups > Members > Owner adds member with expiration date', :js let(:new_member) { create(:user, name: 'Mary Jane') } before do + stub_feature_flags(invite_members_group_modal: false) group.add_owner(user1) sign_in(user1) end diff --git a/spec/features/groups/members/master_manages_access_requests_spec.rb b/spec/features/groups/members/master_manages_access_requests_spec.rb index 71c9b280ebe..2a17e7d2a5c 100644 --- a/spec/features/groups/members/master_manages_access_requests_spec.rb +++ b/spec/features/groups/members/master_manages_access_requests_spec.rb @@ -4,7 +4,6 @@ require 'spec_helper' RSpec.describe 'Groups > Members > Maintainer manages access requests' do it_behaves_like 'Maintainer manages access requests' do - let(:has_tabs) { true } let(:entity) { create(:group, :public) } let(:members_page_path) { group_group_members_path(entity) } end diff --git a/spec/features/groups/members/sort_members_spec.rb b/spec/features/groups/members/sort_members_spec.rb index 68a748aa76a..03758e0d401 100644 --- a/spec/features/groups/members/sort_members_spec.rb +++ b/spec/features/groups/members/sort_members_spec.rb @@ -16,174 +16,92 @@ RSpec.describe 'Groups > Members > Sort members', :js do sign_in(owner) end - context 'when `group_members_filtered_search` feature flag is enabled' do - def expect_sort_by(text, sort_direction) - within('[data-testid="members-sort-dropdown"]') do - expect(page).to have_css('button[aria-haspopup="true"]', text: text) - expect(page).to have_button("Sorting Direction: #{sort_direction == :asc ? 'Ascending' : 'Descending'}") - end - end - - it 'sorts by account by default' do - visit_members_list(sort: nil) - - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - - expect_sort_by('Account', :asc) - end - - it 'sorts by max role ascending' do - visit_members_list(sort: :access_level_asc) - - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - - expect_sort_by('Max role', :asc) - end - - it 'sorts by max role descending' do - visit_members_list(sort: :access_level_desc) - - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - - expect_sort_by('Max role', :desc) - end - - it 'sorts by access granted ascending' do - visit_members_list(sort: :last_joined) - - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - - expect_sort_by('Access granted', :asc) - end - - it 'sorts by access granted descending' do - visit_members_list(sort: :oldest_joined) - - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - - expect_sort_by('Access granted', :desc) - end - - it 'sorts by account ascending' do - visit_members_list(sort: :name_asc) - - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - - expect_sort_by('Account', :asc) + def expect_sort_by(text, sort_direction) + within('[data-testid="members-sort-dropdown"]') do + expect(page).to have_css('button[aria-haspopup="true"]', text: text) + expect(page).to have_button("Sorting Direction: #{sort_direction == :asc ? 'Ascending' : 'Descending'}") end + end - it 'sorts by account descending' do - visit_members_list(sort: :name_desc) + it 'sorts by account by default' do + visit_members_list(sort: nil) - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) - expect_sort_by('Account', :desc) - end + expect_sort_by('Account', :asc) + end - it 'sorts by last sign-in ascending', :clean_gitlab_redis_shared_state do - visit_members_list(sort: :recent_sign_in) + it 'sorts by max role ascending' do + visit_members_list(sort: :access_level_asc) - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) - expect_sort_by('Last sign-in', :asc) - end + expect_sort_by('Max role', :asc) + end - it 'sorts by last sign-in descending', :clean_gitlab_redis_shared_state do - visit_members_list(sort: :oldest_sign_in) + it 'sorts by max role descending' do + visit_members_list(sort: :access_level_desc) - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) - expect_sort_by('Last sign-in', :desc) - end + expect_sort_by('Max role', :desc) end - context 'when `group_members_filtered_search` feature flag is disabled' do - dropdown_toggle_selector = '[data-testid="user-sort-dropdown"] [data-testid="dropdown-toggle"]' + it 'sorts by access granted ascending' do + visit_members_list(sort: :last_joined) - before do - stub_feature_flags(group_members_filtered_search: false) - end - - it 'sorts alphabetically by default' do - visit_members_list(sort: nil) - - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Name, ascending') - end + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) - it 'sorts by access level ascending' do - visit_members_list(sort: :access_level_asc) + expect_sort_by('Access granted', :asc) + end - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Access level, ascending') - end + it 'sorts by access granted descending' do + visit_members_list(sort: :oldest_joined) - it 'sorts by access level descending' do - visit_members_list(sort: :access_level_desc) + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Access level, descending') - end + expect_sort_by('Access granted', :desc) + end - it 'sorts by last joined' do - visit_members_list(sort: :last_joined) + it 'sorts by account ascending' do + visit_members_list(sort: :name_asc) - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Last joined') - end + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) - it 'sorts by oldest joined' do - visit_members_list(sort: :oldest_joined) + expect_sort_by('Account', :asc) + end - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Oldest joined') - end + it 'sorts by account descending' do + visit_members_list(sort: :name_desc) - it 'sorts by name ascending' do - visit_members_list(sort: :name_asc) + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Name, ascending') - end + expect_sort_by('Account', :desc) + end - it 'sorts by name descending' do - visit_members_list(sort: :name_desc) + it 'sorts by last sign-in ascending', :clean_gitlab_redis_shared_state do + visit_members_list(sort: :recent_sign_in) - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Name, descending') - end + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) - it 'sorts by recent sign in', :clean_gitlab_redis_shared_state do - visit_members_list(sort: :recent_sign_in) + expect_sort_by('Last sign-in', :asc) + end - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Recent sign in') - end + it 'sorts by last sign-in descending', :clean_gitlab_redis_shared_state do + visit_members_list(sort: :oldest_sign_in) - it 'sorts by oldest sign in', :clean_gitlab_redis_shared_state do - visit_members_list(sort: :oldest_sign_in) + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Oldest sign in') - end + expect_sort_by('Last sign-in', :desc) end def visit_members_list(sort:) diff --git a/spec/features/groups/settings/ci_cd_spec.rb b/spec/features/groups/settings/ci_cd_spec.rb index 9c2f9512b9d..b059cd8da29 100644 --- a/spec/features/groups/settings/ci_cd_spec.rb +++ b/spec/features/groups/settings/ci_cd_spec.rb @@ -28,7 +28,7 @@ RSpec.describe 'Group CI/CD settings' do let(:page_token) { find('#registration_token').text } before do - click_button 'Reset runners registration token' + click_button 'Reset registration token' end it 'changes registration token' do diff --git a/spec/features/groups/settings/packages_and_registries_spec.rb b/spec/features/groups/settings/packages_and_registries_spec.rb new file mode 100644 index 00000000000..b8ffd73335d --- /dev/null +++ b/spec/features/groups/settings/packages_and_registries_spec.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Group Packages & Registries settings' do + include WaitForRequests + + let(:user) { create(:user) } + let(:group) { create(:group) } + + before do + group.add_owner(user) + sign_in(user) + end + + context 'when the feature flag is off' do + before do + stub_feature_flags(packages_and_registries_group_settings: false) + end + + it 'the menu item is not visible' do + visit group_path(group) + + settings_menu = find_settings_menu + + expect(settings_menu).not_to have_content 'Packages & Registries' + end + end + + context 'when the feature flag is on' do + it 'the menu item is visible' do + visit group_path(group) + + settings_menu = find_settings_menu + expect(settings_menu).to have_content 'Packages & Registries' + end + + it 'has a page title set' do + visit_settings_page + + expect(page).to have_title _('Packages & Registries') + end + + it 'sidebar menu is open' do + visit_settings_page + + sidebar = find('.nav-sidebar') + expect(sidebar).to have_link _('Packages & Registries') + end + end + + def find_settings_menu + find('ul[data-testid="group-settings-menu"]') + end + + def visit_settings_page + visit group_settings_packages_and_registries_path(group) + end +end |