【发布时间】:2012-10-26 22:40:17
【问题描述】:
我正在尝试使用 Cucumber 检查网页上的过滤器功能。如果我检查特定的电影评级,那么它应该只显示表中具有这些评级的电影。这是我的场景:
When I check the following ratings: 'PG', 'R'
And I press Refresh
Then I should not see /PG/
这是我的步骤定义:
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
regexp = Regexp.new(regexp)
if page.respond_to? :should
page.should have_no_xpath('//*', :text => regexp)
else
assert page.has_no_xpath?('//*', :text => regexp)
end
end
但我收到“不明确的匹配”错误。
这里是一些 HTML,以防它很重要:
<table id='movies'>
<thead>
<tr>
<th>Movie Title</th>
<th>Rating</th>
<th>Release Date</th>
<th>More Info</th>
</tr>
</thead>
<tbody>
<tr>
<td>Aladdin</td>
<td>G</td>
<td>1992-11-25 00:00:00 UTC</td>
<td><a href="/movies/1">More about Aladdin</a></td>
</tr>
谢谢!
【问题讨论】:
-
有史以来最好的标题。