Cucumber 菜鸟黄瓜范围问题
我试图在下面的html中检查“style='width:60%”位Cucumber 菜鸟黄瓜范围问题,cucumber,Cucumber,我试图在下面的html中检查“style='width:60%”位 <div class='pers-ref-rate'> <div class='rating-type'> Reliability </div> <div class='type-reliable rating'> <div style='width:60%'></div> </div> </div>
<div class='pers-ref-rate'>
<div class='rating-type'>
Reliability
</div>
<div class='type-reliable rating'>
<div style='width:60%'></div>
</div>
</div>
下面是我的步骤
Then /^I should see a personal (\w+) rating of (\d+)$/ do |rating_type, rating|
with_scope("div.type-#{rating_type}") do
page.should have_css('.rating', :style => "width:#{rating}")
end
end
我犯了一个错误
RSpec::Expectations::ExpectationNotMetError: expected #has_css?(".rating") to return true, got false
我窃取了另一个项目的步骤,并对其进行了轻微的修改(它使用的是ID而不是类)
我做错了什么
提前感谢您的帮助
标记正在寻找一个
<div class="rating" style='width:60%'></div>
在
<div class='type-reliable rating'></div>
要使其正常工作,请将rating类添加到该div,或删除其中对.rating的css搜索
谢谢。通常我只是近视,有时完全失明。
<div class='type-reliable rating'></div>