@@ -13,83 +13,96 @@ function isInputMutation(snap: incrementalData): snap is inputData {
13
13
return snap . source == IncrementalSource . Input ;
14
14
}
15
15
16
- sentryTest ( 'should mask input initial value and its changes' , async ( { getLocalTestPath, page } ) => {
17
- if ( shouldSkipReplayTest ( ) ) {
18
- sentryTest . skip ( ) ;
19
- }
20
-
21
- const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
22
- const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
23
- const reqPromise2 = waitForReplayRequest ( page , 2 ) ;
24
- const reqPromise3 = waitForReplayRequest ( page , 3 ) ;
25
-
26
- await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
27
- return route . fulfill ( {
28
- status : 200 ,
29
- contentType : 'application/json' ,
30
- body : JSON . stringify ( { id : 'test-id' } ) ,
16
+ sentryTest (
17
+ 'should mask input initial value and its changes' ,
18
+ async ( { browserName, forceFlushReplay, getLocalTestPath, page } ) => {
19
+ // TODO(replay): This is flakey on firefox where we do not always get the latest mutation.
20
+ if ( shouldSkipReplayTest ( ) || browserName === 'firefox' ) {
21
+ sentryTest . skip ( ) ;
22
+ }
23
+
24
+ const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
25
+ const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
26
+ const reqPromise2 = waitForReplayRequest ( page , 2 ) ;
27
+ const reqPromise3 = waitForReplayRequest ( page , 3 ) ;
28
+
29
+ await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
30
+ return route . fulfill ( {
31
+ status : 200 ,
32
+ contentType : 'application/json' ,
33
+ body : JSON . stringify ( { id : 'test-id' } ) ,
34
+ } ) ;
31
35
} ) ;
32
- } ) ;
33
36
34
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
35
-
36
- await page . goto ( url ) ;
37
-
38
- await reqPromise0 ;
39
-
40
- const text = 'this is test text' ;
41
-
42
- await page . locator ( '#input' ) . type ( text ) ;
43
- const snapshots = getIncrementalRecordingSnapshots ( await reqPromise1 ) . filter ( isInputMutation ) ;
44
- const lastSnapshot = snapshots [ snapshots . length - 1 ] ;
45
- expect ( lastSnapshot . text ) . toBe ( text ) ;
46
-
47
- await page . locator ( '#input-masked' ) . type ( text ) ;
48
- const snapshots2 = getIncrementalRecordingSnapshots ( await reqPromise2 ) . filter ( isInputMutation ) ;
49
- const lastSnapshot2 = snapshots2 [ snapshots2 . length - 1 ] ;
50
- expect ( lastSnapshot2 . text ) . toBe ( '*' . repeat ( text . length ) ) ;
51
-
52
- await page . locator ( '#input-ignore' ) . type ( text ) ;
53
- const snapshots3 = getIncrementalRecordingSnapshots ( await reqPromise3 ) . filter ( isInputMutation ) ;
54
- expect ( snapshots3 . length ) . toBe ( 0 ) ;
55
- } ) ;
56
-
57
- sentryTest ( 'should mask textarea initial value and its changes' , async ( { getLocalTestPath, page } ) => {
58
- if ( shouldSkipReplayTest ( ) ) {
59
- sentryTest . skip ( ) ;
60
- }
61
-
62
- const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
63
- const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
64
- const reqPromise2 = waitForReplayRequest ( page , 2 ) ;
65
- const reqPromise3 = waitForReplayRequest ( page , 3 ) ;
66
-
67
- await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
68
- return route . fulfill ( {
69
- status : 200 ,
70
- contentType : 'application/json' ,
71
- body : JSON . stringify ( { id : 'test-id' } ) ,
37
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
38
+
39
+ await page . goto ( url ) ;
40
+
41
+ await reqPromise0 ;
42
+
43
+ const text = 'this is test text' ;
44
+
45
+ await page . locator ( '#input' ) . type ( text ) ;
46
+ await forceFlushReplay ( ) ;
47
+ const snapshots = getIncrementalRecordingSnapshots ( await reqPromise1 ) . filter ( isInputMutation ) ;
48
+ const lastSnapshot = snapshots [ snapshots . length - 1 ] ;
49
+ expect ( lastSnapshot . text ) . toBe ( text ) ;
50
+
51
+ await page . locator ( '#input-masked' ) . type ( text ) ;
52
+ await forceFlushReplay ( ) ;
53
+ const snapshots2 = getIncrementalRecordingSnapshots ( await reqPromise2 ) . filter ( isInputMutation ) ;
54
+ const lastSnapshot2 = snapshots2 [ snapshots2 . length - 1 ] ;
55
+ expect ( lastSnapshot2 . text ) . toBe ( '*' . repeat ( text . length ) ) ;
56
+
57
+ await page . locator ( '#input-ignore' ) . type ( text ) ;
58
+ await forceFlushReplay ( ) ;
59
+ const snapshots3 = getIncrementalRecordingSnapshots ( await reqPromise3 ) . filter ( isInputMutation ) ;
60
+ expect ( snapshots3 . length ) . toBe ( 0 ) ;
61
+ } ,
62
+ ) ;
63
+
64
+ sentryTest (
65
+ 'should mask textarea initial value and its changes' ,
66
+ async ( { browserName, forceFlushReplay, getLocalTestPath, page } ) => {
67
+ // TODO(replay): This is flakey on firefox where we do not always get the latest mutation.
68
+ if ( shouldSkipReplayTest ( ) || browserName === 'firefox' ) {
69
+ sentryTest . skip ( ) ;
70
+ }
71
+
72
+ const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
73
+ const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
74
+ const reqPromise2 = waitForReplayRequest ( page , 2 ) ;
75
+ const reqPromise3 = waitForReplayRequest ( page , 3 ) ;
76
+
77
+ await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
78
+ return route . fulfill ( {
79
+ status : 200 ,
80
+ contentType : 'application/json' ,
81
+ body : JSON . stringify ( { id : 'test-id' } ) ,
82
+ } ) ;
72
83
} ) ;
73
- } ) ;
74
-
75
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
76
-
77
- await page . goto ( url ) ;
78
-
79
- await reqPromise0 ;
80
-
81
- const text = 'this is test text' ;
82
- await page . locator ( '#textarea' ) . type ( text ) ;
83
- const snapshots = getIncrementalRecordingSnapshots ( await reqPromise1 ) . filter ( isInputMutation ) ;
84
- const lastSnapshot = snapshots [ snapshots . length - 1 ] ;
85
- expect ( lastSnapshot . text ) . toBe ( text ) ;
86
-
87
- await page . locator ( '#textarea-masked' ) . type ( text ) ;
88
- const snapshots2 = getIncrementalRecordingSnapshots ( await reqPromise2 ) . filter ( isInputMutation ) ;
89
- const lastSnapshot2 = snapshots2 [ snapshots2 . length - 1 ] ;
90
- expect ( lastSnapshot2 . text ) . toBe ( '*' . repeat ( text . length ) ) ;
91
84
92
- await page . locator ( '#textarea-ignore' ) . type ( text ) ;
93
- const snapshots3 = getIncrementalRecordingSnapshots ( await reqPromise3 ) . filter ( isInputMutation ) ;
94
- expect ( snapshots3 . length ) . toBe ( 0 ) ;
95
- } ) ;
85
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
86
+
87
+ await page . goto ( url ) ;
88
+ await reqPromise0 ;
89
+
90
+ const text = 'this is test text' ;
91
+ await page . locator ( '#textarea' ) . type ( text ) ;
92
+ await forceFlushReplay ( ) ;
93
+ const snapshots = getIncrementalRecordingSnapshots ( await reqPromise1 ) . filter ( isInputMutation ) ;
94
+ const lastSnapshot = snapshots [ snapshots . length - 1 ] ;
95
+ expect ( lastSnapshot . text ) . toBe ( text ) ;
96
+
97
+ await page . locator ( '#textarea-masked' ) . type ( text ) ;
98
+ await forceFlushReplay ( ) ;
99
+ const snapshots2 = getIncrementalRecordingSnapshots ( await reqPromise2 ) . filter ( isInputMutation ) ;
100
+ const lastSnapshot2 = snapshots2 [ snapshots2 . length - 1 ] ;
101
+ expect ( lastSnapshot2 . text ) . toBe ( '*' . repeat ( text . length ) ) ;
102
+
103
+ await page . locator ( '#textarea-ignore' ) . type ( text ) ;
104
+ await forceFlushReplay ( ) ;
105
+ const snapshots3 = getIncrementalRecordingSnapshots ( await reqPromise3 ) . filter ( isInputMutation ) ;
106
+ expect ( snapshots3 . length ) . toBe ( 0 ) ;
107
+ } ,
108
+ ) ;
0 commit comments