From 51950c13d8fb51c6bfa2b2c02a7a32b8a27e63b9 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Mon, 26 Mar 2018 20:46:49 +0200 Subject: Wait for finishing any requests When running a test which adds a new comment, we should wait until the comment is added, otherwise page content may be changed and referenced HTML element may be removed meantime. The test then fails with: Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: element is not attached to the page document Closes gitlab-ce#42148 --- spec/support/features/discussion_comments_shared_example.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/support/features/discussion_comments_shared_example.rb b/spec/support/features/discussion_comments_shared_example.rb index 0992b329477..80604395adf 100644 --- a/spec/support/features/discussion_comments_shared_example.rb +++ b/spec/support/features/discussion_comments_shared_example.rb @@ -137,6 +137,8 @@ shared_examples 'discussion comments' do |resource_name| describe 'creating a discussion' do before do find(submit_selector).click + wait_for_requests + find(comments_selector, match: :first) end -- cgit v1.2.1