summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-08-18 15:59:50 +0100
committerPhil Hughes <me@iamphill.com>2016-08-18 17:20:46 +0100
commit893f5e225fa1f9aa88869ab143efecbdfab57d4d (patch)
treebd190d7866bcda730091e12be2ac3c335f8c9705
parent1f14495124e38a0682476744b95a8299ad06593a (diff)
downloadgitlab-ce-boards-spec-improvements.tar.gz
Attempted improvement to stop boards spec failingboards-spec-improvements
-rw-r--r--app/assets/javascripts/boards/vue_resource_interceptor.js.es68
-rw-r--r--spec/features/boards/boards_spec.rb26
2 files changed, 30 insertions, 4 deletions
diff --git a/app/assets/javascripts/boards/vue_resource_interceptor.js.es6 b/app/assets/javascripts/boards/vue_resource_interceptor.js.es6
index 66f645a4b61..f9f9f7999d4 100644
--- a/app/assets/javascripts/boards/vue_resource_interceptor.js.es6
+++ b/app/assets/javascripts/boards/vue_resource_interceptor.js.es6
@@ -1,8 +1,10 @@
Vue.http.interceptors.push((request, next) => {
Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1;
- setTimeout(() => {
- Vue.activeResources--;
- }, 500);
+ Vue.nextTick(() => {
+ setTimeout(() => {
+ Vue.activeResources--;
+ }, 500);
+ });
next();
});
diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb
index e4c5a10ce7e..8910c50c294 100644
--- a/spec/features/boards/boards_spec.rb
+++ b/spec/features/boards/boards_spec.rb
@@ -147,6 +147,7 @@ describe 'Issue Boards', feature: true, js: true do
expect(page).to have_selector('.card', count: 20)
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).to have_selector('.card', count: 40)
@@ -165,6 +166,8 @@ describe 'Issue Boards', feature: true, js: true do
page.within(find('.board', match: :first)) do
find('.form-control').set issue1.title
+ wait_for_vue_resource(spinner: false)
+
expect(page).to have_selector('.card', count: 1)
end
end
@@ -176,7 +179,11 @@ describe 'Issue Boards', feature: true, js: true do
expect(page).to have_selector('.card', count: 1)
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)
end
end
@@ -189,6 +196,8 @@ describe 'Issue Boards', feature: true, js: true do
expect(page).to have_selector('.card', count: 5)
end
+ wait_for_vue_resource
+
page.within(find('.board:nth-child(2)')) do
expect(page.find('.board-header')).to have_content('3')
expect(page).to have_selector('.card', count: 3)
@@ -263,6 +272,7 @@ describe 'Issue Boards', feature: true, js: true do
context 'new list' do
it 'shows all labels in new list dropdown' do
click_button 'Create new list'
+ wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do
expect(page).to have_content(planning.title)
@@ -273,6 +283,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'creates new list for label' do
click_button 'Create new list'
+ wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do
click_link testing.title
@@ -285,6 +296,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'creates new list for Backlog label' do
click_button 'Create new list'
+ wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do
click_link backlog.title
@@ -297,6 +309,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'creates new list for Done label' do
click_button 'Create new list'
+ wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do
click_link done.title
@@ -314,6 +327,7 @@ describe 'Issue Boards', feature: true, js: true do
end
click_button 'Create new list'
+ wait_for_ajax
page.within('.dropdown-menu-issues-board-new') do
click_link testing.title
@@ -333,6 +347,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by author' do
page.within '.issues-filters' do
click_button('Author')
+ wait_for_ajax
page.within '.dropdown-menu-author' do
click_link(user2.name)
@@ -358,6 +373,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by assignee' do
page.within '.issues-filters' do
click_button('Assignee')
+ wait_for_ajax
page.within '.dropdown-menu-assignee' do
click_link(user.name)
@@ -383,6 +399,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by milestone' do
page.within '.issues-filters' do
click_button('Milestone')
+ wait_for_ajax
page.within '.milestone-filter' do
click_link(milestone.title)
@@ -408,6 +425,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by label' do
page.within '.issues-filters' do
click_button('Label')
+ wait_for_ajax
page.within '.dropdown-menu-labels' do
click_link(testing.title)
@@ -436,6 +454,7 @@ describe 'Issue Boards', feature: true, js: true do
page.within '.issues-filters' do
click_button('Label')
+ wait_for_ajax
page.within '.dropdown-menu-labels' do
click_link(testing.title)
@@ -460,8 +479,9 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by multiple labels' do
page.within '.issues-filters' do
click_button('Label')
+ wait_for_ajax
- page.within '.dropdown-menu-labels' do
+ page.within(find('.dropdown-menu-labels')) do
click_link(testing.title)
wait_for_vue_resource(spinner: false)
click_link(bug.title)
@@ -486,6 +506,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by no label' do
page.within '.issues-filters' do
click_button('Label')
+ wait_for_ajax
page.within '.dropdown-menu-labels' do
click_link("No Label")
@@ -510,10 +531,13 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by clicking label button on issue' do
page.within(find('.board', match: :first)) do
expect(page).to have_selector('.card', count: 6)
+ expect(find('.card', match: :first)).to have_content(bug.title)
click_button(bug.title)
wait_for_vue_resource(spinner: false)
end
+ 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)