@@ -4,96 +4,88 @@ 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
- for ( let i = 0 ; i < 25 ; i ++ ) {
8
- sentryTest (
9
- `replay recording should contain fetch request span (${ i } )` ,
10
- async ( { getLocalTestPath, page, browserName } ) => {
11
- // For some reason, observing and waiting for requests in firefox is extremely flaky.
12
- // We therefore skip this test for firefox and only test on chromium/webkit.
13
- // Possibly related: https://github.com/microsoft/playwright/issues/11390
14
- if ( shouldSkipReplayTest ( ) || browserName === 'firefox' ) {
15
- sentryTest . skip ( ) ;
16
- }
17
-
18
- const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
19
- const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
20
-
21
- await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
22
- return route . fulfill ( {
23
- status : 200 ,
24
- contentType : 'application/json' ,
25
- body : JSON . stringify ( { id : 'test-id' } ) ,
26
- } ) ;
27
- } ) ;
28
-
29
- await page . route ( 'https://example.com' , route => {
30
- return route . fulfill ( {
31
- status : 200 ,
32
- contentType : 'application/json' ,
33
- body : 'hello world' ,
34
- } ) ;
35
- } ) ;
36
-
37
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
38
-
39
- await page . goto ( url ) ;
40
- await page . click ( '#go-background' ) ;
41
- const { performanceSpans : spans0 } = getReplayRecordingContent ( await reqPromise0 ) ;
42
-
43
- const receivedResponse = page . waitForResponse ( 'https://example.com' ) ;
44
- await page . click ( '#fetch' ) ;
45
- await receivedResponse ;
46
-
47
- const { performanceSpans : spans1 } = getReplayRecordingContent ( await reqPromise1 ) ;
48
-
49
- const performanceSpans = [ ...spans0 , ...spans1 ] ;
50
- expect ( performanceSpans ) . toContainEqual ( expectedFetchPerformanceSpan ) ;
51
- } ,
52
- ) ;
53
-
54
- sentryTest (
55
- `replay recording should contain XHR request span (${ i } ` ,
56
- async ( { getLocalTestPath, page, browserName } ) => {
57
- // For some reason, observing and waiting for requests in firefox is extremely flaky.
58
- // We therefore skip this test for firefox and only test on chromium/webkit.
59
- if ( shouldSkipReplayTest ( ) || browserName === 'firefox' ) {
60
- sentryTest . skip ( ) ;
61
- }
62
-
63
- const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
64
- const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
65
-
66
- await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
67
- return route . fulfill ( {
68
- status : 200 ,
69
- contentType : 'application/json' ,
70
- body : JSON . stringify ( { id : 'test-id' } ) ,
71
- } ) ;
72
- } ) ;
73
-
74
- await page . route ( 'https://example.com' , route => {
75
- return route . fulfill ( {
76
- status : 200 ,
77
- contentType : 'application/json' ,
78
- body : 'hello world' ,
79
- } ) ;
80
- } ) ;
81
-
82
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
83
-
84
- await page . goto ( url ) ;
85
- await page . click ( '#go-background' ) ;
86
- const { performanceSpans : spans0 } = getReplayRecordingContent ( await reqPromise0 ) ;
87
-
88
- const receivedResponse = page . waitForResponse ( 'https://example.com' ) ;
89
- await page . click ( '#xhr' ) ;
90
- await receivedResponse ;
91
-
92
- const { performanceSpans : spans1 } = getReplayRecordingContent ( await reqPromise1 ) ;
93
-
94
- const performanceSpans = [ ...spans0 , ...spans1 ] ;
95
-
96
- expect ( performanceSpans ) . toContainEqual ( expectedXHRPerformanceSpan ) ;
97
- } ,
98
- ) ;
99
- }
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' ) {
12
+ sentryTest . skip ( ) ;
13
+ }
14
+
15
+ const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
16
+ const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
17
+
18
+ await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
19
+ return route . fulfill ( {
20
+ status : 200 ,
21
+ contentType : 'application/json' ,
22
+ body : JSON . stringify ( { id : 'test-id' } ) ,
23
+ } ) ;
24
+ } ) ;
25
+
26
+ await page . route ( 'https://example.com' , route => {
27
+ return route . fulfill ( {
28
+ status : 200 ,
29
+ contentType : 'application/json' ,
30
+ body : 'hello world' ,
31
+ } ) ;
32
+ } ) ;
33
+
34
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
35
+
36
+ await page . goto ( url ) ;
37
+ await page . click ( '#go-background' ) ;
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
+
44
+ const { performanceSpans : spans1 } = getReplayRecordingContent ( await reqPromise1 ) ;
45
+
46
+ const performanceSpans = [ ...spans0 , ...spans1 ] ;
47
+ expect ( performanceSpans ) . toContainEqual ( expectedFetchPerformanceSpan ) ;
48
+ } ) ;
49
+
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' ) {
54
+ sentryTest . skip ( ) ;
55
+ }
56
+
57
+ const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
58
+ const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
59
+
60
+ await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
61
+ return route . fulfill ( {
62
+ status : 200 ,
63
+ contentType : 'application/json' ,
64
+ body : JSON . stringify ( { id : 'test-id' } ) ,
65
+ } ) ;
66
+ } ) ;
67
+
68
+ await page . route ( 'https://example.com' , route => {
69
+ return route . fulfill ( {
70
+ status : 200 ,
71
+ contentType : 'application/json' ,
72
+ body : 'hello world' ,
73
+ } ) ;
74
+ } ) ;
75
+
76
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
77
+
78
+ await page . goto ( url ) ;
79
+ await page . click ( '#go-background' ) ;
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
+
86
+ const { performanceSpans : spans1 } = getReplayRecordingContent ( await reqPromise1 ) ;
87
+
88
+ const performanceSpans = [ ...spans0 , ...spans1 ] ;
89
+
90
+ expect ( performanceSpans ) . toContainEqual ( expectedXHRPerformanceSpan ) ;
91
+ } ) ;
0 commit comments