From 4fb96ca5d794604ca2d06b9ae8153465a1476c6e Mon Sep 17 00:00:00 2001 From: Jack Leslie <52004409+jackleslie@users.noreply.github.com> Date: Fri, 10 May 2024 16:50:51 +0100 Subject: [PATCH 1/5] Update support.ts --- packages/cypress/src/support.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cypress/src/support.ts b/packages/cypress/src/support.ts index b9b844f8..a6f93880 100644 --- a/packages/cypress/src/support.ts +++ b/packages/cypress/src/support.ts @@ -19,12 +19,12 @@ beforeEach(() => { afterEach(() => { // don't take snapshots when running `cypress open` - if (Cypress.env('disableAutoSnapshot') || !Cypress.config('isTextTerminal')) { + if (Cypress.config('isTextTerminal')) { return; } // can we be sure this always fires after all the requests are back? cy.document().then((doc) => { - const automaticSnapshot = snapshot(doc); + const automaticSnapshots = Cypress.env('disableAutoSnapshot') ? [{ snapshot: snapshot(doc) }] : []; // @ts-expect-error will fix when Cypress has its own package cy.get('@manualSnapshots').then((manualSnapshots = []) => { cy.url().then((url) => { @@ -34,7 +34,7 @@ afterEach(() => { payload: { // @ts-expect-error relativeToCommonRoot is on spec (but undocumented) testTitlePath: [Cypress.spec.relativeToCommonRoot, ...Cypress.currentTest.titlePath], - domSnapshots: [...manualSnapshots, { snapshot: automaticSnapshot }], + domSnapshots: [...manualSnapshots, ...automaticSnapshots], chromaticStorybookParams: { ...(Cypress.env('diffThreshold') && { diffThreshold: Cypress.env('diffThreshold') }), ...(Cypress.env('delay') && { delay: Cypress.env('delay') }), From d0976c0cf3ec35cf91d67c61c4b5cc004aabf729 Mon Sep 17 00:00:00 2001 From: Jack Leslie <52004409+jackleslie@users.noreply.github.com> Date: Fri, 10 May 2024 16:57:05 +0100 Subject: [PATCH 2/5] Update support.ts --- packages/cypress/src/support.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cypress/src/support.ts b/packages/cypress/src/support.ts index a6f93880..41692da4 100644 --- a/packages/cypress/src/support.ts +++ b/packages/cypress/src/support.ts @@ -24,7 +24,7 @@ afterEach(() => { } // can we be sure this always fires after all the requests are back? cy.document().then((doc) => { - const automaticSnapshots = Cypress.env('disableAutoSnapshot') ? [{ snapshot: snapshot(doc) }] : []; + const automaticSnapshots = !Cypress.env('disableAutoSnapshot') ? [{ snapshot: snapshot(doc) }] : []; // @ts-expect-error will fix when Cypress has its own package cy.get('@manualSnapshots').then((manualSnapshots = []) => { cy.url().then((url) => { From 5f0fd2e8b89cacc943a528a3a759bc5404d4ec9f Mon Sep 17 00:00:00 2001 From: Jack Leslie <52004409+jackleslie@users.noreply.github.com> Date: Fri, 10 May 2024 16:57:27 +0100 Subject: [PATCH 3/5] Update support.ts --- packages/cypress/src/support.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cypress/src/support.ts b/packages/cypress/src/support.ts index 41692da4..288c23b6 100644 --- a/packages/cypress/src/support.ts +++ b/packages/cypress/src/support.ts @@ -19,7 +19,7 @@ beforeEach(() => { afterEach(() => { // don't take snapshots when running `cypress open` - if (Cypress.config('isTextTerminal')) { + if (!Cypress.config('isTextTerminal')) { return; } // can we be sure this always fires after all the requests are back? From fb1740a0542b21e2bf5b06f83d3ce2f59c8aeccb Mon Sep 17 00:00:00 2001 From: Reuben Ellis Date: Fri, 24 May 2024 15:29:00 -0600 Subject: [PATCH 4/5] Update support.ts Fix the linting error --- packages/cypress/src/support.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/cypress/src/support.ts b/packages/cypress/src/support.ts index 288c23b6..910bc410 100644 --- a/packages/cypress/src/support.ts +++ b/packages/cypress/src/support.ts @@ -24,7 +24,8 @@ afterEach(() => { } // can we be sure this always fires after all the requests are back? cy.document().then((doc) => { - const automaticSnapshots = !Cypress.env('disableAutoSnapshot') ? [{ snapshot: snapshot(doc) }] : []; + const automaticSnapshots = !Cypress.env('disableAutoSnapshot') + ? [{ snapshot: snapshot(doc) }] : []; // @ts-expect-error will fix when Cypress has its own package cy.get('@manualSnapshots').then((manualSnapshots = []) => { cy.url().then((url) => { From fa90ebcb90d952c6619071626ee1c2528d191401 Mon Sep 17 00:00:00 2001 From: Reuben Ellis Date: Fri, 24 May 2024 15:33:04 -0600 Subject: [PATCH 5/5] Update support.ts Fix linting --- packages/cypress/src/support.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/cypress/src/support.ts b/packages/cypress/src/support.ts index 910bc410..a4536154 100644 --- a/packages/cypress/src/support.ts +++ b/packages/cypress/src/support.ts @@ -24,8 +24,9 @@ afterEach(() => { } // can we be sure this always fires after all the requests are back? cy.document().then((doc) => { - const automaticSnapshots = !Cypress.env('disableAutoSnapshot') - ? [{ snapshot: snapshot(doc) }] : []; + const automaticSnapshots = !Cypress.env('disableAutoSnapshot') + ? [{ snapshot: snapshot(doc) }] + : []; // @ts-expect-error will fix when Cypress has its own package cy.get('@manualSnapshots').then((manualSnapshots = []) => { cy.url().then((url) => {