fix(e2e): fix race condition

This commit is contained in:
Filipe Silva 2016-03-30 05:23:43 +01:00 committed by Ward Bell
parent 76abf7bebd
commit 3ec0e7147b
2 changed files with 46 additions and 43 deletions

View File

@ -153,14 +153,17 @@ function findAndRunE2eTests(filter) {
// to the outputFile.
function runE2eTests(appDir, protractorConfigFilename, outputFile ) {
// start the app
var appRunSpawnInfo = spawnExt('npm',['run','http-server', '--', '-s' ], { cwd: appDir });
var appRunSpawnInfo = spawnExt('npm',['run','http-server:e2e', '--', '-s' ], { cwd: appDir });
var tscRunSpawnInfo = spawnExt('npm',['run','tsc'], { cwd: appDir });
return tscRunSpawnInfo.promise.then(function(data) {
// start protractor
var pcFilename = path.resolve(protractorConfigFilename); // need to resolve because we are going to be running from a different dir
var exePath = path.join(process.cwd(), "./node_modules/.bin/");
var spawnInfo = spawnExt('protractor',
[ pcFilename, '--params.appDir=' + appDir, '--params.outputFile=' + outputFile], { cwd: exePath });
return spawnInfo.promise.then(function(data) {
return spawnInfo.promise;
}).then(function(data) {
// kill the app now that protractor has completed.
// Ugh... proc.kill does not work properly on windows with child processes.
// appRun.proc.kill();
@ -1019,4 +1022,3 @@ function checkAngularProjectPath() {
throw new Error('API related tasks require the angular2 repo to be at ' + path.resolve(ANGULAR_PROJECT_PATH));
}
}

View File

@ -12,6 +12,7 @@
"test": "karma start karma.conf.js",
"build-and-test": "npm run tsc && npm run test",
"http-server": "tsc && http-server",
"http-server:e2e": "http-server",
"typings": "typings",
"postinstall": "typings install"
},