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ACZ,SAAU,KACA,UAAU,OAAS,QAAsB,IAAjB,UAAU,KAAmB,UAAU,GAGxE,GAAG,IAAI,GAAS,OAAO,OAAQ,QAAS,kBAExC,GAAG,IAAI,GAAS,OAAO,OAAQ,QAAS,eAI5C,GACF,EAEA,OAAO,QAAU","file":"/npm/cypress-image-diff-nk@0.0.6/dist/command.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/cypress-image-diff-nk@0.0.6/dist/command.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n\nvar _cypressRecurse = require(\"cypress-recurse\");\n\nvar compareSnapshotCommand = function compareSnapshotCommand(defaultScreenshotOptions) {\n  var height = Cypress.config('viewportHeight') || 1440;\n  var width = Cypress.config('viewportWidth') || 1980;\n  var defaultThreshold = (Cypress.config('env') || {}).defaultImageDiffThreshold || 0; // Force screenshot resolution to keep consistency of test runs across machines\n\n  Cypress.config('viewportHeight', parseInt(height, 10));\n  Cypress.config('viewportWidth', parseInt(width, 10));\n  Cypress.Commands.add('compareSnapshot', {\n    prevSubject: 'optional'\n  }, function (subject, name) {\n    var testThreshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultThreshold;\n    var recurseOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n    var specName = Cypress.spec.name;\n    var testName = \"\".concat(specName.replace('.js', ''), \"-\").concat(name);\n    var defaultRecurseOptions = {\n      limit: 1,\n      log: function log(percentage) {\n        var prefix = percentage <= testThreshold ? 'PASS' : 'FAIL';\n        cy.log(\"\".concat(prefix, \": Image difference percentage \").concat(percentage));\n      },\n      error: \"Image difference greater than threshold: \".concat(testThreshold)\n    };\n    (0, _cypressRecurse.recurse)(function () {\n      // Clear the comparison/diff screenshots/reports for this test\n      cy.task('deleteScreenshot', {\n        testName: testName\n      });\n      cy.task('deleteReport', {\n        testName: testName\n      }); // Take a screenshot and copy to baseline if it does not exist\n\n      var objToOperateOn = subject ? cy.get(subject) : cy;\n      objToOperateOn.screenshot(testName, defaultScreenshotOptions).task('copyScreenshot', {\n        testName: testName\n      }); // Compare screenshots\n\n      var options = {\n        testName: testName,\n        testThreshold: testThreshold\n      };\n      return cy.task('compareSnapshotsPlugin', options);\n    }, function (percentage) {\n      return percentage <= testThreshold;\n    }, Object.assign({}, defaultRecurseOptions, recurseOptions));\n  });\n  Cypress.Commands.add('hideElement', {\n    prevSubject: 'optional'\n  }, function (subject) {\n    var hide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n    if (hide) {\n      cy.get(subject).invoke('attr', 'style', \"display: none;\");\n    } else {\n      cy.get(subject).invoke('attr', 'style', \"display: '';\");\n    }\n\n    return undefined;\n  });\n};\n\nmodule.exports = compareSnapshotCommand;"]}