diff options
Diffstat (limited to 'spec/features/projects/members')
5 files changed, 42 insertions, 12 deletions
diff --git a/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb b/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb index 47cd0d612b5..08de3d95060 100644 --- a/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb +++ b/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb @@ -8,16 +8,23 @@ RSpec.describe 'Projects > Members > Group requester cannot request access to pr let(:owner) { create(:user) } let(:group) { create(:group, :public) } let(:project) { create(:project, :public, namespace: group) } + let(:more_actions_dropdown) do + find('[data-testid="groups-projects-more-actions-dropdown"] .gl-new-dropdown-custom-toggle') + end before do group.add_owner(owner) sign_in(user) visit group_path(group) - perform_enqueued_jobs { click_link 'Request Access' } + perform_enqueued_jobs do + more_actions_dropdown.click + click_link 'Request Access' + end visit project_path(project) end it 'group requester does not see the request access / withdraw access request button' do + expect(page).not_to have_css '[data-testid="groups-projects-more-actions-dropdown"]' expect(page).not_to have_content 'Request Access' expect(page).not_to have_content 'Withdraw Access Request' end diff --git a/spec/features/projects/members/manage_groups_spec.rb b/spec/features/projects/members/manage_groups_spec.rb index 63ff1ba8455..7bd7c822a5d 100644 --- a/spec/features/projects/members/manage_groups_spec.rb +++ b/spec/features/projects/members/manage_groups_spec.rb @@ -228,6 +228,6 @@ RSpec.describe 'Project > Members > Manage groups', :js, feature_category: :grou end def invite_group_selector - 'button[data-test-id="invite-group-button"]' + 'button[data-testid="invite-group-button"]' end end diff --git a/spec/features/projects/members/manage_members_spec.rb b/spec/features/projects/members/manage_members_spec.rb index 76b2a73e170..3423c636c2b 100644 --- a/spec/features/projects/members/manage_members_spec.rb +++ b/spec/features/projects/members/manage_members_spec.rb @@ -108,7 +108,10 @@ RSpec.describe 'Projects > Members > Manage members', :js, feature_category: :on let(:current_user) { project_owner } it 'shows Owner in the dropdown' do - expect(page).to have_select('Select a role', options: %w[Guest Reporter Developer Maintainer Owner]) + within_modal do + toggle_listbox + expect_listbox_items(%w[Guest Reporter Developer Maintainer Owner]) + end end end @@ -116,8 +119,10 @@ RSpec.describe 'Projects > Members > Manage members', :js, feature_category: :on let(:current_user) { project_maintainer } it 'does not show the Owner option' do - expect(page).to have_select('Select a role', options: %w[Guest Reporter Developer Maintainer]) - expect(page).not_to have_select('Select a role', options: %w[Owner]) + within_modal do + toggle_listbox + expect_listbox_items(%w[Guest Reporter Developer Maintainer]) + end end end end diff --git a/spec/features/projects/members/member_leaves_project_spec.rb b/spec/features/projects/members/member_leaves_project_spec.rb index e0c64547e9f..43c6ba48906 100644 --- a/spec/features/projects/members/member_leaves_project_spec.rb +++ b/spec/features/projects/members/member_leaves_project_spec.rb @@ -8,16 +8,21 @@ RSpec.describe 'Projects > Members > Member leaves project', feature_category: : let(:user) { create(:user) } let(:project) { create(:project, :repository, :with_namespace_settings) } + let(:more_actions_dropdown) do + find('[data-testid="groups-projects-more-actions-dropdown"] .gl-new-dropdown-custom-toggle') + end before do project.add_developer(user) sign_in(user) end - it 'user leaves project' do + it 'user leaves project', :js do visit project_path(project) + more_actions_dropdown.click click_link 'Leave project' + accept_gl_confirm(button_text: 'Leave project') expect(page).to have_current_path(dashboard_projects_path, ignore_query: true) expect(project.users.exists?(user.id)).to be_falsey diff --git a/spec/features/projects/members/user_requests_access_spec.rb b/spec/features/projects/members/user_requests_access_spec.rb index e7f99a4048c..14df7e7bafe 100644 --- a/spec/features/projects/members/user_requests_access_spec.rb +++ b/spec/features/projects/members/user_requests_access_spec.rb @@ -10,6 +10,9 @@ RSpec.describe 'Projects > Members > User requests access', :js, feature_categor let_it_be(:project) { create(:project, :public, :repository) } let(:owner) { project.first_owner } + let(:more_actions_dropdown) do + find('[data-testid="groups-projects-more-actions-dropdown"] .gl-new-dropdown-custom-toggle') + end before do sign_in(user) @@ -17,39 +20,46 @@ RSpec.describe 'Projects > Members > User requests access', :js, feature_categor visit project_path(project) end - it 'request access feature is disabled' do + it 'request access feature is disabled', :js do project.update!(request_access_enabled: false) visit project_path(project) + more_actions_dropdown.click expect(page).not_to have_content 'Request Access' end - it 'user can request access to a project' do - perform_enqueued_jobs { click_link 'Request Access' } + it 'user can request access to a project', :js do + perform_enqueued_jobs do + more_actions_dropdown.click + click_link 'Request Access' + end expect(ActionMailer::Base.deliveries.map(&:to)).to match_array([[owner.notification_email_or_default], [maintainer.notification_email_or_default]]) expect(ActionMailer::Base.deliveries.last.subject).to eq "Request to join the #{project.full_name} project" expect(project.requesters.exists?(user_id: user)).to be_truthy + more_actions_dropdown.click expect(page).to have_content 'Withdraw Access Request' expect(page).not_to have_content 'Leave Project' end context 'code access is restricted' do - it 'user can request access' do + it 'user can request access', :js do project.project_feature.update!( repository_access_level: ProjectFeature::PRIVATE, builds_access_level: ProjectFeature::PRIVATE, merge_requests_access_level: ProjectFeature::PRIVATE ) visit project_path(project) + more_actions_dropdown.click expect(page).to have_content 'Request Access' end end - it 'user is not listed in the project members page' do + it 'user is not listed in the project members page', :js do + more_actions_dropdown.click click_link 'Request Access' expect(project.requesters.exists?(user_id: user)).to be_truthy @@ -64,13 +74,16 @@ RSpec.describe 'Projects > Members > User requests access', :js, feature_categor end end - it 'user can withdraw its request for access' do + it 'user can withdraw its request for access', :js do + more_actions_dropdown.click click_link 'Request Access' expect(project.requesters.exists?(user_id: user)).to be_truthy + more_actions_dropdown.click accept_gl_confirm { click_link 'Withdraw Access Request' } + more_actions_dropdown.click expect(page).not_to have_content 'Withdraw Access Request' expect(page).to have_content 'Request Access' end |