Guo*_*Cao 4 selenium ruby-on-rails webrat cucumber
我正在使用Cucumber,webrat和selenium来测试Web应用程序.我用" 我应该看到"某些东西来验证变化.但是,在许多地方,要验证的文本只会从隐藏更改为可见(这可能是由于从自身或其祖先中删除了'隐藏'类).在这种情况下,上述测试实际上并未验证更改.我试图使用'response.should_not have_tag("div#myId.hidden")',这不起作用.推荐的测试方法是什么?
环境:黄瓜0.3.11,selenium-client 1.2.17,webrat 0.6.0
谢谢.
对于这些情况,我使用这两个自定义步骤:
Then /^the element matched by "([^\"]*)" should be visible$/ do |locator|
selenium.should be_visible(locator)
end
Then /^the element matched by "([^\"]*)" should not be visible$/ do |locator|
selenium.should_not be_visible(locator)
end
Run Code Online (Sandbox Code Playgroud)
将它们放在step_definitions /目录下的Ruby文件中.
所以,在你的情况下,而不是然后我应该看到"东西"使用然后匹配"东西"的元素应该是可见的.
| 归档时间: |
|
| 查看次数: |
1372 次 |
| 最近记录: |