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

148 lines
3.9 KiB
Ruby
Raw Normal View History

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
include SharedUser
2012-10-03 06:42:17 -04:00
2015-09-04 14:40:26 -04:00
step 'I should see group "Owned"' do
expect(page).to have_content '@owned'
end
step 'I am a signed out user' do
logout
end
step 'Group "Owned" has a public project "Public-project"' do
group = owned_group
2015-09-04 14:40:26 -04:00
@project = create :empty_project, :public,
group: group,
name: "Public-project"
end
step 'I should see project "Public-project"' do
expect(page).to have_content 'Public-project'
end
step 'I should see group "Owned" projects list' do
owned_group.projects.each do |project|
expect(page).to have_link project.name
2012-10-03 06:42:17 -04:00
end
end
step 'I should see projects activity feed' do
expect(page).to have_content 'joined project'
2012-10-03 06:42:17 -04:00
end
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|
expect(page).to have_content issue.title
2012-10-22 14:42:06 -04:00
end
end
step 'I should not see issues from the archived project' do
@archived_project.issues.each do |issue|
expect(page).not_to have_content issue.title
end
end
step 'I should not see merge requests from the archived project' do
@archived_project.merge_requests.each do |mr|
expect(page).not_to have_content mr.title
end
end
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|
expect(page).to have_content issue.title[0..80]
2012-10-22 14:42:06 -04:00
end
end
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
step 'project from group "Owned" has merge requests assigned to me' do
2012-10-22 14:42:06 -04: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 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-02-07 11:59:55 -05:00
step 'I change group "Owned" avatar' do
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
2014-01-27 16:34:05 -05:00
click_button "Save group"
owned_group.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
expect(owned_group.avatar).to be_instance_of AvatarUploader
expect(owned_group.avatar.url).to eq "/uploads/group/avatar/#{Group.find_by(name: "Owned").id}/banana_sample.gif"
2014-01-27 16:34:05 -05:00
end
step 'I should see the "Remove avatar" button' do
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
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
2014-01-27 16:34:05 -05:00
click_button "Save group"
owned_group.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"
owned_group.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
expect(owned_group.avatar?).to eq false
2014-01-27 16:34:05 -05:00
end
step 'I should not see the "Remove avatar" button' do
expect(page).not_to have_link("Remove avatar")
2014-01-27 16:34:05 -05:00
end
2015-08-18 11:46:57 -04:00
step 'Group "Owned" has archived project' do
group = Group.find_by(name: 'Owned')
@archived_project = create(:empty_project, :archived, namespace: group, path: "archived-project")
2015-08-18 11:46:57 -04:00
end
step 'I should see "archived" label' do
expect(page).to have_xpath("//span[@class='label label-warning']", text: 'archived')
end
step 'I visit group "NonExistentGroup" page' do
visit group_path("NonExistentGroup")
end
step 'the archived project have some issues' do
create :issue,
project: @archived_project,
assignee: current_user,
author: current_user
end
step 'the archived project have some merge requests' do
create :merge_request,
source_project: @archived_project,
target_project: @archived_project,
assignee: current_user,
author: current_user
end
private
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
owned_group.projects.first
2014-02-07 11:59:55 -05:00
end
2012-10-03 06:42:17 -04:00
end