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

Commit

Permalink
fix(runner): webdriver could get into lock when there is async promise
Browse files Browse the repository at this point in the history
  • Loading branch information
hankduan committed Sep 30, 2014
1 parent 91135f2 commit f4e6b40
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,16 @@ Runner.prototype.run = function() {
}).then(function() {
driver = self.driverprovider_.getDriver();
});

// 2) Execute test cases
// 2) Webdriver could schedule this out of order if not in separate 'then'
// See https://github.com/angular/protractor/issues/1385
}).then(function() {
return driver.manage().timeouts()
.setScriptTimeout(self.config_.allScriptsTimeout);
// 3) Execute test cases
}).then(function() {
var deferred = q.defer();
driver.manage().timeouts().setScriptTimeout(self.config_.allScriptsTimeout);
self.setupGlobals_.bind(self)(driver);


// Do the framework setup here so that jasmine and mocha globals are
// available to the onPrepare function.
var frameworkPath = '';
Expand All @@ -266,7 +268,7 @@ Runner.prototype.run = function() {

return deferred.promise;

// 3) Teardown
// 4) Teardown
}).then(function(result) {
self.emit('testsDone', result.failedCount);
testResult = result;
Expand All @@ -279,7 +281,7 @@ Runner.prototype.run = function() {
} else {
return self.driverprovider_.teardownEnv();
}
// 4) Exit process
// 5) Exit process
}).then(function() {
var passed = testResult.failedCount === 0;
var exitCode = passed ? 0 : 1;
Expand Down

0 comments on commit f4e6b40

Please sign in to comment.