I ended up adding this line to my spec / spec_helper.rb
Capybara.ignore_hidden_elements = false
using this specification
spec_helper required
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 "Save" page.should have_content "My Interaction" click_link "Delete Interaction" should_be_hidden "My Interaction" end end end
along with this function should_be_hidden
def should_be_hidden text, selector='' sleep Capybara.default_wait_time its_hidden = page.evaluate_script("$('#{selector}:contains(#{text})').is(':hidden');") its_not_in_dom = page.evaluate_script("$('#{selector}:contains(#{text})').length == 0;") (its_hidden || its_not_in_dom).should be_true end
source share