Skip to content

Commit

Permalink
fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Nov 25, 2020
1 parent eb85c9a commit 404710f
Showing 1 changed file with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions test/integration/full/test-webdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var args = process.argv.slice(2);

// start local server in the background
var startServer = execa('npm', ['run', 'start']);
startServer.stdout.pipe(process.stdout);

// allow running certain browsers through command line args
// (only one browser supported, run multiple times for more browsers)
Expand Down Expand Up @@ -162,25 +163,6 @@ function buildWebDriver(browser) {
};
}

/**
* Clean up and terminate
*/
function end(options) {
var errCode = options.errCode;
var killResult = startServer.kill('SIGTERM', {
forceKillAfterTimeout: 500
});

// end the program immediately if the server was terminated
// successfully, otherwise wait a second for the force kill
setTimeout(
function() {
process.exit(errCode);
},
killResult ? 0 : 1000
);
}

/**
* Start the integration tests
*/
Expand Down Expand Up @@ -208,7 +190,7 @@ function start(options) {
console.log(
'Skipped ' + options.browser + ' as it is not supported on this platform'
);
return end();
return process.exit();
}

// try to load the browser
Expand All @@ -221,7 +203,7 @@ function start(options) {
console.log();
console.log(err.message);
console.log('Aborted testing using ' + options.browser);
return end();
return process.exit();
}

// Give driver timeout options for scripts
Expand Down Expand Up @@ -249,13 +231,13 @@ function start(options) {
console.log();
});

end({ errCode: testErrors.length });
process.exit(testErrors.length);

// catch any potential problems
})
.catch(function(err) {
console.log(err);
end({ errCode: 1 });
process.exit(1);
});
}

Expand All @@ -267,6 +249,11 @@ startServer.stdout.on('data', function(chunk) {
// local server we will need to update this to match the
// server start output
if (str.includes('Starting up')) {
start({ browser: browser });
// give enough time to finish the startup before starting
// test
setTimeout(function() {
console.log('\nStarting integration test\n');
start({ browser: browser });
}, 500);
}
});

0 comments on commit 404710f

Please sign in to comment.