2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Projects > Settings > User manages project members' do
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:group) { create(:group, name: 'OpenSource') }
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:project2) { create(:project) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:user_dmitriy) { create(:user, name: 'Dmitriy') }
|
|
|
|
let(:user_mike) { create(:user, name: 'Mike') }
|
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
project.add_developer(user_dmitriy)
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
it 'cancels a team member', :js do
|
2018-03-17 18:26:18 +05:30
|
|
|
visit(project_project_members_path(project))
|
|
|
|
|
|
|
|
project_member = project.project_members.find_by(user_id: user_dmitriy.id)
|
|
|
|
|
|
|
|
page.within("#project_member_#{project_member.id}") do
|
2020-07-28 23:09:34 +05:30
|
|
|
# Open modal
|
|
|
|
click_on('Remove user from project')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
expect(page).to have_unchecked_field 'Also unassign this user from related issues and merge requests'
|
|
|
|
|
|
|
|
click_on('Remove member')
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
visit(project_project_members_path(project))
|
|
|
|
|
|
|
|
expect(page).not_to have_content(user_dmitriy.name)
|
|
|
|
expect(page).not_to have_content(user_dmitriy.username)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'imports a team from another project' do
|
2018-11-18 11:00:15 +05:30
|
|
|
project2.add_maintainer(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
project2.add_reporter(user_mike)
|
|
|
|
|
|
|
|
visit(project_project_members_path(project))
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
page.within('.invite-users-form') do
|
2018-03-17 18:26:18 +05:30
|
|
|
click_link('Import')
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
select(project2.full_name, from: 'source_project_id')
|
2018-03-17 18:26:18 +05:30
|
|
|
click_button('Import')
|
|
|
|
|
|
|
|
project_member = project.project_members.find_by(user_id: user_mike.id)
|
|
|
|
|
|
|
|
page.within("#project_member_#{project_member.id}") do
|
|
|
|
expect(page).to have_content('Mike')
|
|
|
|
expect(page).to have_content('Reporter')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows all members of project shared group' do
|
|
|
|
group.add_owner(user)
|
|
|
|
group.add_developer(user_dmitriy)
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
share_link = project.project_group_links.new(group_access: Gitlab::Access::MAINTAINER)
|
2018-03-17 18:26:18 +05:30
|
|
|
share_link.group_id = group.id
|
|
|
|
share_link.save!
|
|
|
|
|
|
|
|
visit(project_project_members_path(project))
|
|
|
|
|
|
|
|
page.within('.project-members-groups') do
|
|
|
|
expect(page).to have_content('OpenSource')
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(first('.group_member')).to have_content('Maintainer')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|