简体   繁体   中英

Angular.js tutorial running e2e test using protractor

I am following the Angular tutorial https://docs.angularjs.org/tutorial When I get to the last bit on the first page - "e2e using protractor", I do "npm run protractor" in a new command window with the local site running and karma running, but I get the below error log:

0 info it worked if it ends with ok
1 verbose cli [ 'c:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'protractor' ]
2 info using npm@2.11.2
3 info using node@v0.12.5
4 verbose run-script [ 'preprotractor', 'protractor', 'postprotractor' ]
5 info preprotractor angular-phonecat@0.0.0
6 verbose unsafe-perm in lifecycle true
7 info protractor angular-phonecat@0.0.0
8 verbose unsafe-perm in lifecycle true
9 info angular-phonecat@0.0.0 Failed to exec protractor script
10 verbose stack Error: angular-phonecat@0.0.0 protractor: `protractor test/protractor-conf.js`
10 verbose stack Exit status 1
10 verbose stack     at EventEmitter.<anonymous> (c:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
10 verbose stack     at EventEmitter.emit (events.js:110:17)
10 verbose stack     at ChildProcess.<anonymous> (c:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
10 verbose stack     at ChildProcess.emit (events.js:110:17)
10 verbose stack     at maybeClose (child_process.js:1015:16)
10 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
11 verbose pkgid angular-phonecat@0.0.0
12 verbose cwd c:\Program Files (x86)\GitExtensions\angular-phonecat
13 error Windows_NT 6.1.7601
14 error argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
15 error node v0.12.5
16 error npm  v2.11.2
17 error code ELIFECYCLE
18 error angular-phonecat@0.0.0 protractor: `protractor test/protractor-conf.js`
18 error Exit status 1
19 error Failed at the angular-phonecat@0.0.0 protractor script 'protractor test/protractor-conf.js'.
19 error This is most likely a problem with the angular-phonecat package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error     protractor test/protractor-conf.js
19 error You can get their info via:
19 error     npm owner ls angular-phonecat
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]


I had the same issue. It seems that the chromedriver.zip archive that comes with the angular-phonecat package is corrupted, making the installation of chromedriver impossible. You can go to http://chromedriver.storage.googleapis.com/index.html to download a clean archive of the chromedriver for your platform.
Go to this folder: yourwebRoot\\angular-phonecat\\node_modules\\protractor\\selenium
Remove the archive chromedriver_2.10 from the folder and extract the one you downloaded here.
In your terminal type npm run protractor to run the e2e test again. It should now work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM