yet another attempt at fixing the timing bug

This commit is contained in:
Kyle Drake 2015-09-13 01:04:51 -07:00
parent 575a38fbeb
commit faa738d6c1

View file

@ -7,18 +7,19 @@ end
describe 'signup' do describe 'signup' do
include Capybara::DSL 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 def fill_in_valid
@site = Fabricate.attributes_for(:site) @site = Fabricate.attributes_for(:site)
wait_for_ajax
time = Time.now
begin
fill_in 'username', with: @site[:username] fill_in 'username', with: @site[:username]
fill_in 'password', with: @site[:password] fill_in 'password', with: @site[:password]
fill_in 'email', with: @site[:email] fill_in 'email', with: @site[:email]
rescue Capybara::ElementNotFound
raise if Time.now - time > 30
sleep 0.5
retry
end
end end
def click_signup_button def click_signup_button