diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/features/projects/members/groups_with_access_list_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/features/projects/members/groups_with_access_list_spec.rb')
-rw-r--r-- | spec/features/projects/members/groups_with_access_list_spec.rb | 180 |
1 files changed, 134 insertions, 46 deletions
diff --git a/spec/features/projects/members/groups_with_access_list_spec.rb b/spec/features/projects/members/groups_with_access_list_spec.rb index 686d86b1783..9d087dfd5f6 100644 --- a/spec/features/projects/members/groups_with_access_list_spec.rb +++ b/spec/features/projects/members/groups_with_access_list_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Projects > Members > Groups with access list', :js do + include Spec::Support::Helpers::Features::MembersHelpers + let_it_be(:user) { create(:user) } let_it_be(:group) { create(:group, :public) } let_it_be(:project) { create(:project, :public) } @@ -15,86 +17,172 @@ RSpec.describe 'Projects > Members > Groups with access list', :js do project.add_maintainer(user) sign_in(user) - visit project_project_members_path(project) - click_groups_tab end - it 'updates group access level' do - click_button group_link.human_access - - page.within '.dropdown-menu' do - click_link 'Guest' + context 'when `vue_project_members_list` feature flag is enabled' do + before do + visit project_project_members_path(project) + click_groups_tab end - wait_for_requests + it 'updates group access level' do + click_button group_link.human_access + click_button 'Guest' - visit project_project_members_path(project) + wait_for_requests - click_groups_tab + visit project_project_members_path(project) - expect(first('.group_member')).to have_content('Guest') - end + click_groups_tab + + expect(find_group_row(group)).to have_content('Guest') + end - it 'updates expiry date' do - expires_at_field = "member_expires_at_#{group.id}" - fill_in expires_at_field, with: 3.days.from_now.to_date + it 'updates expiry date' do + page.within find_group_row(group) do + fill_in 'Expiration date', with: 5.days.from_now.to_date + find_field('Expiration date').native.send_keys :enter - find_field(expires_at_field).native.send_keys :enter - wait_for_requests + wait_for_requests - page.within(find('li.group_member')) do - expect(page).to have_content('Expires in 3 days') + expect(page).to have_content(/in \d days/) + end end - end - context 'when link has expiry date set' do - let(:additional_link_attrs) { { expires_at: 3.days.from_now.to_date } } + context 'when link has expiry date set' do + let(:additional_link_attrs) { { expires_at: 5.days.from_now.to_date } } - it 'clears expiry date' do - page.within(find('li.group_member')) do - expect(page).to have_content('Expires in 3 days') + it 'clears expiry date' do + page.within find_group_row(group) do + expect(page).to have_content(/in \d days/) - page.within(find('.js-edit-member-form')) do - find('.js-clear-input').click + find('[data-testid="clear-button"]').click + + wait_for_requests + + expect(page).to have_content('No expiration set') end + end + end - wait_for_requests + it 'deletes group link' do + expect(page).to have_content(group.full_name) + + page.within find_group_row(group) do + click_button 'Remove group' + end - expect(page).not_to have_content('Expires in') + page.within('[role="dialog"]') do + click_button('Remove group') + end + + expect(page).not_to have_content(group.full_name) + end + + context 'search in existing members' do + it 'finds no results' do + fill_in_filtered_search 'Search groups', with: 'testing 123' + + click_groups_tab + + expect(page).not_to have_content(group.full_name) + end + + it 'finds results' do + fill_in_filtered_search 'Search groups', with: group.full_name + + click_groups_tab + + expect(members_table).to have_content(group.full_name) end end end - it 'deletes group link' do - page.within(first('.group_member')) do - accept_confirm { find('.btn-danger').click } + context 'when `vue_project_members_list` feature flag is disabled' do + before do + stub_feature_flags(vue_project_members_list: false) + + visit project_project_members_path(project) + click_groups_tab end - wait_for_requests - expect(page).not_to have_selector('.group_member') - end + it 'updates group access level' do + click_button group_link.human_access - context 'search in existing members' do - it 'finds no results' do - page.within '.user-search-form' do - fill_in 'search_groups', with: 'testing 123' - find('.user-search-btn').click + page.within '.dropdown-menu' do + click_link 'Guest' end + wait_for_requests + + visit project_project_members_path(project) + click_groups_tab + expect(first('.group_member')).to have_content('Guest') + end + + it 'updates expiry date' do + expires_at_field = "member_expires_at_#{group.id}" + fill_in expires_at_field, with: 3.days.from_now.to_date + + find_field(expires_at_field).native.send_keys :enter + wait_for_requests + + page.within(find('li.group_member')) do + expect(page).to have_content('Expires in 3 days') + end + end + + context 'when link has expiry date set' do + let(:additional_link_attrs) { { expires_at: 3.days.from_now.to_date } } + + it 'clears expiry date' do + page.within(find('li.group_member')) do + expect(page).to have_content('Expires in 3 days') + + page.within(find('.js-edit-member-form')) do + find('.js-clear-input').click + end + + wait_for_requests + + expect(page).not_to have_content('Expires in') + end + end + end + + it 'deletes group link' do + page.within(first('.group_member')) do + accept_confirm { find('.btn-danger').click } + end + wait_for_requests + expect(page).not_to have_selector('.group_member') end - it 'finds results' do - page.within '.user-search-form' do - fill_in 'search_groups', with: group.name - find('.user-search-btn').click + context 'search in existing members' do + it 'finds no results' do + page.within '.user-search-form' do + fill_in 'search_groups', with: 'testing 123' + find('.user-search-btn').click + end + + click_groups_tab + + expect(page).not_to have_selector('.group_member') end - click_groups_tab + it 'finds results' do + page.within '.user-search-form' do + fill_in 'search_groups', with: group.name + find('.user-search-btn').click + end + + click_groups_tab - expect(page).to have_selector('.group_member', count: 1) + expect(page).to have_selector('.group_member', count: 1) + end end end |