Closed rhys-vdw closed 7 years ago
We don't currently check the result code of the phantomjs injectJs call - https://github.com/teampoltergeist/poltergeist/blob/master/lib/capybara/poltergeist/client/browser.coffee#L78 - we probably should be checking it and returning an error if false
Cool. Is there any way in the short term that I can check? I'm trying to load in babel-polyfill
but I'm getting this error:
TypeError: undefined is not a constructor (evaluating 'document.querySelectorAll('[data-react-mount]').forEach(mountReact)')
at http://localhost:3808/assets/application.js:79448
at http://localhost:3808/assets/application.js:76961
at :0 in forEach
at http://localhost:3808/assets/application.js:76960
test/integration/taking_third_party_ordered_tests_test.rb:75:in `block in <class:TakingThirdPartyOrderedTestsTest>'
Ah, all good, I got a solution for this particular case:
if (includes(window.navigator.userAgent, 'PhantomJS') && !window._babelPolyfill) {
throw new Error('Babel Polyfill has not been installed!')
}
Would you like a PR for the above issue? I'm not at all familiar with the Poltergeist code base.
@rhys-vdw it'll probably take me a week or two to get to it, if you are able to submit a PR before that it would be great.
Got to it quicker than expected
Released in 1.14.0
Thanks @twalpole! 👍
Tests just run as per usual without any complaint about the dependency not existing. Is there any way to check if a file has been loaded?