Testing bootstrap modal dialogs with poltergeist / phantomjs

It helps to add:

sleep 1

right after you’ve clicked the button or link that will open up the modal dialog. This ensures that capybara/phantomjs will wait until the modal dialog is fully visible and functional before continuing on with the test.

feature 'Sending email from modal' do
  scenario 'succesfully', js: true do
    click_on 'Open modal'
    sleep 1
    click_on 'Send'
    current_path.should == my_path
    page.should have_selector '.alert-success', text: 'Email sent'
    # And some more assertions...

One Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s