Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
fix: prevent endless loop when suitesPerSession is set to infinity
Browse files Browse the repository at this point in the history
Once all suites have run, runner should perform retries in a new browser session. If parameter suitesPerSession is set to infinity (which is a default value), getBrowser method fails to quit previous session because force quit is missing in the freeBrowser method call, and getBrowser is called again recursively.
  • Loading branch information
leonsabr committed Dec 27, 2016
1 parent d2232fb commit 2b399b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/runner/browser-runner/browser-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = class BrowserAgent {
return this._pool.getBrowser(this.browserId)
.then((browser) => {
if (_.includes(this._sessions, browser.sessionId)) {
return this.freeBrowser(browser).then(() => this.getBrowser());
return this.freeBrowser(browser, {force: true}).then(() => this.getBrowser());
}

this._sessions.push(browser.sessionId);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/runner/browser-runner/browser-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('runner/browser-runner/browser-agent', () => {
.then((bro) => {
assert.equal(bro, otherBro);
assert.calledTwice(browserPool.getBrowser);
assert.calledWith(browserPool.freeBrowser, someBro);
assert.calledWith(browserPool.freeBrowser, someBro, {force: true});
});
});

Expand Down

0 comments on commit 2b399b6

Please sign in to comment.