加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 在服务器上没有跟踪的Capybara服务器和浏览器

发布时间:2020-12-17 04:38:33 所属栏目:百科 来源:网络整理
导读:出于某种原因,我的一个黄瓜测试似乎在恶作剧驱动程序和rails服务器上都失败了. 我对浏览器崩溃进行了全面跟踪,但在服务器端几乎没有任何内容. 当我打开Capybara截图时,我看到了 Internal Server Error undefined method name for nil:NilClass 当我拖尾test.
出于某种原因,我的一个黄瓜测试似乎在恶作剧驱动程序和rails服务器上都失败了.

我对浏览器崩溃进行了全面跟踪,但在服务器端几乎没有任何内容.

当我打开Capybara截图时,我看到了

Internal Server Error
undefined method name for nil:NilClass

当我拖尾test.log

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

(并没有痕迹)

我试过了

>设置config.action_dispatch.show_exceptions = true
> b标志(但它只显示了Capybara错误的详细描述
>(我的配置级别设置为:我的环境文件中已经调试)

如何在服务器端获得完整的回溯?

编辑

> Capybara 2.13.0
> Rails 5.0.2
>所有在backtrace_silencers中评论的内容

解决方法

我从 this answer得到了一些东西!

因此解决方案是允许在ActionController :: Base中挽救异常.在我的env文件中,我有以下几行误导

# 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

通过添加@ allow-rescue标签,我在test.log中显示了更全面的错误跟踪,以及前端错误视图

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读