来自rspec,只要我们不启用JavaScript,我们就可以很快地运行我们的Capybara特性规范。如何加快内置Rails 5系统测试的启动和/或执行时间?
我现在的application_system_test_case.rb
require 'test_helper'
require 'capybara/poltergeist'
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :poltergeist
end发布于 2017-12-19 17:37:39
啊,现在我记起来了。水豚默认使用RackTest驱动程序,速度相当快。您也可以对Rails系统测试配置执行同样的操作。
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :rack_test
end我还不确定的一个缺点是,如何为某些确实需要JavaScript执行的测试切换驱动程序,因此需要真正的无头浏览器来驱动系统测试。(在rspec中,我们将在特性测试定义中传递js: true选项。)
https://stackoverflow.com/questions/47891961
复制相似问题