How to capture server errors in Capybara Feature JS Tests using lazy bootloader?

Version:

  • Rails 5.0.2
  • rspec 3.5.0
  • rspec-rails 3.5.1
  • capybara 2.12.1 (w / chromedriver / selenium for JS tests)
  • ruby 2.3.3
  • gitlab-ci

Past (and desired) behavior

When I encounter an error in the function test, the stacktrace and error will be saved in the results on the console for my machine and our CI.

i.e. undefined method '#dance' for nilClass at line 36 of app/models/dancer.rb

Current behavior

We recently updated the codebase to use "lazy loading" (or server-side loading) for certain data types and individual views. This means that in the JS / feature test, if something in the view does not load correctly, instead of making an error, we just have a counter that never stops spinning and a timeout error (or something is not found).

, Development Rails - POST- , .

Rspec/Capybara, , , , , ?

, , , .

+4
1

, , - , (-, ..), , , Capybara.raise_server_errors = true ( , , false). Capybara , Capybara. - (, , ) , Capybara .

0

Source: https://habr.com/ru/post/1675340/


All Articles