From b946d6c84f7e049269986b7a86d158ccf798f402 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 7 Feb 2024 17:13:09 +0000 Subject: [PATCH] fix tests --- cypress/e2e/session-recording.cy.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cypress/e2e/session-recording.cy.ts b/cypress/e2e/session-recording.cy.ts index 6b033503f..82323d5ef 100644 --- a/cypress/e2e/session-recording.cy.ts +++ b/cypress/e2e/session-recording.cy.ts @@ -27,13 +27,14 @@ describe('Session recording', () => { // should be a pageview and a $snapshot expect(captures.map((c) => c.event)).to.deep.equal(['$pageview', '$snapshot']) - expect(captures[1]['properties']['$snapshot_data']).to.have.length.above(33).and.below(38) + expect(captures[1]['properties']['$snapshot_data']).to.have.length.above(33).and.below(39) // a meta and then a full snapshot expect(captures[1]['properties']['$snapshot_data'][0].type).to.equal(4) // meta expect(captures[1]['properties']['$snapshot_data'][1].type).to.equal(2) // full_snapshot expect(captures[1]['properties']['$snapshot_data'][2].type).to.equal(5) // custom event with options + expect(captures[1]['properties']['$snapshot_data'][3].type).to.equal(5) // custom event with posthog config // Making a set from the rest should all be 3 - incremental snapshots - const incrementalSnapshots = captures[1]['properties']['$snapshot_data'].slice(3) + const incrementalSnapshots = captures[1]['properties']['$snapshot_data'].slice(4) expect(new Set(incrementalSnapshots.map((s) => s.type))).to.deep.equal(new Set([3])) }) }) @@ -66,14 +67,15 @@ describe('Session recording', () => { cy.phCaptures({ full: true }).then((captures) => { // should be a pageview and a $snapshot expect(captures.map((c) => c.event)).to.deep.equal(['$pageview', '$snapshot']) - expect(captures[1]['properties']['$snapshot_data']).to.have.length.above(33).and.below(38) + expect(captures[1]['properties']['$snapshot_data']).to.have.length.above(33).and.below(39) // a meta and then a full snapshot expect(captures[1]['properties']['$snapshot_data'][0].type).to.equal(4) // meta expect(captures[1]['properties']['$snapshot_data'][1].type).to.equal(2) // full_snapshot expect(captures[1]['properties']['$snapshot_data'][2].type).to.equal(5) // custom event with options + expect(captures[1]['properties']['$snapshot_data'][3].type).to.equal(5) // custom event with posthog config // Making a set from the rest should all be 3 - incremental snapshots expect( - new Set(captures[1]['properties']['$snapshot_data'].slice(3).map((s) => s.type)) + new Set(captures[1]['properties']['$snapshot_data'].slice(4).map((s) => s.type)) ).to.deep.equal(new Set([3])) }) }) @@ -195,9 +197,9 @@ describe('Session recording', () => { expect(captures[1]['properties']['$snapshot_data'][0].type).to.equal(4) // meta expect(captures[1]['properties']['$snapshot_data'][1].type).to.equal(2) // full_snapshot expect(captures[1]['properties']['$snapshot_data'][2].type).to.equal(5) // custom event with options - + expect(captures[1]['properties']['$snapshot_data'][3].type).to.equal(5) // custom event with posthog config const xPositions = [] - for (let i = 3; i < captures[1]['properties']['$snapshot_data'].length; i++) { + for (let i = 4; i < captures[1]['properties']['$snapshot_data'].length; i++) { expect(captures[1]['properties']['$snapshot_data'][i].type).to.equal(3) expect(captures[1]['properties']['$snapshot_data'][i].data.source).to.equal( 6,