diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/features/groups/members/sort_members_spec.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/features/groups/members/sort_members_spec.rb')
-rw-r--r-- | spec/features/groups/members/sort_members_spec.rb | 196 |
1 files changed, 57 insertions, 139 deletions
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:) |