您如何使用Minitest,Capybara,Selenium执行javascript测试? [英] How do you perform javascript tests with Minitest, Capybara, Selenium?
问题描述
关于如何使用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屋!