I\'m working to live life the BDD way. I\'m using Cucumber (with Selenium) and happen to be using Twitter Bootstrap modals in my application.
While running Cucumber tes
What I generally do is assert against some content that should be visible on the modal (or not visible when it is fading out):
expect(page).to have_content('My Modal Header')
expect(page).to have_no_content('My Modal Header')
It's important to use .to have_no_content
and not .not_to have_content
, as have_no_content
will wait for a period for the thing to be true.
In a pinch, you can also check for modal CSS selectors. Bootstrap adds an in
class when the modal is visible:
expect(page).to have_selector('.modal.in')
expect(page).to have_no_selector('.modal.in')