diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-05 21:10:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-05 21:10:06 +0300 |
commit | c8419b0227e069a7403f41589f1d0ef690e762f1 (patch) | |
tree | 7009382402811f9e32b448f68f7f90912237aa03 /spec/features | |
parent | 6659634b2bdc3ba362574541985c6852ad1574a4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
9 files changed, 82 insertions, 27 deletions
diff --git a/spec/features/groups/members/leave_group_spec.rb b/spec/features/groups/members/leave_group_spec.rb index 27ceec05fe3..632155cd7e4 100644 --- a/spec/features/groups/members/leave_group_spec.rb +++ b/spec/features/groups/members/leave_group_spec.rb @@ -9,17 +9,22 @@ RSpec.describe 'Groups > Members > Leave group', feature_category: :groups_and_p let(:user) { create(:user) } let(:other_user) { create(:user) } let(:group) { create(:group) } + let(:more_actions_dropdown) do + find('[data-testid="groups-projects-more-actions-dropdown"] .gl-new-dropdown-custom-toggle') + end before do sign_in(user) end - it 'guest leaves the group' do + it 'guest leaves the group', :js do group.add_guest(user) group.add_owner(other_user) visit group_path(group) + more_actions_dropdown.click click_link 'Leave group' + accept_gl_confirm(button_text: 'Leave group') expect(page).to have_current_path(dashboard_groups_path, ignore_query: true) expect(page).to have_content left_group_message(group) @@ -31,31 +36,33 @@ RSpec.describe 'Groups > Members > Leave group', feature_category: :groups_and_p group.add_owner(other_user) visit group_path(group, leave: 1) - accept_gl_confirm(button_text: 'Leave group') - wait_for_all_requests expect(page).to have_current_path(dashboard_groups_path, ignore_query: true) expect(group.users).not_to include(user) end - it 'guest leaves the group as last member' do + it 'guest leaves the group as last member', :js do group.add_guest(user) visit group_path(group) + more_actions_dropdown.click click_link 'Leave group' + accept_gl_confirm(button_text: 'Leave group') expect(page).to have_current_path(dashboard_groups_path, ignore_query: true) expect(page).to have_content left_group_message(group) expect(group.users).not_to include(user) end - it 'owner leaves the group if they are not the last owner' do + it 'owner leaves the group if they are not the last owner', :js do group.add_owner(user) group.add_owner(other_user) visit group_path(group) + more_actions_dropdown.click click_link 'Leave group' + accept_gl_confirm(button_text: 'Leave group') expect(page).to have_current_path(dashboard_groups_path, ignore_query: true) expect(page).to have_content left_group_message(group) @@ -66,6 +73,7 @@ RSpec.describe 'Groups > Members > Leave group', feature_category: :groups_and_p group.add_owner(user) visit group_path(group) + more_actions_dropdown.click expect(page).not_to have_content 'Leave group' diff --git a/spec/features/groups/members/request_access_spec.rb b/spec/features/groups/members/request_access_spec.rb index 2d0b2e483c5..e6da2ce7cec 100644 --- a/spec/features/groups/members/request_access_spec.rb +++ b/spec/features/groups/members/request_access_spec.rb @@ -3,10 +3,15 @@ require 'spec_helper' RSpec.describe 'Groups > Members > Request access', feature_category: :groups_and_projects do + include Spec::Support::Helpers::ModalHelpers + let(:user) { create(:user) } let(:owner) { create(:user) } let(:group) { create(:group, :public) } let!(:project) { create(:project, :private, 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) @@ -14,15 +19,19 @@ RSpec.describe 'Groups > Members > Request access', feature_category: :groups_an visit group_path(group) end - it 'request access feature is disabled' do + it 'request access feature is disabled', :js do group.update!(request_access_enabled: false) visit group_path(group) + more_actions_dropdown.click expect(page).not_to have_content 'Request Access' end - it 'user can request access to a group' do - perform_enqueued_jobs { click_link 'Request Access' } + it 'user can request access to a group', :js do + perform_enqueued_jobs do + more_actions_dropdown.click + click_link 'Request Access' + end expect(ActionMailer::Base.deliveries.last.to).to eq [owner.notification_email_or_default] expect(ActionMailer::Base.deliveries.last.subject).to match "Request to join the #{group.name} group" @@ -30,18 +39,26 @@ RSpec.describe 'Groups > Members > Request access', feature_category: :groups_an expect(group.requesters.exists?(user_id: user)).to be_truthy expect(page).to have_content 'Your request for access has been queued for review.' + more_actions_dropdown.click + expect(page).to have_content 'Withdraw Access Request' expect(page).not_to have_content 'Leave group' end - it 'user does not see private projects' do - perform_enqueued_jobs { click_link 'Request Access' } + it 'user does not see private projects', :js do + perform_enqueued_jobs do + more_actions_dropdown.click + click_link 'Request Access' + end expect(page).not_to have_content project.name end - it 'user does not see group in the Dashboard > Groups page' do - perform_enqueued_jobs { click_link 'Request Access' } + it 'user does not see group in the Dashboard > Groups page', :js do + perform_enqueued_jobs do + more_actions_dropdown.click + click_link 'Request Access' + end visit dashboard_groups_path @@ -49,6 +66,7 @@ RSpec.describe 'Groups > Members > Request access', feature_category: :groups_an end it 'user is not listed in the group members page', :js do + more_actions_dropdown.click click_link 'Request Access' expect(group.requesters.exists?(user_id: user)).to be_truthy @@ -63,20 +81,24 @@ RSpec.describe 'Groups > Members > Request access', feature_category: :groups_an 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(group.requesters.exists?(user_id: user)).to be_truthy + more_actions_dropdown.click click_link 'Withdraw Access Request' + accept_gl_confirm - expect(group.requesters.exists?(user_id: user)).to be_falsey expect(page).to have_content 'Your access request to the group has been withdrawn.' + expect(group.requesters.exists?(user_id: user)).to be_falsey end - it 'member does not see the request access button' do + it 'member does not see the request access button', :js do group.add_owner(user) visit group_path(group) + more_actions_dropdown.click expect(page).not_to have_content 'Request Access' end diff --git a/spec/features/projects/files/user_reads_pipeline_status_spec.rb b/spec/features/projects/files/user_reads_pipeline_status_spec.rb index 24dd673501c..610c583f060 100644 --- a/spec/features/projects/files/user_reads_pipeline_status_spec.rb +++ b/spec/features/projects/files/user_reads_pipeline_status_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'user reads pipeline status', :js, feature_category: :groups_and_projects do +RSpec.describe 'user reads pipeline status', :js, feature_category: :continuous_integration do let(:project) { create(:project, :repository) } let(:user) { create(:user) } let(:v110_pipeline) { create_pipeline('v1.1.0', 'success') } diff --git a/spec/features/projects/jobs/user_browses_job_spec.rb b/spec/features/projects/jobs/user_browses_job_spec.rb index 448db8b6d89..1be1a58d212 100644 --- a/spec/features/projects/jobs/user_browses_job_spec.rb +++ b/spec/features/projects/jobs/user_browses_job_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'User browses a job', :js, feature_category: :groups_and_projects do +RSpec.describe 'User browses a job', :js, feature_category: :continuous_integration do include Spec::Support::Helpers::ModalHelpers let(:user) { create(:user) } diff --git a/spec/features/projects/jobs/user_browses_jobs_spec.rb b/spec/features/projects/jobs/user_browses_jobs_spec.rb index 115b3dda5b2..5c1dc36a31c 100644 --- a/spec/features/projects/jobs/user_browses_jobs_spec.rb +++ b/spec/features/projects/jobs/user_browses_jobs_spec.rb @@ -8,7 +8,7 @@ def visit_jobs_page wait_for_requests end -RSpec.describe 'User browses jobs', feature_category: :groups_and_projects do +RSpec.describe 'User browses jobs', feature_category: :continuous_integration do describe 'Jobs', :js do let(:project) { create(:project, :repository) } let(:user) { create(:user) } diff --git a/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb b/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb index 41a21b1155b..21274572352 100644 --- a/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb +++ b/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'User triggers manual job with variables', :js, feature_category: :groups_and_projects do +RSpec.describe 'User triggers manual job with variables', :js, feature_category: :continuous_integration do let(:user) { create(:user) } let(:user_access_level) { :developer } let(:project) { create(:project, :repository, namespace: user.namespace) } 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/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 |