1
1
import { expect } from '@playwright/test' ;
2
2
import { 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' ;
4
4
5
5
import { sentryTest } from '../../../utils/fixtures' ;
6
6
import {
@@ -13,73 +13,79 @@ 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 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
+ } ) ;
30
33
} ) ;
31
- } ) ;
32
34
33
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
35
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
34
36
35
- await page . goto ( url ) ;
37
+ await page . goto ( url ) ;
36
38
37
- await reqPromise0 ;
39
+ await reqPromise0 ;
38
40
39
- const text = 'this is test text' ;
41
+ const text = 'this is test text' ;
40
42
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 ) ) ;
45
47
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
+ ) ;
51
54
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
+ }
56
61
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 ) ;
60
65
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
+ } ) ;
66
72
} ) ;
67
- } ) ;
68
73
69
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
74
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
70
75
71
- await page . goto ( url ) ;
76
+ await page . goto ( url ) ;
72
77
73
- await reqPromise0 ;
78
+ await reqPromise0 ;
74
79
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 ) ) ;
80
85
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