2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 07:56:52 +00:00
|
|
|
require 'spec_helper'
|
2016-08-03 07:42:26 +00:00
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'Issue Boards', :js do
|
2017-01-06 16:52:18 +00:00
|
|
|
include DragTo
|
2017-11-02 20:45:46 +00:00
|
|
|
include MobileHelpers
|
2016-08-12 10:37:47 +00:00
|
|
|
|
2020-08-21 09:10:08 +00:00
|
|
|
let_it_be(:group) { create(:group, :nested) }
|
|
|
|
let_it_be(:project) { create(:project, :public, namespace: group) }
|
|
|
|
let_it_be(:board) { create(:board, project: project) }
|
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:user2) { create(:user) }
|
2016-08-03 07:42:26 +00:00
|
|
|
|
|
|
|
before do
|
2021-02-02 15:09:06 +00:00
|
|
|
stub_feature_flags(board_new_list: false)
|
|
|
|
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
|
|
|
project.add_maintainer(user2)
|
2016-08-16 19:45:07 +00:00
|
|
|
|
2017-09-22 18:15:43 +00:00
|
|
|
set_cookie('sidebar_collapsed', 'true')
|
2017-08-29 14:45:18 +00:00
|
|
|
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(user)
|
2016-08-03 07:42:26 +00:00
|
|
|
end
|
|
|
|
|
2016-08-09 15:53:56 +00:00
|
|
|
context 'no lists' do
|
|
|
|
before do
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_board_path(project, board)
|
2016-08-03 07:42:26 +00:00
|
|
|
end
|
|
|
|
|
2016-08-09 15:53:56 +00:00
|
|
|
it 'creates default lists' do
|
2020-12-09 21:09:43 +00:00
|
|
|
lists = %w[Open Closed]
|
2016-08-03 07:42:26 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-16 11:57:59 +00:00
|
|
|
|
2020-12-09 21:09:43 +00:00
|
|
|
expect(page).to have_selector('.board', count: 2)
|
2016-08-09 15:53:56 +00:00
|
|
|
|
|
|
|
page.all('.board').each_with_index do |list, i|
|
|
|
|
expect(list.find('.board-title')).to have_content(lists[i])
|
|
|
|
end
|
|
|
|
end
|
2016-08-03 07:42:26 +00:00
|
|
|
end
|
|
|
|
|
2016-08-09 15:53:56 +00:00
|
|
|
context 'with lists' do
|
2020-08-21 09:10:08 +00:00
|
|
|
let_it_be(:milestone) { create(:milestone, project: project) }
|
|
|
|
|
|
|
|
let_it_be(:planning) { create(:label, project: project, name: 'Planning', description: 'Test') }
|
|
|
|
let_it_be(:development) { create(:label, project: project, name: 'Development') }
|
|
|
|
let_it_be(:testing) { create(:label, project: project, name: 'Testing') }
|
|
|
|
let_it_be(:bug) { create(:label, project: project, name: 'Bug') }
|
|
|
|
let_it_be(:backlog) { create(:label, project: project, name: 'Backlog') }
|
|
|
|
let_it_be(:closed) { create(:label, project: project, name: 'Closed') }
|
|
|
|
let_it_be(:accepting) { create(:label, project: project, name: 'Accepting Merge Requests') }
|
|
|
|
let_it_be(:a_plus) { create(:label, project: project, name: 'A+') }
|
|
|
|
let_it_be(:list1) { create(:list, board: board, label: planning, position: 0) }
|
|
|
|
let_it_be(:list2) { create(:list, board: board, label: development, position: 1) }
|
|
|
|
|
|
|
|
let_it_be(:confidential_issue) { create(:labeled_issue, :confidential, project: project, author: user, labels: [planning], relative_position: 9) }
|
|
|
|
let_it_be(:issue1) { create(:labeled_issue, project: project, title: 'aaa', description: '111', assignees: [user], labels: [planning], relative_position: 8) }
|
|
|
|
let_it_be(:issue2) { create(:labeled_issue, project: project, title: 'bbb', description: '222', author: user2, labels: [planning], relative_position: 7) }
|
|
|
|
let_it_be(:issue3) { create(:labeled_issue, project: project, title: 'ccc', description: '333', labels: [planning], relative_position: 6) }
|
|
|
|
let_it_be(:issue4) { create(:labeled_issue, project: project, title: 'ddd', description: '444', labels: [planning], relative_position: 5) }
|
|
|
|
let_it_be(:issue5) { create(:labeled_issue, project: project, title: 'eee', description: '555', labels: [planning], milestone: milestone, relative_position: 4) }
|
|
|
|
let_it_be(:issue6) { create(:labeled_issue, project: project, title: 'fff', description: '666', labels: [planning, development], relative_position: 3) }
|
|
|
|
let_it_be(:issue7) { create(:labeled_issue, project: project, title: 'ggg', description: '777', labels: [development], relative_position: 2) }
|
|
|
|
let_it_be(:issue8) { create(:closed_issue, project: project, title: 'hhh', description: '888') }
|
|
|
|
let_it_be(:issue9) { create(:labeled_issue, project: project, title: 'iii', description: '999', labels: [planning, testing, bug, accepting], relative_position: 1) }
|
|
|
|
let_it_be(:issue10) { create(:labeled_issue, project: project, title: 'issue +', description: 'A+ great issue', labels: [a_plus]) }
|
2016-08-09 15:53:56 +00:00
|
|
|
|
|
|
|
before do
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_board_path(project, board)
|
2016-08-09 15:53:56 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-16 16:32:38 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(page).to have_selector('.board', count: 4)
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(find('.board:nth-child(2)')).to have_selector('.board-card')
|
|
|
|
expect(find('.board:nth-child(3)')).to have_selector('.board-card')
|
|
|
|
expect(find('.board:nth-child(4)')).to have_selector('.board-card')
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
|
2019-01-14 18:20:16 +00:00
|
|
|
it 'shows description tooltip on list title', :quarantine do
|
2017-06-01 10:11:02 +00:00
|
|
|
page.within('.board:nth-child(2)') do
|
2016-10-07 14:32:07 +00:00
|
|
|
expect(find('.board-title span.has-tooltip')[:title]).to eq('Test')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-09 15:53:56 +00:00
|
|
|
it 'shows issues in lists' do
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 8)
|
|
|
|
wait_for_board_cards(3, 2)
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
2016-08-03 07:42:26 +00:00
|
|
|
|
2016-08-10 16:19:56 +00:00
|
|
|
it 'shows confidential issues with icon' do
|
2017-06-01 10:11:02 +00:00
|
|
|
page.within(find('.board:nth-child(2)')) do
|
2016-08-10 16:19:56 +00:00
|
|
|
expect(page).to have_selector('.confidential-icon', count: 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-24 12:40:35 +00:00
|
|
|
it 'search closed list' do
|
2017-03-08 14:46:46 +00:00
|
|
|
find('.filtered-search').set(issue8.title)
|
|
|
|
find('.filtered-search').native.send_keys(:enter)
|
2016-08-30 09:32:19 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-30 09:32:19 +00:00
|
|
|
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(find('.board:nth-child(2)')).to have_selector('.board-card', count: 0)
|
|
|
|
expect(find('.board:nth-child(3)')).to have_selector('.board-card', count: 0)
|
|
|
|
expect(find('.board:nth-child(4)')).to have_selector('.board-card', count: 1)
|
2016-08-30 09:32:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'search list' do
|
2017-03-08 14:46:46 +00:00
|
|
|
find('.filtered-search').set(issue5.title)
|
|
|
|
find('.filtered-search').native.send_keys(:enter)
|
2016-08-30 09:32:19 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-30 09:32:19 +00:00
|
|
|
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(find('.board:nth-child(2)')).to have_selector('.board-card', count: 1)
|
|
|
|
expect(find('.board:nth-child(3)')).to have_selector('.board-card', count: 0)
|
|
|
|
expect(find('.board:nth-child(4)')).to have_selector('.board-card', count: 0)
|
2016-08-30 09:32:19 +00:00
|
|
|
end
|
|
|
|
|
2020-05-16 00:08:12 +00:00
|
|
|
context 'search list negation queries' do
|
|
|
|
context 'with the NOT queries feature flag disabled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(not_issuable_queries: false)
|
|
|
|
visit project_board_path(project, board)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not have the != option' do
|
|
|
|
find('.filtered-search').set('label:')
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
within('#js-dropdown-operator') do
|
|
|
|
tokens = all(:css, 'li.filter-dropdown-item')
|
|
|
|
expect(tokens.count).to eq(1)
|
|
|
|
button = tokens[0].find('button')
|
|
|
|
expect(button).to have_content('=')
|
|
|
|
expect(button).not_to have_content('!=')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with the NOT queries feature flag enabled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(not_issuable_queries: true)
|
|
|
|
visit project_board_path(project, board)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not have the != option' do
|
|
|
|
find('.filtered-search').set('label:')
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
within('#js-dropdown-operator') do
|
|
|
|
tokens = all(:css, 'li.filter-dropdown-item')
|
|
|
|
expect(tokens.count).to eq(2)
|
|
|
|
button = tokens[0].find('button')
|
|
|
|
expect(button).to have_content('=')
|
|
|
|
button = tokens[1].find('button')
|
|
|
|
expect(button).to have_content('!=')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-09 15:53:56 +00:00
|
|
|
it 'allows user to delete board' do
|
2020-10-14 18:08:47 +00:00
|
|
|
remove_list
|
2016-08-16 11:57:59 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-16 11:57:59 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(page).to have_selector('.board', count: 3)
|
2016-08-03 07:42:26 +00:00
|
|
|
end
|
|
|
|
|
2016-08-12 10:37:47 +00:00
|
|
|
it 'removes checkmark in new list dropdown after deleting' do
|
2016-11-19 17:58:31 +00:00
|
|
|
click_button 'Add list'
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-12 10:37:47 +00:00
|
|
|
|
2018-06-07 20:54:24 +00:00
|
|
|
find('.js-new-board-list').click
|
2017-08-17 08:51:19 +00:00
|
|
|
|
2020-10-14 18:08:47 +00:00
|
|
|
remove_list
|
2016-08-16 19:45:07 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-12 10:37:47 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(page).to have_selector('.board', count: 3)
|
2016-08-12 10:37:47 +00:00
|
|
|
end
|
|
|
|
|
2016-08-10 14:13:42 +00:00
|
|
|
it 'infinite scrolls list' do
|
2020-01-09 18:07:52 +00:00
|
|
|
create_list(:labeled_issue, 50, project: project, labels: [planning])
|
2016-08-10 14:13:42 +00:00
|
|
|
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_board_path(project, board)
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-10 14:13:42 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
page.within(find('.board:nth-child(2)')) do
|
2017-01-27 11:14:50 +00:00
|
|
|
expect(page.find('.board-header')).to have_content('58')
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 20)
|
2017-01-27 11:14:50 +00:00
|
|
|
expect(page).to have_content('Showing 20 of 58 issues')
|
2016-08-10 14:13:42 +00:00
|
|
|
|
2017-10-16 17:37:52 +00:00
|
|
|
find('.board .board-list')
|
2017-06-01 10:11:02 +00:00
|
|
|
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-10 14:13:42 +00:00
|
|
|
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 40)
|
2017-01-27 11:14:50 +00:00
|
|
|
expect(page).to have_content('Showing 40 of 58 issues')
|
2016-08-19 19:23:56 +00:00
|
|
|
|
2017-10-16 17:37:52 +00:00
|
|
|
find('.board .board-list')
|
2017-06-01 10:11:02 +00:00
|
|
|
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-19 19:23:56 +00:00
|
|
|
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 58)
|
2016-08-19 19:23:56 +00:00
|
|
|
expect(page).to have_content('Showing all issues')
|
2016-08-10 14:13:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-24 12:40:35 +00:00
|
|
|
context 'closed' do
|
|
|
|
it 'shows list of closed issues' do
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(4, 1)
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
|
2017-03-24 12:40:35 +00:00
|
|
|
it 'moves issue to closed' do
|
2017-06-01 10:11:02 +00:00
|
|
|
drag(list_from_index: 1, list_to_index: 3)
|
2016-08-09 15:53:56 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 7)
|
2016-09-04 18:05:26 +00:00
|
|
|
wait_for_board_cards(3, 2)
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(4, 2)
|
2016-09-04 18:05:26 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(find('.board:nth-child(2)')).not_to have_content(issue9.title)
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(find('.board:nth-child(4)')).to have_selector('.board-card', count: 2)
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(find('.board:nth-child(4)')).to have_content(issue9.title)
|
|
|
|
expect(find('.board:nth-child(4)')).not_to have_content(planning.title)
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
|
2017-03-24 12:40:35 +00:00
|
|
|
it 'removes all of the same issue to closed' do
|
2017-06-01 10:11:02 +00:00
|
|
|
drag(list_from_index: 1, list_to_index: 3)
|
2016-08-09 15:53:56 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 7)
|
2017-01-27 11:14:50 +00:00
|
|
|
wait_for_board_cards(3, 2)
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(4, 2)
|
2016-09-04 18:05:26 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(find('.board:nth-child(2)')).not_to have_content(issue9.title)
|
|
|
|
expect(find('.board:nth-child(4)')).to have_content(issue9.title)
|
|
|
|
expect(find('.board:nth-child(4)')).not_to have_content(planning.title)
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'lists' do
|
2016-08-10 08:10:50 +00:00
|
|
|
it 'changes position of list' do
|
2017-06-01 10:11:02 +00:00
|
|
|
drag(list_from_index: 2, list_to_index: 1, selector: '.board-header')
|
2016-08-10 08:10:50 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 2)
|
|
|
|
wait_for_board_cards(3, 8)
|
|
|
|
wait_for_board_cards(4, 1)
|
2016-09-04 18:05:26 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(find('.board:nth-child(2)')).to have_content(development.title)
|
|
|
|
expect(find('.board:nth-child(2)')).to have_content(planning.title)
|
2019-09-24 12:06:20 +00:00
|
|
|
|
|
|
|
# Make sure list positions are preserved after a reload
|
|
|
|
visit project_board_path(project, board)
|
|
|
|
|
|
|
|
expect(find('.board:nth-child(2)')).to have_content(development.title)
|
|
|
|
expect(find('.board:nth-child(2)')).to have_content(planning.title)
|
2016-08-10 08:10:50 +00:00
|
|
|
end
|
|
|
|
|
2019-08-23 11:40:56 +00:00
|
|
|
it 'dragging does not duplicate list' do
|
|
|
|
selector = '.board:not(.is-ghost) .board-header'
|
|
|
|
expect(page).to have_selector(selector, text: development.title, count: 1)
|
|
|
|
|
|
|
|
drag(list_from_index: 2, list_to_index: 1, selector: '.board-header', perform_drop: false)
|
|
|
|
|
|
|
|
expect(page).to have_selector(selector, text: development.title, count: 1)
|
|
|
|
end
|
|
|
|
|
2019-10-11 00:06:24 +00:00
|
|
|
it 'issue moves between lists and does not show the "Development" label since the card is in the "Development" list label' do
|
2017-06-01 10:11:02 +00:00
|
|
|
drag(list_from_index: 1, from_index: 1, list_to_index: 2)
|
2016-08-09 15:53:56 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 7)
|
|
|
|
wait_for_board_cards(3, 2)
|
|
|
|
wait_for_board_cards(4, 1)
|
2016-09-04 18:05:26 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(find('.board:nth-child(3)')).to have_content(issue6.title)
|
2019-10-11 00:06:24 +00:00
|
|
|
expect(find('.board:nth-child(3)').all('.board-card').last).not_to have_content(development.title)
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
|
2019-10-11 00:06:24 +00:00
|
|
|
it 'issue moves between lists and does not show the "Planning" label since the card is in the "Planning" list label' do
|
2017-06-01 10:11:02 +00:00
|
|
|
drag(list_from_index: 2, list_to_index: 1)
|
2016-08-09 15:53:56 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 9)
|
2016-09-04 18:05:26 +00:00
|
|
|
wait_for_board_cards(3, 1)
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(4, 1)
|
2016-09-04 18:05:26 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(find('.board:nth-child(2)')).to have_content(issue7.title)
|
2019-10-11 00:06:24 +00:00
|
|
|
expect(find('.board:nth-child(2)').all('.board-card').first).not_to have_content(planning.title)
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
|
2017-03-24 12:40:35 +00:00
|
|
|
it 'issue moves from closed' do
|
2017-06-16 17:07:18 +00:00
|
|
|
drag(list_from_index: 2, list_to_index: 3)
|
2016-08-09 15:53:56 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 8)
|
2017-06-16 17:07:18 +00:00
|
|
|
wait_for_board_cards(3, 1)
|
|
|
|
wait_for_board_cards(4, 2)
|
2017-06-15 16:52:29 +00:00
|
|
|
|
2017-06-16 17:07:18 +00:00
|
|
|
expect(find('.board:nth-child(4)')).to have_content(issue8.title)
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'issue card' do
|
|
|
|
it 'shows assignee' do
|
2017-06-01 10:11:02 +00:00
|
|
|
page.within(find('.board:nth-child(2)')) do
|
2016-08-10 16:19:56 +00:00
|
|
|
expect(page).to have_selector('.avatar', count: 1)
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
end
|
2019-11-21 06:06:32 +00:00
|
|
|
|
|
|
|
context 'list header' do
|
|
|
|
let(:total_planning_issues) { "8" }
|
|
|
|
|
|
|
|
it 'shows issue count on the list' do
|
|
|
|
page.within(find(".board:nth-child(2)")) do
|
|
|
|
expect(page.find('.js-issue-size')).to have_text(total_planning_issues)
|
|
|
|
expect(page).not_to have_selector('.js-max-issue-size')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'new list' do
|
|
|
|
it 'shows all labels in new list dropdown' do
|
2016-11-19 17:58:31 +00:00
|
|
|
click_button 'Add list'
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-09 15:53:56 +00:00
|
|
|
|
|
|
|
page.within('.dropdown-menu-issues-board-new') do
|
|
|
|
expect(page).to have_content(planning.title)
|
|
|
|
expect(page).to have_content(development.title)
|
|
|
|
expect(page).to have_content(testing.title)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates new list for label' do
|
2016-11-19 17:58:31 +00:00
|
|
|
click_button 'Add list'
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-09 15:53:56 +00:00
|
|
|
|
|
|
|
page.within('.dropdown-menu-issues-board-new') do
|
|
|
|
click_link testing.title
|
|
|
|
end
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-16 19:45:07 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(page).to have_selector('.board', count: 5)
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
|
2016-08-12 09:39:45 +00:00
|
|
|
it 'creates new list for Backlog label' do
|
2016-11-19 17:58:31 +00:00
|
|
|
click_button 'Add list'
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-12 09:39:45 +00:00
|
|
|
|
|
|
|
page.within('.dropdown-menu-issues-board-new') do
|
|
|
|
click_link backlog.title
|
|
|
|
end
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-16 19:45:07 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(page).to have_selector('.board', count: 5)
|
2016-08-12 09:39:45 +00:00
|
|
|
end
|
|
|
|
|
2017-03-24 12:40:35 +00:00
|
|
|
it 'creates new list for Closed label' do
|
2016-11-19 17:58:31 +00:00
|
|
|
click_button 'Add list'
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-12 09:39:45 +00:00
|
|
|
|
|
|
|
page.within('.dropdown-menu-issues-board-new') do
|
2017-03-24 12:40:35 +00:00
|
|
|
click_link closed.title
|
2016-08-12 09:39:45 +00:00
|
|
|
end
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-16 19:45:07 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(page).to have_selector('.board', count: 5)
|
2016-08-12 09:39:45 +00:00
|
|
|
end
|
|
|
|
|
2016-10-07 13:33:38 +00:00
|
|
|
it 'keeps dropdown open after adding new list' do
|
2016-11-19 17:58:31 +00:00
|
|
|
click_button 'Add list'
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-10-07 13:33:38 +00:00
|
|
|
|
|
|
|
page.within('.dropdown-menu-issues-board-new') do
|
2017-03-24 12:40:35 +00:00
|
|
|
click_link closed.title
|
2016-10-07 13:33:38 +00:00
|
|
|
end
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-10-07 13:33:38 +00:00
|
|
|
|
2018-04-24 00:32:30 +00:00
|
|
|
expect(page).to have_css('#js-add-list.show')
|
2016-10-07 13:33:38 +00:00
|
|
|
end
|
|
|
|
|
2016-10-07 15:18:42 +00:00
|
|
|
it 'creates new list from a new label' do
|
2016-11-19 17:58:31 +00:00
|
|
|
click_button 'Add list'
|
2016-10-07 15:18:42 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-10-07 15:18:42 +00:00
|
|
|
|
2018-03-12 06:12:30 +00:00
|
|
|
click_link 'Create project label'
|
2016-10-07 15:18:42 +00:00
|
|
|
|
2019-04-05 15:50:21 +00:00
|
|
|
fill_in('new_label_name', with: 'Testing New Label - with list')
|
2016-10-07 15:18:42 +00:00
|
|
|
|
|
|
|
first('.suggest-colors a').click
|
|
|
|
|
|
|
|
click_button 'Create'
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
|
|
|
wait_for_requests
|
2016-10-07 15:18:42 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
expect(page).to have_selector('.board', count: 5)
|
2016-10-07 15:18:42 +00:00
|
|
|
end
|
2016-08-09 15:53:56 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'filtering' do
|
2016-08-10 08:10:50 +00:00
|
|
|
it 'filters by author' do
|
2017-03-08 12:17:01 +00:00
|
|
|
set_filter("author", user2.username)
|
|
|
|
click_filter_link(user2.username)
|
|
|
|
submit_filter
|
2016-08-10 08:10:50 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 1)
|
|
|
|
wait_for_empty_boards((3..4))
|
2016-08-10 08:10:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters by assignee' do
|
2017-03-08 12:17:01 +00:00
|
|
|
set_filter("assignee", user.username)
|
|
|
|
click_filter_link(user.username)
|
|
|
|
submit_filter
|
2016-08-10 08:10:50 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-16 10:34:32 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 1)
|
|
|
|
wait_for_empty_boards((3..4))
|
2016-08-10 08:10:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters by milestone' do
|
2017-10-13 21:32:23 +00:00
|
|
|
set_filter("milestone", "\"#{milestone.title}")
|
2017-03-08 12:17:01 +00:00
|
|
|
click_filter_link(milestone.title)
|
|
|
|
submit_filter
|
2016-08-10 08:10:50 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 1)
|
2016-09-04 18:05:26 +00:00
|
|
|
wait_for_board_cards(3, 0)
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(4, 0)
|
2016-08-10 08:10:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters by label' do
|
2017-03-08 12:17:01 +00:00
|
|
|
set_filter("label", testing.title)
|
|
|
|
click_filter_link(testing.title)
|
|
|
|
submit_filter
|
2016-08-10 08:10:50 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 1)
|
|
|
|
wait_for_empty_boards((3..4))
|
2016-08-10 08:10:50 +00:00
|
|
|
end
|
|
|
|
|
2018-01-17 22:26:49 +00:00
|
|
|
it 'filters by label with encoded character' do
|
|
|
|
set_filter("label", a_plus.title)
|
|
|
|
click_filter_link(a_plus.title)
|
|
|
|
submit_filter
|
|
|
|
|
|
|
|
wait_for_board_cards(1, 1)
|
|
|
|
wait_for_empty_boards((2..4))
|
|
|
|
end
|
|
|
|
|
2019-01-14 18:20:16 +00:00
|
|
|
it 'filters by label with space after reload', :quarantine do
|
2017-10-13 21:32:23 +00:00
|
|
|
set_filter("label", "\"#{accepting.title}")
|
2017-03-08 12:17:01 +00:00
|
|
|
click_filter_link(accepting.title)
|
|
|
|
submit_filter
|
2016-09-08 08:59:20 +00:00
|
|
|
|
|
|
|
# Test after reload
|
|
|
|
page.evaluate_script 'window.location.reload()'
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 1)
|
|
|
|
wait_for_empty_boards((3..4))
|
2016-09-08 08:59:20 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-09-08 08:59:20 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
page.within(find('.board:nth-child(2)')) do
|
2016-09-08 08:59:20 +00:00
|
|
|
expect(page.find('.board-header')).to have_content('1')
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 1)
|
2016-09-08 08:59:20 +00:00
|
|
|
end
|
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
page.within(find('.board:nth-child(3)')) do
|
2016-09-08 08:59:20 +00:00
|
|
|
expect(page.find('.board-header')).to have_content('0')
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 0)
|
2016-09-08 08:59:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-05 16:32:07 +00:00
|
|
|
it 'removes filtered labels' do
|
2017-03-08 12:17:01 +00:00
|
|
|
set_filter("label", testing.title)
|
|
|
|
click_filter_link(testing.title)
|
|
|
|
submit_filter
|
2016-09-05 16:32:07 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 1)
|
2016-09-05 16:32:07 +00:00
|
|
|
|
2017-03-08 12:17:01 +00:00
|
|
|
find('.clear-search').click
|
|
|
|
submit_filter
|
2016-09-05 16:32:07 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 8)
|
2016-09-05 16:32:07 +00:00
|
|
|
end
|
|
|
|
|
2016-08-10 14:13:42 +00:00
|
|
|
it 'infinite scrolls list with label filter' do
|
2020-01-09 18:07:52 +00:00
|
|
|
create_list(:labeled_issue, 50, project: project, labels: [planning, testing])
|
2016-08-10 14:13:42 +00:00
|
|
|
|
2017-03-08 12:17:01 +00:00
|
|
|
set_filter("label", testing.title)
|
|
|
|
click_filter_link(testing.title)
|
|
|
|
submit_filter
|
2016-08-10 14:13:42 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-16 10:34:32 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
page.within(find('.board:nth-child(2)')) do
|
2016-08-19 16:19:20 +00:00
|
|
|
expect(page.find('.board-header')).to have_content('51')
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 20)
|
2016-08-19 19:23:56 +00:00
|
|
|
expect(page).to have_content('Showing 20 of 51 issues')
|
2016-08-10 14:13:42 +00:00
|
|
|
|
2017-10-16 17:37:52 +00:00
|
|
|
find('.board .board-list')
|
2017-06-01 10:11:02 +00:00
|
|
|
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
|
2016-08-10 14:13:42 +00:00
|
|
|
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 40)
|
2016-08-19 19:23:56 +00:00
|
|
|
expect(page).to have_content('Showing 40 of 51 issues')
|
|
|
|
|
2017-10-16 17:37:52 +00:00
|
|
|
find('.board .board-list')
|
2017-06-01 10:11:02 +00:00
|
|
|
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
|
2016-08-19 19:23:56 +00:00
|
|
|
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 51)
|
2016-08-19 19:23:56 +00:00
|
|
|
expect(page).to have_content('Showing all issues')
|
2016-08-10 14:13:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-01-14 18:20:16 +00:00
|
|
|
it 'filters by multiple labels', :quarantine do
|
2017-03-08 12:17:01 +00:00
|
|
|
set_filter("label", testing.title)
|
|
|
|
click_filter_link(testing.title)
|
2016-08-10 08:10:50 +00:00
|
|
|
|
2017-03-08 12:17:01 +00:00
|
|
|
set_filter("label", bug.title)
|
|
|
|
click_filter_link(bug.title)
|
|
|
|
|
|
|
|
submit_filter
|
2016-08-10 08:10:50 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-16 10:34:32 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 1)
|
|
|
|
wait_for_empty_boards((3..4))
|
2016-08-10 08:10:50 +00:00
|
|
|
end
|
2016-08-10 13:35:14 +00:00
|
|
|
|
|
|
|
it 'filters by clicking label button on issue' do
|
2017-06-01 10:11:02 +00:00
|
|
|
page.within(find('.board:nth-child(2)')) do
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 8)
|
|
|
|
expect(find('.board-card', match: :first)).to have_content(bug.title)
|
2020-03-09 09:07:45 +00:00
|
|
|
click_link(bug.title)
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-10 13:35:14 +00:00
|
|
|
end
|
|
|
|
|
2017-03-08 12:17:01 +00:00
|
|
|
page.within('.tokens-container') do
|
|
|
|
expect(page).to have_content(bug.title)
|
|
|
|
end
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-18 14:59:50 +00:00
|
|
|
|
2017-06-01 10:11:02 +00:00
|
|
|
wait_for_board_cards(2, 1)
|
|
|
|
wait_for_empty_boards((3..4))
|
2016-08-10 13:35:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'removes label filter by clicking label button on issue' do
|
2017-06-01 10:11:02 +00:00
|
|
|
page.within(find('.board:nth-child(2)')) do
|
2018-04-13 20:27:10 +00:00
|
|
|
page.within(find('.board-card', match: :first)) do
|
2020-03-09 09:07:45 +00:00
|
|
|
click_link(bug.title)
|
2016-08-10 13:35:14 +00:00
|
|
|
end
|
2017-03-08 12:17:01 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-10 13:35:14 +00:00
|
|
|
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: 1)
|
2016-08-10 13:35:14 +00:00
|
|
|
end
|
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-10 13:35:14 +00:00
|
|
|
end
|
2016-08-03 07:42:26 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-05-14 00:07:47 +00:00
|
|
|
context 'issue board focus mode' do
|
|
|
|
before do
|
|
|
|
visit project_board_path(project, board)
|
|
|
|
wait_for_requests
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the button' do
|
2021-02-11 12:08:52 +00:00
|
|
|
expect(page).to have_button('Toggle focus mode')
|
2020-05-14 00:07:47 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-19 09:21:09 +00:00
|
|
|
context 'keyboard shortcuts' do
|
|
|
|
before do
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_board_path(project, board)
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-19 09:21:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'allows user to use keyboard shortcuts' do
|
2017-10-09 22:19:43 +00:00
|
|
|
find('body').native.send_keys('i')
|
2016-08-19 09:21:09 +00:00
|
|
|
expect(page).to have_content('New Issue')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-17 13:05:34 +00:00
|
|
|
context 'signed out user' do
|
|
|
|
before do
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_out(:user)
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_board_path(project, board)
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-17 13:05:34 +00:00
|
|
|
end
|
|
|
|
|
2016-11-14 12:12:01 +00:00
|
|
|
it 'displays lists' do
|
|
|
|
expect(page).to have_selector('.board')
|
|
|
|
end
|
|
|
|
|
2016-08-17 13:05:34 +00:00
|
|
|
it 'does not show create new list' do
|
2017-10-31 16:15:03 +00:00
|
|
|
expect(page).not_to have_button('.js-new-board-list')
|
2016-08-17 13:05:34 +00:00
|
|
|
end
|
2016-10-25 11:57:56 +00:00
|
|
|
|
|
|
|
it 'does not allow dragging' do
|
|
|
|
expect(page).not_to have_selector('.user-can-drag')
|
|
|
|
end
|
2016-08-17 13:05:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'as guest user' do
|
2020-08-21 09:10:08 +00:00
|
|
|
let_it_be(:user_guest) { create(:user) }
|
2016-08-17 13:05:34 +00:00
|
|
|
|
|
|
|
before do
|
2017-12-22 08:18:28 +00:00
|
|
|
project.add_guest(user_guest)
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_out(:user)
|
|
|
|
sign_in(user_guest)
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_board_path(project, board)
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-08-17 13:05:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show create new list' do
|
|
|
|
expect(page).not_to have_selector('.js-new-board-list')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-08-23 11:40:56 +00:00
|
|
|
def drag(selector: '.board-list', list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0, perform_drop: true)
|
2017-10-09 22:08:46 +00:00
|
|
|
# ensure there is enough horizontal space for four boards
|
2017-11-02 20:45:46 +00:00
|
|
|
resize_window(2000, 800)
|
2017-10-09 22:08:46 +00:00
|
|
|
|
2017-01-06 16:52:18 +00:00
|
|
|
drag_to(selector: selector,
|
|
|
|
scrollable: '#board-app',
|
|
|
|
list_from_index: list_from_index,
|
|
|
|
from_index: from_index,
|
|
|
|
to_index: to_index,
|
2019-08-23 11:40:56 +00:00
|
|
|
list_to_index: list_to_index,
|
|
|
|
perform_drop: perform_drop)
|
2016-08-03 07:42:26 +00:00
|
|
|
end
|
2016-09-04 18:05:26 +00:00
|
|
|
|
|
|
|
def wait_for_board_cards(board_number, expected_cards)
|
|
|
|
page.within(find(".board:nth-child(#{board_number})")) do
|
|
|
|
expect(page.find('.board-header')).to have_content(expected_cards.to_s)
|
2018-04-13 20:27:10 +00:00
|
|
|
expect(page).to have_selector('.board-card', count: expected_cards)
|
2016-09-04 18:05:26 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def wait_for_empty_boards(board_numbers)
|
|
|
|
board_numbers.each do |board|
|
|
|
|
wait_for_board_cards(board, 0)
|
|
|
|
end
|
|
|
|
end
|
2017-03-08 12:17:01 +00:00
|
|
|
|
|
|
|
def set_filter(type, text)
|
2020-03-04 09:08:20 +00:00
|
|
|
find('.filtered-search').native.send_keys("#{type}:=#{text}")
|
2017-03-08 12:17:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def submit_filter
|
|
|
|
find('.filtered-search').native.send_keys(:enter)
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_filter_link(link_text)
|
2017-03-30 02:04:05 +00:00
|
|
|
page.within('.filtered-search-box') do
|
2017-03-08 12:17:01 +00:00
|
|
|
expect(page).to have_button(link_text)
|
|
|
|
|
|
|
|
click_button(link_text)
|
|
|
|
end
|
|
|
|
end
|
2020-10-14 18:08:47 +00:00
|
|
|
|
|
|
|
def remove_list
|
|
|
|
page.within(find('.board:nth-child(2)')) do
|
|
|
|
find('button[title="List settings"]').click
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within(find('.js-board-settings-sidebar')) do
|
|
|
|
accept_confirm { find('[data-testid="remove-list"]').click }
|
|
|
|
end
|
|
|
|
end
|
2016-08-03 07:42:26 +00:00
|
|
|
end
|