From 458786b1fe087215d6c6c752b4334e35f311ef52 Mon Sep 17 00:00:00 2001 From: Bill Glesias Date: Thu, 3 Nov 2022 00:26:32 -0400 Subject: [PATCH] fix: only take snapshots if the AUT document is in state --- packages/driver/src/cy/snapshots.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/driver/src/cy/snapshots.ts b/packages/driver/src/cy/snapshots.ts index 707a83fd0b39..297758848ec1 100644 --- a/packages/driver/src/cy/snapshots.ts +++ b/packages/driver/src/cy/snapshots.ts @@ -229,6 +229,11 @@ export const create = ($$: $Cy['$$'], state: StateFunc) => { const createSnapshot = (name, $elToHighlight, preprocessedSnapshot) => { Cypress.action('cy:snapshot', name) + // only take a snapshot if the AUT document is in state to prevent cypress-in-cypress like snapshots + // or if the snapshot has been taken in a spec bridge and has already been preprocessed + if (!preprocessedSnapshot && !state('document')) { + return null + } try { const {