In order to test my react app using webdriver.io, I need to launch it using phantomjs.
At first I thought the problem was webdriver.io but I\'ve realized that Phanto
You can download PhantomJS 2.5.0 Beta at https://bitbucket.org/ariya/phantomjs/downloads.
It features updated QtWebKit engine that supports ES6 natively.
Probably has to do with the lack of ES6 support in PhantomJS. To check I added page.onError() callback to your script (always handy!) and opened some React example site to get this error:
ReferenceError: Can't find variable: Symbol
To polyfill Symbol one can inject a core.js script from this excellent package into the page before loading the target url:
page.onInitialized = function() {
if(page.injectJs('core.js')){
console.log("Polyfills loaded");
}
}
But that's for opening external sites. If the site that's being tested is under your development (as localhost url suggests) you probably could do with just configuring babel as is shown in this answer.