1

我正在尝试使用@angular/cliUbuntu 16.04.2 x64 (Digital Ocean)运行e2e (ng e2e)测试, 系统抛出下一个错误:

[19:06:51] I/update - chromedriver: unzipping chromedriver_2.31.zip
[19:06:52] I/update - chromedriver: setting permissions to 0755 for /var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.31
[19:06:52] I/update - chromedriver: chromedriver_2.31 up to date
[19:06:52] I/launcher - Running 1 instances of WebDriver
[19:06:52] I/direct - Using ChromeDriver directly...
[19:07:53] E/launcher - unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Linux 4.4.0-83-generic x86_64)
[19:07:53] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Linux 4.4.0-83-generic x86_64)
    at Object.checkLegacyResponse (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/selenium-webdriver/lib/error.js:505:15)
    at parseHttpResponse (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/selenium-webdriver/lib/http.js:440:13)
    at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
    at Function.createSession (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
    at Function.createSession (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/selenium-webdriver/chrome.js:709:29)
    at Direct.getNewDriver (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/built/driverProviders/direct.js:77:33)
    at Runner.createBrowser (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/built/runner.js:195:43)
    at q.then.then (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/built/runner.js:339:29)
    at _fulfilled (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/node_modules/q/q.js:796:13)
    at /var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/node_modules/q/q.js:556:49
    at runSingle (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/node_modules/q/q.js:137:13)
    at flush (/var/lib/jenkins/workspace/synctive_insynctive2_master-K4DWE65EX25OYDIWIK3ALYX67LFQGPTCQV6C56IBXDIXXOVGYBRA/HubIns/node_modules/protractor/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
[19:07:53] E/launcher - Process exited with error code 199
4

1 回答 1

1

解决了这个问题:

我安装了:

sudo apt-get install -y xvfb
sudo apt-get install -y  xfonts-100dpi xfonts-75dpi xfonts-cyrillic  dbus-x11

还有魔法:

xvfb-run -a -e /dev/stdout -s "-screen 0 2920x2580x24" ng e2e
于 2017-09-07T21:15:13.113 回答