dockerelectronspectron

E2E Test Electron With Spectron - Docker Windows


I'm working in E2E testing in an application running inside Electron, to make it able to run in a pipeline in Jenkins I put it in a docker container that is running a windows service (build version 1903) image. The problem is that the chrome driver is crashing inside the container.

I'm using these dependencies (Spectron and electron):

"electron": "^6.0.12",
"spectron": "^8.0.0"

And I'm getting this error:

{ Error: unknown error: Chrome failed to start: exited normally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Users\rvlima\node_modules\spectron\lib\launcher.bat is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=78.0.3904.11 (eaaae9de6b8999773fa33f92ce1e1bbe294437cf-refs/branch-heads/3904@{#86}),pla
tform=Windows NT 10.0.18362 x86_64)
    at new RuntimeError (C:\Users\rvlima\node_modules\webdriverio\build\lib\utils\ErrorHandler.js:143:12)
    at Request._callback (C:\Users\rvlima\node_modules\webdriverio\build\lib\utils\RequestHandler.js:318:39)
    at Request.self.callback (C:\Users\rvlima\node_modules\request\request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.EventEmitter.emit (domain.js:448:20)
    at Request.<anonymous> (C:\Users\rvlima\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:198:13)
    at Request.EventEmitter.emit (domain.js:448:20)
    at IncomingMessage.<anonymous> (C:\Users\rvlima\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
    at IncomingMessage.EventEmitter.emit (domain.js:448:20)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  details: undefined,
  message:
   'Client initialization failed after 10 attempts: RuntimeError Client initialization failed after 10 attempts: ',
  type: 'RuntimeError',
  seleniumStack:
   { type: 'UnknownError',
     message:
      'An unknown server-side error occurred while processing the command.',
     orgStatusMessage:
      'unknown error: Chrome failed to start: exited normally\n  (unknown error: DevToolsActivePort file doesn\'t exi
st)\n  (The process started from chrome location C:\\Users\\rvlima\\node_modules\\spectron\\lib\\launcher.bat is no l
onger running, so ChromeDriver is assuming that Chrome has crashed.)\n  (Driver info: chromedriver=78.0.3904.11 (eaaa
e9de6b8999773fa33f92ce1e1bbe294437cf-refs/branch-heads/3904@{#86}),platform=Windows NT 10.0.18362 x86_64)' } }

Another point is that this works inside a windows container with the version 1803, but unfortunately, I can't use that version because the Jenkins machine is using the last version of Windows (1903).


Solution

  • For anyone who has the same problem, I found a solution.

    The problem was that I was using the windows service core image, and it has a problem to render the chromium. So I need to make it work was just change the base image to use the windows client that way I can make it work.