Reputation: 2980
I'm reading this Angular tutorial and in the first chapter they explained how to run unit and e2e tests. In the tutorial they use Chrome and Firefox. Since I run application on Ubuntu 14 virtual machine with no GUI I decided to use Phantomjs browser.
Eventually I was able to run unit tests with Phantom, but I have problems with e2e.
This is how protractor-conf.js looks like:
exports.config = {
allScriptsTimeout: 11000,
specs: [
'e2e/*.js'
],
capabilities: {
'browserName': 'phantomjs',
'phantomjs.binary.path':'./node_modules/phantomjs/bin/phantomjs',
'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG']
},
chromeOnly:true,
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
But when I run tests there is a following error:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
Did I miss something in configuration? How to get more detailed error description in this case?
Upvotes: 2
Views: 2792
Reputation: 2980
This particular problem (weird error 8) can be solved by installing java:
sudo apt-get install openjdk-7-jdk
However, I still can not run tests because another issue occurred. In my case it is:
UnknownError: Error communicating with the remote browser. It may have died.
It looks like using phantomjs is a road paved with tortures, maybe I should try firefox with xvfb like @martin770 suggested.
UPD
This post can be helpful too if you are running in a problem with dying phantom.js https://gist.github.com/tfnico/8471223
User barzik advised to add the following command to the beforeEach:
browser.ignoreSynchronization = true;
browser.get('/'); //or any page you are going to test
browser.waitForAngular();
Upvotes: 2