Skip to content

Commit 26d37f1

Browse files
committed
add snapshots, test without img
1 parent 2c2f550 commit 26d37f1

File tree

7 files changed

+822
-209
lines changed

7 files changed

+822
-209
lines changed

packages/integration-tests/suites/replay/privacy/template.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<input placeholder="Placeholder should be masked" />
99
<div title="Title should be masked">Title should be masked</div>
1010
<svg viewBox="0 0 80 80"><path d="M79 71.91a7.32 7.32 0 0 0 0-7.38L46.4 8A7.22 7.22 0 0 0 40 4.37 7.33 7.33 0 0 0 33.62 8L23.06 26.33l2.66 1.54A51.42 51.42 0 0 1 44.6 46.75a50.41 50.41 0 0 1 6.81 22.72H44a44.34 44.34 0 0 0-5.84-19A43.76 43.76 0 0 0 22.07 34.2l-2.66-1.54-9.83 17.13 2.65 1.54A24.9 24.9 0 0 1 24.3 69.47H7.39a1.2 1.2 0 0 1-1.06-.59 1.21 1.21 0 0 1 0-1.23l4.73-8.14a17.67 17.67 0 0 0-5.38-3.08L1 64.57A7.34 7.34 0 0 0 1 72a7.25 7.25 0 0 0 6.39 3.67h23.24v-3.12a31.32 31.32 0 0 0-4.09-15.38 31.26 31.26 0 0 0-8.67-9.57l3.71-6.39a38 38 0 0 1 11.33 12.28 38.1 38.1 0 0 1 5.1 19v3.08h19.68v-3.02a57.52 57.52 0 0 0-7.76-28.88A57.48 57.48 0 0 0 31.47 24.1l7.51-13a1.18 1.18 0 0 1 1.02-.57 1.16 1.16 0 0 1 1.05.59L73.7 67.61a1.2 1.2 0 0 1 0 1.22 1.13 1.13 0 0 1-1.06.59H65c.1 2.07.1 4.09 0 6.16h7.65A7.1 7.1 0 0 0 79 71.91z"/></svg>
11-
<img style="width:100px;height:100px" src="//foo/foo.png" />
12-
<img data-sentry-unblock style="width:100px;height:100px" src="//foo/foo.png" />
11+
<svg class="sentry-unblock" viewBox="0 0 80 80" data-sentry-unblock><path d="M79 71.91a7.32 7.32 0 0 0 0-7.38L46.4 8A7.22 7.22 0 0 0 40 4.37 7.33 7.33 0 0 0 33.62 8L23.06 26.33l2.66 1.54A51.42 51.42 0 0 1 44.6 46.75a50.41 50.41 0 0 1 6.81 22.72H44a44.34 44.34 0 0 0-5.84-19A43.76 43.76 0 0 0 22.07 34.2l-2.66-1.54-9.83 17.13 2.65 1.54A24.9 24.9 0 0 1 24.3 69.47H7.39a1.2 1.2 0 0 1-1.06-.59 1.21 1.21 0 0 1 0-1.23l4.73-8.14a17.67 17.67 0 0 0-5.38-3.08L1 64.57A7.34 7.34 0 0 0 1 72a7.25 7.25 0 0 0 6.39 3.67h23.24v-3.12a31.32 31.32 0 0 0-4.09-15.38 31.26 31.26 0 0 0-8.67-9.57l3.71-6.39a38 38 0 0 1 11.33 12.28 38.1 38.1 0 0 1 5.1 19v3.08h19.68v-3.02a57.52 57.52 0 0 0-7.76-28.88A57.48 57.48 0 0 0 31.47 24.1l7.51-13a1.18 1.18 0 0 1 1.02-.57 1.16 1.16 0 0 1 1.05.59L73.7 67.61a1.2 1.2 0 0 1 0 1.22 1.13 1.13 0 0 1-1.06.59H65c.1 2.07.1 4.09 0 6.16h7.65A7.1 7.1 0 0 0 79 71.91z"/></svg>
1312
</body>
1413
</html>

packages/integration-tests/suites/replay/privacy/test.ts

