Capybara server & browser error with no trace on server
Asked Answered
B

2

9

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
Booklet answered 21/4, 2017 at 20:16 Comment(1)
Just a few random thoughts: try removing Rails silencers (see config/initializers/backtrace_silencers.rb) or perhaps this might be some log flushing issue? What Rails version are we talking about?Whereat
B
1

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

Booklet answered 28/5, 2017 at 12:55 Comment(2)
This was really helpful! Had been struggling with this for 1 hour.Maskanonge
I just came back to this answer that I have upvoted some time ago. I wish I could upvote it again!Maskanonge
S
1

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
Stauder answered 11/3, 2019 at 13:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.