gitlab-org--gitlab-foss/spec/features/issues/update_issues_spec.rb

125 lines
3.2 KiB
Ruby
Raw Normal View History

require 'rails_helper'
feature 'Multiple issue updating from issues#index', :js do
let!(:project) { create(:project) }
let!(:issue) { create(:issue, project: project) }
let!(:user) { create(:user)}
2016-03-23 07:45:24 -04:00
before do
project.team << [user, :master]
sign_in(user)
2016-03-23 07:45:24 -04:00
end
context 'status' do
it 'sets to closed' do
visit project_issues_path(project)
click_button 'Edit Issues'
find('#check-all-issues').click
find('.js-issue-status').click
find('.dropdown-menu-status a', text: 'Closed').click
click_update_issues_button
expect(page).to have_selector('.issue', count: 0)
end
it 'sets to open' do
create_closed
visit project_issues_path(project, state: 'closed')
click_button 'Edit Issues'
find('#check-all-issues').click
find('.js-issue-status').click
find('.dropdown-menu-status a', text: 'Open').click
click_update_issues_button
expect(page).to have_selector('.issue', count: 0)
end
end
context 'assignee' do
it 'updates to current user' do
visit project_issues_path(project)
2016-03-23 07:18:39 -04:00
click_button 'Edit Issues'
find('#check-all-issues').click
2016-05-10 19:11:16 -04:00
click_update_assignee_button
2016-03-23 07:18:39 -04:00
find('.dropdown-menu-user-link', text: user.username).click
click_update_issues_button
page.within('.issue .controls') do
expect(find('.author_link')["title"]).to have_content(user.name)
2016-03-23 07:18:39 -04:00
end
end
it 'updates to unassigned' do
2016-03-23 07:18:39 -04:00
create_assigned
visit project_issues_path(project)
2016-03-23 07:18:39 -04:00
click_button 'Edit Issues'
find('#check-all-issues').click
2016-05-10 19:11:16 -04:00
click_update_assignee_button
2016-03-23 07:18:39 -04:00
2016-03-24 05:10:46 -04:00
click_link 'Unassigned'
2016-03-23 07:18:39 -04:00
click_update_issues_button
2016-05-10 19:11:16 -04:00
expect(find('.issue:first-child .controls')).not_to have_css('.author_link')
2016-03-23 07:18:39 -04:00
end
end
context 'milestone' do
let!(:milestone) { create(:milestone, project: project) }
2016-03-23 07:45:24 -04:00
it 'updates milestone' do
visit project_issues_path(project)
2016-03-23 07:45:24 -04:00
click_button 'Edit Issues'
find('#check-all-issues').click
find('.issues-bulk-update .js-milestone-select').click
2016-03-23 07:45:24 -04:00
find('.dropdown-menu-milestone a', text: milestone.title).click
click_update_issues_button
expect(find('.issue')).to have_content milestone.title
end
it 'sets to no milestone' do
2016-03-23 07:45:24 -04:00
create_with_milestone
visit project_issues_path(project)
2016-03-23 07:45:24 -04:00
expect(first('.issue')).to have_content milestone.title
click_button 'Edit Issues'
find('#check-all-issues').click
find('.issues-bulk-update .js-milestone-select').click
2016-03-23 07:45:24 -04:00
find('.dropdown-menu-milestone a', text: "No Milestone").click
click_update_issues_button
2016-05-23 13:02:53 -04:00
expect(find('.issue:first-child')).not_to have_content milestone.title
2016-03-23 07:45:24 -04:00
end
end
def create_closed
create(:issue, project: project, state: :closed)
end
2016-03-23 07:18:39 -04:00
def create_assigned
create(:issue, project: project, assignees: [user])
2016-03-23 07:18:39 -04:00
end
2016-03-23 07:45:24 -04:00
def create_with_milestone
create(:issue, project: project, milestone: milestone)
end
2016-05-10 19:11:16 -04:00
def click_update_assignee_button
find('.js-update-assignee').click
wait_for_requests
2016-05-10 19:11:16 -04:00
end
def click_update_issues_button
find('.update-selected-issues').click
wait_for_requests
end
end