summaryrefslogtreecommitdiff
path: root/spec/features/boards/boards_spec.rb
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-10-16 12:37:52 -0500
committerEric Eastwood <contact@ericeastwood.com>2017-10-16 15:19:15 -0500
commit758fc7a7919ec427dde5ddd52f15f5cfaca1fea5 (patch)
treeae04d0a2131350090cef39a905857dc61d0a5016 /spec/features/boards/boards_spec.rb
parent96d8c7fff114911faa7d3e1b6322c2b9e3377e9b (diff)
downloadgitlab-ce-758fc7a7919ec427dde5ddd52f15f5cfaca1fea5.tar.gz
Check for element before evaluate_scriptfeature/reliable-rspec-with-eval-script
Tip from https://robots.thoughtbot.com/write-reliable-asynchronous-integration-tests-with-capybara#directly-interacting-with-javascript
Diffstat (limited to 'spec/features/boards/boards_spec.rb')
-rw-r--r--spec/features/boards/boards_spec.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb
index 91c4e5037de..60ed17c0c81 100644
--- a/spec/features/boards/boards_spec.rb
+++ b/spec/features/boards/boards_spec.rb
@@ -171,12 +171,14 @@ describe 'Issue Boards', :js do
expect(page).to have_selector('.card', count: 20)
expect(page).to have_content('Showing 20 of 58 issues')
+ find('.board .board-list')
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
wait_for_requests
expect(page).to have_selector('.card', count: 40)
expect(page).to have_content('Showing 40 of 58 issues')
+ find('.board .board-list')
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
wait_for_requests
@@ -449,11 +451,13 @@ describe 'Issue Boards', :js do
expect(page).to have_selector('.card', count: 20)
expect(page).to have_content('Showing 20 of 51 issues')
+ find('.board .board-list')
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_content('Showing 40 of 51 issues')
+ find('.board .board-list')
evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight")
expect(page).to have_selector('.card', count: 51)