ページがあり、他のいくつかのアイテム内にいくつかのアイテムが必要です。したがって、基本的に私の機能は次のようになります。
Scenario: Footer has caption Impressum
Given I am on the index page.
When I look at the footer
Then I should see a caption "Impressum"
私が働きたいのはこれです:
When /I look at the footer/ do
scope("footer") # << css selector <footer\b.*</footer>
end
Then /I should see a caption "(.*?)"/ do |caption|
within "h3" do
page.should have_content(caption)
end
end
これを可能な限りしっかりと実装するにはどうすればよいですか?
さらに詳しく説明すると、通過する必要があるページは次のとおりです。
<html>
<head></head>
<body>
<footer>
<h3>Impressum</h3>
<p>Address: Baker Street 21</p>
</footer>
</body>
</html>
通過してはならないページは次のとおりです。
<html>
<head></head>
<body>
<h3>Impressum</h3>
<footer><p>Address: Baker Street 21</p></footer>
</body>
</html>