From 69b636d477e9664cc239d1080fcadc0116fc4a4d Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Sun, 13 Sep 2015 00:22:27 -0700 Subject: [PATCH] theoretical fix for occasional missing field in tests --- tests/acceptance/signup_tests.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/acceptance/signup_tests.rb b/tests/acceptance/signup_tests.rb index 32e1b70d..6ae9d6bd 100644 --- a/tests/acceptance/signup_tests.rb +++ b/tests/acceptance/signup_tests.rb @@ -7,8 +7,15 @@ end describe 'signup' do include Capybara::DSL + def wait_for_ajax + Timeout.timeout(Capybara.default_wait_time) do + loop until page.evaluate_script('jQuery.active').zero? + end + end + def fill_in_valid @site = Fabricate.attributes_for(:site) + wait_for_ajax fill_in 'username', with: @site[:username] fill_in 'password', with: @site[:password] fill_in 'email', with: @site[:email]