【发布时间】:2011-06-12 22:33:28
【问题描述】:
我正在尝试使用 Capybara (head) 和 Selenium 在 Rails 3.0.8 中编写集成测试。我想测试当用户单击我网页上某个项目的删除按钮时,该项目实际上是否被删除。所以在网页上,我使用 JQuery sn-p 隐藏项目
$('#interaction').fadeOut();
我使用follow rspec 测试,并将Capybara.default_wait_time 设置为5 秒,但似乎没有什么能让我通过测试。如何正确测试?
describe "A User adding an Interaction" do
describe "when looking at an Item detail page" do
it "should be able to delete and existing interaction", :js => true do
sign_in_and_view_item
page.should have_content "ITEM DETAILS - #{@item.name}"
fill_in "interaction-input", :with => "My Interaction"
click_button "item-interaction-submit"
page.should have_content "My Interaction"
click_link "Delete Interaction"
wait_until do
page.evaluate_script('$.active') == 0
end
#page.should_not have_content "My Interaction"
page.should have_no_content "My Interaction"
end
end
end
【问题讨论】:
标签: ruby-on-rails selenium rspec capybara