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/admin/admin_projects_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/features/admin/admin_projects_spec.rb')
-rw-r--r-- | spec/features/admin/admin_projects_spec.rb | 99 |
1 files changed, 76 insertions, 23 deletions
diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index ff4e592234b..aab2e6d7cef 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' RSpec.describe "Admin::Projects" do + include Spec::Support::Helpers::Features::MembersHelpers include Select2Helper let(:user) { create :user } @@ -91,45 +92,97 @@ RSpec.describe "Admin::Projects" do end end - describe 'add admin himself to a project' do - before do - project.add_maintainer(user) - end + context 'when `vue_project_members_list` feature flag is enabled', :js do + describe 'admin adds themselves to the project' do + before do + project.add_maintainer(user) + stub_feature_flags(invite_members_group_modal: false) + end - it 'adds admin a to a project as developer', :js do - visit project_project_members_path(project) + it 'adds admin to the project as developer', :js do + visit project_project_members_path(project) - page.within '.invite-users-form' do - select2(current_user.id, from: '#user_ids', multiple: true) - select 'Developer', from: 'access_level' + page.within '.invite-users-form' do + select2(current_user.id, from: '#user_ids', multiple: true) + select 'Developer', from: 'access_level' + end + + click_button 'Invite' + + expect(find_member_row(current_user)).to have_content('Developer') end + end + + describe 'admin removes themselves from the project' do + before do + project.add_maintainer(user) + project.add_developer(current_user) + end + + it 'removes admin from the project' do + visit project_project_members_path(project) + + expect(find_member_row(current_user)).to have_content('Developer') + + page.within find_member_row(current_user) do + click_button 'Leave' + end - click_button 'Invite' + page.within('[role="dialog"]') do + click_button('Leave') + end - page.within '.content-list' do - expect(page).to have_content(current_user.name) - expect(page).to have_content('Developer') + expect(current_path).to match dashboard_projects_path end end end - describe 'admin remove himself from a project' do + context 'when `vue_project_members_list` feature flag is disabled' do before do - project.add_maintainer(user) - project.add_developer(current_user) + stub_feature_flags(vue_project_members_list: false) end - it 'removes admin from the project' do - visit project_project_members_path(project) + describe 'admin adds themselves to the project' do + before do + project.add_maintainer(user) + stub_feature_flags(invite_members_group_modal: false) + end + + it 'adds admin to the project as developer', :js do + visit project_project_members_path(project) + + page.within '.invite-users-form' do + select2(current_user.id, from: '#user_ids', multiple: true) + select 'Developer', from: 'access_level' + end + + click_button 'Invite' + + page.within '.content-list' do + expect(page).to have_content(current_user.name) + expect(page).to have_content('Developer') + end + end + end - page.within '.content-list' do - expect(page).to have_content(current_user.name) - expect(page).to have_content('Developer') + describe 'admin removes themselves from the project' do + before do + project.add_maintainer(user) + project.add_developer(current_user) end - find(:css, '.content-list li', text: current_user.name).find(:css, 'a.btn-danger').click + it 'removes admin from the project' do + visit project_project_members_path(project) + + page.within '.content-list' do + expect(page).to have_content(current_user.name) + expect(page).to have_content('Developer') + end - expect(page).not_to have_selector(:css, '.content-list') + find(:css, '.content-list li', text: current_user.name).find(:css, 'a.btn-danger').click + + expect(page).not_to have_selector(:css, '.content-list') + end end end end |