Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capybara server & browser error with no trace on server

For some reason one of my cucumber tests seem to fail both on the poltergeist driver and from the rails server.

I am getting a full trace on the browser crash but almost nothing on the server side.

When I open the Capybara screenshot I just see

Internal Server Error undefined method name for nil:NilClass

When I tail the test.log

Completed 500 Internal Server Error in 0ms (Elasticsearch: 0.0ms)

(And no trace)

I have tried

  • to set config.action_dispatch.show_exceptions = true
  • the b flag (but it's only showing the detailed trace for the Capybara error
  • (my config level is set to :debug already in my environment file)

How can I get the full backtrace on the server side ?

EDIT

  • Capybara 2.13.0
  • Rails 5.0.2
  • everything commented in backtrace_silencers
like image 870
Cyril Duchon-Doris Avatar asked Apr 21 '17 20:04

Cyril Duchon-Doris


2 Answers

I got something from this answer !

So the solution was to allow rescuing the exception in ActionController::Base. In my env file I had the following lines that were misleading

# There are two ways to allow Rails to rescue exceptions:
#
# 1) Tag your scenario (or feature) with @allow-rescue
#
# 2) Set the value below to true. Beware that doing this globally is not
# recommended as it will mask a lot of errors for you!
#
ActionController::Base.allow_rescue = false

And by adding the @allow-rescue tag I got more comprehensive error trace showing in my test.log, along with a frontend error view

like image 179
Cyril Duchon-Doris Avatar answered Sep 19 '22 01:09

Cyril Duchon-Doris


If you (like me) do not use Cucumber but Capybara this answer might help you, too.

In config/environments/test.rb set

config.action_dispatch.show_exceptions = true
like image 43
Sandro L Avatar answered Sep 19 '22 01:09

Sandro L