debian-mirror-gitlab/spec/features/issues/update_issues_spec.rb

125 lines
3.2 KiB
Ruby
Raw Normal View History

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