我想在Rails 3.0.8中使用水豚(頭)和Selen寫一個集成測試。我想測試一下,當用戶點擊我網頁上的某個項目的刪除按鈕時,該項目實際上被刪除。等網頁,我隱藏使用jQuery項目片斷我怎樣才能測試一個項目從水豚和硒的頁面中刪除?
$('#interaction').fadeOut();
我用的是後續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