2014-09-22 10:30:25 -04:00
|
|
|
|
class Spinach::Features::Groups < Spinach::FeatureSteps
|
2012-10-03 06:42:17 -04:00
|
|
|
|
include SharedAuthentication
|
|
|
|
|
include SharedPaths
|
2014-02-07 11:59:55 -05:00
|
|
|
|
include SharedGroup
|
2014-01-27 09:53:59 -05:00
|
|
|
|
include SharedUser
|
2013-06-11 06:54:58 -04:00
|
|
|
|
include Select2Helper
|
2012-10-03 06:42:17 -04:00
|
|
|
|
|
2015-03-30 17:17:49 -04:00
|
|
|
|
step 'gitlab user "Mike"' do
|
|
|
|
|
create(:user, name: "Mike")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'I click link "Add members"' do
|
|
|
|
|
find(:css, 'button.btn-new').click
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'I select "Mike" as "Reporter"' do
|
|
|
|
|
user = User.find_by(name: "Mike")
|
|
|
|
|
|
2015-06-12 01:36:00 -04:00
|
|
|
|
page.within ".users-group-form" do
|
2015-03-30 17:17:49 -04:00
|
|
|
|
select2(user.id, from: "#user_ids", multiple: true)
|
|
|
|
|
select "Reporter", from: "access_level"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
click_button "Add users to group"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'I should see "Mike" in team list as "Reporter"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
|
page.within '.well-list' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content('Mike')
|
|
|
|
|
expect(page).to have_content('Reporter')
|
2015-03-30 17:17:49 -04:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-10 09:40:23 -04:00
|
|
|
|
step 'I select "sjobs@apple.com" as "Reporter"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
|
page.within ".users-group-form" do
|
2015-04-10 09:40:23 -04:00
|
|
|
|
select2("sjobs@apple.com", from: "#user_ids", multiple: true)
|
|
|
|
|
select "Reporter", from: "access_level"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
click_button "Add users to group"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
|
page.within '.well-list' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content('sjobs@apple.com')
|
|
|
|
|
expect(page).to have_content('invited')
|
|
|
|
|
expect(page).to have_content('Reporter')
|
2015-04-10 09:40:23 -04:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I should see group "Owned" projects list' do
|
2014-02-07 11:59:55 -05:00
|
|
|
|
Group.find_by(name: "Owned").projects.each do |project|
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_link project.name
|
2012-10-03 06:42:17 -04:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I should see projects activity feed' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content 'closed issue'
|
2012-10-03 06:42:17 -04:00
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I should see issues from group "Owned" assigned to me' do
|
2012-10-22 14:42:06 -04:00
|
|
|
|
assigned_to_me(:issues).each do |issue|
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content issue.title
|
2012-10-22 14:42:06 -04:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I should see merge requests from group "Owned" assigned to me' do
|
2012-10-22 14:42:06 -04:00
|
|
|
|
assigned_to_me(:merge_requests).each do |issue|
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content issue.title[0..80]
|
2012-10-22 14:42:06 -04:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I select user "Mary Jane" from list with role "Reporter"' do
|
2014-02-07 11:59:55 -05:00
|
|
|
|
user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane")
|
2014-09-30 10:39:37 -04:00
|
|
|
|
click_button 'Add members'
|
2015-06-12 01:36:00 -04:00
|
|
|
|
page.within ".users-group-form" do
|
2013-06-11 06:54:58 -04:00
|
|
|
|
select2(user.id, from: "#user_ids", multiple: true)
|
2014-09-15 09:45:28 -04:00
|
|
|
|
select "Reporter", from: "access_level"
|
2012-12-25 17:52:49 -05:00
|
|
|
|
end
|
2015-02-03 19:55:31 -05:00
|
|
|
|
click_button "Add users to group"
|
2012-12-25 17:52:49 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I should see user "John Doe" in team list' do
|
2014-05-29 14:30:07 -04:00
|
|
|
|
projects_with_access = find(".panel .well-list")
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(projects_with_access).to have_content("John Doe")
|
2012-12-25 17:52:49 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I should not see user "John Doe" in team list' do
|
2014-05-29 14:30:07 -04:00
|
|
|
|
projects_with_access = find(".panel .well-list")
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(projects_with_access).not_to have_content("John Doe")
|
2014-02-07 11:59:55 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I should see user "Mary Jane" in team list' do
|
2014-05-29 14:30:07 -04:00
|
|
|
|
projects_with_access = find(".panel .well-list")
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(projects_with_access).to have_content("Mary Jane")
|
2014-02-07 11:59:55 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I should not see user "Mary Jane" in team list' do
|
2014-05-29 14:30:07 -04:00
|
|
|
|
projects_with_access = find(".panel .well-list")
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(projects_with_access).not_to have_content("Mary Jane")
|
2014-02-07 11:59:55 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'project from group "Owned" has issues assigned to me' do
|
2012-10-22 14:42:06 -04:00
|
|
|
|
create :issue,
|
|
|
|
|
project: project,
|
|
|
|
|
assignee: current_user,
|
|
|
|
|
author: current_user
|
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'project from group "Owned" has merge requests assigned to me' do
|
2012-10-22 14:42:06 -04:00
|
|
|
|
create :merge_request,
|
2013-04-25 10:15:33 -04:00
|
|
|
|
source_project: project,
|
|
|
|
|
target_project: project,
|
2012-10-22 14:42:06 -04:00
|
|
|
|
assignee: current_user,
|
|
|
|
|
author: current_user
|
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I change group "Owned" name to "new-name"' do
|
2013-05-05 10:01:10 -04:00
|
|
|
|
fill_in 'group_name', with: 'new-name'
|
2014-12-22 08:02:47 -05:00
|
|
|
|
fill_in 'group_path', with: 'new-name'
|
2013-02-01 12:04:11 -05:00
|
|
|
|
click_button "Save group"
|
|
|
|
|
end
|
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
|
step 'I should see new group "Owned" name' do
|
2015-06-12 01:36:00 -04:00
|
|
|
|
page.within ".navbar-gitlab" do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content "new-name"
|
2013-02-01 12:04:11 -05:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
step 'I change group "Owned" avatar' do
|
2014-01-27 16:34:05 -05:00
|
|
|
|
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
|
|
|
|
|
click_button "Save group"
|
2014-02-07 11:59:55 -05:00
|
|
|
|
Group.find_by(name: "Owned").reload
|
2014-01-27 16:34:05 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
step 'I should see new group "Owned" avatar' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(Group.find_by(name: "Owned").avatar).to be_instance_of AvatarUploader
|
|
|
|
|
expect(Group.find_by(name: "Owned").avatar.url).to eq "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png"
|
2014-01-27 16:34:05 -05:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'I should see the "Remove avatar" button' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_link("Remove avatar")
|
2014-01-27 16:34:05 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
step 'I have group "Owned" avatar' do
|
2014-01-27 16:34:05 -05:00
|
|
|
|
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
|
|
|
|
|
click_button "Save group"
|
2014-02-07 11:59:55 -05:00
|
|
|
|
Group.find_by(name: "Owned").reload
|
2014-01-27 16:34:05 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
step 'I remove group "Owned" avatar' do
|
2014-01-27 16:34:05 -05:00
|
|
|
|
click_link "Remove avatar"
|
2014-02-07 11:59:55 -05:00
|
|
|
|
Group.find_by(name: "Owned").reload
|
2014-01-27 16:34:05 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
step 'I should not see group "Owned" avatar' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(Group.find_by(name: "Owned").avatar?).to be_false
|
2014-01-27 16:34:05 -05:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'I should not see the "Remove avatar" button' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).not_to have_link("Remove avatar")
|
2014-01-27 16:34:05 -05:00
|
|
|
|
end
|
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
step 'I click on the "Remove User From Group" button for "John Doe"' do
|
|
|
|
|
find(:css, 'li', text: "John Doe").find(:css, 'a.btn-remove').click
|
|
|
|
|
# poltergeist always confirms popups.
|
|
|
|
|
end
|
2012-10-03 06:42:17 -04:00
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
step 'I click on the "Remove User From Group" button for "Mary Jane"' do
|
|
|
|
|
find(:css, 'li', text: "Mary Jane").find(:css, 'a.btn-remove').click
|
|
|
|
|
# poltergeist always confirms popups.
|
2012-10-03 06:42:17 -04:00
|
|
|
|
end
|
2012-10-22 14:42:06 -04:00
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
step 'I should not see the "Remove User From Group" button for "John Doe"' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(find(:css, 'li', text: "John Doe")).not_to have_selector(:css, 'a.btn-remove')
|
2014-02-07 11:59:55 -05:00
|
|
|
|
# poltergeist always confirms popups.
|
2012-10-22 14:42:06 -04:00
|
|
|
|
end
|
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
step 'I should not see the "Remove User From Group" button for "Mary Jane"' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(find(:css, 'li', text: "Mary Jane")).not_to have_selector(:css, 'a.btn-remove')
|
2014-02-07 11:59:55 -05:00
|
|
|
|
# poltergeist always confirms popups.
|
|
|
|
|
end
|
|
|
|
|
|
2014-05-16 06:28:35 -04:00
|
|
|
|
step 'I search for \'Mary\' member' do
|
2015-06-12 01:36:00 -04:00
|
|
|
|
page.within '.member-search-form' do
|
2014-05-16 06:28:35 -04:00
|
|
|
|
fill_in 'search', with: 'Mary'
|
|
|
|
|
click_button 'Search'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-06-30 10:18:26 -04:00
|
|
|
|
step 'I click on group milestones' do
|
|
|
|
|
click_link 'Milestones'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'I should see group milestones index page has no milestones' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content('No milestones to show')
|
2014-06-30 10:18:26 -04:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'Group has projects with milestones' do
|
|
|
|
|
group_milestone
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'I should see group milestones index page with milestones' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content('Version 7.2')
|
|
|
|
|
expect(page).to have_content('GL-113')
|
|
|
|
|
expect(page).to have_link('2 Issues', href: issues_group_path("owned", milestone_title: "Version 7.2"))
|
|
|
|
|
expect(page).to have_link('3 Merge Requests', href: merge_requests_group_path("owned", milestone_title: "GL-113"))
|
2014-06-30 10:18:26 -04:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
step 'I click on one group milestone' do
|
|
|
|
|
click_link 'GL-113'
|
|
|
|
|
end
|
|
|
|
|
|
2014-07-10 02:46:52 -04:00
|
|
|
|
step 'I should see group milestone with descriptions and expiry date' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content('expires at Aug 20, 2114')
|
2014-07-10 02:46:52 -04:00
|
|
|
|
end
|
|
|
|
|
|
2014-06-30 10:18:26 -04:00
|
|
|
|
step 'I should see group milestone with all issues and MRs assigned to that milestone' do
|
2015-06-12 00:44:13 -04:00
|
|
|
|
expect(page).to have_content('Milestone GL-113')
|
|
|
|
|
expect(page).to have_content('Progress: 0 closed – 4 open')
|
|
|
|
|
expect(page).to have_link(@issue1.title, href: namespace_project_issue_path(@project1.namespace, @project1, @issue1))
|
|
|
|
|
expect(page).to have_link(@mr3.title, href: namespace_project_merge_request_path(@project3.namespace, @project3, @mr3))
|
2014-06-30 10:18:26 -04:00
|
|
|
|
end
|
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
|
protected
|
|
|
|
|
|
2014-09-25 18:07:40 -04:00
|
|
|
|
def assigned_to_me(key)
|
2012-10-22 14:42:06 -04:00
|
|
|
|
project.send(key).where(assignee_id: current_user.id)
|
|
|
|
|
end
|
2014-02-07 11:59:55 -05:00
|
|
|
|
|
|
|
|
|
def project
|
|
|
|
|
Group.find_by(name: "Owned").projects.first
|
|
|
|
|
end
|
2014-06-30 10:18:26 -04:00
|
|
|
|
|
|
|
|
|
def group_milestone
|
|
|
|
|
group = Group.find_by(name: "Owned")
|
|
|
|
|
|
|
|
|
|
@project1 = create :project,
|
|
|
|
|
group: group
|
|
|
|
|
project2 = create :project,
|
|
|
|
|
path: 'gitlab-ci',
|
|
|
|
|
group: group
|
|
|
|
|
@project3 = create :project,
|
|
|
|
|
path: 'cookbook-gitlab',
|
|
|
|
|
group: group
|
|
|
|
|
milestone1_project1 = create :milestone,
|
|
|
|
|
title: "Version 7.2",
|
|
|
|
|
project: @project1
|
|
|
|
|
milestone1_project2 = create :milestone,
|
|
|
|
|
title: "Version 7.2",
|
|
|
|
|
project: project2
|
|
|
|
|
milestone1_project3 = create :milestone,
|
|
|
|
|
title: "Version 7.2",
|
|
|
|
|
project: @project3
|
|
|
|
|
milestone2_project1 = create :milestone,
|
|
|
|
|
title: "GL-113",
|
|
|
|
|
project: @project1
|
|
|
|
|
milestone2_project2 = create :milestone,
|
|
|
|
|
title: "GL-113",
|
|
|
|
|
project: project2
|
|
|
|
|
milestone2_project3 = create :milestone,
|
|
|
|
|
title: "GL-113",
|
2014-07-10 02:46:52 -04:00
|
|
|
|
project: @project3,
|
2014-08-21 04:49:12 -04:00
|
|
|
|
due_date: '2114-08-20',
|
2014-07-10 02:46:52 -04:00
|
|
|
|
description: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry'
|
2014-06-30 10:18:26 -04:00
|
|
|
|
@issue1 = create :issue,
|
|
|
|
|
project: @project1,
|
|
|
|
|
assignee: current_user,
|
|
|
|
|
author: current_user,
|
|
|
|
|
milestone: milestone2_project1
|
|
|
|
|
issue2 = create :issue,
|
|
|
|
|
project: project2,
|
|
|
|
|
assignee: current_user,
|
|
|
|
|
author: current_user,
|
|
|
|
|
milestone: milestone1_project2
|
|
|
|
|
issue3 = create :issue,
|
|
|
|
|
project: @project3,
|
|
|
|
|
assignee: current_user,
|
|
|
|
|
author: current_user,
|
|
|
|
|
milestone: milestone1_project1
|
|
|
|
|
mr1 = create :merge_request,
|
|
|
|
|
source_project: @project1,
|
|
|
|
|
target_project: @project1,
|
|
|
|
|
assignee: current_user,
|
|
|
|
|
author: current_user,
|
|
|
|
|
milestone: milestone2_project1
|
|
|
|
|
mr2 = create :merge_request,
|
|
|
|
|
source_project: project2,
|
|
|
|
|
target_project: project2,
|
|
|
|
|
assignee: current_user,
|
|
|
|
|
author: current_user,
|
|
|
|
|
milestone: milestone2_project2
|
|
|
|
|
@mr3 = create :merge_request,
|
|
|
|
|
source_project: @project3,
|
|
|
|
|
target_project: @project3,
|
|
|
|
|
assignee: current_user,
|
|
|
|
|
author: current_user,
|
|
|
|
|
milestone: milestone2_project3
|
|
|
|
|
end
|
2012-10-03 06:42:17 -04:00
|
|
|
|
end
|