我正在使用seyium驱动程序为capybara运行一些请求规范,虽然它们有效,但它们需要很长时间才能完成。测试开始,Firefox启动,点击链接并在填写表单之前挂起15秒。这是规范代码:
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 => "john@doe.com"
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
关于发生了什么的任何想法?这是硒的预期行为吗?有没有办法加快速度呢?
答案 0 :(得分:2)
来自原创海报:
我发现它与页面上的一些长轮询javascript有关,所以selenium没有检测到页面已经完成加载(因为后台的长轮询请求)。