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/members | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/features/groups/members')
5 files changed, 87 insertions, 140 deletions
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:) |