webdriverio-boneyard / wdio-selenium-standalone-service

WebdriverIO v4 service to start & stop Selenium Standalone http://webdriver.io
MIT License
54 stars 28 forks source link

Often fails, but tests successfully run anyway #14

Closed silvenon closed 7 years ago

silvenon commented 8 years ago

I often get this error message when running tests via the test runner (or programmatically) with browserName: 'phantomjs':

A service failed in the 'onPrepare' hook
Error: Selenium exited before it could start
    at ChildProcess.errorIfNeverStarted (/Users/matija/Code/test/e2e/node_modules/selenium-standalone/lib/start.js:144:15)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)

Continue...
------------------------------------------------------------------
[phantomjs #0-0] Session ID: adee4490-a812-11e6-9640-0311ac66cd91
[phantomjs #0-0] Spec: /Users/matija/Code/test/e2e/test/specs/page-title.js
[phantomjs #0-0] Running: phantomjs
[phantomjs #0-0]
[phantomjs #0-0]   fixture
[phantomjs #0-0]       āœ“ has the expected page title
[phantomjs #0-0]
[phantomjs #0-0]
[phantomjs #0-0] 1 passing (0s)
[phantomjs #0-0]

I didn't notice a pattern for this, but still tests run correctly anyway. If I change browserName to firefox, Firefox starts, does nothing for a longer while, then closes. WebdriverIO outputs nothing, no test report, error message or anything.

Then (because I like breaking things) I tried uninstalling the selenium-standalone service and removing it from the config, now I didn't see the failure output, everything else was the same. I tried changing browserName: 'phantomjs' to firefox, same thing. Then tried browserName: 'foo' and still the same. The output even said Running: foo. šŸ˜†

I'm aware that Selenium errors are next to impossible to figure out, I just wanted to have this issue on the GitHubs in case someone has a similar problem or maybe even found a solution.

christian-bromann commented 7 years ago

I'm aware that Selenium errors are next to impossible to figure out

not true šŸ˜

in case someone has a similar problem or maybe even found a solution.

This is not an issue. This happens when a selenium server is already running on port 4444. It fails to start. All WebdriverIO hooks are designed to not break the test flow. So only an error is shown in the output but it didn't affect your test.