summaryrefslogtreecommitdiff
path: root/spec/support/capybara.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-11 00:06:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-11 00:06:26 +0000
commit991a295378736c60d419c794f0accbf0336987fc (patch)
treeaaee5152256c8d4eb40a1583521bcf320082bb49 /spec/support/capybara.rb
parent71d998ca0de672d5accdf209b4b5e3f360ea5267 (diff)
downloadgitlab-ce-991a295378736c60d419c794f0accbf0336987fc.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/capybara.rb')
-rw-r--r--spec/support/capybara.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index 7b3b966bd50..2bd4750dffa 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -101,8 +101,12 @@ RSpec.configure do |config|
config.after(:example, :js) do |example|
# when a test fails, display any messages in the browser's console
- if example.exception
+ # but fail don't add the message if the failure is a pending test that got
+ # fixed. If we raised the `JSException` the fixed test would be marked as
+ # failed again.
+ if example.exception && !example.exception.is_a?(RSpec::Core::Pending::PendingExampleFixedError)
console = page.driver.browser.manage.logs.get(:browser)&.reject { |log| log.message =~ JS_CONSOLE_FILTER }
+
if console.present?
message = "Unexpected browser console output:\n" + console.map(&:message).join("\n")
raise JSConsoleError, message