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

129 lines
3 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2016-06-02 11:05:42 +05:30
2020-06-23 00:09:42 +05:30
RSpec.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
2021-09-30 23:02:18 +05:30
it 'sets to closed', :js 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'
2021-06-08 01:23:25 +05:30
check 'Select all'
click_button 'Select status'
2021-09-30 23:02:18 +05:30
click_button 'Closed'
2016-06-02 11:05:42 +05:30
click_update_issues_button
expect(page).to have_selector('.issue', count: 0)
end
2021-09-30 23:02:18 +05:30
it 'sets to open', :js 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'
2021-06-08 01:23:25 +05:30
check 'Select all'
click_button 'Select status'
2021-09-30 23:02:18 +05:30
click_button 'Open'
2016-06-02 11:05:42 +05:30
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'
2021-06-08 01:23:25 +05:30
check 'Select all'
click_update_assignee_button
2021-06-08 01:23:25 +05:30
click_link user.username
2016-06-02 11:05:42 +05:30
click_update_issues_button
page.within('.issue .controls') do
2020-10-24 23:57:45 +05:30
expect(find('.author-link')['href']).to have_content(user.website_url)
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
2021-06-08 01:23:25 +05:30
expect(find('.issue:first-of-type')).to have_link "Assigned to #{user.name}"
2018-03-17 18:26:18 +05:30
click_button 'Edit issues'
2021-06-08 01:23:25 +05:30
check 'Select all'
click_update_assignee_button
2016-06-02 11:05:42 +05:30
click_link 'Unassigned'
click_update_issues_button
2021-06-08 01:23:25 +05:30
expect(find('.issue:first-of-type')).not_to have_link "Assigned to #{user.name}"
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'
2021-06-08 01:23:25 +05:30
check 'Select all'
click_button 'Select milestone'
click_link milestone.title
2016-06-02 11:05:42 +05:30
click_update_issues_button
2020-10-24 23:57:45 +05:30
expect(page.find('.issue')).to have_content milestone.title
2016-06-02 11:05:42 +05:30
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
2020-10-24 23:57:45 +05:30
wait_for_requests
2021-06-08 01:23:25 +05:30
expect(find('.issue:first-of-type')).to have_text milestone.title
2016-06-02 11:05:42 +05:30
2018-03-17 18:26:18 +05:30
click_button 'Edit issues'
2021-06-08 01:23:25 +05:30
check 'Select all'
click_button 'Select milestone'
click_link 'No milestone'
2016-06-02 11:05:42 +05:30
click_update_issues_button
2021-06-08 01:23:25 +05:30
expect(find('.issue:first-of-type')).not_to have_text 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
2021-06-08 01:23:25 +05:30
click_button 'Select assignee'
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
2021-06-08 01:23:25 +05:30
click_button 'Update all'
2017-09-10 17:25:29 +05:30
wait_for_requests
2016-06-02 11:05:42 +05:30
end
end