Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 431
jgdreyes Avatar asked Nov 12 '22 08:11

jgdreyes


1 Answers

I've experienced timeout errors while waiting for an external script to lead (e.g. 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.

like image 101
mkirk Avatar answered Nov 15 '22 14:11

mkirk