我使用Capybara进行的Rails 6系统测试在我的haml代码中没有发现text_field输入:
.form-group
= f.label :summary
= f.text_field :summary, placeholder: 'A brief 2-3 lines summarizing your idea', class: 'form-control summary'通过测试:
fill_in "Summary", with: "Some generic text" 我得到以下错误:
Error:
ActivitiesTest#test_creating_an_activity:
Capybara::ElementNotFound: Unable to find field "Summary" that is not disabled
test/system/activities_test.rb:20:in `block in <class:ActivitiesTest>'发布于 2020-11-10 01:45:10
事实证明,如果您使用占位符,那么您必须对该文本执行fill_in:
fill_in "A brief 2-3 lines summarizing your idea", with: "Some generic text"它会起作用的。
https://stackoverflow.com/questions/64756621
复制相似问题