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