コレクションで rspec を使用して CSS 要素をチェックするステップ定義を作成しました。1 つの期待が失敗すると、シナリオ全体が爆破され、各 CSS 要素が存在するかどうかについての固有のフィードバックさえ得られません (残念ながら、それはすべてかゼロかです! 私はそれを望んでいません)。
次のコードがあります。
Then(/^I should see the following css selectors:$/) do |table|
css_selectors = table.raw
css_selectors.each do |selector|
browser.element(:css=>selector.to_s).exists?.should be_true
end
end
要素の大きなリストをテストすると、次のようになります。
Then I should see the following css selectors:
|input#foo|
|.bar |
|h#baz |
|span.batz|
要素が存在しないと問題が発生します。ヘルプ!