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
|
2014-09-02 18:07:02 +05:30
|
|
|
page.should have_content(@user.name)
|
|
|
|
page.should have_content(@user.username)
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see "Sam" in team list' do
|
2014-09-02 18:07:02 +05:30
|
|
|
user = User.find_by(name: "Sam")
|
|
|
|
page.should have_content(user.name)
|
|
|
|
page.should have_content(user.username)
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I click link "Add members"' do
|
|
|
|
find(:css, 'button.btn-new').click
|
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-04-26 12:48:37 +05:30
|
|
|
within ".users-project-form" do
|
|
|
|
select2(user.id, from: "#user_ids", multiple: true)
|
|
|
|
select "Reporter", from: "access_level"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
click_button "Add users 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
|
2014-09-02 18:07:02 +05:30
|
|
|
within ".access-reporter" do
|
|
|
|
page.should have_content('Mike')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I select "sjobs@apple.com" as "Reporter"' do
|
|
|
|
within ".users-project-form" do
|
|
|
|
select2("sjobs@apple.com", from: "#user_ids", multiple: true)
|
|
|
|
select "Reporter", from: "access_level"
|
|
|
|
end
|
|
|
|
click_button "Add users to project"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do
|
|
|
|
within ".access-reporter" do
|
|
|
|
page.should have_content('sjobs@apple.com')
|
|
|
|
page.should have_content('invited')
|
|
|
|
page.should have_content('Reporter')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "Sam" in team list as "Developer"' do
|
2014-09-02 18:07:02 +05:30
|
|
|
within ".access-developer" do
|
|
|
|
page.should have_content('Sam')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I change "Sam" role to "Reporter"' do
|
|
|
|
project = Project.find_by(name: "Shop")
|
|
|
|
user = User.find_by(name: 'Sam')
|
|
|
|
project_member = project.project_members.find_by(user_id: user.id)
|
|
|
|
within "#project_member_#{project_member.id}" do
|
|
|
|
click_button "Edit access level"
|
|
|
|
select "Reporter", from: "project_member_access_level"
|
|
|
|
click_button "Save"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see "Sam" in team list as "Reporter"' do
|
2014-09-02 18:07:02 +05:30
|
|
|
within ".access-reporter" do
|
|
|
|
page.should have_content('Sam')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I click link "Remove from team"' do
|
2014-09-02 18:07:02 +05:30
|
|
|
click_link "Remove from team"
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should not see "Sam" in team list' do
|
2014-09-02 18:07:02 +05:30
|
|
|
user = User.find_by(name: "Sam")
|
|
|
|
page.should_not have_content(user.name)
|
|
|
|
page.should_not have_content(user.username)
|
|
|
|
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-04-26 12:48:37 +05:30
|
|
|
step 'gitlab user "Sam"' do
|
2014-09-02 18:07:02 +05:30
|
|
|
create(:user, name: "Sam")
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step '"Sam" is "Shop" developer' do
|
2014-09-02 18:07:02 +05:30
|
|
|
user = User.find_by(name: "Sam")
|
|
|
|
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
|
2014-09-02 18:07:02 +05:30
|
|
|
click_link "Import members from another project"
|
|
|
|
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
|
|
|
|
|
|
|
|
step 'I click cancel link for "Sam"' do
|
2015-04-26 12:48:37 +05:30
|
|
|
project = Project.find_by(name: "Shop")
|
|
|
|
user = User.find_by(name: 'Sam')
|
|
|
|
project_member = project.project_members.find_by(user_id: user.id)
|
|
|
|
within "#project_member_#{project_member.id}" do
|
2014-09-02 18:07:02 +05:30
|
|
|
click_link('Remove user from team')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|