electron-userland / spectron

DEPRECATED: 🔎 Test Electron apps using ChromeDriver
http://electronjs.org/spectron
MIT License
1.68k stars 229 forks source link

Spectron test times out on Travis-CI and AppVeyor #136

Closed SimplyAhmazing closed 7 years ago

SimplyAhmazing commented 7 years ago

I've set up Spectron to test our Electron app and have been able to get the tests to pass on my machine and a coworkers machine smoothly. However I'm unable to get it to work on AppVeyor or Travis. The specific error I get is,

mocha --timeout 60000 test/integration_test.js
  application launch
    1) "before each" hook for "runs a protocol"
  0 passing (1m)
  1 failing
  1) application launch "before each" hook for "runs a protocol":
     Error: timeout of 60000ms exceeded. Ensure the done() callback is being called in this test.

The command "mocha --timeout 60000 test/integration_test.js" failed and exited with 1 during .
Your build has been stopped.

I got this error locally and was able to work around it by increasing the timeout time on my Mocha test, however this hasn't worked for my CI tests...

I increased the test time on my AppVeyor build to 100 minutes and got this error,

mocha --timeout 6000000 test/integration_test.js
  application launch
    1) "before each" hook for "runs a protocol"
  0 passing (50m)
  1 failing
  1) application launch "before each" hook for "runs a protocol":
     Client initialization failed after 10 attempts: RuntimeError Client initialization failed after 10 attempts: 
  Error: Couldn't connect to selenium server
Command exited with code 1

I suppose it's this error that makes the Spectron test fail,

Client initialization failed after 10 attempts: RuntimeError Client initialization failed after 10 attempts: 
  Error: Couldn't connect to selenium server

After googling this error it seems to have something to do with WebDriverIO. I haven't yet been able to determine more on why this error is happening. Maybe I'm not be installing the proper dependencies for Spectron on AppVeyor/Travis -- I feel that this is unlikely because a coworker was able to pull my branch, npm i and get everything running fine...

I did set up AppVeyor build to use os: unstable and my Travis to use os: - osx...

Not sure if anyone is familiar with what's causing this failure on Travis/AppVeyor?

Thanks

Relevant build logs,

SimplyAhmazing commented 7 years ago

I figured out my error. It was due to the fact that I was attempting to write to a log file but was doing so outside of electron ready and therefore the file did not exist. This certain log file existed in our local dev environments so spectron was able to start electron tests just fine..