Lines changed: 1 addition & 207 deletions
Original file line numberDiff line numberDiff line change
@@ -28,211 +28,5 @@ sentryTest('should have the correct default privacy settings', async ({ getLocal
2828
const replayPayload = envelopeRequestParser<RecordingEvent[]>(await reqPromise0, 5);
2929
const checkoutEvent = replayPayload.find(({ type }) => type === EventType.FullSnapshot);
3030

31-
expect(checkoutEvent?.data).toMatchObject({
32-
initialOffset: {
33-
left: 0,
34-
top: 0,
35-
},
36-
node: {
37-
childNodes: [
38-
{
39-
id: 2,
40-
name: 'html',
41-
publicId: '',
42-
systemId: '',
43-
type: 1,
44-
},
45-
{
46-
attributes: {},
47-
childNodes: [
48-
{
49-
attributes: {},
50-
childNodes: [
51-
{
52-
attributes: {
53-
charset: 'utf-8',
54-
},
55-
childNodes: [],
56-
id: 5,
57-
tagName: 'meta',
58-
type: 2,
59-
},
60-
],
61-
id: 4,
62-
tagName: 'head',
63-
type: 2,
64-
},
65-
{
66-
id: 6,
67-
textContent: '\n ',
68-
type: 3,
69-
},
70-
{
71-
attributes: {},
72-
childNodes: [
73-
{
74-
id: 8,
75-
textContent: '\n ',
76-
type: 3,
77-
},
78-
{
79-
attributes: {
80-
'aria-label': 'Click me',
81-
onclick: "console.log('Test log')",
82-
},
83-
childNodes: [
84-
{
85-
id: 10,
86-
textContent: '***** **',
87-
type: 3,
88-
},
89-
],
90-
id: 9,
91-
tagName: 'button',
92-
type: 2,
93-
},
94-
{
95-
id: 11,
96-
textContent: '\n ',
97-
type: 3,
98-
},
99-
{
100-
attributes: {},
101-
childNodes: [
102-
{
103-
id: 13,
104-
textContent: '**** ****** ** ****** ** *******',
105-
type: 3,
106-
},
107-
],
108-
id: 12,
109-
tagName: 'div',
110-
type: 2,
111-
},
112-
{
113-
id: 14,
114-
textContent: '\n ',
115-
type: 3,
116-
},
117-
{
118-
attributes: {
119-
'data-sentry-unmask': '',
120-
},
121-
childNodes: [
122-
{
123-
id: 16,
124-
textContent: 'This should be unmasked due to data attribute',
125-
type: 3,
126-
},
127-
],
128-
id: 15,
129-
tagName: 'div',
130-
type: 2,
131-
},
132-
{
133-
id: 17,
134-
textContent: '\n ',
135-
type: 3,
136-
},
137-
{
138-
attributes: {
139-
placeholder: 'Placeholder should be masked',
140-
},
141-
childNodes: [],
142-
id: 18,
143-
tagName: 'input',
144-
type: 2,
145-
},
146-
{
147-
id: 19,
148-
textContent: '\n ',
149-
type: 3,
150-
},
151-
{
152-
attributes: {
153-
title: 'Title should be masked',
154-
},
155-
childNodes: [
156-
{
157-
id: 21,
158-
textContent: '***** ****** ** ******',
159-
type: 3,
160-
},
161-
],
162-
id: 20,
163-
tagName: 'div',
164-
type: 2,
165-
},
166-
{
167-
id: 22,
168-
textContent: '\n ',
169-
type: 3,
170-
},
171-
{
172-
attributes: {
173-
rr_height: '1264px',
174-
rr_width: '1264px',
175-
},
176-
childNodes: [],
177-
id: 23,
178-
isSVG: true,
179-
tagName: 'svg',
180-
type: 2,
181-
},
182-
{
183-
id: 24,
184-
textContent: '\n ',
185-
type: 3,
186-
},
187-
{
188-
attributes: {
189-
rr_height: '100px',
190-
rr_width: '100px',
191-
},
192-
childNodes: [],
193-
id: 25,
194-
tagName: 'img',
195-
type: 2,
196-
},
197-
{
198-
id: 26,
199-
textContent: '\n ',
200-
type: 3,
201-
},
202-
{
203-
attributes: {
204-
"data-sentry-unblock": "",
205-
src: "file://foo/foo.png",
206-
style: "width:100px;height:100px",
207-
},
208-
childNodes: [],
209-
id: 27,
210-
tagName: 'img',
211-
type: 2,
212-
},
213-
{
214-
id: 28,
215-
textContent: '\n ',
216-
type: 3,
217-
},
218-
{
219-
id: 29,
220-
textContent: '\n\n',
221-
type: 3,
222-
},
223-
],
224-
id: 7,
225-
tagName: 'body',
226-
type: 2,
227-
},
228-
],
229-
id: 3,
230-
tagName: 'html',
231-
type: 2,
232-
},
233-
],
234-
id: 1,
235-
type: 0,
236-
},
237-
});
31+
expect(JSON.stringify(checkoutEvent?.data, null, 2)).toMatchSnapshot('privacy.json');
23832
});

0 commit comments

Comments
 (0)