Skip to content

Commit 755d9f2

Browse files
committed
Fix to issue1.
1 parent 4518fb3 commit 755d9f2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ protractorUtil.takeScreenshotOnExpectFail = function (context) {
5252
global.browser.takeScreenshot().then(function (png) {
5353

5454
var fileName = (config.capabilities.browserName + '-' + self.result.fullName + '-' + 'expect failure-' + protractorUtil.index++).replace(/[\/\\]/g, ' ');
55-
var stream = fs.createWriteStream((context.config.screenshotPath ? context.config.screenshotPath.replace('./', '') : 'reports/screenshots/') + fileName + '.png');
55+
var screenshotPathUserSupplied;
56+
if (context.config.screenshotPath) {
57+
if (((context.config.screenshotPath.charAt(context.config.screenshotPath.length - 1)) != '/') || ((context.config.screenshotPath.charAt(context.config.screenshotPath.length - 1)) != '\\')) {
58+
screenshotPathUserSupplied = context.config.screenshotPath + '/';
59+
}
60+
}
61+
var stream = fs.createWriteStream((screenshotPathUserSupplied ? context.config.screenshotPath.replace('./', '') : 'reports/screenshots/') + fileName + '.png');
5662
stream.write(new Buffer(png, 'base64'));
5763
stream.end();
5864
}, function (err) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jasmine2-protractor-utils",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "Utilities for Protractor with jasmine2 [HTML Reports, Screenshot, Browser Console log and more]",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)