Commit 15b441f3 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'boards-spec-improvements' into 'master'

Attempted improvement to stop boards spec failing



See merge request !5869
parents 6f3fe923 893f5e22
Vue.http.interceptors.push((request, next) => { Vue.http.interceptors.push((request, next) => {
Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1; Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1;
setTimeout(() => { Vue.nextTick(() => {
Vue.activeResources--; setTimeout(() => {
}, 500); Vue.activeResources--;
}, 500);
});
next(); next();
}); });
...@@ -147,6 +147,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -147,6 +147,7 @@ describe 'Issue Boards', feature: true, js: true do
expect(page).to have_selector('.card', count: 20) expect(page).to have_selector('.card', count: 20)
evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight") evaluate_script("document.querySelectorAll('.board .board-list')[0].scrollTop = document.querySelectorAll('.board .board-list')[0].scrollHeight")
wait_for_vue_resource(spinner: false)
expect(page.find('.board-header')).to have_content('40') expect(page.find('.board-header')).to have_content('40')
expect(page).to have_selector('.card', count: 40) expect(page).to have_selector('.card', count: 40)
...@@ -165,6 +166,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -165,6 +166,8 @@ describe 'Issue Boards', feature: true, js: true do
page.within(find('.board', match: :first)) do page.within(find('.board', match: :first)) do
find('.form-control').set issue1.title find('.form-control').set issue1.title
wait_for_vue_resource(spinner: false)
expect(page).to have_selector('.card', count: 1) expect(page).to have_selector('.card', count: 1)
end end
end end
...@@ -176,7 +179,11 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -176,7 +179,11 @@ describe 'Issue Boards', feature: true, js: true do
expect(page).to have_selector('.card', count: 1) expect(page).to have_selector('.card', count: 1)
find('.board-search-clear-btn').click find('.board-search-clear-btn').click
end
wait_for_vue_resource
page.within(find('.board', match: :first)) do
expect(page).to have_selector('.card', count: 6) expect(page).to have_selector('.card', count: 6)
end end
end end
...@@ -189,6 +196,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -189,6 +196,8 @@ describe 'Issue Boards', feature: true, js: true do
expect(page).to have_selector('.card', count: 5) expect(page).to have_selector('.card', count: 5)
end end
wait_for_vue_resource
page.within(find('.board:nth-child(2)')) do page.within(find('.board:nth-child(2)')) do
expect(page.find('.board-header')).to have_content('3') expect(page.find('.board-header')).to have_content('3')
expect(page).to have_selector('.card', count: 3) expect(page).to have_selector('.card', count: 3)
...@@ -263,6 +272,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -263,6 +272,7 @@ describe 'Issue Boards', feature: true, js: true do
context 'new list' do context 'new list' do
it 'shows all labels in new list dropdown' do it 'shows all labels in new list dropdown' do
click_button 'Create new list' click_button 'Create new list'
wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do page.within('.dropdown-menu-issues-board-new') do
expect(page).to have_content(planning.title) expect(page).to have_content(planning.title)
...@@ -273,6 +283,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -273,6 +283,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'creates new list for label' do it 'creates new list for label' do
click_button 'Create new list' click_button 'Create new list'
wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do page.within('.dropdown-menu-issues-board-new') do
click_link testing.title click_link testing.title
...@@ -285,6 +296,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -285,6 +296,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'creates new list for Backlog label' do it 'creates new list for Backlog label' do
click_button 'Create new list' click_button 'Create new list'
wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do page.within('.dropdown-menu-issues-board-new') do
click_link backlog.title click_link backlog.title
...@@ -297,6 +309,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -297,6 +309,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'creates new list for Done label' do it 'creates new list for Done label' do
click_button 'Create new list' click_button 'Create new list'
wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do page.within('.dropdown-menu-issues-board-new') do
click_link done.title click_link done.title
...@@ -314,6 +327,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -314,6 +327,7 @@ describe 'Issue Boards', feature: true, js: true do
end end
click_button 'Create new list' click_button 'Create new list'
wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do page.within('.dropdown-menu-issues-board-new') do
click_link testing.title click_link testing.title
...@@ -333,6 +347,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -333,6 +347,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by author' do it 'filters by author' do
page.within '.issues-filters' do page.within '.issues-filters' do
click_button('Author') click_button('Author')
wait_for_ajax
page.within '.dropdown-menu-author' do page.within '.dropdown-menu-author' do
click_link(user2.name) click_link(user2.name)
...@@ -358,6 +373,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -358,6 +373,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by assignee' do it 'filters by assignee' do
page.within '.issues-filters' do page.within '.issues-filters' do
click_button('Assignee') click_button('Assignee')
wait_for_ajax
page.within '.dropdown-menu-assignee' do page.within '.dropdown-menu-assignee' do
click_link(user.name) click_link(user.name)
...@@ -383,6 +399,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -383,6 +399,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by milestone' do it 'filters by milestone' do
page.within '.issues-filters' do page.within '.issues-filters' do
click_button('Milestone') click_button('Milestone')
wait_for_ajax
page.within '.milestone-filter' do page.within '.milestone-filter' do
click_link(milestone.title) click_link(milestone.title)
...@@ -408,6 +425,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -408,6 +425,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by label' do it 'filters by label' do
page.within '.issues-filters' do page.within '.issues-filters' do
click_button('Label') click_button('Label')
wait_for_ajax
page.within '.dropdown-menu-labels' do page.within '.dropdown-menu-labels' do
click_link(testing.title) click_link(testing.title)
...@@ -436,6 +454,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -436,6 +454,7 @@ describe 'Issue Boards', feature: true, js: true do
page.within '.issues-filters' do page.within '.issues-filters' do
click_button('Label') click_button('Label')
wait_for_ajax
page.within '.dropdown-menu-labels' do page.within '.dropdown-menu-labels' do
click_link(testing.title) click_link(testing.title)
...@@ -460,8 +479,9 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -460,8 +479,9 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by multiple labels' do it 'filters by multiple labels' do
page.within '.issues-filters' do page.within '.issues-filters' do
click_button('Label') click_button('Label')
wait_for_ajax
page.within '.dropdown-menu-labels' do page.within(find('.dropdown-menu-labels')) do
click_link(testing.title) click_link(testing.title)
wait_for_vue_resource(spinner: false) wait_for_vue_resource(spinner: false)
click_link(bug.title) click_link(bug.title)
...@@ -486,6 +506,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -486,6 +506,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by no label' do it 'filters by no label' do
page.within '.issues-filters' do page.within '.issues-filters' do
click_button('Label') click_button('Label')
wait_for_ajax
page.within '.dropdown-menu-labels' do page.within '.dropdown-menu-labels' do
click_link("No Label") click_link("No Label")
...@@ -510,10 +531,13 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -510,10 +531,13 @@ describe 'Issue Boards', feature: true, js: true do
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', match: :first)) do
expect(page).to have_selector('.card', count: 6) expect(page).to have_selector('.card', count: 6)
expect(find('.card', match: :first)).to have_content(bug.title)
click_button(bug.title) click_button(bug.title)
wait_for_vue_resource(spinner: false) wait_for_vue_resource(spinner: false)
end end
wait_for_vue_resource
page.within(find('.board', match: :first)) do page.within(find('.board', match: :first)) 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)
......
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