diff --git a/packages/integration-tests/suites/replay/requests/init.js b/packages/integration-tests/suites/replay/requests/init.js index 639cf05628e4..db6a0aa21821 100644 --- a/packages/integration-tests/suites/replay/requests/init.js +++ b/packages/integration-tests/suites/replay/requests/init.js @@ -4,7 +4,7 @@ window.Sentry = Sentry; window.Replay = new Sentry.Replay({ flushMinDelay: 500, flushMaxDelay: 500, - useCompression: true, + useCompression: false, }); Sentry.init({ diff --git a/packages/integration-tests/suites/replay/requests/test.ts b/packages/integration-tests/suites/replay/requests/test.ts index fa5a1bdcf7c0..3b711afbfe88 100644 --- a/packages/integration-tests/suites/replay/requests/test.ts +++ b/packages/integration-tests/suites/replay/requests/test.ts @@ -4,8 +4,11 @@ import { sentryTest } from '../../../utils/fixtures'; import { expectedFetchPerformanceSpan, expectedXHRPerformanceSpan } from '../../../utils/replayEventTemplates'; import { getReplayRecordingContent, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers'; -sentryTest('replay recording should contain fetch request span', async ({ getLocalTestPath, page }) => { - if (shouldSkipReplayTest()) { +sentryTest('replay recording should contain fetch request span', async ({ getLocalTestPath, page, browserName }) => { + // For some reason, observing and waiting for requests in firefox is extremely flaky. + // We therefore skip this test for firefox and only test on chromium/webkit. + // Possibly related: https://github.com/microsoft/playwright/issues/11390 + if (shouldSkipReplayTest() || browserName === 'firefox') { sentryTest.skip(); } @@ -31,18 +34,23 @@ sentryTest('replay recording should contain fetch request span', async ({ getLoc const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); - await page.click('#fetch'); await page.click('#go-background'); - const { performanceSpans: spans0 } = getReplayRecordingContent(await reqPromise0); + + const receivedResponse = page.waitForResponse('https://example.com'); + await page.click('#fetch'); + await receivedResponse; + const { performanceSpans: spans1 } = getReplayRecordingContent(await reqPromise1); - const performanceSpans = [...spans0, ...spans1]; + const performanceSpans = [...spans0, ...spans1]; expect(performanceSpans).toContainEqual(expectedFetchPerformanceSpan); }); -sentryTest('replay recording should contain XHR request span', async ({ getLocalTestPath, page }) => { - if (shouldSkipReplayTest()) { +sentryTest('replay recording should contain XHR request span', async ({ getLocalTestPath, page, browserName }) => { + // For some reason, observing and waiting for requests in firefox is extremely flaky. + // We therefore skip this test for firefox and only test on chromium/webkit. + if (shouldSkipReplayTest() || browserName === 'firefox') { sentryTest.skip(); } @@ -68,11 +76,15 @@ sentryTest('replay recording should contain XHR request span', async ({ getLocal const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); - await page.click('#xhr'); await page.click('#go-background'); - const { performanceSpans: spans0 } = getReplayRecordingContent(await reqPromise0); + + const receivedResponse = page.waitForResponse('https://example.com'); + await page.click('#xhr'); + await receivedResponse; + const { performanceSpans: spans1 } = getReplayRecordingContent(await reqPromise1); + const performanceSpans = [...spans0, ...spans1]; expect(performanceSpans).toContainEqual(expectedXHRPerformanceSpan);