您如何使用Minitest,Capybara,Selenium执行javascript测试? [英] How do you perform javascript tests with Minitest, Capybara, Selenium?

查看:59
本文介绍了您如何使用Minitest,Capybara,Selenium执行javascript测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于如何使用Capybara/Selenium/ Rspec 执行javascript测试的例子很多,您可以像这样编写测试:

There are a lot of examples on how to perform javascript tests with Capybara/Selenium/Rspec in which you can write a test like so:

it "does something", :js => true do
  ...
end

但是,使用 minitest 时,您无法传递第二个参数来指示硒执行测试.

However with minitest you can't pass a second parameter to instruct selenium to perform the test.

有人对如何做到这一点有任何想法吗?

Does anyone have any ideas on how this can be done?

推荐答案

嗯,我注意到文档中有几行内容似乎表明上述内容只能在Rspec中完成

Hmm I noticed a couple lines in the docs that seem to say that the above can only be done in Rspec

但是,如果您使用的是 RSpec或Cucumber ,则可以考虑将更快的:rack_test保留为default_driver,并仅标记那些需要JavaScript驱动程序的测试. using :js => true@javascript.

However, if you are using RSpec or Cucumber, you may instead want to consider leaving the faster :rack_test as the default_driver, and marking only those tests that require a JavaScript-capable driver using :js => true or @javascript, respectively.

这篇关于您如何使用Minitest,Capybara,Selenium执行javascript测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