Skip to content

The "save screenshot" code needs changing #19

Description

@jaffamonkey

The "save screenshot" code needs changing. Node conversion from image to base64 was getting corrupted. Not entirely sure why, but it's related to newer version of Node. If you remove the mime type prior to base64 conversion, and omit the conversion to binary, it works fine. The following code works (tested!).

this.After(function (scenario, callback) {
        if (scenario.isFailed()) {
            browser.takeScreenshot().then(function (png) {
                var decodedImage = new Buffer(png.replace(/^data:image\/(png|gif|jpeg);base64,/,''), 'base64');
                scenario.attach(decodedImage, 'image/png');
                callback();
            });
        }
        else {
            callback();
        }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions