Module: ApiMaker::SpecHelper::ExpectNoBrowserErrors

Included in:
ApiMaker::SpecHelper
Defined in:
lib/api_maker/spec_helper/expect_no_browser_errors.rb

Instance Method Summary collapse

Instance Method Details

#expect_no_browser_errorsObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/api_maker/spec_helper/expect_no_browser_errors.rb', line 2

def expect_no_browser_errors
  logs = browser_logs
    .map(&:to_s)
    .reject { |log| log.include?("Warning: Can't perform a React state update on an unmounted component.") }
    .reject { |log| log.include?("DEBUG: ") }
    .join("\n")

  expect_no_browser_window_errors
  return if logs.blank? || logs.exclude?("SEVERE ")

  # Lets try one more time - just in case browser window error got registered meanwhile
  sleep 0.4
  expect_no_browser_window_errors

  raise logs
end