hbenl / vscode-mocha-test-adapter

Mocha Test Adapter for the VS Code Test Explorer
MIT License
90 stars 31 forks source link

e2e spectron tests fail to run #83

Open izotomas opened 4 years ago

izotomas commented 4 years ago

this is my mocha config:

--timeout 300000 --require ts-node/register e2e/**/*.spec.ts

and this is mochaExplorer config:

{
  "mochaExplorer.files": "e2e/**/*.spec.ts",
  "mochaExplorer.require": "ts-node/register",
  "mochaExplorer.timeout": 300000,
  "mochaExplorer.mochaPath": "./node_modules/mocha",
  "mochaExplorer.logpanel": true
}

when i'm running e2e test through command line, tests do run, however, explorer fail to execute them with following error:

{
   "type":"test",
   "test":"/Users/tomasizo/Desktop/angular-electron/e2e/main.spec.ts: angular-electron App \"before each\" hook for \"should display message saying App works !\"",
   "state":"failed",
   "message":"Error: unknown error: Chrome failed to start: exited abnormally\n  (chrome not reachable)\n  (The process started from chrome location /Users/tomasizo/Desktop/angular-electron/node_modules/spectron/lib/launcher.js is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\n  (Driver info: chromedriver=78.0.3905.1 (7ce1e685d6d0ea69526c2b7e1cfa43fbf1d0463b-refs/heads/master@{#703739}),platform=Mac OS X 10.15.2 x86_64)\n    at new RuntimeError (node_modules/webdriverio/build/lib/utils/ErrorHandler.js:143:12)\n    at Request._callback (node_modules/webdriverio/build/lib/utils/RequestHandler.js:318:39)\n    at Request.self.callback (node_modules/request/request.js:185:22)\n    at Request.EventEmitter.emit (domain.js:475:20)\n    at Request.<anonymous> (node_modules/request/request.js:1161:10)\n    at Request.EventEmitter.emit (domain.js:475:20)\n    at IncomingMessage.<anonymous> (node_modules/request/request.js:1083:12)",
   "decorations":[]
}
chandanrayarm commented 4 years ago

Hi I'm using spectron on webdriverIO and try to avoid client.pause() method to wait and used client.waitForExist, waitForWindowLoading, waitUnitlText but the applicaation closes very quick and I doesnt want to pass implicit wait

can some one guide towards right direction to achieve it?

hbenl commented 4 years ago

@izotomas How do you run your tests on the command line? Please give me the exact command that you are using.

izotomas commented 4 years ago

@hbenl well, since the test explorer can't run them...all the time!

$ mocha --timeout 3000000 --require ts-node/register e2e/**/*.spec.ts

I've been using this extension for over a year now and had no problems with it until i started work on this electron project...

I even tried to setup a fresh electron project (suspecting that it might be sth with our project config) to see how that goes but it still fails with the same issue.

hbenl commented 4 years ago

I'll try to reproduce this - could you upload your fresh electron project to Github? Or alternatively point me to the description you used for setting it up?

izotomas commented 4 years ago

there you go: spectron-mocha-explorer

hbenl commented 4 years ago

Thanks, I guess that you have to run npm start in a terminal (and keep it running) before you start the tests (either on the command line or in Test Explorer). When I try to run the tests without running npm start I get the same error message as you do - both in the command line and in Test Explorer. When I run npm start first and then run the tests, they work (well, one of them succeeds and one of them fails, but they are both executed) both in the command line and in Test Explorer. Did you perhaps assume that the Mocha Explorer would automatically run npm start for you? It doesn't (just like Mocha doesn't).

hbenl commented 4 years ago

Does it work for you now?