问题是我有一些带有一点 jquery 的 html 页面,当我按下“添加新预订号”链接时,它会触发一些 Jquery 代码,将新的输入文本附加到视图中,当我通过 Web 浏览器对其进行测试时有效,但我在黄瓜功能中有以下步骤:
1. And I fill in "Booking" with "2FD5623A6"
2. And I follow "Add new booking number"
3. And show me the page
4. And I fill in "Booking 2" with "HGJD8FDU7"
第 4 步失败,因为单击“添加新预订号”链接时未生成预订 2 标签,但是在第 3 步中,当我手动单击该链接时,新字段已正确生成,所以我没有知道发生了什么
我刚刚解决了 capybara 和 cucumber-rails 的问题,我评论了以下行
# require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
因为这个问题https://github.com/jnicklas/capybara/issues/issue/110
我的宝石版本是:
Using capybara (0.4.1) Using
cucumber (0.10.0) Using
cucumber-rails (0.3.2)
任何人都可以帮助我吗?