Capybara synchronize with has_no_css?

前端 未结 3 1359
耶瑟儿~
耶瑟儿~ 2020-12-20 03:36

Since upgrading to Capybara 2.4, I\'ve been running into this issue. Previously, this block worked fine:

page.document.synchronize do
  page.should have_no_c         


        
3条回答
  •  一个人的身影
    2020-12-20 04:19

    The solution I've settled for is the following:

    page.document.synchronize do
      page.assert_no_selector('#ajax_indicator', :visible => true)
    end
    

    The assert_no_selector method properly throws a Capybara::ExpectationNotMet error and appears to work in the same way as has_no_css, so I'm satisfied with this solution.

    I still have no idea why the RSpec error is being thrown for some methods but not others.


    Edit: While this works it isn't actually a good idea to do so, see other responses.

提交回复
热议问题