2016-03-23 10:36:30 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-07-03 10:55:15 +00:00
|
|
|
feature 'Multiple issue updating from issues#index', :js do
|
2017-08-02 19:55:11 +00:00
|
|
|
let!(:project) { create(:project) }
|
2016-03-23 10:36:30 +00:00
|
|
|
let!(:issue) { create(:issue, project: project) }
|
|
|
|
let!(:user) { create(:user)}
|
|
|
|
|
2016-03-23 11:45:24 +00:00
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
2017-07-03 10:55:15 +00:00
|
|
|
sign_in(user)
|
2016-03-23 11:45:24 +00:00
|
|
|
end
|
2016-03-23 10:36:30 +00:00
|
|
|
|
2017-07-03 10:55:15 +00:00
|
|
|
context 'status' do
|
2016-07-25 18:16:19 +00:00
|
|
|
it 'sets to closed' do
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_issues_path(project)
|
2016-03-23 10:36:30 +00:00
|
|
|
|
2017-08-15 08:07:41 +00:00
|
|
|
click_button 'Edit issues'
|
2017-05-15 22:12:43 +00:00
|
|
|
find('#check-all-issues').click
|
2016-03-23 10:36:30 +00:00
|
|
|
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
|
|
|
|
|
2016-07-25 18:16:19 +00:00
|
|
|
it 'sets to open' do
|
2016-03-23 10:36:30 +00:00
|
|
|
create_closed
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_issues_path(project, state: 'closed')
|
2016-03-23 10:36:30 +00:00
|
|
|
|
2017-08-15 08:07:41 +00:00
|
|
|
click_button 'Edit issues'
|
2017-05-15 22:12:43 +00:00
|
|
|
find('#check-all-issues').click
|
2016-03-23 10:36:30 +00:00
|
|
|
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
|
|
|
|
|
2017-07-03 10:55:15 +00:00
|
|
|
context 'assignee' do
|
2016-07-25 18:16:19 +00:00
|
|
|
it 'updates to current user' do
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_issues_path(project)
|
2016-03-23 11:18:39 +00:00
|
|
|
|
2017-08-15 08:07:41 +00:00
|
|
|
click_button 'Edit issues'
|
2017-05-15 22:12:43 +00:00
|
|
|
find('#check-all-issues').click
|
2016-05-10 23:11:16 +00:00
|
|
|
click_update_assignee_button
|
2016-03-23 11:18:39 +00:00
|
|
|
|
|
|
|
find('.dropdown-menu-user-link', text: user.username).click
|
|
|
|
click_update_issues_button
|
|
|
|
|
|
|
|
page.within('.issue .controls') do
|
2016-04-18 15:40:24 +00:00
|
|
|
expect(find('.author_link')["title"]).to have_content(user.name)
|
2016-03-23 11:18:39 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-07-25 18:16:19 +00:00
|
|
|
it 'updates to unassigned' do
|
2016-03-23 11:18:39 +00:00
|
|
|
create_assigned
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_issues_path(project)
|
2016-03-23 11:18:39 +00:00
|
|
|
|
2017-08-15 08:07:41 +00:00
|
|
|
click_button 'Edit issues'
|
2017-05-15 22:12:43 +00:00
|
|
|
find('#check-all-issues').click
|
2016-05-10 23:11:16 +00:00
|
|
|
click_update_assignee_button
|
2016-03-23 11:18:39 +00:00
|
|
|
|
2016-03-24 09:10:46 +00:00
|
|
|
click_link 'Unassigned'
|
2016-03-23 11:18:39 +00:00
|
|
|
click_update_issues_button
|
2016-05-10 23:11:16 +00:00
|
|
|
expect(find('.issue:first-child .controls')).not_to have_css('.author_link')
|
2016-03-23 11:18:39 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-07-03 10:55:15 +00:00
|
|
|
context 'milestone' do
|
|
|
|
let!(:milestone) { create(:milestone, project: project) }
|
2016-03-23 11:45:24 +00:00
|
|
|
|
2016-07-25 18:16:19 +00:00
|
|
|
it 'updates milestone' do
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_issues_path(project)
|
2016-03-23 11:45:24 +00:00
|
|
|
|
2017-08-15 08:07:41 +00:00
|
|
|
click_button 'Edit issues'
|
2017-05-15 22:12:43 +00:00
|
|
|
find('#check-all-issues').click
|
|
|
|
find('.issues-bulk-update .js-milestone-select').click
|
2016-03-23 11:45:24 +00:00
|
|
|
|
|
|
|
find('.dropdown-menu-milestone a', text: milestone.title).click
|
|
|
|
click_update_issues_button
|
|
|
|
|
|
|
|
expect(find('.issue')).to have_content milestone.title
|
|
|
|
end
|
|
|
|
|
2016-07-25 18:16:19 +00:00
|
|
|
it 'sets to no milestone' do
|
2016-03-23 11:45:24 +00:00
|
|
|
create_with_milestone
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_issues_path(project)
|
2016-03-23 11:45:24 +00:00
|
|
|
|
|
|
|
expect(first('.issue')).to have_content milestone.title
|
|
|
|
|
2017-08-15 08:07:41 +00:00
|
|
|
click_button 'Edit issues'
|
2017-05-15 22:12:43 +00:00
|
|
|
find('#check-all-issues').click
|
|
|
|
find('.issues-bulk-update .js-milestone-select').click
|
2016-03-23 11:45:24 +00:00
|
|
|
|
|
|
|
find('.dropdown-menu-milestone a', text: "No Milestone").click
|
|
|
|
click_update_issues_button
|
|
|
|
|
2016-05-23 17:02:53 +00:00
|
|
|
expect(find('.issue:first-child')).not_to have_content milestone.title
|
2016-03-23 11:45:24 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-03-23 10:36:30 +00:00
|
|
|
def create_closed
|
|
|
|
create(:issue, project: project, state: :closed)
|
|
|
|
end
|
|
|
|
|
2016-03-23 11:18:39 +00:00
|
|
|
def create_assigned
|
2017-05-04 12:11:15 +00:00
|
|
|
create(:issue, project: project, assignees: [user])
|
2016-03-23 11:18:39 +00:00
|
|
|
end
|
|
|
|
|
2016-03-23 11:45:24 +00:00
|
|
|
def create_with_milestone
|
|
|
|
create(:issue, project: project, milestone: milestone)
|
|
|
|
end
|
|
|
|
|
2016-05-10 23:11:16 +00:00
|
|
|
def click_update_assignee_button
|
|
|
|
find('.js-update-assignee').click
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-05-10 23:11:16 +00:00
|
|
|
end
|
|
|
|
|
2016-03-23 10:36:30 +00:00
|
|
|
def click_update_issues_button
|
2017-09-27 18:13:07 +00:00
|
|
|
find('.update-selected-issues').click
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-03-23 10:36:30 +00:00
|
|
|
end
|
|
|
|
end
|