2016-09-13 17:45:13 +05:30
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe 'Issue Boards', feature: true, js: true do
|
2016-09-29 09:46:39 +05:30
|
|
|
include WaitForVueResource
|
2017-08-17 22:00:37 +05:30
|
|
|
include DragTo
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
let(:project) { create(:empty_project, :public) }
|
2016-11-03 12:29:30 +05:30
|
|
|
let(:board) { create(:board, project: project) }
|
2016-09-13 17:45:13 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let!(:user2) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
project.team << [user2, :master]
|
|
|
|
|
|
|
|
login_as(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'no lists' do
|
|
|
|
before do
|
2016-11-03 12:29:30 +05:30
|
|
|
visit namespace_project_board_path(project.namespace, project, board)
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_vue_resource
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 2)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows blank state' do
|
|
|
|
expect(page).to have_content('Welcome to your Issue Board!')
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'shows tooltip on add issues button' do
|
|
|
|
button = page.find('.filter-dropdown-container button', text: 'Add issues')
|
|
|
|
|
|
|
|
expect(button[:"data-original-title"]).to eq("Please add a list to your board first")
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'hides the blank state when clicking nevermind button' do
|
|
|
|
page.within(find('.board-blank-state')) do
|
|
|
|
click_button("Nevermind, I'll use my own")
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 1)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates default lists' do
|
2017-08-17 22:00:37 +05:30
|
|
|
lists = ['To Do', 'Doing', 'Closed']
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
page.within(find('.board-blank-state')) do
|
|
|
|
click_button('Add default lists')
|
|
|
|
end
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 3)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
page.all('.board').each_with_index do |list, i|
|
|
|
|
expect(list.find('.board-title')).to have_content(lists[i])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with lists' do
|
|
|
|
let(:milestone) { create(:milestone, project: project) }
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:planning) { create(:label, project: project, name: 'Planning', description: 'Test') }
|
2016-09-13 17:45:13 +05:30
|
|
|
let(:development) { create(:label, project: project, name: 'Development') }
|
|
|
|
let(:testing) { create(:label, project: project, name: 'Testing') }
|
|
|
|
let(:bug) { create(:label, project: project, name: 'Bug') }
|
|
|
|
let!(:backlog) { create(:label, project: project, name: 'Backlog') }
|
2017-08-17 22:00:37 +05:30
|
|
|
let!(:closed) { create(:label, project: project, name: 'Closed') }
|
2016-10-01 15:18:49 +05:30
|
|
|
let!(:accepting) { create(:label, project: project, name: 'Accepting Merge Requests') }
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
let!(:list1) { create(:list, board: board, label: planning, position: 0) }
|
|
|
|
let!(:list2) { create(:list, board: board, label: development, position: 1) }
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
let!(:confidential_issue) { create(:labeled_issue, :confidential, project: project, author: user, labels: [planning], relative_position: 9) }
|
|
|
|
let!(:issue1) { create(:labeled_issue, project: project, assignees: [user], labels: [planning], relative_position: 8) }
|
|
|
|
let!(:issue2) { create(:labeled_issue, project: project, author: user2, labels: [planning], relative_position: 7) }
|
|
|
|
let!(:issue3) { create(:labeled_issue, project: project, labels: [planning], relative_position: 6) }
|
|
|
|
let!(:issue4) { create(:labeled_issue, project: project, labels: [planning], relative_position: 5) }
|
|
|
|
let!(:issue5) { create(:labeled_issue, project: project, labels: [planning], milestone: milestone, relative_position: 4) }
|
|
|
|
let!(:issue6) { create(:labeled_issue, project: project, labels: [planning, development], relative_position: 3) }
|
|
|
|
let!(:issue7) { create(:labeled_issue, project: project, labels: [development], relative_position: 2) }
|
2016-09-13 17:45:13 +05:30
|
|
|
let!(:issue8) { create(:closed_issue, project: project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
let!(:issue9) { create(:labeled_issue, project: project, labels: [planning, testing, bug, accepting], relative_position: 1) }
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
before do
|
2016-11-03 12:29:30 +05:30
|
|
|
visit namespace_project_board_path(project.namespace, project, board)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 3)
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(find('.board:nth-child(1)')).to have_selector('.card')
|
|
|
|
expect(find('.board:nth-child(2)')).to have_selector('.card')
|
|
|
|
expect(find('.board:nth-child(3)')).to have_selector('.card')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows lists' do
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 3)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows description tooltip on list title' do
|
|
|
|
page.within('.board:nth-child(1)') do
|
|
|
|
expect(find('.board-title span.has-tooltip')[:title]).to eq('Test')
|
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows issues in lists' do
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 8)
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_board_cards(2, 2)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows confidential issues with icon' do
|
|
|
|
page.within(find('.board', match: :first)) do
|
|
|
|
expect(page).to have_selector('.confidential-icon', count: 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'search closed list' do
|
|
|
|
find('.filtered-search').set(issue8.title)
|
|
|
|
find('.filtered-search').native.send_keys(:enter)
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
|
|
|
expect(find('.board:nth-child(1)')).to have_selector('.card', count: 0)
|
|
|
|
expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0)
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(find('.board:nth-child(3)')).to have_selector('.card', count: 1)
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'search list' do
|
2017-08-17 22:00:37 +05:30
|
|
|
find('.filtered-search').set(issue5.title)
|
|
|
|
find('.filtered-search').native.send_keys(:enter)
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(find('.board:nth-child(1)')).to have_selector('.card', count: 1)
|
|
|
|
expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0)
|
2016-09-29 09:46:39 +05:30
|
|
|
expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0)
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'allows user to delete board' do
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within(find('.board:nth-child(1)')) do
|
2016-09-13 17:45:13 +05:30
|
|
|
find('.board-delete').click
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 2)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'removes checkmark in new list dropdown after deleting' do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button 'Add list'
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_ajax
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within(find('.board:nth-child(1)')) do
|
2016-09-13 17:45:13 +05:30
|
|
|
find('.board-delete').click
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 2)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'infinite scrolls list' do
|
|
|
|
50.times do
|
2017-08-17 22:00:37 +05:30
|
|
|
create(:labeled_issue, project: project, labels: [planning])
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
visit namespace_project_board_path(project.namespace, project, board)
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_vue_resource
|
|
|
|
|
|
|
|
page.within(find('.board', match: :first)) do
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page.find('.board-header')).to have_content('58')
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).to have_selector('.card', count: 20)
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content('Showing 20 of 58 issues')
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_vue_resource
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
expect(page).to have_selector('.card', count: 40)
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content('Showing 40 of 58 issues')
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.card', count: 58)
|
2016-09-29 09:46:39 +05:30
|
|
|
expect(page).to have_content('Showing all issues')
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
context 'closed' do
|
|
|
|
it 'shows list of closed issues' do
|
|
|
|
wait_for_board_cards(3, 1)
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_ajax
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'moves issue to closed' do
|
|
|
|
drag(list_from_index: 0, list_to_index: 2)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 7)
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_board_cards(2, 2)
|
|
|
|
wait_for_board_cards(3, 2)
|
|
|
|
|
|
|
|
expect(find('.board:nth-child(1)')).not_to have_content(issue9.title)
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(find('.board:nth-child(3)')).to have_selector('.card', count: 2)
|
|
|
|
expect(find('.board:nth-child(3)')).to have_content(issue9.title)
|
|
|
|
expect(find('.board:nth-child(3)')).not_to have_content(planning.title)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'removes all of the same issue to closed' do
|
|
|
|
drag(list_from_index: 0, list_to_index: 2)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 7)
|
|
|
|
wait_for_board_cards(2, 2)
|
|
|
|
wait_for_board_cards(3, 2)
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(find('.board:nth-child(1)')).not_to have_content(issue9.title)
|
|
|
|
expect(find('.board:nth-child(3)')).to have_content(issue9.title)
|
|
|
|
expect(find('.board:nth-child(3)')).not_to have_content(planning.title)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'lists' do
|
|
|
|
it 'changes position of list' do
|
2017-08-17 22:00:37 +05:30
|
|
|
drag(list_from_index: 1, list_to_index: 0, selector: '.board-header')
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 2)
|
|
|
|
wait_for_board_cards(2, 8)
|
|
|
|
wait_for_board_cards(3, 1)
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(find('.board:nth-child(1)')).to have_content(development.title)
|
|
|
|
expect(find('.board:nth-child(1)')).to have_content(planning.title)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'issue moves between lists' do
|
2017-08-17 22:00:37 +05:30
|
|
|
drag(list_from_index: 0, from_index: 1, list_to_index: 1)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 7)
|
|
|
|
wait_for_board_cards(2, 2)
|
|
|
|
wait_for_board_cards(3, 1)
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(find('.board:nth-child(2)')).to have_content(issue6.title)
|
|
|
|
expect(find('.board:nth-child(2)').all('.card').last).not_to have_content(development.title)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'issue moves between lists' do
|
2017-08-17 22:00:37 +05:30
|
|
|
drag(list_from_index: 1, list_to_index: 0)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 9)
|
|
|
|
wait_for_board_cards(2, 1)
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_board_cards(3, 1)
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(find('.board:nth-child(1)')).to have_content(issue7.title)
|
|
|
|
expect(find('.board:nth-child(1)').all('.card').first).not_to have_content(planning.title)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'issue moves from closed' do
|
|
|
|
drag(list_from_index: 2, list_to_index: 1)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
expect(find('.board:nth-child(2)')).to have_content(issue8.title)
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 8)
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_board_cards(2, 3)
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(3, 0)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'issue card' do
|
|
|
|
it 'shows assignee' do
|
|
|
|
page.within(find('.board', match: :first)) do
|
|
|
|
expect(page).to have_selector('.avatar', count: 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'new list' do
|
|
|
|
it 'shows all labels in new list dropdown' do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button 'Add list'
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_ajax
|
|
|
|
|
|
|
|
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
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button 'Add list'
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_ajax
|
|
|
|
|
|
|
|
page.within('.dropdown-menu-issues-board-new') do
|
|
|
|
click_link testing.title
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 4)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates new list for Backlog label' do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button 'Add list'
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_ajax
|
|
|
|
|
|
|
|
page.within('.dropdown-menu-issues-board-new') do
|
|
|
|
click_link backlog.title
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 4)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'creates new list for Closed label' do
|
|
|
|
click_button 'Add list'
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_ajax
|
|
|
|
|
|
|
|
page.within('.dropdown-menu-issues-board-new') do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_link closed.title
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 4)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'keeps dropdown open after adding new list' do
|
|
|
|
click_button 'Add list'
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_ajax
|
|
|
|
|
|
|
|
page.within('.dropdown-menu-issues-board-new') do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_link closed.title
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_css('#js-add-list.open')
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'creates new list from a new label' do
|
|
|
|
click_button 'Add list'
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_ajax
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
click_link 'Create new label'
|
|
|
|
|
|
|
|
fill_in('new_label_name', with: 'Testing New Label')
|
|
|
|
|
|
|
|
first('.suggest-colors a').click
|
|
|
|
|
|
|
|
click_button 'Create'
|
|
|
|
|
|
|
|
wait_for_ajax
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_vue_resource
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.board', count: 4)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'filtering' do
|
|
|
|
it 'filters by author' do
|
|
|
|
set_filter("author", user2.username)
|
|
|
|
click_filter_link(user2.username)
|
|
|
|
submit_filter
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_board_cards(1, 1)
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_empty_boards((2..3))
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters by assignee' do
|
2017-08-17 22:00:37 +05:30
|
|
|
set_filter("assignee", user.username)
|
|
|
|
click_filter_link(user.username)
|
|
|
|
submit_filter
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_board_cards(1, 1)
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_empty_boards((2..3))
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters by milestone' do
|
2017-08-17 22:00:37 +05:30
|
|
|
set_filter("milestone", "\"#{milestone.title}\"")
|
|
|
|
click_filter_link(milestone.title)
|
|
|
|
submit_filter
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 1)
|
|
|
|
wait_for_board_cards(2, 0)
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_board_cards(3, 0)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters by label' do
|
2017-08-17 22:00:37 +05:30
|
|
|
set_filter("label", testing.title)
|
|
|
|
click_filter_link(testing.title)
|
|
|
|
submit_filter
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_board_cards(1, 1)
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_empty_boards((2..3))
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2016-10-01 15:18:49 +05:30
|
|
|
it 'filters by label with space after reload' do
|
2017-08-17 22:00:37 +05:30
|
|
|
set_filter("label", "\"#{accepting.title}\"")
|
|
|
|
click_filter_link(accepting.title)
|
|
|
|
submit_filter
|
2016-10-01 15:18:49 +05:30
|
|
|
|
|
|
|
# Test after reload
|
|
|
|
page.evaluate_script 'window.location.reload()'
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 1)
|
|
|
|
wait_for_empty_boards((2..3))
|
2016-10-01 15:18:49 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
|
|
|
page.within(find('.board', match: :first)) do
|
|
|
|
expect(page.find('.board-header')).to have_content('1')
|
|
|
|
expect(page).to have_selector('.card', count: 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within(find('.board:nth-child(2)')) do
|
|
|
|
expect(page.find('.board-header')).to have_content('0')
|
|
|
|
expect(page).to have_selector('.card', count: 0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
it 'removes filtered labels' do
|
2017-08-17 22:00:37 +05:30
|
|
|
set_filter("label", testing.title)
|
|
|
|
click_filter_link(testing.title)
|
|
|
|
submit_filter
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 1)
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
find('.clear-search').click
|
|
|
|
submit_filter
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 8)
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'infinite scrolls list with label filter' do
|
|
|
|
50.times do
|
2017-08-17 22:00:37 +05:30
|
|
|
create(:labeled_issue, project: project, labels: [planning, testing])
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
set_filter("label", testing.title)
|
|
|
|
click_filter_link(testing.title)
|
|
|
|
submit_filter
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
|
|
|
page.within(find('.board', match: :first)) do
|
2016-09-29 09:46:39 +05:30
|
|
|
expect(page.find('.board-header')).to have_content('51')
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).to have_selector('.card', count: 20)
|
2016-09-29 09:46:39 +05:30
|
|
|
expect(page).to have_content('Showing 20 of 51 issues')
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")
|
|
|
|
|
|
|
|
expect(page).to have_selector('.card', count: 40)
|
2016-09-29 09:46:39 +05:30
|
|
|
expect(page).to have_content('Showing 40 of 51 issues')
|
|
|
|
|
|
|
|
evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")
|
|
|
|
|
|
|
|
expect(page).to have_selector('.card', count: 51)
|
|
|
|
expect(page).to have_content('Showing all issues')
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters by multiple labels' do
|
2017-08-17 22:00:37 +05:30
|
|
|
set_filter("label", testing.title)
|
|
|
|
click_filter_link(testing.title)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
set_filter("label", bug.title)
|
|
|
|
click_filter_link(bug.title)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
submit_filter
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_board_cards(1, 1)
|
|
|
|
wait_for_empty_boards((2..3))
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters by clicking label button on issue' do
|
|
|
|
page.within(find('.board', match: :first)) do
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.card', count: 8)
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(find('.card', match: :first)).to have_content(bug.title)
|
|
|
|
click_button(bug.title)
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_vue_resource
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within('.tokens-container') do
|
|
|
|
expect(page).to have_content(bug.title)
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_vue_resource
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_board_cards(1, 1)
|
2017-08-17 22:00:37 +05:30
|
|
|
wait_for_empty_boards((2..3))
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'removes label filter by clicking label button on issue' do
|
|
|
|
page.within(find('.board', match: :first)) do
|
|
|
|
page.within(find('.card', match: :first)) do
|
|
|
|
click_button(bug.title)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
wait_for_vue_resource
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
expect(page).to have_selector('.card', count: 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_vue_resource
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'keyboard shortcuts' do
|
|
|
|
before do
|
2016-11-03 12:29:30 +05:30
|
|
|
visit namespace_project_board_path(project.namespace, project, board)
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_vue_resource
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'allows user to use keyboard shortcuts' do
|
|
|
|
find('.boards-list').native.send_keys('i')
|
|
|
|
expect(page).to have_content('New Issue')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'signed out user' do
|
|
|
|
before do
|
|
|
|
logout
|
2016-11-03 12:29:30 +05:30
|
|
|
visit namespace_project_board_path(project.namespace, project, board)
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_vue_resource
|
|
|
|
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
|
|
|
|
expect(page).not_to have_selector('.js-new-board-list')
|
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
it 'does not allow dragging' do
|
|
|
|
expect(page).not_to have_selector('.user-can-drag')
|
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'as guest user' do
|
|
|
|
let(:user_guest) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user_guest, :guest]
|
|
|
|
logout
|
|
|
|
login_as(user_guest)
|
2016-11-03 12:29:30 +05:30
|
|
|
visit namespace_project_board_path(project.namespace, project, board)
|
2016-09-13 17:45:13 +05:30
|
|
|
wait_for_vue_resource
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show create new list' do
|
|
|
|
expect(page).not_to have_selector('.js-new-board-list')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
def drag(selector: '.board-list', list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0)
|
|
|
|
drag_to(selector: selector,
|
|
|
|
scrollable: '#board-app',
|
|
|
|
list_from_index: list_from_index,
|
|
|
|
from_index: from_index,
|
|
|
|
to_index: to_index,
|
|
|
|
list_to_index: list_to_index)
|
2016-09-13 17:45:13 +05:30
|
|
|
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)
|
|
|
|
expect(page).to have_selector('.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
|
|
|
|
|
|
|
def set_filter(type, text)
|
|
|
|
find('.filtered-search').native.send_keys("#{type}:#{text}")
|
|
|
|
end
|
|
|
|
|
|
|
|
def submit_filter
|
|
|
|
find('.filtered-search').native.send_keys(:enter)
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_filter_link(link_text)
|
|
|
|
page.within('.filtered-search-box') do
|
|
|
|
expect(page).to have_button(link_text)
|
|
|
|
|
|
|
|
click_button(link_text)
|
|
|
|
end
|
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|