11import { expect } from '@playwright/test' ;
22import { IncrementalSource } from '@sentry-internal/rrweb' ;
3- import type { incrementalData , inputData } from '@sentry-internal/rrweb/typings/types' ;
3+ import type { incrementalData , inputData } from '@sentry-internal/rrweb/typings/types' ;
44
55import { sentryTest } from '../../../utils/fixtures' ;
66import {
@@ -13,73 +13,79 @@ function isInputMutation(snap: incrementalData): snap is inputData {
1313 return snap . source == IncrementalSource . Input ;
1414}
1515
16- sentryTest ( 'should mask input initial value and its changes from `maskAllInputs` and allow unmasked selector' , 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-
25- await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
26- return route . fulfill ( {
27- status : 200 ,
28- contentType : 'application/json' ,
29- body : JSON . stringify ( { id : 'test-id' } ) ,
16+ sentryTest (
17+ 'should mask input initial value and its changes from `maskAllInputs` and allow unmasked selector' ,
18+ async ( { getLocalTestPath, page } ) => {
19+ if ( shouldSkipReplayTest ( ) ) {
20+ sentryTest . skip ( ) ;
21+ }
22+
23+ const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
24+ const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
25+ const reqPromise2 = waitForReplayRequest ( page , 2 ) ;
26+
27+ await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
28+ return route . fulfill ( {
29+ status : 200 ,
30+ contentType : 'application/json' ,
31+ body : JSON . stringify ( { id : 'test-id' } ) ,
32+ } ) ;
3033 } ) ;
31- } ) ;
3234
33- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
35+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
3436
35- await page . goto ( url ) ;
37+ await page . goto ( url ) ;
3638
37- await reqPromise0 ;
39+ await reqPromise0 ;
3840
39- const text = 'this is test text' ;
41+ const text = 'this is test text' ;
4042
41- await page . locator ( '#input' ) . type ( text )
42- const snapshots = getIncrementalRecordingSnapshots ( await reqPromise1 ) . filter ( isInputMutation ) ;
43- const lastSnapshot = snapshots [ snapshots . length - 1 ] ;
44- expect ( lastSnapshot . text ) . toBe ( '*' . repeat ( text . length ) ) ;
43+ await page . locator ( '#input' ) . type ( text ) ;
44+ const snapshots = getIncrementalRecordingSnapshots ( await reqPromise1 ) . filter ( isInputMutation ) ;
45+ const lastSnapshot = snapshots [ snapshots . length - 1 ] ;
46+ expect ( lastSnapshot . text ) . toBe ( '*' . repeat ( text . length ) ) ;
4547
46- await page . locator ( '#input-unmasked' ) . type ( text )
47- const snapshots2 = getIncrementalRecordingSnapshots ( await reqPromise2 ) . filter ( isInputMutation ) ;
48- const lastSnapshot2 = snapshots2 [ snapshots2 . length - 1 ] ;
49- expect ( lastSnapshot2 . text ) . toBe ( text ) ;
50- } ) ;
48+ await page . locator ( '#input-unmasked' ) . type ( text ) ;
49+ const snapshots2 = getIncrementalRecordingSnapshots ( await reqPromise2 ) . filter ( isInputMutation ) ;
50+ const lastSnapshot2 = snapshots2 [ snapshots2 . length - 1 ] ;
51+ expect ( lastSnapshot2 . text ) . toBe ( text ) ;
52+ } ,
53+ ) ;
5154
52- sentryTest ( 'should mask textarea initial value and its changes from `maskAllInputs` and allow unmasked selector' , async ( { getLocalTestPath, page } ) => {
53- if ( shouldSkipReplayTest ( ) ) {
54- sentryTest . skip ( ) ;
55- }
55+ sentryTest (
56+ 'should mask textarea initial value and its changes from `maskAllInputs` and allow unmasked selector' ,
57+ async ( { getLocalTestPath, page } ) => {
58+ if ( shouldSkipReplayTest ( ) ) {
59+ sentryTest . skip ( ) ;
60+ }
5661
57- const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
58- const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
59- const reqPromise2 = waitForReplayRequest ( page , 2 ) ;
62+ const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
63+ const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
64+ const reqPromise2 = waitForReplayRequest ( page , 2 ) ;
6065
61- await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
62- return route . fulfill ( {
63- status : 200 ,
64- contentType : 'application/json' ,
65- body : JSON . stringify ( { id : 'test-id' } ) ,
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+ } ) ;
6672 } ) ;
67- } ) ;
6873
69- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
74+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
7075
71- await page . goto ( url ) ;
76+ await page . goto ( url ) ;
7277
73- await reqPromise0 ;
78+ await reqPromise0 ;
7479
75- const text = 'this is test text' ;
76- await page . locator ( '#textarea' ) . type ( text )
77- const snapshots = getIncrementalRecordingSnapshots ( await reqPromise1 ) . filter ( isInputMutation ) ;
78- const lastSnapshot = snapshots [ snapshots . length - 1 ] ;
79- expect ( lastSnapshot . text ) . toBe ( '*' . repeat ( text . length ) ) ;
80+ const text = 'this is test text' ;
81+ await page . locator ( '#textarea' ) . type ( text ) ;
82+ const snapshots = getIncrementalRecordingSnapshots ( await reqPromise1 ) . filter ( isInputMutation ) ;
83+ const lastSnapshot = snapshots [ snapshots . length - 1 ] ;
84+ expect ( lastSnapshot . text ) . toBe ( '*' . repeat ( text . length ) ) ;
8085
81- await page . locator ( '#textarea-unmasked' ) . type ( text )
82- const snapshots2 = getIncrementalRecordingSnapshots ( await reqPromise2 ) . filter ( isInputMutation ) ;
83- const lastSnapshot2 = snapshots2 [ snapshots2 . length - 1 ] ;
84- expect ( lastSnapshot2 . text ) . toBe ( text ) ;
85- } ) ;
86+ await page . locator ( '#textarea-unmasked' ) . type ( text ) ;
87+ const snapshots2 = getIncrementalRecordingSnapshots ( await reqPromise2 ) . filter ( isInputMutation ) ;
88+ const lastSnapshot2 = snapshots2 [ snapshots2 . length - 1 ] ;
89+ expect ( lastSnapshot2 . text ) . toBe ( text ) ;
90+ } ,
91+ ) ;
0 commit comments