From 645fcd60b3b34da6d2fb4e6722abf500e4df3e77 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Tue, 9 Sep 2014 19:54:13 +0300 Subject: [PATCH] Ensure webdriver session is closed before exiting --- tests/selenium.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/selenium.js b/tests/selenium.js index cab09a6..d6f154f 100644 --- a/tests/selenium.js +++ b/tests/selenium.js @@ -172,11 +172,13 @@ browserStream.push(result.browser); }); - resultStream.onEnd(function() { - browser.quit(); + return resultStream.fold([], pushToArray).flatMap(function(value) { + return Bacon.fromCallback(function(callback) { + browser.quit(function() { + callback(value); + }); + }); }); - - return resultStream.fold([], pushToArray); } function createImages(data) {