0
我刚刚做了save_and_open_page
,所以这里是我想要点击进行集成测试的html。无法检查水豚中的复选框
<input id="tos" name="tos" type="checkbox" value="{:id=>"tos"}">
<label for="tos">I have read and agree to the <a href="/termsofservice" style="color:#428bca" target="_blank">Terms of Service</a>.</label>
,代码:
<%= check_box_tag :tos, id: "tos" %>
<%= label_tag "tos", "I have read and agree to the #{link_to 'Terms of Service', terms_path, { style: "color:#428bca", target: "_blank" }}.".html_safe %>
下面是检查我试图
find(:xpath, "//*[@id='tos']").set(true)
check 'tos'
find("#tos").set(true)
check 'I have read and agree to the Terms of Service'
check 'I have read and agree to the "<a href="/termsofservice" style="color:#428bca" target="_blank">Terms of Service</a>".'
find(:css, "#tos[value='{:id=>"tos"}']").set(true)
find(:css, "#tos[value='{:id=>'tos'}']").set(true)
的东西的所有失败的方式这是为什么这么难?
确定更多相关内容:
该规范的完整流程是:
describe "something" do
before do
visit '/original'
page.check("tos")
fill_in 'signup_email1', :with => "[email protected]"
click_button 'lend'
save_and_open_page
fill_in 'inventory_1', :with => 1
click_button 'submit_lend'
end
it "should achieve some result" do
...
end
end
之后每次尝试我试过到目前为止,该错误信息只是
Failure/Error: fill_in 'inventory_1', :with => 1
Capybara::ElementNotFound:
Unable to find field "inventory_1"
因为它反映的是,当再click_button 'lend'
发生,用户不会被导向页面借出有inventory_1
的东西,因为他们得到的/original
页面会重新呈现,并显示错误(通过save_and_open_page
确认),指出在继续之前必须同意服务条款。
你没有显示错误消息,您的任何企图。尝试'page.check(“tos”)'并显示输出。 – pawel7318 2014-09-13 11:58:44
试过了,没有工作,我发布了更多的上下文和错误消息,对不起,我遗漏了它,因为它似乎在这种情况下不会太有用。 – james 2014-09-15 01:14:19