Commit 8c3f65f8 authored by Phil Hughes's avatar Phil Hughes

fixed boards_spec

[ci skip]
parent fd9d8302
...@@ -19,7 +19,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -19,7 +19,7 @@ describe 'Issue Boards', feature: true, js: true do
before do before do
visit namespace_project_board_path(project.namespace, project, board) visit namespace_project_board_path(project.namespace, project, board)
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 2) expect(page).to have_selector('.board', count: 3)
end end
it 'shows blank state' do it 'shows blank state' do
...@@ -36,18 +36,18 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -36,18 +36,18 @@ describe 'Issue Boards', feature: true, js: true do
page.within(find('.board-blank-state')) do page.within(find('.board-blank-state')) do
click_button("Nevermind, I'll use my own") click_button("Nevermind, I'll use my own")
end end
expect(page).to have_selector('.board', count: 1) expect(page).to have_selector('.board', count: 2)
end end
it 'creates default lists' do it 'creates default lists' do
lists = ['To Do', 'Doing', 'Closed'] lists = ['Backlog', 'To Do', 'Doing', 'Closed']
page.within(find('.board-blank-state')) do page.within(find('.board-blank-state')) do
click_button('Add default lists') click_button('Add default lists')
end end
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 4)
page.all('.board').each_with_index do |list, i| page.all('.board').each_with_index do |list, i|
expect(list.find('.board-title')).to have_content(lists[i]) expect(list.find('.board-title')).to have_content(lists[i])
...@@ -85,29 +85,25 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -85,29 +85,25 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 4)
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(2)')).to have_selector('.card')
expect(find('.board:nth-child(3)')).to have_selector('.card') expect(find('.board:nth-child(3)')).to have_selector('.card')
end expect(find('.board:nth-child(4)')).to have_selector('.card')
it 'shows lists' do
expect(page).to have_selector('.board', count: 3)
end end
it 'shows description tooltip on list title' do it 'shows description tooltip on list title' do
page.within('.board:nth-child(1)') do page.within('.board:nth-child(2)') do
expect(find('.board-title span.has-tooltip')[:title]).to eq('Test') expect(find('.board-title span.has-tooltip')[:title]).to eq('Test')
end end
end end
it 'shows issues in lists' do it 'shows issues in lists' do
wait_for_board_cards(1, 8) wait_for_board_cards(2, 8)
wait_for_board_cards(2, 2) wait_for_board_cards(3, 2)
end end
it 'shows confidential issues with icon' do it 'shows confidential issues with icon' do
page.within(find('.board', match: :first)) do page.within(find('.board:nth-child(2)')) do
expect(page).to have_selector('.confidential-icon', count: 1) expect(page).to have_selector('.confidential-icon', count: 1)
end end
end end
...@@ -118,9 +114,9 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -118,9 +114,9 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
expect(find('.board:nth-child(1)')).to have_selector('.card', count: 0)
expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0) expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0)
expect(find('.board:nth-child(3)')).to have_selector('.card', count: 1) expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0)
expect(find('.board:nth-child(4)')).to have_selector('.card', count: 1)
end end
it 'search list' do it 'search list' do
...@@ -129,32 +125,32 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -129,32 +125,32 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
expect(find('.board:nth-child(1)')).to have_selector('.card', count: 1) expect(find('.board:nth-child(2)')).to have_selector('.card', count: 1)
expect(find('.board:nth-child(2)')).to have_selector('.card', count: 0)
expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0) expect(find('.board:nth-child(3)')).to have_selector('.card', count: 0)
expect(find('.board:nth-child(4)')).to have_selector('.card', count: 0)
end end
it 'allows user to delete board' do it 'allows user to delete board' do
page.within(find('.board:nth-child(1)')) do page.within(find('.board:nth-child(2)')) do
find('.board-delete').click find('.board-delete').click
end end
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 2) expect(page).to have_selector('.board', count: 3)
end end
it 'removes checkmark in new list dropdown after deleting' do it 'removes checkmark in new list dropdown after deleting' do
click_button 'Add list' click_button 'Add list'
wait_for_requests wait_for_requests
page.within(find('.board:nth-child(1)')) do page.within(find('.board:nth-child(2)')) do
find('.board-delete').click find('.board-delete').click
end end
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 2) expect(page).to have_selector('.board', count: 3)
end end
it 'infinite scrolls list' do it 'infinite scrolls list' do
...@@ -165,18 +161,18 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -165,18 +161,18 @@ describe 'Issue Boards', feature: true, js: true do
visit namespace_project_board_path(project.namespace, project, board) visit namespace_project_board_path(project.namespace, project, board)
wait_for_requests wait_for_requests
page.within(find('.board', match: :first)) do page.within(find('.board:nth-child(2)')) do
expect(page.find('.board-header')).to have_content('58') expect(page.find('.board-header')).to have_content('58')
expect(page).to have_selector('.card', count: 20) expect(page).to have_selector('.card', count: 20)
expect(page).to have_content('Showing 20 of 58 issues') expect(page).to have_content('Showing 20 of 58 issues')
evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight") evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
wait_for_requests wait_for_requests
expect(page).to have_selector('.card', count: 40) expect(page).to have_selector('.card', count: 40)
expect(page).to have_content('Showing 40 of 58 issues') expect(page).to have_content('Showing 40 of 58 issues')
evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight") evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
wait_for_requests wait_for_requests
expect(page).to have_selector('.card', count: 58) expect(page).to have_selector('.card', count: 58)
...@@ -186,83 +182,83 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -186,83 +182,83 @@ describe 'Issue Boards', feature: true, js: true do
context 'closed' do context 'closed' do
it 'shows list of closed issues' do it 'shows list of closed issues' do
wait_for_board_cards(3, 1) wait_for_board_cards(4, 1)
wait_for_requests wait_for_requests
end end
it 'moves issue to closed' do it 'moves issue to closed' do
drag(list_from_index: 0, list_to_index: 2) drag(list_from_index: 1, list_to_index: 3)
wait_for_board_cards(1, 7) wait_for_board_cards(2, 7)
wait_for_board_cards(2, 2)
wait_for_board_cards(3, 2) wait_for_board_cards(3, 2)
wait_for_board_cards(4, 2)
expect(find('.board:nth-child(1)')).not_to have_content(issue9.title) expect(find('.board:nth-child(2)')).not_to have_content(issue9.title)
expect(find('.board:nth-child(3)')).to have_selector('.card', count: 2) expect(find('.board:nth-child(4)')).to have_selector('.card', count: 2)
expect(find('.board:nth-child(3)')).to have_content(issue9.title) expect(find('.board:nth-child(4)')).to have_content(issue9.title)
expect(find('.board:nth-child(3)')).not_to have_content(planning.title) expect(find('.board:nth-child(4)')).not_to have_content(planning.title)
end end
it 'removes all of the same issue to closed' do it 'removes all of the same issue to closed' do
drag(list_from_index: 0, list_to_index: 2) drag(list_from_index: 1, list_to_index: 3)
wait_for_board_cards(1, 7) wait_for_board_cards(2, 7)
wait_for_board_cards(2, 2)
wait_for_board_cards(3, 2) wait_for_board_cards(3, 2)
wait_for_board_cards(4, 2)
expect(find('.board:nth-child(1)')).not_to have_content(issue9.title) expect(find('.board:nth-child(2)')).not_to have_content(issue9.title)
expect(find('.board:nth-child(3)')).to have_content(issue9.title) expect(find('.board:nth-child(4)')).to have_content(issue9.title)
expect(find('.board:nth-child(3)')).not_to have_content(planning.title) expect(find('.board:nth-child(4)')).not_to have_content(planning.title)
end end
end end
context 'lists' do context 'lists' do
it 'changes position of list' do it 'changes position of list' do
drag(list_from_index: 1, list_to_index: 0, selector: '.board-header') drag(list_from_index: 2, list_to_index: 1, selector: '.board-header')
wait_for_board_cards(1, 2) wait_for_board_cards(2, 2)
wait_for_board_cards(2, 8) wait_for_board_cards(3, 8)
wait_for_board_cards(3, 1) wait_for_board_cards(4, 1)
expect(find('.board:nth-child(1)')).to have_content(development.title) expect(find('.board:nth-child(2)')).to have_content(development.title)
expect(find('.board:nth-child(1)')).to have_content(planning.title) expect(find('.board:nth-child(2)')).to have_content(planning.title)
end end
it 'issue moves between lists' do it 'issue moves between lists' do
drag(list_from_index: 0, from_index: 1, list_to_index: 1) drag(list_from_index: 1, from_index: 1, list_to_index: 2)
wait_for_board_cards(1, 7) wait_for_board_cards(2, 7)
wait_for_board_cards(2, 2) wait_for_board_cards(3, 2)
wait_for_board_cards(3, 1) wait_for_board_cards(4, 1)
expect(find('.board:nth-child(2)')).to have_content(issue6.title) expect(find('.board:nth-child(3)')).to have_content(issue6.title)
expect(find('.board:nth-child(2)').all('.card').last).not_to have_content(development.title) expect(find('.board:nth-child(3)').all('.card').last).not_to have_content(development.title)
end end
it 'issue moves between lists' do it 'issue moves between lists' do
drag(list_from_index: 1, list_to_index: 0) drag(list_from_index: 2, list_to_index: 1)
wait_for_board_cards(1, 9) wait_for_board_cards(2, 9)
wait_for_board_cards(2, 1)
wait_for_board_cards(3, 1) wait_for_board_cards(3, 1)
wait_for_board_cards(4, 1)
expect(find('.board:nth-child(1)')).to have_content(issue7.title) expect(find('.board:nth-child(2)')).to have_content(issue7.title)
expect(find('.board:nth-child(1)').all('.card').first).not_to have_content(planning.title) expect(find('.board:nth-child(2)').all('.card').first).not_to have_content(planning.title)
end end
it 'issue moves from closed' do it 'issue moves from closed' do
drag(list_from_index: 2, list_to_index: 1) drag(list_from_index: 3, list_to_index: 2)
expect(find('.board:nth-child(2)')).to have_content(issue8.title) expect(find('.board:nth-child(3)')).to have_content(issue8.title)
wait_for_board_cards(1, 8) wait_for_board_cards(2, 8)
wait_for_board_cards(2, 3) wait_for_board_cards(3, 3)
wait_for_board_cards(3, 0) wait_for_board_cards(4, 0)
end end
context 'issue card' do context 'issue card' do
it 'shows assignee' do it 'shows assignee' do
page.within(find('.board', match: :first)) do page.within(find('.board:nth-child(2)')) do
expect(page).to have_selector('.avatar', count: 1) expect(page).to have_selector('.avatar', count: 1)
end end
end end
...@@ -290,7 +286,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -290,7 +286,7 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 4) expect(page).to have_selector('.board', count: 5)
end end
it 'creates new list for Backlog label' do it 'creates new list for Backlog label' do
...@@ -303,7 +299,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -303,7 +299,7 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 4) expect(page).to have_selector('.board', count: 5)
end end
it 'creates new list for Closed label' do it 'creates new list for Closed label' do
...@@ -316,7 +312,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -316,7 +312,7 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 4) expect(page).to have_selector('.board', count: 5)
end end
it 'keeps dropdown open after adding new list' do it 'keeps dropdown open after adding new list' do
...@@ -348,7 +344,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -348,7 +344,7 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 4) expect(page).to have_selector('.board', count: 5)
end end
end end
end end
...@@ -360,8 +356,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -360,8 +356,8 @@ describe 'Issue Boards', feature: true, js: true do
submit_filter submit_filter
wait_for_requests wait_for_requests
wait_for_board_cards(1, 1) wait_for_board_cards(2, 1)
wait_for_empty_boards((2..3)) wait_for_empty_boards((3..4))
end end
it 'filters by assignee' do it 'filters by assignee' do
...@@ -371,8 +367,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -371,8 +367,8 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
wait_for_board_cards(1, 1) wait_for_board_cards(2, 1)
wait_for_empty_boards((2..3)) wait_for_empty_boards((3..4))
end end
it 'filters by milestone' do it 'filters by milestone' do
...@@ -381,9 +377,9 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -381,9 +377,9 @@ describe 'Issue Boards', feature: true, js: true do
submit_filter submit_filter
wait_for_requests wait_for_requests
wait_for_board_cards(1, 1) wait_for_board_cards(2, 1)
wait_for_board_cards(2, 0)
wait_for_board_cards(3, 0) wait_for_board_cards(3, 0)
wait_for_board_cards(4, 0)
end end
it 'filters by label' do it 'filters by label' do
...@@ -392,8 +388,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -392,8 +388,8 @@ describe 'Issue Boards', feature: true, js: true do
submit_filter submit_filter
wait_for_requests wait_for_requests
wait_for_board_cards(1, 1) wait_for_board_cards(2, 1)
wait_for_empty_boards((2..3)) wait_for_empty_boards((3..4))
end end
it 'filters by label with space after reload' do it 'filters by label with space after reload' do
...@@ -403,17 +399,17 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -403,17 +399,17 @@ describe 'Issue Boards', feature: true, js: true do
# Test after reload # Test after reload
page.evaluate_script 'window.location.reload()' page.evaluate_script 'window.location.reload()'
wait_for_board_cards(1, 1) wait_for_board_cards(2, 1)
wait_for_empty_boards((2..3)) wait_for_empty_boards((3..4))
wait_for_requests wait_for_requests
page.within(find('.board', match: :first)) do page.within(find('.board:nth-child(2)')) do
expect(page.find('.board-header')).to have_content('1') expect(page.find('.board-header')).to have_content('1')
expect(page).to have_selector('.card', count: 1) expect(page).to have_selector('.card', count: 1)
end end
page.within(find('.board:nth-child(2)')) do page.within(find('.board:nth-child(3)')) do
expect(page.find('.board-header')).to have_content('0') expect(page.find('.board-header')).to have_content('0')
expect(page).to have_selector('.card', count: 0) expect(page).to have_selector('.card', count: 0)
end end
...@@ -424,12 +420,12 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -424,12 +420,12 @@ describe 'Issue Boards', feature: true, js: true do
click_filter_link(testing.title) click_filter_link(testing.title)
submit_filter submit_filter
wait_for_board_cards(1, 1) wait_for_board_cards(2, 1)
find('.clear-search').click find('.clear-search').click
submit_filter submit_filter
wait_for_board_cards(1, 8) wait_for_board_cards(2, 8)
end end
it 'infinite scrolls list with label filter' do it 'infinite scrolls list with label filter' do
...@@ -443,17 +439,17 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -443,17 +439,17 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
page.within(find('.board', match: :first)) do page.within(find('.board:nth-child(2)')) do
expect(page.find('.board-header')).to have_content('51') expect(page.find('.board-header')).to have_content('51')
expect(page).to have_selector('.card', count: 20) expect(page).to have_selector('.card', count: 20)
expect(page).to have_content('Showing 20 of 51 issues') expect(page).to have_content('Showing 20 of 51 issues')
evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight") evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
expect(page).to have_selector('.card', count: 40) expect(page).to have_selector('.card', count: 40)
expect(page).to have_content('Showing 40 of 51 issues') 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") evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
expect(page).to have_selector('.card', count: 51) expect(page).to have_selector('.card', count: 51)
expect(page).to have_content('Showing all issues') expect(page).to have_content('Showing all issues')
...@@ -471,12 +467,12 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -471,12 +467,12 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
wait_for_board_cards(1, 1) wait_for_board_cards(2, 1)
wait_for_empty_boards((2..3)) wait_for_empty_boards((3..4))
end end
it 'filters by clicking label button on issue' do it 'filters by clicking label button on issue' do
page.within(find('.board', match: :first)) do page.within(find('.board:nth-child(2)')) do
expect(page).to have_selector('.card', count: 8) expect(page).to have_selector('.card', count: 8)
expect(find('.card', match: :first)).to have_content(bug.title) expect(find('.card', match: :first)).to have_content(bug.title)
click_button(bug.title) click_button(bug.title)
...@@ -489,12 +485,12 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -489,12 +485,12 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_requests wait_for_requests
wait_for_board_cards(1, 1) wait_for_board_cards(2, 1)
wait_for_empty_boards((2..3)) wait_for_empty_boards((3..4))
end end
it 'removes label filter by clicking label button on issue' do it 'removes label filter by clicking label button on issue' do
page.within(find('.board', match: :first)) do page.within(find('.board:nth-child(2)')) do
page.within(find('.card', match: :first)) do page.within(find('.card', match: :first)) do
click_button(bug.title) click_button(bug.title)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment