Reputation: 4185
I'm running some request specs using the selenium driver for capybara, and while they work, they take too long to complete. The test starts, Firefox starts, clicks on the link and hangs for like 15 seconds before filling in the form. Here's the spec code:
it "should let an invited user sign up" do
# Invite the user
invitation = Factory.create :invitation, :invitee => nil
# Sign up
visit invitation_path(:controller => :sessions, :action => :invitation, :token => invitation.token)
current_path.should eq(login_path)
click_link "Connect with Facebook"
current_path.should eq(edit_user_path(User.order('created_at desc').first))
# Fill form
# THIS IS THE PART THAT TAKES WAY TOO LONG TO BEGIN
fill_in "Username", :with => "johndoe"
fill_in "Email", :with => "[email protected]"
fill_in "City", :with => "Santiago"
fill_in "Commune", :with => "Santiago"
select_date Time.now, :from => "user_birthday"
click_on "Save"
# THIS ASSERTION ALSO TAKES VERY LONG TO BE RUN
current_path.should eq(root_path)
end
Any ideas as to what is going on? Is this expected behavior for selenium? Is there a way to speed this up?
Upvotes: 1
Views: 1276
Reputation: 70163
From Original Poster:
I found out it had to do with some long-polling javascript on the page, so selenium didn't detect that the page had finished loading (because of the long-poll request on the background).
Upvotes: 2