From 66a2761c110b96c1795be2b52eac27280c816351 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Sun, 29 Dec 2024 11:16:21 +0000 Subject: [PATCH] less flaky --- playwright/session-recording/opting-out.spec.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/playwright/session-recording/opting-out.spec.ts b/playwright/session-recording/opting-out.spec.ts index e3686f14f..b2debb362 100644 --- a/playwright/session-recording/opting-out.spec.ts +++ b/playwright/session-recording/opting-out.spec.ts @@ -8,10 +8,6 @@ async function startWith(config: Partial, page: Page, context: Br // there will be a decide call const decideResponse = page.waitForResponse('**/decide/*') - // but no recorder or snapshot call, because we're opting out - void expect(page.waitForResponse('**/recorder.js*', { timeout: 250 })).rejects.toThrowError('Timeout') - void expect(page.waitForResponse('**/ses/*', { timeout: 250 })).rejects.toThrowError('Timeout') - await start( { options: config, @@ -35,7 +31,11 @@ async function startWith(config: Partial, page: Page, context: Br test.describe('Session Recording - opting out', () => { test('does not capture events when config opts out by default', async ({ page, context }) => { + // but no recorder or snapshot call, because we're opting out + void expect(page.waitForResponse('**/recorder.js*', { timeout: 250 })).rejects.toThrowError('Timeout') + void expect(page.waitForResponse('**/ses/*', { timeout: 250 })).rejects.toThrowError('Timeout') await startWith({ opt_out_capturing_by_default: true }, page, context) + await page.locator('[data-cy-input]').type('hello posthog!') await page.waitForTimeout(250) // short delay since there's no snapshot to wait for const capturedEvents = await page.capturedEvents() @@ -43,6 +43,10 @@ test.describe('Session Recording - opting out', () => { }) test('does not capture recordings when config disables session recording', async ({ page, context }) => { + // but no recorder or snapshot call, because we're opting out + void expect(page.waitForResponse('**/recorder.js*', { timeout: 250 })).rejects.toThrowError('Timeout') + void expect(page.waitForResponse('**/ses/*', { timeout: 250 })).rejects.toThrowError('Timeout') + await startWith({ disable_session_recording: true }, page, context) await page.locator('[data-cy-input]').type('hello posthog!')