lib/server/datastores/resultsDatastore.js
function saveScreenshotIfExists(testResults) {
        var deferred = Q.defer();

        if (testResults.screenshotBuffer) {

            var screenshotFilePath = path.join(resultsDir, testResults.runId, resultScreenshotName);
            fs.writeFile(screenshotFilePath, testResults.screenshotBuffer);

            delete testResults.screenshotBuffer;

        } else {
            deferred.resolve();
        }

        return deferred;
    }
function saveScreenshotIfExists(testResults) {
        var deferred = Q.defer();

        if (testResults.screenshotBuffer) {

            var screenshotFilePath = path.join(resultsDir, testResults.runId, resultScreenshotName);
            fs.writeFile(screenshotFilePath, testResults.screenshotBuffer);

            delete testResults.screenshotBuffer;

        } else {
            deferred.resolve();
        }

        return deferred;
    }
function saveScreenshotIfExists ( testResults ) { var deferred = Q . defer ( ) ; if ( testResults . screenshotBuffer ) { var screenshotFilePath = path . join ( resultsDir , testResults . runId , resultScreenshotName ) ; fs . writeFile ( screenshotFilePath , testResults . screenshotBuffer ) ; delete testResults . screenshotBuffer ; } else { deferred . resolve ( ) ; } return deferred ; }
If there is a screenshot, save it as screenshot.jpg in the same folder as the results
If there is a screenshot save it as screenshot . jpg in the same folder as the results