2016-06-30 11:34:19 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
describe 'Issues > User uses quick actions', :js do
|
2018-04-03 06:27:56 -04:00
|
|
|
include Spec::Support::Helpers::Features::NotesHelpers
|
2016-06-30 11:34:19 -04:00
|
|
|
|
2019-03-13 06:45:43 -04:00
|
|
|
context "issuable common quick actions" do
|
|
|
|
let(:new_url_opts) { {} }
|
|
|
|
let(:maintainer) { create(:user) }
|
|
|
|
let(:project) { create(:project, :public) }
|
|
|
|
let!(:label_bug) { create(:label, project: project, title: 'bug') }
|
|
|
|
let!(:label_feature) { create(:label, project: project, title: 'feature') }
|
|
|
|
let!(:milestone) { create(:milestone, project: project, title: 'ASAP') }
|
2016-06-30 11:34:19 -04:00
|
|
|
let(:issuable) { create(:issue, project: project) }
|
2019-03-13 06:45:43 -04:00
|
|
|
let(:source_issuable) { create(:issue, project: project, milestone: milestone, labels: [label_bug, label_feature])}
|
|
|
|
|
|
|
|
it_behaves_like 'assign quick action', :issue
|
|
|
|
it_behaves_like 'unassign quick action', :issue
|
|
|
|
it_behaves_like 'close quick action', :issue
|
|
|
|
it_behaves_like 'reopen quick action', :issue
|
|
|
|
it_behaves_like 'title quick action', :issue
|
|
|
|
it_behaves_like 'todo quick action', :issue
|
|
|
|
it_behaves_like 'done quick action', :issue
|
|
|
|
it_behaves_like 'subscribe quick action', :issue
|
|
|
|
it_behaves_like 'unsubscribe quick action', :issue
|
|
|
|
it_behaves_like 'lock quick action', :issue
|
|
|
|
it_behaves_like 'unlock quick action', :issue
|
|
|
|
it_behaves_like 'milestone quick action', :issue
|
|
|
|
it_behaves_like 'remove_milestone quick action', :issue
|
|
|
|
it_behaves_like 'label quick action', :issue
|
|
|
|
it_behaves_like 'unlabel quick action', :issue
|
|
|
|
it_behaves_like 'relabel quick action', :issue
|
|
|
|
it_behaves_like 'award quick action', :issue
|
|
|
|
it_behaves_like 'estimate quick action', :issue
|
|
|
|
it_behaves_like 'remove_estimate quick action', :issue
|
|
|
|
it_behaves_like 'spend quick action', :issue
|
|
|
|
it_behaves_like 'remove_time_spent quick action', :issue
|
|
|
|
it_behaves_like 'shrug quick action', :issue
|
|
|
|
it_behaves_like 'tableflip quick action', :issue
|
|
|
|
it_behaves_like 'copy_metadata quick action', :issue
|
|
|
|
it_behaves_like 'issuable time tracker', :issue
|
2016-06-30 11:34:19 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'issue-only commands' do
|
|
|
|
let(:user) { create(:user) }
|
2019-04-03 06:49:43 -04:00
|
|
|
let(:project) { create(:project, :public, :repository) }
|
2019-04-03 07:41:49 -04:00
|
|
|
let(:issue) { create(:issue, project: project, due_date: Date.new(2016, 8, 28)) }
|
2016-06-30 11:34:19 -04:00
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2019-03-13 06:45:43 -04:00
|
|
|
wait_for_all_requests
|
2016-06-30 11:34:19 -04:00
|
|
|
end
|
|
|
|
|
2016-09-08 18:51:35 -04:00
|
|
|
after do
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2016-09-08 18:51:35 -04:00
|
|
|
end
|
|
|
|
|
2019-04-03 06:34:26 -04:00
|
|
|
it_behaves_like 'confidential quick action'
|
2019-04-03 07:41:49 -04:00
|
|
|
it_behaves_like 'remove_due_date quick action'
|
2019-04-03 06:26:32 -04:00
|
|
|
it_behaves_like 'duplicate quick action'
|
2019-04-03 06:49:43 -04:00
|
|
|
it_behaves_like 'create_merge_request quick action'
|
2019-04-03 07:23:58 -04:00
|
|
|
it_behaves_like 'due quick action'
|
2017-03-29 21:39:06 -04:00
|
|
|
|
2017-08-09 11:37:06 -04:00
|
|
|
describe 'move the issue to another project' do
|
|
|
|
let(:issue) { create(:issue, project: project) }
|
|
|
|
|
2017-09-15 17:19:24 -04:00
|
|
|
context 'when the project is valid' do
|
2017-08-09 11:37:06 -04:00
|
|
|
let(:target_project) { create(:project, :public) }
|
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
target_project.add_maintainer(user)
|
2018-05-03 08:31:32 -04:00
|
|
|
gitlab_sign_out
|
2017-08-09 11:37:06 -04:00
|
|
|
sign_in(user)
|
|
|
|
visit project_issue_path(project, issue)
|
2019-03-13 06:45:43 -04:00
|
|
|
wait_for_requests
|
2017-08-09 11:37:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'moves the issue' do
|
2018-04-03 06:27:56 -04:00
|
|
|
add_note("/move #{target_project.full_path}")
|
2017-08-09 11:37:06 -04:00
|
|
|
|
|
|
|
expect(page).to have_content 'Commands applied'
|
|
|
|
expect(issue.reload).to be_closed
|
|
|
|
|
|
|
|
visit project_issue_path(target_project, issue)
|
|
|
|
|
|
|
|
expect(page).to have_content 'Issues 1'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-09-15 17:19:24 -04:00
|
|
|
context 'when the project is valid but the user not authorized' do
|
2018-05-02 08:46:46 -04:00
|
|
|
let(:project_unauthorized) { create(:project, :public) }
|
2017-08-09 11:37:06 -04:00
|
|
|
|
|
|
|
before do
|
2018-05-02 08:46:46 -04:00
|
|
|
gitlab_sign_out
|
2017-08-09 11:37:06 -04:00
|
|
|
sign_in(user)
|
|
|
|
visit project_issue_path(project, issue)
|
2019-03-13 06:45:43 -04:00
|
|
|
wait_for_requests
|
2017-08-09 11:37:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not move the issue' do
|
2018-04-03 06:27:56 -04:00
|
|
|
add_note("/move #{project_unauthorized.full_path}")
|
2017-08-09 11:37:06 -04:00
|
|
|
|
2018-06-13 18:09:50 -04:00
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect(page).to have_content 'Commands applied'
|
2017-08-09 11:37:06 -04:00
|
|
|
expect(issue.reload).to be_open
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-09-15 17:19:24 -04:00
|
|
|
context 'when the project is invalid' do
|
2017-08-09 11:37:06 -04:00
|
|
|
before do
|
2018-05-02 08:46:46 -04:00
|
|
|
gitlab_sign_out
|
2017-08-09 11:37:06 -04:00
|
|
|
sign_in(user)
|
|
|
|
visit project_issue_path(project, issue)
|
2019-03-13 06:45:43 -04:00
|
|
|
wait_for_requests
|
2017-08-09 11:37:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not move the issue' do
|
2018-04-03 06:27:56 -04:00
|
|
|
add_note("/move not/valid")
|
2017-08-09 11:37:06 -04:00
|
|
|
|
2019-03-04 04:21:47 -05:00
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect(page).to have_content 'Commands applied'
|
2017-08-09 11:37:06 -04:00
|
|
|
expect(issue.reload).to be_open
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-09-15 17:19:24 -04:00
|
|
|
context 'when the user issues multiple commands' do
|
2017-08-09 11:37:06 -04:00
|
|
|
let(:target_project) { create(:project, :public) }
|
|
|
|
let(:milestone) { create(:milestone, title: '1.0', project: project) }
|
|
|
|
let(:target_milestone) { create(:milestone, title: '1.0', project: target_project) }
|
|
|
|
let(:bug) { create(:label, project: project, title: 'bug') }
|
|
|
|
let(:wontfix) { create(:label, project: project, title: 'wontfix') }
|
|
|
|
let(:bug_target) { create(:label, project: target_project, title: 'bug') }
|
|
|
|
let(:wontfix_target) { create(:label, project: target_project, title: 'wontfix') }
|
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
target_project.add_maintainer(user)
|
2018-05-03 08:31:32 -04:00
|
|
|
gitlab_sign_out
|
2017-08-09 11:37:06 -04:00
|
|
|
sign_in(user)
|
|
|
|
visit project_issue_path(project, issue)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'applies the commands to both issues and moves the issue' do
|
2018-04-03 06:27:56 -04:00
|
|
|
add_note("/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"\n\n/move #{target_project.full_path}")
|
2017-08-09 11:37:06 -04:00
|
|
|
|
|
|
|
expect(page).to have_content 'Commands applied'
|
|
|
|
expect(issue.reload).to be_closed
|
|
|
|
|
|
|
|
visit project_issue_path(target_project, issue)
|
|
|
|
|
|
|
|
expect(page).to have_content 'bug'
|
|
|
|
expect(page).to have_content 'wontfix'
|
|
|
|
expect(page).to have_content '1.0'
|
|
|
|
|
|
|
|
visit project_issue_path(project, issue)
|
|
|
|
expect(page).to have_content 'Closed'
|
|
|
|
expect(page).to have_content 'bug'
|
|
|
|
expect(page).to have_content 'wontfix'
|
|
|
|
expect(page).to have_content '1.0'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'moves the issue and applies the commands to both issues' do
|
2018-04-03 06:27:56 -04:00
|
|
|
add_note("/move #{target_project.full_path}\n\n/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"")
|
2017-08-09 11:37:06 -04:00
|
|
|
|
|
|
|
expect(page).to have_content 'Commands applied'
|
|
|
|
expect(issue.reload).to be_closed
|
|
|
|
|
|
|
|
visit project_issue_path(target_project, issue)
|
|
|
|
|
|
|
|
expect(page).to have_content 'bug'
|
|
|
|
expect(page).to have_content 'wontfix'
|
|
|
|
expect(page).to have_content '1.0'
|
|
|
|
|
|
|
|
visit project_issue_path(project, issue)
|
|
|
|
expect(page).to have_content 'Closed'
|
|
|
|
expect(page).to have_content 'bug'
|
|
|
|
expect(page).to have_content 'wontfix'
|
|
|
|
expect(page).to have_content '1.0'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-06-30 11:34:19 -04:00
|
|
|
end
|
|
|
|
end
|