gitlab-org--gitlab-foss/features/steps/groups.rb

278 lines
9.1 KiB
Ruby
Raw Normal View History

class Spinach::Features::Groups < Spinach::FeatureSteps
2012-10-03 10:42:17 +00:00
include SharedAuthentication
include SharedPaths
2014-02-07 16:59:55 +00:00
include SharedGroup
include SharedUser
include Select2Helper
2012-10-03 10:42:17 +00:00
step 'I should see group "Owned" projects list' do
2014-02-07 16:59:55 +00:00
Group.find_by(name: "Owned").projects.each do |project|
2012-10-03 10:42:17 +00:00
page.should have_link project.name
end
end
step 'I should see projects activity feed' do
2012-10-03 10:42:17 +00:00
page.should have_content 'closed issue'
end
step 'I should see issues from group "Owned" assigned to me' do
2012-10-22 18:42:06 +00:00
assigned_to_me(:issues).each do |issue|
page.should have_content issue.title
end
end
step 'I should see merge requests from group "Owned" assigned to me' do
2012-10-22 18:42:06 +00:00
assigned_to_me(:merge_requests).each do |issue|
page.should have_content issue.title[0..80]
2012-10-22 18:42:06 +00:00
end
end
step 'I select user "Mary Jane" from list with role "Reporter"' do
2014-02-07 16:59:55 +00:00
user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane")
click_link 'Add members'
within ".users-group-form" do
select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "access_level"
2012-12-25 22:52:49 +00:00
end
2013-06-17 14:00:24 +00:00
click_button "Add users into group"
2012-12-25 22:52:49 +00:00
end
step 'I should see user "John Doe" in team list' do
projects_with_access = find(".panel .well-list")
projects_with_access.should have_content("John Doe")
2012-12-25 22:52:49 +00:00
end
step 'I should not see user "John Doe" in team list' do
projects_with_access = find(".panel .well-list")
2014-02-07 16:59:55 +00:00
projects_with_access.should_not have_content("John Doe")
end
step 'I should see user "Mary Jane" in team list' do
projects_with_access = find(".panel .well-list")
2014-02-07 16:59:55 +00:00
projects_with_access.should have_content("Mary Jane")
end
step 'I should not see user "Mary Jane" in team list' do
projects_with_access = find(".panel .well-list")
2014-02-07 16:59:55 +00:00
projects_with_access.should_not have_content("Mary Jane")
end
step 'project from group "Owned" has issues assigned to me' do
2012-10-22 18:42:06 +00:00
create :issue,
project: project,
assignee: current_user,
author: current_user
end
step 'project from group "Owned" has merge requests assigned to me' do
2012-10-22 18:42:06 +00:00
create :merge_request,
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 14:15:33 +00:00
source_project: project,
target_project: project,
2012-10-22 18:42:06 +00:00
assignee: current_user,
author: current_user
end
2013-01-24 15:47:09 +00:00
When 'I click new group link' do
2013-08-27 10:49:29 +00:00
click_link "New group"
2013-01-24 15:47:09 +00:00
end
step 'submit form with new group "Samurai" info' do
fill_in 'group_path', with: 'Samurai'
2013-02-28 14:55:35 +00:00
fill_in 'group_description', with: 'Tokugawa Shogunate'
2013-01-24 15:47:09 +00:00
click_button "Create group"
end
step 'I should be redirected to group "Samurai" page' do
2014-02-07 16:59:55 +00:00
current_path.should == group_path(Group.last)
end
step 'I should see newly created group "Samurai"' do
2013-01-24 15:47:09 +00:00
page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate"
2013-01-24 15:47:09 +00:00
end
step 'I change group "Owned" name to "new-name"' do
fill_in 'group_name', with: 'new-name'
fill_in 'group_path', with: 'new-name'
click_button "Save group"
end
step 'I should see new group "Owned" name' do
within ".navbar-gitlab" do
page.should have_content "new-name"
end
end
2014-02-07 16:59:55 +00:00
step 'I change group "Owned" avatar' do
2014-01-27 21:34:05 +00:00
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
click_button "Save group"
2014-02-07 16:59:55 +00:00
Group.find_by(name: "Owned").reload
2014-01-27 21:34:05 +00:00
end
2014-02-07 16:59:55 +00:00
step 'I should see new group "Owned" avatar' do
Group.find_by(name: "Owned").avatar.should be_instance_of AttachmentUploader
Group.find_by(name: "Owned").avatar.url.should == "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png"
2014-01-27 21:34:05 +00:00
end
step 'I should see the "Remove avatar" button' do
page.should have_link("Remove avatar")
end
2014-02-07 16:59:55 +00:00
step 'I have group "Owned" avatar' do
2014-01-27 21:34:05 +00:00
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
click_button "Save group"
2014-02-07 16:59:55 +00:00
Group.find_by(name: "Owned").reload
2014-01-27 21:34:05 +00:00
end
2014-02-07 16:59:55 +00:00
step 'I remove group "Owned" avatar' do
2014-01-27 21:34:05 +00:00
click_link "Remove avatar"
2014-02-07 16:59:55 +00:00
Group.find_by(name: "Owned").reload
2014-01-27 21:34:05 +00:00
end
2014-02-07 16:59:55 +00:00
step 'I should not see group "Owned" avatar' do
Group.find_by(name: "Owned").avatar?.should be_false
2014-01-27 21:34:05 +00:00
end
step 'I should not see the "Remove avatar" button' do
page.should_not have_link("Remove avatar")
end
2014-02-07 16:59:55 +00: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 10:42:17 +00:00
2014-02-07 16:59:55 +00: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 10:42:17 +00:00
end
2012-10-22 18:42:06 +00:00
2014-02-07 16:59:55 +00:00
step 'I should not see the "Remove User From Group" button for "John Doe"' do
find(:css, 'li', text: "John Doe").should_not have_selector(:css, 'a.btn-remove')
# poltergeist always confirms popups.
2012-10-22 18:42:06 +00:00
end
2014-02-07 16:59:55 +00:00
step 'I should not see the "Remove User From Group" button for "Mary Jane"' do
find(:css, 'li', text: "Mary Jane").should_not have_selector(:css, 'a.btn-remove')
# poltergeist always confirms popups.
end
step 'I search for \'Mary\' member' do
within '.member-search-form' do
fill_in 'search', with: 'Mary'
click_button 'Search'
end
end
2014-06-30 14:18:26 +00:00
step 'I click on group milestones' do
click_link 'Milestones'
end
step 'I should see group milestones index page has no milestones' do
page.should have_content('No milestones to show')
end
step 'Group has projects with milestones' do
group_milestone
end
step 'I should see group milestones index page with milestones' do
page.should have_content('Version 7.2')
page.should have_content('GL-113')
page.should have_link('2 Issues', href: group_milestone_path("owned", "version-7-2", title: "Version 7.2"))
page.should have_link('3 Merge Requests', href: group_milestone_path("owned", "gl-113", title: "GL-113"))
end
step 'I click on one group milestone' do
click_link 'GL-113'
end
step 'I should see group milestone with descriptions and expiry date' do
page.should have_content('Lorem Ipsum is simply dummy text of the printing and typesetting industry')
2014-08-21 08:49:12 +00:00
page.should have_content('expires at Aug 20, 2114')
end
2014-06-30 14:18:26 +00:00
step 'I should see group milestone with all issues and MRs assigned to that milestone' do
page.should have_content('Milestone GL-113')
page.should have_content('Progress: 0 closed 4 open')
page.should have_link(@issue1.title, href: project_issue_path(@project1, @issue1))
page.should have_link(@mr3.title, href: project_merge_request_path(@project3, @mr3))
end
2014-02-07 16:59:55 +00:00
protected
def assigned_to_me(key)
2012-10-22 18:42:06 +00:00
project.send(key).where(assignee_id: current_user.id)
end
2014-02-07 16:59:55 +00:00
def project
Group.find_by(name: "Owned").projects.first
end
2014-06-30 14:18:26 +00: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",
project: @project3,
2014-08-21 08:49:12 +00:00
due_date: '2114-08-20',
description: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry'
2014-06-30 14:18:26 +00: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 10:42:17 +00:00
end