【问题标题】:Azure Pipeline E2E Testing: unknown error: Chrome failed to start: exited abnormallyAzure Pipeline E2E 测试:未知错误:Chrome 无法启动:异常退出
【发布时间】:2020-12-28 12:04:27
【问题描述】:

我即将在 azure 管道中运行量角器测试。 以下步骤是成功的,

  1. npm 安装
  2. 网络驱动更新

运行“npm run e2e”时出现以下错误(以空格突出显示),

2020-12-28T11:24:00.1123719Z Date: 2020-12-28T11:24:00.108Z - Hash: 3bfb7dbf8249d8ecd0a9 - Time: 44081ms
2020-12-28T11:24:00.1205386Z ** Angular Live Development Server is listening on localhost:4203, open your browser on http://localhost:4203/ **
2020-12-28T11:24:00.1739298Z [34mℹ[39m [90m「wdm」[39m: Compiled successfully.
2020-12-28T11:24:01.9754480Z [11:24:01] I/launcher - Running 1 instances of WebDriver
2020-12-28T11:24:01.9755656Z [11:24:01] I/direct - Using ChromeDriver directly...


2020-12-28T11:24:06.7970214Z [11:24:06] E/launcher - unknown error: Chrome failed to start: exited abnormally.
2020-12-28T11:24:06.7972134Z   (unknown error: DevToolsActivePort file doesn't exist)
2020-12-28T11:24:06.7980054Z   (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)



2020-12-28T11:24:06.7981720Z   (Driver info: chromedriver=87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280@{#1761}),platform=Linux 4.15.0-1100-azure x86_64)
2020-12-28T11:24:06.7982724Z [11:24:06] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally.
2020-12-28T11:24:06.7983474Z   (unknown error: DevToolsActivePort file doesn't exist)
2020-12-28T11:24:06.7984515Z   (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
2020-12-28T11:24:06.7985577Z   (Driver info: chromedriver=87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280@{#1761}),platform=Linux 4.15.0-1100-azure x86_64)
2020-12-28T11:24:06.7986586Z     at Object.checkLegacyResponse (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/error.js:546:15)
2020-12-28T11:24:06.7987489Z     at parseHttpResponse (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/http.js:509:13)
2020-12-28T11:24:06.7988405Z     at doSend.then.response (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/http.js:441:30)
2020-12-28T11:24:06.7988962Z     at process._tickCallback (internal/process/next_tick.js:68:7)
2020-12-28T11:24:06.7989391Z From: Task: WebDriver.createSession()
2020-12-28T11:24:06.7990163Z     at Function.createSession (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
2020-12-28T11:24:06.7991076Z     at Function.createSession (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/chrome.js:761:15)
2020-12-28T11:24:06.7992017Z     at Direct.getNewDriver (/home/vsts/work/1/s/amaze-commerce/node_modules/protractor/built/driverProviders/direct.js:77:33)
2020-12-28T11:24:06.7992916Z     at Runner.createBrowser (/home/vsts/work/1/s/amaze-commerce/node_modules/protractor/built/runner.js:195:43)
2020-12-28T11:24:06.7993802Z     at q.then.then (/home/vsts/work/1/s/amaze-commerce/node_modules/protractor/built/runner.js:339:29)
2020-12-28T11:24:06.8001078Z     at _fulfilled (/home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:834:54)
2020-12-28T11:24:06.8001877Z     at /home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:863:30
2020-12-28T11:24:06.8002782Z     at Promise.promise.promiseDispatch (/home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:796:13)
2020-12-28T11:24:06.8003556Z     at /home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:556:49
2020-12-28T11:24:06.8004307Z     at runSingle (/home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:137:13)
2020-12-28T11:24:06.8005078Z [11:24:06] E/launcher - Process exited with error code 199
2020-12-28T11:24:07.4394944Z npm ERR! code ELIFECYCLE
2020-12-28T11:24:07.4395828Z npm ERR! errno 1
2020-12-28T11:24:07.4462731Z npm ERR! amaze-commerce@1.0.0 e2etest: `node --max_old_space_size=35000 ./node_modules/@angular/cli/bin/ng e2e`
2020-12-28T11:24:07.4465097Z npm ERR! Exit status 1
2020-12-28T11:24:07.4468705Z npm ERR! 
2020-12-28T11:24:07.4472803Z npm ERR! Failed at the amaze-commerce@1.0.0 e2etest script.
2020-12-28T11:24:07.4475619Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-12-28T11:24:07.4546066Z 
2020-12-28T11:24:07.4546683Z npm ERR! A complete log of this run can be found in:
2020-12-28T11:24:07.4547625Z npm ERR!     /home/vsts/.npm/_logs/2020-12-28T11_24_07_448Z-debug.log
2020-12-28T11:24:07.4656714Z ##[error]Bash exited with code '1'.
2020-12-28T11:24:07.4737893Z ##[section]Finishing: run e2e test

请在这个问题上帮助我。 提前致谢。

【问题讨论】:

  • 本地运行“npm run e2e”,结果如何?您使用哪个代理池?您可以将 system.debug 变量设置为 true 并检查是否有更详细的日志。
  • 本地没问题,运行成功。
  • 您使用哪个代理池?您是否尝试过将 system.debug 变量设置为 true?你能得到更详细的日志吗?

标签: node.js angular azure-devops protractor e2e-testing


【解决方案1】:

在 protractor.conf 文件中添加下面的 chromeOptions

  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: ['--disable-gpu', '--no-sandbox','--headless', '--disable-extensions', '--disable-dev-shm-usage']
    }

--disable-dev-shm-usage : 克服资源有限的问题

// The /dev/shm partition is too small in certain VM environments, causing
// Chrome to fail or crash (see http://crbug.com/715363). Use disable-dev-shm-usage flag to
// work-around this issue (a temporary directory will always be used to create
// anonymous shared memory files).

【讨论】:

  • 同样添加,问题依旧没有变化。
猜你喜欢
  • 2014-04-20
  • 2016-10-08
  • 2017-09-07
  • 1970-01-01
  • 2021-04-19
  • 2020-04-21
  • 2023-01-07
  • 2015-08-14
  • 1970-01-01
相关资源
最近更新 更多