diff --git a/cypress/e2e/billing.cy.ts b/cypress/e2e/billing.cy.ts index a21188c0f42d0..8f81ca07a63eb 100644 --- a/cypress/e2e/billing.cy.ts +++ b/cypress/e2e/billing.cy.ts @@ -20,6 +20,7 @@ describe('Billing', () => { cy.contains('.LemonModal .LemonButton', 'Unsubscribe').click() cy.window().then((win) => { + win.console.warn('_CYPRESS_POSTHOG_CAPTURES', (win as any)._cypress_posthog_captures) const events = (win as any)._cypress_posthog_captures const matchingEvents = events.filter((event) => event.event === 'survey sent') expect(matchingEvents.length).to.equal(1) diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index f2fad98287005..a01a69b3d23e0 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -20,6 +20,7 @@ Cypress.on('window:before:load', (win) => { cy.spy(win.console, 'error') cy.spy(win.console, 'warn') + win.console.warn('SETTING _CYPRESS_POSTHOG_CAPTURES') win._cypress_posthog_captures = [] }) diff --git a/frontend/src/loadPostHogJS.tsx b/frontend/src/loadPostHogJS.tsx index e0307ab977635..233bb79b99fa2 100644 --- a/frontend/src/loadPostHogJS.tsx +++ b/frontend/src/loadPostHogJS.tsx @@ -17,6 +17,7 @@ const configWithSentry = (config: Partial): Partial (window as any)._cypress_posthog_captures.push(event) - : undefined, + _onCapture: (_, event) => (window as any)._cypress_posthog_captures.push(event), }) )