仅在TeamCity上使用@ angular / cli脚本不起作用

时间:2017-05-24 21:01:29

标签: angular npm continuous-integration teamcity angular-cli

我正在使用TeamCity 10并尝试获取@angular/cli项目以在构建步骤中执行以下操作: enter image description here 一切都运行良好,直到e2e脚本。它停止了构建,我不得不强制关闭它。

所以我远程登录到我的构建代理并尝试在它刚刚提取的代码位置运行命令ng e2e,然后我得到一个Chrome浏览器窗口,但在10秒内它崩溃了以下错误:

PS C:\TeamCity\BuildAgent\work\4038db2ebec7f79b> npm run e2e

> tdportal@0.0.0 e2e C:\TeamCity\BuildAgent\work\4038db2ebec7f79b
> ng e2e

** NG Live Development Server is listening on localhost:49152, open your browser on http://localhost:49152 **
(node:5660) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
Hash: 4e69738611fdf13a3b2b
Time: 24258ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 158 kB {5} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.js.map (main) 70.9 kB {4} [initial] [rendered]
chunk    {2} scripts.bundle.js, scripts.bundle.js.map (scripts) 910 kB {5} [initial] [rendered]
chunk    {3} styles.bundle.js, styles.bundle.js.map (styles) 420 kB {5} [initial] [rendered]
chunk    {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 4.32 MB [initial] [rendered]
chunk    {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.
[14:40:49] I/update - chromedriver: file exists C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.29.zip
[14:40:49] I/update - chromedriver: unzipping chromedriver_2.29.zip
[14:40:50] I/update - chromedriver: chromedriver_2.29.exe up to date
[14:40:50] I/launcher - Running 1 instances of WebDriver
[14:40:50] I/direct - Using ChromeDriver directly...
Spec started
[14:41:07] E/protractor - Could not find Angular on page http://localhost:49152/ : retries looking for angular exceeded

  tdportal App
    × should display message saying Team Digital Portal
      - Failed: Angular could not be found on the page http://localhost:49152/.If this is not an Angular application, you may need to turn off waiting for Angular.
            Please see https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular-on-page-load
            Please see https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular-on-page-load
      at executeAsyncScript_.then (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\protractor\lib\browser.ts:936:29)
      at ManagedPromise.invokeCallback_ (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\promise.js:1366:14)
      at TaskQueue.execute_ (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\promise.js:2970:14)
      at TaskQueue.executeNext_ (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\promise.js:2953:27)
      at asyncRun (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\promise.js:2813:27)
      at C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\promise.js:676:7
      at process._tickCallback (internal/process/next_tick.js:109:7)
  From: Task: Run it("should display message saying Team Digital Portal") in control flow
      at ControlFlow.emit (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\events.js:62:21)
      at ControlFlow.shutdown_ (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\promise.js:2565:10)
      at shutdownTask_.MicroTask (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\promise.js:2490:53)
      at MicroTask.asyncRun (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\promise.js:2619:9)
      at C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\selenium-webdriver\lib\promise.js:676:7
      at process._tickCallback (internal/process/next_tick.js:109:7)
  From asynchronous test:
  Error
      at Suite.<anonymous> (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\e2e\app.e2e-spec.ts:10:3)
      at Object.<anonymous> (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\e2e\app.e2e-spec.ts:3:1)
      at Module._compile (module.js:571:32)
      at Module.m._compile (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\ts-node\src\index.ts:406:23)
      at Module._extensions..js (module.js:580:10)
      at Object.require.extensions.(anonymous function) [as .ts] (C:\TeamCity\BuildAgent\work\4038db2ebec7f79b\node_modules\ts-node\src\index.ts:409:12)
      at Module.load (module.js:488:32)
      at tryModuleLoad (module.js:447:12)
      at Function.Module._load (module.js:439:3)
      at Module.require (module.js:498:17)
      at require (internal/module.js:20:19)

**************************************************
*                    Failures                    *
**************************************************

1) tdportal App should display message saying Team Digital Portal
  - Failed: Angular could not be found on the page http://localhost:49152/.If this is not an Angular application, you may need to turn off waiting for Angular.
                        Please see
                        https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular-on-page-load

Executed 1 of 1 spec (1 FAILED) in 13 secs.
[14:41:07] I/launcher - 0 instance(s) of WebDriver still running
[14:41:07] I/launcher - chrome #01 failed 1 test(s)
[14:41:07] I/launcher - overall: 1 failed spec(s)
[14:41:07] E/launcher - Process exited with error code 1

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "e2e"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tdportal@0.0.0 e2e: `ng e2e`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tdportal@0.0.0 e2e script 'ng e2e'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the tdportal package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ng e2e
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs tdportal
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls tdportal
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\J.Smith\AppData\Roaming\npm-cache\_logs\2017-05-24T20_41_07_438Z-debug.log

为什么我不能在这台机器上运行我的e2e测试呢?我需要做些什么不同的事情?

1 个答案:

答案 0 :(得分:1)

E2E测试要求在TeamCity代理上启动Chrome以运行测试,并且由于代理运行时未与桌面交互,因此您无法使用Chrome运行您的E2E测试。相反,您需要配置Karma以使用PhantomJs运行您的E2E测试。 Phantom是一款无头浏览器,无需与桌面交互即可运行。让我知道如果你需要一个例子,我必须挖掘我的。