@@ -4,8 +4,11 @@ import { sentryTest } from '../../../utils/fixtures';
4
4
import { expectedFetchPerformanceSpan , expectedXHRPerformanceSpan } from '../../../utils/replayEventTemplates' ;
5
5
import { getReplayRecordingContent , shouldSkipReplayTest , waitForReplayRequest } from '../../../utils/replayHelpers' ;
6
6
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' ) {
9
12
sentryTest . skip ( ) ;
10
13
}
11
14
@@ -31,18 +34,23 @@ sentryTest('replay recording should contain fetch request span', async ({ getLoc
31
34
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
32
35
33
36
await page . goto ( url ) ;
34
- await page . click ( '#fetch' ) ;
35
37
await page . click ( '#go-background' ) ;
36
-
37
38
const { performanceSpans : spans0 } = getReplayRecordingContent ( await reqPromise0 ) ;
39
+
40
+ const receivedResponse = page . waitForResponse ( 'https://example.com' ) ;
41
+ await page . click ( '#fetch' ) ;
42
+ await receivedResponse ;
43
+
38
44
const { performanceSpans : spans1 } = getReplayRecordingContent ( await reqPromise1 ) ;
39
- const performanceSpans = [ ...spans0 , ...spans1 ] ;
40
45
46
+ const performanceSpans = [ ...spans0 , ...spans1 ] ;
41
47
expect ( performanceSpans ) . toContainEqual ( expectedFetchPerformanceSpan ) ;
42
48
} ) ;
43
49
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' ) {
46
54
sentryTest . skip ( ) ;
47
55
}
48
56
@@ -68,11 +76,15 @@ sentryTest('replay recording should contain XHR request span', async ({ getLocal
68
76
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
69
77
70
78
await page . goto ( url ) ;
71
- await page . click ( '#xhr' ) ;
72
79
await page . click ( '#go-background' ) ;
73
-
74
80
const { performanceSpans : spans0 } = getReplayRecordingContent ( await reqPromise0 ) ;
81
+
82
+ const receivedResponse = page . waitForResponse ( 'https://example.com' ) ;
83
+ await page . click ( '#xhr' ) ;
84
+ await receivedResponse ;
85
+
75
86
const { performanceSpans : spans1 } = getReplayRecordingContent ( await reqPromise1 ) ;
87
+
76
88
const performanceSpans = [ ...spans0 , ...spans1 ] ;
77
89
78
90
expect ( performanceSpans ) . toContainEqual ( expectedXHRPerformanceSpan ) ;
0 commit comments