Search code examples
angularjslinuxrspeccapybarapoltergeist

Capybara-Poltergeist Angular modulerr on Linux


I am experiencing some issue with Rspec & Capybara when trying to test my Angular application.

It returns me that error :

Failure/Error: visit '/'

 Capybara::Poltergeist::JavascriptError:
   One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).

   Error: [$injector:modulerr] Failed to instantiate module ng due to:
   ...

Actually that error occurs only on TravisCI and my Ubuntu 14.04, everything is fine when running it on MacOS, or on both environments with Selenium instead of Poltergeist.
Setting js_errors on false leads to blank pages on Capybara screenshots.

Have you got any clue of what's going wrong here?

Thank you in advance for your answers !


Solution

  • Sounds like you're probably running different versions of phantomjs in your different environments. Make sure youre running Phantomjs 2.1+ with angular apps, otherwise you're missing important functionality like Function.prototype.bind - The rest of the error message you get should explain whats missing.