@@ -17,49 +17,54 @@ import { getReplayEvent, shouldSkipReplayTest, waitForReplayRequest } from '../.
17
17
* TODO: Once we have lifecycle hooks, we should revisit this test and make sure it behaves as expected.
18
18
* This means that the recording should not be started or stopped if the error that triggered it is not sent.
19
19
*/
20
- sentryTest (
21
- '[error-mode] should start recording if an error occurred although the error was dropped' ,
22
- async ( { getLocalTestPath, page } ) => {
23
- if ( shouldSkipReplayTest ( ) ) {
24
- sentryTest . skip ( ) ;
25
- }
20
+ for ( let i = 0 ; i < 100 ; i ++ ) {
21
+ sentryTest (
22
+ `[error-mode] should start recording if an error occurred although the error was dropped RUN ${ i } ` ,
23
+ async ( { getLocalTestPath, page } ) => {
24
+ if ( shouldSkipReplayTest ( ) ) {
25
+ sentryTest . skip ( ) ;
26
+ }
26
27
27
- let callsToSentry = 0 ;
28
- const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
28
+ let callsToSentry = 0 ;
29
+ const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
30
+ const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
29
31
30
- await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
31
- callsToSentry ++ ;
32
- return route . fulfill ( {
33
- status : 200 ,
34
- contentType : 'application/json' ,
35
- body : JSON . stringify ( { id : 'test-id' } ) ,
32
+ await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
33
+ callsToSentry ++ ;
34
+ return route . fulfill ( {
35
+ status : 200 ,
36
+ contentType : 'application/json' ,
37
+ body : JSON . stringify ( { id : 'test-id' } ) ,
38
+ } ) ;
36
39
} ) ;
37
- } ) ;
38
40
39
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
41
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
40
42
41
- await page . goto ( url ) ;
42
- await page . click ( '#go-background' ) ;
43
- expect ( callsToSentry ) . toEqual ( 0 ) ;
43
+ await page . goto ( url ) ;
44
+ await page . click ( '#go-background' ) ;
45
+ expect ( callsToSentry ) . toEqual ( 0 ) ;
44
46
45
- await page . click ( '#error' ) ;
46
- const req0 = await reqPromise0 ;
47
+ await page . click ( '#error' ) ;
48
+ const req0 = await reqPromise0 ;
47
49
48
- await page . click ( '#go-background' ) ;
49
- expect ( callsToSentry ) . toEqual ( 2 ) ; // 2 replay events
50
+ await page . click ( '#go-background' ) ;
51
+ await reqPromise1 ;
50
52
51
- await page . click ( '#log' ) ;
52
- await page . click ( '#go-background' ) ;
53
+ expect ( callsToSentry ) . toEqual ( 2 ) ; // 2 replay events
53
54
54
- const event0 = getReplayEvent ( req0 ) ;
55
+ await page . click ( '#log' ) ;
56
+ await page . click ( '#go-background' ) ;
55
57
56
- expect ( event0 ) . toEqual (
57
- getExpectedReplayEvent ( {
58
- contexts : { replay : { error_sample_rate : 1 , session_sample_rate : 0 } } ,
59
- // This is by design. A dropped error shouldn't be in this list.
60
- error_ids : [ ] ,
61
- replay_type : 'error' ,
62
- } ) ,
63
- ) ;
64
- } ,
65
- ) ;
58
+ const event0 = getReplayEvent ( req0 ) ;
59
+
60
+ expect ( event0 ) . toEqual (
61
+ getExpectedReplayEvent ( {
62
+ contexts : { replay : { error_sample_rate : 1 , session_sample_rate : 0 } } ,
63
+ // This is by design. A dropped error shouldn't be in this list.
64
+ error_ids : [ ] ,
65
+ replay_type : 'error' ,
66
+ } ) ,
67
+ ) ;
68
+ } ,
69
+ ) ;
70
+ }
0 commit comments