Skip to content

Commit 6a4f416

Browse files
author
John Doherty
committed
updated world.js after event to close the browser using promises
1 parent fd333bc commit 6a4f416

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selenium-cucumber-js",
3-
"version": "1.2.7",
3+
"version": "1.2.8",
44
"description": "A debuggable JS BDD framework that uses the official selenium-webdriver for Node and cucumber-js",
55
"main": "index.js",
66
"scripts": {

runtime/world.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,22 +173,25 @@ module.exports = function () {
173173
});
174174

175175
// executed after each scenario (always closes the browser to ensure fresh tests)
176-
this.After(function (scenario, done) {
176+
this.After(function (scenario) {
177177

178178
if (scenario.isFailed()) {
179179

180180
// add a screenshot to the error report
181-
driver.takeScreenshot().then(function (screenShot) {
181+
return driver.takeScreenshot().then(function (screenShot) {
182+
182183
scenario.attach(new Buffer(screenShot, 'base64'), 'image/png');
183-
driver.close();
184-
driver.quit().then(done);
185-
});
186184

185+
return driver.close().then(function(){
186+
return driver.quit();
187+
});
188+
});
187189
}
188190
else {
189191

190-
driver.close();
191-
driver.quit().then(done);
192+
return driver.close().then(function(){
193+
return driver.quit();
194+
});
192195
}
193196
});
194197
};

0 commit comments

Comments
 (0)