2015-04-26 12:48:37 +05:30
|
|
|
class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
|
2014-09-02 18:07:02 +05:30
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
include Select2Helper
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should be able to see myself in team' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content(@user.name)
|
|
|
|
expect(page).to have_content(@user.username)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
step 'I should see "Dmitriy" in team list' do
|
|
|
|
user = User.find_by(name: "Dmitriy")
|
|
|
|
expect(page).to have_content(user.name)
|
|
|
|
expect(page).to have_content(user.username)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I select "Mike" as "Reporter"' do
|
2014-09-02 18:07:02 +05:30
|
|
|
user = User.find_by(name: "Mike")
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within ".users-project-form" do
|
2015-04-26 12:48:37 +05:30
|
|
|
select2(user.id, from: "#user_ids", multiple: true)
|
|
|
|
select "Reporter", from: "access_level"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
click_button "Add to project"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see "Mike" in team list as "Reporter"' do
|
2016-06-16 23:09:34 +05:30
|
|
|
user = User.find_by(name: 'Mike')
|
|
|
|
project_member = project.project_members.find_by(user_id: user.id)
|
|
|
|
page.within "#project_member_#{project_member.id}" do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content('Mike')
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).to have_content('Reporter')
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I select "sjobs@apple.com" as "Reporter"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within ".users-project-form" do
|
2016-11-03 12:29:30 +05:30
|
|
|
find('#user_ids', visible: false).set('sjobs@apple.com')
|
2015-04-26 12:48:37 +05:30
|
|
|
select "Reporter", from: "access_level"
|
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
click_button "Add to project"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do
|
2016-06-16 23:09:34 +05:30
|
|
|
project_member = project.project_members.find_by(invite_email: 'sjobs@apple.com')
|
|
|
|
page.within "#project_member_#{project_member.id}" do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content('sjobs@apple.com')
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).to have_content('Invited')
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content('Reporter')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
step 'I should see "Dmitriy" in team list as "Developer"' do
|
2016-06-16 23:09:34 +05:30
|
|
|
user = User.find_by(name: 'Dmitriy')
|
|
|
|
project_member = project.project_members.find_by(user_id: user.id)
|
|
|
|
page.within "#project_member_#{project_member.id}" do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content('Dmitriy')
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).to have_content('Developer')
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
step 'I change "Dmitriy" role to "Reporter"' do
|
2015-04-26 12:48:37 +05:30
|
|
|
project = Project.find_by(name: "Shop")
|
2015-09-11 14:41:01 +05:30
|
|
|
user = User.find_by(name: 'Dmitriy')
|
2015-04-26 12:48:37 +05:30
|
|
|
project_member = project.project_members.find_by(user_id: user.id)
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within "#project_member_#{project_member.id}" do
|
2016-09-13 17:45:13 +05:30
|
|
|
select "Reporter", from: "member_access_level_#{project_member.id}"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
step 'I should see "Dmitriy" in team list as "Reporter"' do
|
2016-06-16 23:09:34 +05:30
|
|
|
user = User.find_by(name: 'Dmitriy')
|
|
|
|
project_member = project.project_members.find_by(user_id: user.id)
|
|
|
|
page.within "#project_member_#{project_member.id}" do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content('Dmitriy')
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).to have_content('Reporter')
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
step 'I should not see "Dmitriy" in team list' do
|
|
|
|
user = User.find_by(name: "Dmitriy")
|
|
|
|
expect(page).not_to have_content(user.name)
|
|
|
|
expect(page).not_to have_content(user.username)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'gitlab user "Mike"' do
|
2014-09-02 18:07:02 +05:30
|
|
|
create(:user, name: "Mike")
|
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
step 'gitlab user "Dmitriy"' do
|
|
|
|
create(:user, name: "Dmitriy")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
step '"Dmitriy" is "Shop" developer' do
|
|
|
|
user = User.find_by(name: "Dmitriy")
|
2014-09-02 18:07:02 +05:30
|
|
|
project = Project.find_by(name: "Shop")
|
|
|
|
project.team << [user, :developer]
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I own project "Website"' do
|
2014-09-02 18:07:02 +05:30
|
|
|
@project = create(:empty_project, name: "Website", namespace: @user.namespace)
|
|
|
|
@project.team << [@user, :master]
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step '"Mike" is "Website" reporter' do
|
2014-09-02 18:07:02 +05:30
|
|
|
user = User.find_by(name: "Mike")
|
|
|
|
project = Project.find_by(name: "Website")
|
|
|
|
project.team << [user, :reporter]
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I click link "Import team from another project"' do
|
2016-11-03 12:29:30 +05:30
|
|
|
click_link "Import"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
When 'I submit "Website" project for import team' do
|
|
|
|
project = Project.find_by(name: "Website")
|
|
|
|
select project.name_with_namespace, from: 'source_project_id'
|
|
|
|
click_button 'Import'
|
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
step 'I click cancel link for "Dmitriy"' do
|
2015-04-26 12:48:37 +05:30
|
|
|
project = Project.find_by(name: "Shop")
|
2015-09-11 14:41:01 +05:30
|
|
|
user = User.find_by(name: 'Dmitriy')
|
2015-04-26 12:48:37 +05:30
|
|
|
project_member = project.project_members.find_by(user_id: user.id)
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within "#project_member_#{project_member.id}" do
|
2016-06-16 23:09:34 +05:30
|
|
|
click_link('Remove user from project')
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
step 'I share project with group "OpenSource"' do
|
|
|
|
project = Project.find_by(name: 'Shop')
|
|
|
|
os_group = create(:group, name: 'OpenSource')
|
|
|
|
create(:project, group: os_group)
|
|
|
|
@os_user1 = create(:user)
|
|
|
|
@os_user2 = create(:user)
|
|
|
|
os_group.add_owner(@os_user1)
|
|
|
|
os_group.add_user(@os_user2, Gitlab::Access::DEVELOPER)
|
|
|
|
share_link = project.project_group_links.new(group_access: Gitlab::Access::MASTER)
|
|
|
|
share_link.group_id = os_group.id
|
|
|
|
share_link.save!
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "Opensource" group user listing' do
|
2016-11-03 12:29:30 +05:30
|
|
|
page.within '.project-members-groups' do
|
|
|
|
expect(page).to have_content('OpenSource')
|
|
|
|
expect(find('select').value).to eq('40')
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|