2014-02-11 38 views
0

荫内的文本与正在使用的红宝石水豚,以WITE测试scripts.Using测试自动化。对于工作红宝石水豚检查一个开发

红宝石cabybara码我要检查文本存在不dev的元素中

我怎么可能?

<div class="modal-header"> 
     <h3 class="orderCompleteNoEmailLabel"> 
      Your order is placed, but one more step is needed to complete it. 
     </h3> 

</div> 

在这里,我想检查文本Your order is placed, but one more step is needed to complete it.是否存在或不存在。

回答

1

个人而言,我会用这样的:

page.should have_css('div.modal-header', :text => "Your order is placed, but one more step is needed to complete it.") 

你也可以使用:

page.should have_content('Your order is placed, but one more step is needed to complete it.') 

这里是为水豚方法非常有用的列表的链接。

https://gist.github.com/zhengjia/428105

+0

我想在页面上添加,它不是大测试对实际文本内容可以(很有可能),因此这将打破测试的变化。同意你可以维持你的测试,但说有几个领域一次改变?只是一个小费。 – Dono