Ruby on rails 未找到水豚内容物,但实际内容物存在

Ruby on rails 未找到水豚内容物,但实际内容物存在,ruby-on-rails,ruby,cucumber,capybara,Ruby On Rails,Ruby,Cucumber,Capybara,我面临着一些奇怪的问题。我用水豚、黄瓜和恶鬼为我的rails应用程序编写了一个测试用例。代码见下文 @javascript Scenario: admin can search multiple users when different oinkcodes exist Given a "admin" user exists and is signed in And the following users with an oinkcode exist: | email |

我面临着一些奇怪的问题。我用水豚、黄瓜和恶鬼为我的rails应用程序编写了一个测试用例。代码见下文

@javascript
Scenario: admin can search multiple users when different oinkcodes exist
Given a "admin" user exists and is signed in
And the following users with an oinkcode exist:
  | email           | oinkcode                                 |
  | berf@berf.com   | 5f9614e97a5610f99c7d0975a73de43f2414fc96 |
  | sample@berf.com | asd2455a5610f99c7d0975a73de43f2414fc9812 |
When I goto "/oinkcodes/search"
And I fill in "query" with the following lines of text:
  |                    text                |
  |5f9614e97a5610f99c7d0975a73de43f2414fc96|
  |asd2455a5610f99c7d0975a73de43f2414fc9812|
And I click "Go"
And I wait for index   # sleep for 10 sec
#And I do some debugging
Then I should see "berf@berf.com"
And I should see "sample@berf.com"
在上面的示例中,当我单击“Go”时,我通过javascript获得用户的电子邮件地址。当我运行这个测试时,它失败为“找不到内容(RuntimeError)”。。。。。。。。当我试图通过pry进行调试时

pry(#<Cucumber::Rails::World>)> page.body
Result: <h3>Users</h3>\n      <textarea class=\"text_area\" id=\"users\" rows=\"15\" cols=\"60\" readonly=\"\">    berf@berf.com\n    sample@berf.com\n</textarea>\n 

pry(#<Cucumber::Rails::World>)> find_field('users').value
=> "    berf@berf.com\n    sample@berf.com\n"
[4] pry(#<Cucumber::Rails::World>)> page.has_content?('berf@berf.com')
=> false
pry(#)>page.body
结果:用户\nberf@berf.com\nsample@berf.com\n\n
pry(#)>查找字段('users')。值
=> "    berf@berf.com\nsample@berf.com\n“
[4] pry(#)>页面。是否有内容?('berf@berf.com')
=>错误

我不明白,为什么page.has\u有内容?当我可以在page.body或find_字段(“用户”)中看到该内容时,返回false。值。。。。。。有人能帮我吗?提前感谢

在谷歌搜索了1-2天后,我得到了答案。Capybara中存在一个错误,即当文本区域中填充javascript时,我们尝试时,Capybara返回false:

page.has_content?
即使我们可以在UI中看到结果。
请参阅链接:

这里的任何人都可以帮助我。。。。或者我的问题不好,因为这个问题在2011年被标记为已修复。你吃的是很老的水豚吗?