Tag: 长轮询

轮询时如何修复黄瓜期望错误?

我有帮助sign_in用户。 我正在尝试使用新方法来确保用户使用轮询登录: def sign_in(user, password = ‘111111’) # … click_button ‘sign-in-btn’ eventually(5){ page.should have_content user.username.upcase } end 最后是: module AsyncSupport def eventually(timeout = 2) polling_interval = 0.1 time_limit = Time.now + timeout loop do begin yield rescue Exception => error end return if error.nil? raise error if Time.now >= time_limit sleep polling_interval end end end […]