debian-mirror-gitlab/spec/features/boards/boards_spec.rb

594 lines
22 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-09-13 17:45:13 +05:30
2021-04-29 21:17:54 +05:30
RSpec.describe 'Project issue boards', :js do
2017-08-17 22:00:37 +05:30
include DragTo
2018-03-17 18:26:18 +05:30
include MobileHelpers
2021-10-27 15:23:28 +05:30
include BoardHelpers
2016-09-13 17:45:13 +05:30
2020-11-24 15:15:51 +05:30
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-09-13 17:45:13 +05:30
2022-05-07 20:08:51 +05:30
let(:filtered_search) { find('[data-testid="issue-board-filtered-search"]') }
let(:filter_input) { find('.gl-filtered-search-term-input') }
let(:filter_submit) { find('.gl-search-box-by-click-search-button') }
2021-10-27 15:23:28 +05:30
context 'signed in user' do
2016-09-13 17:45:13 +05:30
before do
2021-10-27 15:23:28 +05:30
project.add_maintainer(user)
project.add_maintainer(user2)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
sign_in(user)
2022-05-07 20:08:51 +05:30
stub_feature_flags(gl_avatar_for_all_user_avatars: false)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
set_cookie('sidebar_collapsed', 'true')
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
context 'no lists' do
before do
visit_project_board_path_without_query_limit(project, board)
end
2021-04-17 20:07:23 +05:30
2021-10-27 15:23:28 +05:30
it 'creates default lists' do
lists = %w[Open Closed]
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_requests
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector('.board', count: 2)
2017-08-17 22:00:37 +05:30
2021-10-27 15:23:28 +05:30
page.all('.board').each_with_index do |list, i|
expect(list.find('.board-title')).to have_content(lists[i])
end
2017-08-17 22:00:37 +05:30
end
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
context 'with lists' do
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(:backlog_list) { create(:backlog_list, board: board) }
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-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
before do
visit_project_board_path_without_query_limit(project, board)
2016-09-13 17:45:13 +05:30
end
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
it 'shows description tooltip on list title', :quarantine do
page.within('.board:nth-child(2)') do
expect(find('.board-title span.has-tooltip')[:title]).to eq('Test')
end
end
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
it 'shows issues in lists' do
wait_for_board_cards(2, 8)
wait_for_board_cards(3, 2)
end
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
it 'shows confidential issues with icon' do
page.within(find('.board:nth-child(2)')) do
expect(page).to have_selector('.confidential-icon', count: 1)
end
end
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
it 'search closed list' do
2022-05-07 20:08:51 +05:30
set_filter_and_search_by_token_value(issue8.title)
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
wait_for_requests
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
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)
2020-05-24 23:13:21 +05:30
end
2021-10-27 15:23:28 +05:30
it 'search list' do
2022-05-07 20:08:51 +05:30
set_filter_and_search_by_token_value(issue5.title)
2021-06-08 01:23:25 +05:30
wait_for_requests
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
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)
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
it 'allows user to delete board' do
remove_list
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_requests
2021-09-04 01:27:46 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector('.board', count: 3)
end
2021-09-04 01:27:46 +05:30
2021-10-27 15:23:28 +05:30
it 'infinite scrolls list' do
create_list(:labeled_issue, 30, project: project, labels: [planning])
2021-09-04 01:27:46 +05:30
2021-10-27 15:23:28 +05:30
visit_project_board_path_without_query_limit(project, board)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
page.within(find('.board:nth-child(2)')) do
expect(page.find('.board-header')).to have_content('38')
expect(page).to have_selector('.board-card', count: 10)
expect(page).to have_content('Showing 10 of 38 issues')
2021-04-29 21:17:54 +05:30
2021-10-27 15:23:28 +05:30
find('.board .board-list')
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector('.board-card', count: 20)
expect(page).to have_content('Showing 20 of 38 issues')
2021-04-29 21:17:54 +05:30
2021-10-27 15:23:28 +05:30
find('.board .board-list')
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector('.board-card', count: 30)
expect(page).to have_content('Showing 30 of 38 issues')
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
find('.board .board-list')
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector('.board-card', count: 38)
expect(page).to have_content('Showing all issues')
end
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
context 'closed' do
it 'shows list of closed issues' do
wait_for_board_cards(4, 1)
wait_for_requests
end
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
it 'moves issue to closed' do
drag(list_from_index: 1, list_to_index: 3)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 7)
wait_for_board_cards(3, 2)
wait_for_board_cards(4, 2)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
expect(find('.board:nth-child(2)')).not_to have_content(issue9.title)
expect(find('.board:nth-child(4)')).to have_selector('.board-card', count: 2)
expect(find('.board:nth-child(4)')).to have_content(issue9.title)
expect(find('.board:nth-child(4)')).not_to have_content(planning.title)
end
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
it 'removes all of the same issue to closed' do
drag(list_from_index: 1, list_to_index: 3)
2019-12-21 20:55:43 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 7)
wait_for_board_cards(3, 2)
wait_for_board_cards(4, 2)
2019-12-21 20:55:43 +05:30
2021-10-27 15:23:28 +05:30
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)
end
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
context 'lists' do
it 'changes position of list' do
drag(list_from_index: 2, list_to_index: 1, selector: '.board-header')
2019-12-04 20:38:33 +05:30
2021-10-27 15:23:28 +05:30
expect(find('.board:nth-child(2) [data-testid="board-list-header"]')).to have_content(development.title)
expect(find('.board:nth-child(3) [data-testid="board-list-header"]')).to have_content(planning.title)
2019-12-04 20:38:33 +05:30
2021-10-27 15:23:28 +05:30
# Make sure list positions are preserved after a reload
visit_project_board_path_without_query_limit(project, board)
2019-12-04 20:38:33 +05:30
2021-10-27 15:23:28 +05:30
expect(find('.board:nth-child(2) [data-testid="board-list-header"]')).to have_content(development.title)
expect(find('.board:nth-child(3) [data-testid="board-list-header"]')).to have_content(planning.title)
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
context 'without backlog and closed lists' do
let_it_be(:board) { create(:board, project: project, hide_backlog_list: true, hide_closed_list: true) }
let_it_be(:list1) { create(:list, board: board, label: planning, position: 0) }
let_it_be(:list2) { create(:list, board: board, label: development, position: 1) }
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
it 'changes position of list' do
visit_project_board_path_without_query_limit(project, board)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
drag(list_from_index: 0, list_to_index: 1, selector: '.board-header')
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
expect(find('.board:nth-child(1) [data-testid="board-list-header"]')).to have_content(development.title)
expect(find('.board:nth-child(2) [data-testid="board-list-header"]')).to have_content(planning.title)
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
# Make sure list positions are preserved after a reload
visit_project_board_path_without_query_limit(project, board)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
expect(find('.board:nth-child(1) [data-testid="board-list-header"]')).to have_content(development.title)
expect(find('.board:nth-child(2) [data-testid="board-list-header"]')).to have_content(planning.title)
end
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
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)
2016-09-29 09:46:39 +05:30
2021-10-27 15:23:28 +05:30
drag(list_from_index: 2, list_to_index: 1, selector: '.board-header', perform_drop: false)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector(selector, text: development.title, count: 1)
2016-09-13 17:45:13 +05:30
end
2020-01-01 13:55:28 +05:30
2021-10-27 15:23:28 +05:30
it 'issue moves between lists and does not show the "Development" label since the card is in the "Development" list label' do
drag(list_from_index: 1, from_index: 1, list_to_index: 2)
2020-01-01 13:55:28 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 7)
wait_for_board_cards(3, 2)
wait_for_board_cards(4, 1)
expect(find('.board:nth-child(3)')).to have_content(issue6.title)
expect(find('.board:nth-child(3)').all('.board-card').last).not_to have_content(development.title)
2020-01-01 13:55:28 +05:30
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
it 'issue moves between lists and does not show the "Planning" label since the card is in the "Planning" list label' do
drag(list_from_index: 2, list_to_index: 1)
2021-04-17 20:07:23 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 9)
wait_for_board_cards(3, 1)
wait_for_board_cards(4, 1)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
expect(find('.board:nth-child(2)')).to have_content(issue7.title)
expect(find('.board:nth-child(2)').all('.board-card').first).not_to have_content(planning.title)
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
it 'issue moves from closed' do
drag(list_from_index: 2, list_to_index: 3)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 8)
wait_for_board_cards(3, 1)
wait_for_board_cards(4, 2)
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
expect(find('.board:nth-child(4)')).to have_content(issue8.title)
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
context 'issue card' do
it 'shows assignee' do
page.within(find('.board:nth-child(2)')) do
expect(page).to have_selector('.avatar', count: 1)
end
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
context 'list header' do
let(:total_planning_issues) { "8" }
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
it 'shows issue count on the list' do
page.within(find(".board:nth-child(2)")) do
expect(page.find('[data-testid="board-items-count"]')).to have_text(total_planning_issues)
expect(page).not_to have_selector('.js-max-issue-size')
end
end
end
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
end
context 'filtering' do
it 'filters by author' do
set_filter("author", user2.username)
2022-05-07 20:08:51 +05:30
click_on user2.username
filter_submit.click
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 1)
wait_for_empty_boards((3..4))
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
it 'filters by assignee' do
set_filter("assignee", user.username)
2022-05-07 20:08:51 +05:30
click_on user.username
filter_submit.click
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 1)
wait_for_empty_boards((3..4))
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
it 'filters by milestone' do
set_filter("milestone", "\"#{milestone.title}")
2022-05-07 20:08:51 +05:30
click_on milestone.title
filter_submit.click
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 1)
wait_for_board_cards(3, 0)
wait_for_board_cards(4, 0)
2016-09-13 17:45:13 +05:30
end
2021-10-27 15:23:28 +05:30
it 'filters by label' do
set_filter("label", testing.title)
2022-05-07 20:08:51 +05:30
click_on testing.title
filter_submit.click
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 1)
wait_for_empty_boards((3..4))
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
it 'filters by label with encoded character' do
set_filter("label", a_plus.title)
2022-05-07 20:08:51 +05:30
# This one is a char encoding issue like the & issue
click_on a_plus.title
filter_submit.click
wait_for_requests
2017-08-17 22:00:37 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(1, 1)
wait_for_empty_boards((2..4))
end
2017-08-17 22:00:37 +05:30
2021-10-27 15:23:28 +05:30
it 'filters by label with space after reload', :quarantine do
set_filter("label", "\"#{accepting.title}")
2022-05-07 20:08:51 +05:30
click_on accepting.title
filter_submit.click
2017-08-17 22:00:37 +05:30
2021-10-27 15:23:28 +05:30
# Test after reload
page.evaluate_script 'window.location.reload()'
wait_for_board_cards(2, 1)
wait_for_empty_boards((3..4))
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
page.within(find('.board:nth-child(2)')) do
expect(page.find('.board-header')).to have_content('1')
expect(page).to have_selector('.board-card', count: 1)
end
page.within(find('.board:nth-child(3)')) do
expect(page.find('.board-header')).to have_content('0')
expect(page).to have_selector('.board-card', count: 0)
end
2016-09-13 17:45:13 +05:30
end
2017-08-17 22:00:37 +05:30
2021-10-27 15:23:28 +05:30
it 'removes filtered labels' do
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
set_filter("label", testing.title)
2022-05-07 20:08:51 +05:30
click_on testing.title
filter_submit.click
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 1)
2016-09-13 17:45:13 +05:30
2022-05-07 20:08:51 +05:30
find('[data-testid="filtered-search-clear-button"]').click
filter_submit.click
2021-10-27 15:23:28 +05:30
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 8)
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
it 'infinite scrolls list with label filter' do
create_list(:labeled_issue, 30, project: project, labels: [planning, testing])
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
set_filter("label", testing.title)
2022-05-07 20:08:51 +05:30
click_on testing.title
2021-10-27 15:23:28 +05:30
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
2022-05-07 20:08:51 +05:30
filter_submit.click
2021-10-27 15:23:28 +05:30
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_requests
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
page.within(find('.board:nth-child(2)')) do
expect(page.find('.board-header')).to have_content('31')
expect(page).to have_selector('.board-card', count: 10)
expect(page).to have_content('Showing 10 of 31 issues')
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
find('.board .board-list')
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
2018-03-17 18:26:18 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector('.board-card', count: 20)
expect(page).to have_content('Showing 20 of 31 issues')
2018-03-17 18:26:18 +05:30
2021-10-27 15:23:28 +05:30
find('.board .board-list')
2016-10-01 15:18:49 +05:30
2021-10-27 15:23:28 +05:30
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
2016-10-01 15:18:49 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector('.board-card', count: 30)
expect(page).to have_content('Showing 30 of 31 issues')
2016-10-01 15:18:49 +05:30
2021-10-27 15:23:28 +05:30
find('.board .board-list')
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
end
2016-10-01 15:18:49 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector('.board-card', count: 31)
expect(page).to have_content('Showing all issues')
end
2016-10-01 15:18:49 +05:30
end
2021-10-27 15:23:28 +05:30
it 'filters by multiple labels', :quarantine do
2021-04-29 21:17:54 +05:30
set_filter("label", testing.title)
2022-05-07 20:08:51 +05:30
click_on testing.title
2016-11-03 12:29:30 +05:30
2021-10-27 15:23:28 +05:30
set_filter("label", bug.title)
2022-05-07 20:08:51 +05:30
click_on bug.title
2016-11-03 12:29:30 +05:30
2021-04-29 21:17:54 +05:30
submit_filter
2016-11-03 12:29:30 +05:30
2021-10-27 15:23:28 +05:30
wait_for_requests
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 1)
wait_for_empty_boards((3..4))
2021-04-29 21:17:54 +05:30
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
it 'filters by clicking label button on issue' do
page.within(find('.board:nth-child(2)')) do
expect(page).to have_selector('.board-card', count: 8)
expect(find('.board-card', match: :first)).to have_content(bug.title)
click_link(bug.title)
wait_for_requests
2021-04-29 21:17:54 +05:30
end
2016-09-13 17:45:13 +05:30
2022-05-07 20:08:51 +05:30
page.within('.gl-filtered-search-token') do
2021-10-27 15:23:28 +05:30
expect(page).to have_content(bug.title)
2021-04-29 21:17:54 +05:30
end
2016-09-29 09:46:39 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_board_cards(2, 1)
wait_for_empty_boards((3..4))
2017-08-17 22:00:37 +05:30
end
2021-10-27 15:23:28 +05:30
it 'removes label filter by clicking label button on issue' do
page.within(find('.board:nth-child(2)')) do
page.within(find('.board-card', match: :first)) do
click_link(bug.title)
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
wait_for_requests
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
expect(page).to have_selector('.board-card', count: 1)
2016-09-13 17:45:13 +05:30
end
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
wait_for_requests
2016-09-13 17:45:13 +05:30
end
end
end
2021-10-27 15:23:28 +05:30
context 'issue board focus mode' do
before do
visit project_board_path(project, board)
wait_for_requests
end
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
it 'shows the button' do
expect(page).to have_button('Toggle focus mode')
end
2020-05-24 23:13:21 +05:30
end
2021-10-27 15:23:28 +05:30
context 'keyboard shortcuts' do
before do
visit_project_board_path_without_query_limit(project, board)
wait_for_requests
end
2016-09-13 17:45:13 +05:30
2021-10-27 15:23:28 +05:30
it 'allows user to use keyboard shortcuts' do
find('body').native.send_keys('i')
expect(page).to have_content('New Issue')
end
2016-09-13 17:45:13 +05:30
end
end
context 'signed out user' do
before do
2017-09-10 17:25:29 +05:30
visit project_board_path(project, board)
wait_for_requests
2016-09-13 17:45:13 +05:30
end
2017-08-17 22:00:37 +05:30
it 'displays lists' do
expect(page).to have_selector('.board')
end
2016-09-13 17:45:13 +05:30
it 'does not show create new list' do
2021-10-27 15:23:28 +05:30
expect(page).not_to have_button('Create list')
2016-09-13 17:45:13 +05:30
end
2016-11-03 12:29:30 +05:30
it 'does not allow dragging' do
2022-03-02 08:16:31 +05:30
expect(page).not_to have_selector('.gl-cursor-grab')
2016-11-03 12:29:30 +05:30
end
2016-09-13 17:45:13 +05:30
end
context 'as guest user' do
2020-11-24 15:15:51 +05:30
let_it_be(:user_guest) { create(:user) }
2016-09-13 17:45:13 +05:30
before do
2021-12-11 22:18:48 +05:30
stub_feature_flags(bootstrap_confirmation_modals: false)
2018-03-17 18:26:18 +05:30
project.add_guest(user_guest)
2017-09-10 17:25:29 +05:30
sign_in(user_guest)
visit project_board_path(project, board)
wait_for_requests
2016-09-13 17:45:13 +05:30
end
it 'does not show create new list' do
2021-10-27 15:23:28 +05:30
expect(page).not_to have_button('Create list')
2016-09-13 17:45:13 +05:30
end
end
2016-09-29 09:46:39 +05:30
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-11-08 19:23:39 +05:30
expect(page).to have_selector('.board-card', count: expected_cards)
2016-09-13 17:45:13 +05:30
end
2016-09-29 09:46:39 +05:30
end
2016-09-13 17:45:13 +05:30
2016-09-29 09:46:39 +05:30
def wait_for_empty_boards(board_numbers)
board_numbers.each do |board|
wait_for_board_cards(board, 0)
2016-09-13 17:45:13 +05:30
end
end
2017-08-17 22:00:37 +05:30
2022-05-07 20:08:51 +05:30
def set_filter_and_search_by_token_value(value)
filter_input.click
filter_input.set(value)
filter_submit.click
end
2017-08-17 22:00:37 +05:30
def set_filter(type, text)
2022-05-07 20:08:51 +05:30
filter_input.click
filter_input.native.send_keys("#{type}:=#{text}")
2017-08-17 22:00:37 +05:30
end
def submit_filter
2022-05-07 20:08:51 +05:30
filter_input.native.send_keys(:enter)
2017-08-17 22:00:37 +05:30
end
def click_filter_link(link_text)
2022-05-07 20:08:51 +05:30
page.within(filtered_search) do
2017-08-17 22:00:37 +05:30
expect(page).to have_button(link_text)
2022-05-07 20:08:51 +05:30
click_on link_text
2017-08-17 22:00:37 +05:30
end
end
2021-01-03 14:25:43 +05:30
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
2022-04-04 11:22:00 +05:30
click_button 'Remove list'
end
page.within('.modal') do
click_button 'Remove list'
2021-01-03 14:25:43 +05:30
end
end
2021-04-29 21:17:54 +05:30
def visit_project_board_path_without_query_limit(project, board)
inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do
visit project_board_path(project, board)
2021-10-27 15:23:28 +05:30
wait_for_requests
2021-04-29 21:17:54 +05:30
end
end
2016-09-13 17:45:13 +05:30
end