function checkImageDiff (args) {
    //storage, driver, spec, specGenerators
    _assertMandatoryArgs(args, [
        "driver", "spec", "storage"
    ]);

    var specGenerators = args.specGenerators || $galen.settings.imageDiffSpecGenerators;

    if (!fileExists(args.storage)) {
        makeDirectory(args.storage);
    }

    var iterationDirs = listDirectory(args.storage);

    var currentIteration = 0;

    if (iterationDirs.length > 0) {
        iterationDirs.sort( function (a, b) {
            var aInt = parseInt(a) || 0;
            var bInt = parseInt(b) || 0;
            return aInt - bInt;
        });
        var selectedFolder = iterationDirs[iterationDirs.length - 1];
        currentIteration = parseInt(selectedFolder);

        var pageSpec = parsePageSpec(args);
        pageSpec.clearSections();

        var totalObjects = 0;

        forMap(specGenerators, function (imageDiffGroupName, imageDiffGroup) {
            var imageDiffObjects = GalenUtils.listToArray(pageSpec.findObjectsInGroup(imageDiffGroupName));

            totalObjects += imageDiffObjects.length;

            forArray(imageDiffObjects, function (imageDiffObjectName) {
                pageSpec.addSpec("Image Diff Validation", 
                    imageDiffObjectName, 
                    imageDiffGroup(args.storage + "/" + selectedFolder + "/objects/" + imageDiffObjectName + ".png")
                );
            });
        });

        if (totalObjects === 0) {
            throw new Error("Couldn't find any objects for " + imageDiffGroup + " group");
        }

        logged("Verifying image diffs with #" + selectedFolder + " iteration", function () {
            checkPageSpecLayout(args.driver, pageSpec);
        });
    }
        
    currentIteration += 1;
    var iterationPath = args.storage + "/" + currentIteration;

    logged("Creating page dump to " + iterationPath, function () {
        var dumpArgs = {};
        copyProperties(dumpArgs, args);
        copyProperties(dumpArgs, {
            exportPath: iterationPath,
            onlyImages: true,
            excludedObjects: ["screen", "viewport"]
        });
        dumpPage(dumpArgs);
    });

    if (iterationDirs.length == 0) {
        throw new Error("Couldn't find any previous iterations");
    }
}
/**
 * Will only work with galen 2.2+
 */
Will only work with galen 2.2+
Will only work with galen 2 . 2 +
function checkImageDiff (args) {
    _assertMandatoryArgs(args, [
        "driver", "spec", "storage"
    ]);
    var specGenerators = args.specGenerators || $galen.settings.imageDiffSpecGenerators;
    if (!fileExists(args.storage)) {
        makeDirectory(args.storage);
    }
    var iterationDirs = listDirectory(args.storage);
    var currentIteration = 0;
    if (iterationDirs.length > 0) {
        iterationDirs.sort( function (a, b) {
            var aInt = parseInt(a) || 0;
            var bInt = parseInt(b) || 0;
            return aInt - bInt;
        });
        var selectedFolder = iterationDirs[iterationDirs.length - 1];
        currentIteration = parseInt(selectedFolder);
        var pageSpec = parsePageSpec(args);
        pageSpec.clearSections();
        var totalObjects = 0;
        forMap(specGenerators, function (imageDiffGroupName, imageDiffGroup) {
            var imageDiffObjects = GalenUtils.listToArray(pageSpec.findObjectsInGroup(imageDiffGroupName));
            totalObjects += imageDiffObjects.length;
            forArray(imageDiffObjects, function (imageDiffObjectName) {
                pageSpec.addSpec("Image Diff Validation", 
                    imageDiffObjectName, 
                    imageDiffGroup(args.storage + "/" + selectedFolder + "/objects/" + imageDiffObjectName + ".png")
                );
            });
        });
        if (totalObjects === 0) {
            throw new Error("Couldn't find any objects for " + imageDiffGroup + " group");
        }
        logged("Verifying image diffs with #" + selectedFolder + " iteration", function () {
            checkPageSpecLayout(args.driver, pageSpec);
        });
    }
    currentIteration += 1;
    var iterationPath = args.storage + "/" + currentIteration;
    logged("Creating page dump to " + iterationPath, function () {
        var dumpArgs = {};
        copyProperties(dumpArgs, args);
        copyProperties(dumpArgs, {
            exportPath: iterationPath,
            onlyImages: true,
            excludedObjects: ["screen", "viewport"]
        });
        dumpPage(dumpArgs);
    });
    if (iterationDirs.length == 0) {
        throw new Error("Couldn't find any previous iterations");
    }
}
function checkImageDiff ( args ) { _assertMandatoryArgs ( args , [ "driver" , "spec" , "storage" ] ) ; var specGenerators = args . specGenerators || $galen . settings . imageDiffSpecGenerators ; if ( ! fileExists ( args . storage ) ) { makeDirectory ( args . storage ) ; } var iterationDirs = listDirectory ( args . storage ) ; var currentIteration = 0 ; if ( iterationDirs . length > 0 ) { iterationDirs . sort ( function ( a , b ) { var aInt = parseInt ( a ) || 0 ; var bInt = parseInt ( b ) || 0 ; return aInt - bInt ; } ) ; var selectedFolder = iterationDirs [ iterationDirs . length - 1 ] ; currentIteration = parseInt ( selectedFolder ) ; var pageSpec = parsePageSpec ( args ) ; pageSpec . clearSections ( ) ; var totalObjects = 0 ; forMap ( specGenerators , function ( imageDiffGroupName , imageDiffGroup ) { var imageDiffObjects = GalenUtils . listToArray ( pageSpec . findObjectsInGroup ( imageDiffGroupName ) ) ; totalObjects += imageDiffObjects . length ; forArray ( imageDiffObjects , function ( imageDiffObjectName ) { pageSpec . addSpec ( "Image Diff Validation" , imageDiffObjectName , imageDiffGroup ( args . storage + "/" + selectedFolder + "/objects/" + imageDiffObjectName + ".png" ) ) ; } ) ; } ) ; if ( totalObjects === 0 ) { throw new Error ( "Couldn't find any objects for " + imageDiffGroup + " group" ) ; } logged ( "Verifying image diffs with #" + selectedFolder + " iteration" , function ( ) { checkPageSpecLayout ( args . driver , pageSpec ) ; } ) ; } currentIteration += 1 ; var iterationPath = args . storage + "/" + currentIteration ; logged ( "Creating page dump to " + iterationPath , function ( ) { var dumpArgs = { } ; copyProperties ( dumpArgs , args ) ; copyProperties ( dumpArgs , { exportPath : iterationPath , onlyImages : true , excludedObjects : [ "screen" , "viewport" ] } ) ; dumpPage ( dumpArgs ) ; } ) ; if ( iterationDirs . length == 0 ) { throw new Error ( "Couldn't find any previous iterations" ) ; } }
Will only work with galen 2.2+
Will only work with galen 2 . 2 +
//storage, driver, spec, specGenerators