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

Commit 9cc0f63

Browse files
committed
fix(runner): gracefully shutdown browsers after test
1 parent 1e03e77 commit 9cc0f63

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/runner.js

+10
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,14 @@ Runner.prototype.run = function() {
200200

201201
this.setTestPreparer(this.config_.onPrepare);
202202

203+
var gracefulShutdown = function(driver) {
204+
return driver.getSession().then(function(session_) {
205+
if (session_) {
206+
return driver.quit();
207+
}
208+
});
209+
};
210+
203211
// 1) Setup environment
204212
//noinspection JSValidateTypes
205213
return this.driverprovider_.setupEnv().then(function() {
@@ -254,6 +262,8 @@ Runner.prototype.run = function() {
254262
var passed = testResult.failedCount === 0;
255263
var exitCode = passed ? 0 : 1;
256264
return self.exit_(exitCode);
265+
}).fin(function() {
266+
return gracefulShutdown(driver);
257267
});
258268
};
259269

0 commit comments

Comments
 (0)