From 29f1aff801cf39e7fd19449c0cca4f96df1ed6b8 Mon Sep 17 00:00:00 2001 From: Craig Nishina Date: Wed, 16 Nov 2016 21:01:25 -0800 Subject: [PATCH] chore(test): interaction tests - webdriver.quit throws a no session error - define "quit" at runner.ts similar to restart where the driverprovider calls quit instead of the webdriver --- lib/runner.ts | 5 +++++ scripts/attachSession.js | 2 +- spec/interaction/interaction_spec.js | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/runner.ts b/lib/runner.ts index eee47b4c2..37a93ab37 100644 --- a/lib/runner.ts +++ b/lib/runner.ts @@ -257,6 +257,11 @@ export class Runner extends EventEmitter { this.setupGlobals_(browser_); }; + browser_.quit = + () => { + this.driverprovider_.quitDriver(browser_.driver); + } + return browser_; } diff --git a/scripts/attachSession.js b/scripts/attachSession.js index ebd3c0ca6..9e195fb85 100644 --- a/scripts/attachSession.js +++ b/scripts/attachSession.js @@ -9,7 +9,7 @@ var sessionId = ''; // 1. Create a new selenium session. var postData = JSON.stringify( - {'desiredCapabilities': {'browserName': 'chrome'}}); + {'desiredCapabilities': {'browserName': 'firefox'}}); var createOptions = { hostname: 'localhost', port: 4444, diff --git a/spec/interaction/interaction_spec.js b/spec/interaction/interaction_spec.js index becfe3bdd..36438b5c3 100644 --- a/spec/interaction/interaction_spec.js +++ b/spec/interaction/interaction_spec.js @@ -11,9 +11,8 @@ describe('Browser', function() { // throughout all of your tests). However, I'm forking browsers in my tests // and don't want to pile up my browser count. if (newBrowser) { - newBrowser.quit().then(function() { - done(); - }); + newBrowser.quit(); + done(); } else { done(); }