E2E 测试电子与 Spectron - Docker Windows
E2E Test Electron With Spectron - Docker Windows
我正在 Electron 中的应用程序 运行ning 中进行 E2E 测试,以使其能够 运行 在 Jenkins 的管道中,我将其放在 docker 容器中那是 运行 一个 windows 服务(内部版本 1903)映像。问题是 chrome 驱动程序在容器内崩溃。
我正在使用这些依赖项(Spectron 和 electron):
"electron": "^6.0.12",
"spectron": "^8.0.0"
我收到这个错误:
{ 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)' } }
另一点是,它可以在版本为 1803 的 windows 容器中运行,但不幸的是,我无法使用该版本,因为 Jenkins 机器使用的是 Windows 的最新版本( 1903).
对于遇到同样问题的人,我找到了解决方案。
问题是我使用的是 windows 服务核心图像,它在渲染 chromium 时出现问题。所以我需要让它工作,只需更改基本图像以使用 windows 客户端,这样我就可以让它工作。
我正在 Electron 中的应用程序 运行ning 中进行 E2E 测试,以使其能够 运行 在 Jenkins 的管道中,我将其放在 docker 容器中那是 运行 一个 windows 服务(内部版本 1903)映像。问题是 chrome 驱动程序在容器内崩溃。
我正在使用这些依赖项(Spectron 和 electron):
"electron": "^6.0.12",
"spectron": "^8.0.0"
我收到这个错误:
{ 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)' } }
另一点是,它可以在版本为 1803 的 windows 容器中运行,但不幸的是,我无法使用该版本,因为 Jenkins 机器使用的是 Windows 的最新版本( 1903).
对于遇到同样问题的人,我找到了解决方案。
问题是我使用的是 windows 服务核心图像,它在渲染 chromium 时出现问题。所以我需要让它工作,只需更改基本图像以使用 windows 客户端,这样我就可以让它工作。