1
があります:RSpecの/カピバラ:奇妙な行動が見つからないの<input type = "隠し">が、それは間違いなく私は、次のスペック持っ
:ここwithin dom_id_selector(@boilerplate_copy) do
within '.copied_attributes_differing_from_original' do
within 'form.title[action="http://www.textdiff.com/"]' do
expect(page).to have_css 'button', text: 'Title'
expect(page).to have_css 'input[name="string1"]'
expect(page).to have_css 'input[name="string2"]'
end
end
end
は、問題のHTMLです最初have_css
通過する間
(ボタンが見つかった)
<div class="copied_attributes_differing_from_original">
<form action="http://www.textdiff.com/" class="title" method="post" target="_blank">
<input name="string1" type="hidden" value="Boilerplate Original test title">
<input name="string2" type="hidden" value="Boilerplate Copy test title">
<button type="submit">Title</button>
</form>
<form action="http://www.textdiff.com/" class="success_criterion_id" method="post" target="_blank">
<input name="string1" type="hidden">
<input name="string2" type="hidden" value="1">
<button type="submit">Success criterion</button>
</form>
// More of them...
<form action="http://www.textdiff.com/"...
</div>
は、第二
have_css
は失敗:
Failure/Error: expect(page).to have_css 'input[name="string1"]'
expected to find css "input[name=\"string1\"]" but there were no matches. Also found "", which matched the selector but not all filters.
しかし、私の意見では、この要素は間違いなくそこにあります!私はまた、出力Also found "", which matched the selector but not all filters.
を理解していない、それはどういう意味ですか?
ありがとうございます。
ありがとうございます!あなたが正しいです、機能テストはブラックボックスでなければなりませんが、私は外部リソース(テスト範囲外)にデータを送信するフォームが存在することをテストしています。データは期待どおりに利用可能です。 –
セレクタには一致したものの、すべてのフィルタではないものも考えていますか? –
@JoshuaMuheim唯一の目に見えるビヘイビアは、カピバラの結果のフィルタとして実装されているため、CSSセレクタに一致する要素が見つかりましたが、可視性フィルタと一致しませんでした –