简体   繁体   中英

Rspec periodically hangs when using capybara-webkit with a page that loads an external script with async = true

I'm working on an application that uses uservoice. The uservoice snippet

  var uv = document.createElement('script');
  uv.type = 'text/javascript';
  uv.async = true;
  uv.src = ...; // external call to uservoice to fetch js
  var s = document.getElementsByTagName('script')[0];
  ...

This javascript is loaded on all pages. When running rake spec the run will periodically hang. All tests run smoothly when I remove the uservoice snippet. I've tried setting Capybara.javascript_driver = :webkit_debug and I see no response from uservoice. When I set page.driver.browser.timeout I can see a 0 response from uservoice and the specs will fail with a timeout error.

Anyone else encounter this problem?

I've experienced timeout errors while waiting for an external script to lead (eg google analytics) when my development machine becomes disconnected from the internet.

I still sometimes use firebug and selenium driver when I'm trying to debug capybara as it can be illuminating to see an actual browser go at it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM