diff --git a/cypress/e2e/capture.cy.ts b/cypress/e2e/capture.cy.ts index ac3d8de65..15fb62627 100644 --- a/cypress/e2e/capture.cy.ts +++ b/cypress/e2e/capture.cy.ts @@ -287,7 +287,7 @@ describe('Event capture', () => { // the code below is going to trigger an event capture // we want to assert on the request - cy.intercept('POST', '**/e/*', async (request) => { + cy.intercept('POST', '/e/*', async (request) => { expect(request.headers['content-type']).to.eq('text/plain') const captures = await getGzipEncodedPayload(request) expect(captures.map(({ event }) => event)).to.deep.equal(['$autocapture', 'custom-event']) diff --git a/cypress/e2e/opting-out.cy.ts b/cypress/e2e/opting-out.cy.ts index 23715a6cf..473667881 100644 --- a/cypress/e2e/opting-out.cy.ts +++ b/cypress/e2e/opting-out.cy.ts @@ -3,7 +3,7 @@ import { assertWhetherPostHogRequestsWereCalled } from '../support/assertions' describe('opting out', () => { describe('session recording', () => { beforeEach(() => { - cy.intercept('POST', '**/decide/*', { + cy.intercept('POST', '/decide/*', { config: { enable_collect_everything: false }, editorParams: {}, featureFlags: ['session-recording-player'], diff --git a/cypress/e2e/session-recording.cy.ts b/cypress/e2e/session-recording.cy.ts index d791200fb..f614c8060 100644 --- a/cypress/e2e/session-recording.cy.ts +++ b/cypress/e2e/session-recording.cy.ts @@ -4,6 +4,8 @@ import { _isNull } from '../../src/utils/type-utils' import { start } from '../support/setup' function ensureRecordingIsStopped() { + cy.resetPhCaptures() + cy.get('[data-cy-input]') .type('hello posthog!') .wait(250) @@ -16,6 +18,8 @@ function ensureRecordingIsStopped() { } function ensureActivitySendsSnapshots() { + cy.resetPhCaptures() + cy.get('[data-cy-input]') .type('hello posthog!') .wait('@session-recording') diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 2a4c1f641..5bd353bba 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -9,25 +9,41 @@ Cypress.on('window:before:load', (win) => { }) beforeEach(() => { - cy.intercept('POST', '**/decide/*').as('decide') - cy.intercept('POST', '**/e/*').as('capture') - cy.intercept('POST', '**/ses/*').as('session-recording') - cy.intercept('GET', '**/surveys/*').as('surveys') + cy.intercept('POST', '/decide/*').as('decide') + cy.intercept('POST', '/e/*', { status: 1 }).as('capture') + cy.intercept('POST', '/ses/*', { status: 1 }).as('session-recording') + cy.intercept('GET', '/surveys/*').as('surveys') cy.readFile('dist/array.full.js').then((body) => { - cy.intercept('**/static/array.full.js', { body }) + cy.intercept('/static/array.full.js', { body }) }) cy.readFile('dist/array.js').then((body) => { - cy.intercept('**/static/array.js', { body }) + cy.intercept('/static/array.js', { body }) + }) + + cy.readFile('dist/array.full.js.map').then((body) => { + cy.intercept('/static/array.full.js.map', { body }) + }) + + cy.readFile('dist/array.js.map').then((body) => { + cy.intercept('/static/array.js.map', { body }) }) cy.readFile('dist/recorder.js').then((body) => { - cy.intercept('**/static/recorder.js*', { body }).as('recorder') - cy.intercept('**/static/recorder-v2.js*', { body }).as('recorder') + cy.intercept('/static/recorder.js*', { body }).as('recorder') + cy.intercept('/static/recorder-v2.js*', { body }).as('recorder') + }) + + cy.readFile('dist/recorder.js.map').then((body) => { + cy.intercept('/static/recorder.js.map', { body }) }) cy.readFile('dist/surveys.js').then((body) => { - cy.intercept('**/static/surveys.js*', { body }) + cy.intercept('/static/surveys.js*', { body }) + }) + + cy.readFile('dist/surveys.js.map').then((body) => { + cy.intercept('/static/surveys.js.map', { body }) }) }) diff --git a/cypress/support/setup.ts b/cypress/support/setup.ts index e5534eeb6..935436e00 100644 --- a/cypress/support/setup.ts +++ b/cypress/support/setup.ts @@ -29,7 +29,7 @@ export const start = ({ ...decideResponseOverrides, config: { enable_collect_everything: true, ...decideResponseOverrides.config }, } - cy.intercept('POST', '**/decide/*', decideResponse).as('decide') + cy.intercept('POST', '/decide/*', decideResponse).as('decide') cy.visit(url)