Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
fix(runner): gracefully shutdown browsers after test
Browse files Browse the repository at this point in the history
  • Loading branch information
hankduan committed Oct 11, 2014
1 parent 1e03e77 commit 9cc0f63
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ Runner.prototype.run = function() {

this.setTestPreparer(this.config_.onPrepare);

var gracefulShutdown = function(driver) {
return driver.getSession().then(function(session_) {
if (session_) {
return driver.quit();
}
});
};

// 1) Setup environment
//noinspection JSValidateTypes
return this.driverprovider_.setupEnv().then(function() {
Expand Down Expand Up @@ -254,6 +262,8 @@ Runner.prototype.run = function() {
var passed = testResult.failedCount === 0;
var exitCode = passed ? 0 : 1;
return self.exit_(exitCode);
}).fin(function() {
return gracefulShutdown(driver);
});
};

Expand Down

0 comments on commit 9cc0f63

Please sign in to comment.