{"version":3,"sources":["../../src/cypress-api/support.ts","../../src/cypress-api/commands.ts"],"names":["snapshot","Cypress","Commands","add","cy","document","then","doc","manualSnapshot","get","snapshots","as","beforeEach","wrap","task","action","afterEach","snap","manualSnapshots","url","payload","testTitle","currentTest","title","domSnapshots","chromaticStorybookParams","diffThreshold","env","pageUrl"],"mappings":"AAAA,OAASA,YAAAA,MAAgB,iBCAzB,OAASA,YAAAA,MAAgB,iBAGzBC,QAAQC,SAASC,IAAI,uBAAwB,IAAA,CAC3CC,GAAGC,SAAQ,EAAGC,KAAMC,GAAAA,CAElB,IAAMC,EAAiBR,EAASO,CAAAA,EAEhCH,GAAGK,IAAI,kBAAA,EAEJH,KAAMI,GACE,IAAIA,EAAWF,EACxB,EACCG,GAAG,iBAAA,CACR,CAAA,CACF,CAAA,EDXAC,WAAW,IAAA,CAITR,GAAGS,KAAK,CAAA,CAAE,EAAEF,GAAG,iBAAA,EACfP,GAAGU,KAAK,kBAAmB,CAAEC,OAAQ,wBAAyB,CAAA,CAChE,CAAA,EAEAC,UAAU,IAAA,CAERZ,GAAGC,SAAQ,EAAGC,KAAMC,GAAAA,CAClB,IAAMU,EAAOjB,EAASO,CAAAA,EAEtBH,GAAGK,IAAI,kBAAA,EAAoBH,KAAK,CAACY,EAAkB,CAAA,IAAE,CACnDd,GAAGe,IAAG,EAAGb,KAAMa,GAAAA,CAEbf,GAAGU,KAAK,kBAAmB,CACzBC,OAAQ,gBACRK,QAAS,CACPC,UAAWpB,QAAQqB,YAAYC,MAC/BC,aAAc,IAAIN,EAAiBD,GACnCQ,yBAA0B,CACxBC,cAAezB,QAAQ0B,IAAI,eAAA,CAC7B,EACAC,QAAST,CACX,CACF,CAAA,CACF,CAAA,CACF,CAAA,CACF,CAAA,CACF,CAAA","sourcesContent":["import { snapshot } from 'rrweb-snapshot';\nimport './commands';\n\n// these client-side lifecycle hooks will be added to the user's Cypress suite\nbeforeEach(() => {\n  // this \"manualSnapshots\" variable will be available before, during, and after the test,\n  // then cleaned up before the next test is run\n  // (see https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Aliases)\n  cy.wrap([]).as('manualSnapshots');\n  cy.task('prepareArchives', { action: 'setup-network-listener' });\n});\n\nafterEach(() => {\n  // can we be sure this always fires after all the requests are back?\n  cy.document().then((doc) => {\n    const snap = snapshot(doc);\n    // @ts-expect-error will fix when Cypress has its own package\n    cy.get('@manualSnapshots').then((manualSnapshots = []) => {\n      cy.url().then((url) => {\n        // pass the snapshot to the server to write to disk\n        cy.task('prepareArchives', {\n          action: 'save-archives',\n          payload: {\n            testTitle: Cypress.currentTest.title,\n            domSnapshots: [...manualSnapshots, snap],\n            chromaticStorybookParams: {\n              diffThreshold: Cypress.env('diffThreshold'),\n            },\n            pageUrl: url,\n          },\n        });\n      });\n    });\n  });\n});\n","import { snapshot } from 'rrweb-snapshot';\nimport type { elementNode } from 'rrweb-snapshot';\n// @ts-expect-error will fix when Cypress has its own package\nCypress.Commands.add('takeChromaticArchive', () => {\n  cy.document().then((doc) => {\n    // here, handle the source map\n    const manualSnapshot = snapshot(doc);\n    // reassign manualSnapshots so it includes this new snapshot\n    cy.get('@manualSnapshots')\n      // @ts-expect-error will fix when Cypress has its own package\n      .then((snapshots: elementNode[]) => {\n        return [...snapshots, manualSnapshot];\n      })\n      .as('manualSnapshots');\n  });\n});\n"]}