rails 5 capybara test.log

时间:2017-07-25 22:13:07

标签: testing capybara ruby-on-rails-5 rspec-rails

我在进行一些测试时遇到了问题,我希望在test.log中看到已经完成的请求。我可以更改配置以在日志中注册请求,如下所示?

Started GET "/carts" for 127.0.0.1 at 2017-07-25 19:09:55 -0300
  Processing by CartsController#show as HTML
  Rendering carts/show.html.erb within layouts/application
  Rendered layouts/_header.html.erb (1.5ms)
  Rendered layouts/_notice_modal.html.erb (1.2ms)
  Rendered carts/show.html.erb within layouts/application (8.9ms)
  Rendered layouts/_alert_modal.html.erb (0.7ms)
  Rendered layouts/_notice_modal.html.erb (0.4ms)
Completed 200 OK in 62ms (Views: 57.6ms | ActiveRecord: 0.0ms)

我使用的是Rails 5.1.1,RSpec 3.6和Capybara 2.14.4。

提前感谢您的帮助!

编辑1

我在rails_helper.rb中使用capybara进行了以下配置:

require "capybara"
require "capybara/rspec"

....

Capybara.register_driver :selenium_chrome do |app|
  Capybara::Selenium::Driver.new(app, browser: :chrome)
end

Capybara.javascript_driver = :selenium_chrome

0 个答案:

没有答案