@@ -3,37 +3,40 @@ import { expect } from '@playwright/test';
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
4
import { getReplaySnapshot , shouldSkipReplayTest , waitForReplayRequest } from '../../../../utils/replayHelpers' ;
5
5
6
- sentryTest ( '[error-mode] should handle errors with custom transport' , async ( { getLocalTestPath, page } ) => {
7
- if ( shouldSkipReplayTest ( ) ) {
8
- sentryTest . skip ( ) ;
9
- }
6
+ sentryTest (
7
+ '[error-mode] should handle errors with custom transport' ,
8
+ async ( { getLocalTestPath, page, forceFlushReplay } ) => {
9
+ if ( shouldSkipReplayTest ( ) ) {
10
+ sentryTest . skip ( ) ;
11
+ }
10
12
11
- const promiseReq0 = waitForReplayRequest ( page , 0 ) ;
12
- const promiseReq1 = waitForReplayRequest ( page , 1 ) ;
13
+ const promiseReq0 = waitForReplayRequest ( page , 0 ) ;
14
+ const promiseReq1 = waitForReplayRequest ( page , 1 ) ;
13
15
14
- let callsToSentry = 0 ;
16
+ let callsToSentry = 0 ;
15
17
16
- await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
17
- callsToSentry ++ ;
18
+ await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
19
+ callsToSentry ++ ;
18
20
19
- return route . fulfill ( {
20
- // Only error out for error, then succeed
21
- status : callsToSentry === 1 ? 422 : 200 ,
21
+ return route . fulfill ( {
22
+ // Only error out for error, then succeed
23
+ status : callsToSentry === 1 ? 422 : 200 ,
24
+ } ) ;
22
25
} ) ;
23
- } ) ;
24
26
25
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
27
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
26
28
27
- await page . goto ( url ) ;
28
- await page . click ( '#go-background' ) ;
29
- expect ( callsToSentry ) . toEqual ( 0 ) ;
29
+ await page . goto ( url ) ;
30
+ await forceFlushReplay ( ) ;
31
+ expect ( callsToSentry ) . toEqual ( 0 ) ;
30
32
31
- await page . click ( '#error' ) ;
32
- await promiseReq0 ;
33
+ await page . click ( '#error' ) ;
34
+ await promiseReq0 ;
33
35
34
- await page . click ( '#go-background' ) ;
35
- await promiseReq1 ;
36
+ await forceFlushReplay ( ) ;
37
+ await promiseReq1 ;
36
38
37
- const replay = await getReplaySnapshot ( page ) ;
38
- expect ( replay . recordingMode ) . toBe ( 'session' ) ;
39
- } ) ;
39
+ const replay = await getReplaySnapshot ( page ) ;
40
+ expect ( replay . recordingMode ) . toBe ( 'session' ) ;
41
+ } ,
42
+ ) ;
0 commit comments