From c988afa409c6a7a319984df6d29240186714b5da Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 3 Feb 2023 18:23:14 -0500 Subject: [PATCH 01/16] feat(replay): Add integration test for privacy --- .../suites/replay/privacy/init.js | 17 ++ .../suites/replay/privacy/template.html | 20 ++ .../suites/replay/privacy/test.ts | 211 ++++++++++++++++++ packages/integration-tests/utils/helpers.ts | 4 +- 4 files changed, 250 insertions(+), 2 deletions(-) create mode 100644 packages/integration-tests/suites/replay/privacy/init.js create mode 100644 packages/integration-tests/suites/replay/privacy/template.html create mode 100644 packages/integration-tests/suites/replay/privacy/test.ts diff --git a/packages/integration-tests/suites/replay/privacy/init.js b/packages/integration-tests/suites/replay/privacy/init.js new file mode 100644 index 000000000000..10f4385a1369 --- /dev/null +++ b/packages/integration-tests/suites/replay/privacy/init.js @@ -0,0 +1,17 @@ +import * as Sentry from '@sentry/browser'; + +window.Sentry = Sentry; +window.Replay = new Sentry.Replay({ + flushMinDelay: 200, + flushMaxDelay: 200, + useCompression: false, +}); + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + sampleRate: 0, + replaysSessionSampleRate: 1.0, + replaysOnErrorSampleRate: 0.0, + + integrations: [window.Replay], +}); diff --git a/packages/integration-tests/suites/replay/privacy/template.html b/packages/integration-tests/suites/replay/privacy/template.html new file mode 100644 index 000000000000..c35a4ab2ca42 --- /dev/null +++ b/packages/integration-tests/suites/replay/privacy/template.html @@ -0,0 +1,20 @@ + + + + + + + +
+ This should be masked by default +
+ +
+ This should be unmasked due to data attribute +
+ + + +
Title should be masked
+ + diff --git a/packages/integration-tests/suites/replay/privacy/test.ts b/packages/integration-tests/suites/replay/privacy/test.ts new file mode 100644 index 000000000000..62ad0996282c --- /dev/null +++ b/packages/integration-tests/suites/replay/privacy/test.ts @@ -0,0 +1,211 @@ +import { expect } from '@playwright/test'; +import { EventType } from '@sentry-internal/rrweb'; +import type { RecordingEvent } from '@sentry/replay/types'; + +import { sentryTest } from '../../../utils/fixtures'; +import { envelopeRequestParser } from '../../../utils/helpers'; +import { waitForReplayRequest } from '../../../utils/replayHelpers'; + +sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalTestPath, page }) => { + // For this test, we skip all bundle tests, as we're only interested in Replay being correctly + // exported from the `@sentry/browser` npm package. + if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle_')) { + sentryTest.skip(); + } + + const reqPromise0 = waitForReplayRequest(page, 0); + + await page.route('https://dsn.ingest.sentry.io/**/*', route => { + return route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ id: 'test-id' }), + }); + }); + + const url = await getLocalTestPath({ testDir: __dirname }); + + await page.goto(url); + const replayPayload = envelopeRequestParser(await reqPromise0, 5) as RecordingEvent[]; + const checkoutEvent = replayPayload.find(({type}) => type === EventType.FullSnapshot); + + expect(checkoutEvent.data).toEqual( + { + 'initialOffset': { + 'left': 0, + 'top': 0, + }, + 'node': { + 'childNodes': [ + { + 'id': 2, + 'name': 'html', + 'publicId': '', + 'systemId': '', + 'type': 1, + }, + { + 'attributes': {}, + 'childNodes': [ + { + 'attributes': {}, + 'childNodes': [ + { + 'attributes': { + 'charset': 'utf-8', + }, + 'childNodes': [], + 'id': 5, + 'tagName': 'meta', + 'type': 2, + }, + ], + 'id': 4, + 'tagName': 'head', + 'type': 2, + }, + { + 'id': 6, + 'textContent': ` + `, + 'type': 3, + }, + { + 'attributes': {}, + 'childNodes': [ + { + 'id': 8, + 'textContent': ` + `, + 'type': 3, + }, + { + 'attributes': { + 'aria-label': 'Click me', + 'onclick': "console.log('Test log')", + }, + 'childNodes': [ + { + 'id': 10, + 'textContent': '***** **', + 'type': 3, + }, + ], + 'id': 9, + 'tagName': 'button', + 'type': 2, + }, + { + 'id': 11, + 'textContent': ` + `, + 'type': 3, + }, + { + 'attributes': {}, + 'childNodes': [ + { + 'id': 13, + 'textContent': ` + **** ****** ** ****** ** ******* + `, + 'type': 3, + }, + ], + 'id': 12, + 'tagName': 'div', + 'type': 2, + }, + { + 'id': 14, + 'textContent': ` + + `, + 'type': 3, + }, + { + 'attributes': { + 'data-sentry-unmask': '', + }, + 'childNodes': [ + { + 'id': 16, + 'textContent': ` + This should be unmasked due to data attribute + `, + 'type': 3, + }, + ], + 'id': 15, + 'tagName': 'div', + 'type': 2, + }, + { + 'id': 17, + 'textContent': ` + + `, + 'type': 3, + }, + { + 'attributes': { + 'placeholder': 'Placeholder should be masked', + }, + 'childNodes': [], + 'id': 18, + 'tagName': 'input', + 'type': 2, + }, + { + 'id': 19, + 'textContent': ` + + `, + 'type': 3, + }, + { + 'attributes': { + 'title': 'Title should be masked', + }, + 'childNodes': [ + { + 'id': 21, + 'textContent': '***** ****** ** ******', + 'type': 3, + }, + ], + 'id': 20, + 'tagName': 'div', + 'type': 2, + }, + { + 'id': 22, + 'textContent': ` + `, + 'type': 3, + }, + { + 'id': 23, + 'textContent': ` + +`, + 'type': 3, + }, + ], + 'id': 7, + 'tagName': 'body', + 'type': 2, + }, + ], + 'id': 3, + 'tagName': 'html', + 'type': 2, + }, + ], + 'id': 1, + 'type': 0, + }, + } + + ); +}); diff --git a/packages/integration-tests/utils/helpers.ts b/packages/integration-tests/utils/helpers.ts index 443e3e0e57af..4538a210dfd3 100644 --- a/packages/integration-tests/utils/helpers.ts +++ b/packages/integration-tests/utils/helpers.ts @@ -17,8 +17,8 @@ export const envelopeParser = (request: Request | null): unknown[] => { }); }; -export const envelopeRequestParser = (request: Request | null): Event => { - return envelopeParser(request)[2] as Event; +export const envelopeRequestParser = (request: Request | null, index = 2): Event => { + return envelopeParser(request)[index] as Event; }; export const envelopeHeaderRequestParser = (request: Request | null): EventEnvelopeHeaders => { From 9e20f9492d27deca7f807b08cdf81929783b094b Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Mon, 6 Feb 2023 11:33:03 -0500 Subject: [PATCH 02/16] add imgs and remove whitespaces --- .../suites/replay/privacy/template.html | 17 ++-- .../suites/replay/privacy/test.ts | 77 +++++++++++-------- packages/integration-tests/utils/helpers.ts | 4 +- packages/replay/src/index.ts | 2 + packages/replay/src/types/rrweb.ts | 2 +- 5 files changed, 56 insertions(+), 46 deletions(-) diff --git a/packages/integration-tests/suites/replay/privacy/template.html b/packages/integration-tests/suites/replay/privacy/template.html index c35a4ab2ca42..32444337f993 100644 --- a/packages/integration-tests/suites/replay/privacy/template.html +++ b/packages/integration-tests/suites/replay/privacy/template.html @@ -1,20 +1,13 @@ - - - + -
- This should be masked by default -
- -
- This should be unmasked due to data attribute -
- +
This should be masked by default
+
This should be unmasked due to data attribute
-
Title should be masked
+ + diff --git a/packages/integration-tests/suites/replay/privacy/test.ts b/packages/integration-tests/suites/replay/privacy/test.ts index 62ad0996282c..c8dec10b472d 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts +++ b/packages/integration-tests/suites/replay/privacy/test.ts @@ -1,12 +1,12 @@ import { expect } from '@playwright/test'; import { EventType } from '@sentry-internal/rrweb'; -import type { RecordingEvent } from '@sentry/replay/types'; +import type { RecordingEvent } from '@sentry/replay'; import { sentryTest } from '../../../utils/fixtures'; import { envelopeRequestParser } from '../../../utils/helpers'; import { waitForReplayRequest } from '../../../utils/replayHelpers'; -sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalTestPath, page }) => { +sentryTest('should have the correct default privacy settings', async ({ getLocalTestPath, page }) => { // For this test, we skip all bundle tests, as we're only interested in Replay being correctly // exported from the `@sentry/browser` npm package. if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle_')) { @@ -26,10 +26,10 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); - const replayPayload = envelopeRequestParser(await reqPromise0, 5) as RecordingEvent[]; + const replayPayload = envelopeRequestParser(await reqPromise0, 5); const checkoutEvent = replayPayload.find(({type}) => type === EventType.FullSnapshot); - expect(checkoutEvent.data).toEqual( + expect(checkoutEvent?.data).toMatchObject( { 'initialOffset': { 'left': 0, @@ -66,8 +66,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT }, { 'id': 6, - 'textContent': ` - `, + 'textContent': '\n ', 'type': 3, }, { @@ -75,8 +74,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT 'childNodes': [ { 'id': 8, - 'textContent': ` - `, + 'textContent': '\n ', 'type': 3, }, { @@ -97,8 +95,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT }, { 'id': 11, - 'textContent': ` - `, + 'textContent': '\n ', 'type': 3, }, { @@ -106,9 +103,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT 'childNodes': [ { 'id': 13, - 'textContent': ` - **** ****** ** ****** ** ******* - `, + 'textContent': '**** ****** ** ****** ** *******', 'type': 3, }, ], @@ -118,9 +113,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT }, { 'id': 14, - 'textContent': ` - - `, + 'textContent': '\n ', 'type': 3, }, { @@ -130,9 +123,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT 'childNodes': [ { 'id': 16, - 'textContent': ` - This should be unmasked due to data attribute - `, + 'textContent': 'This should be unmasked due to data attribute', 'type': 3, }, ], @@ -142,9 +133,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT }, { 'id': 17, - 'textContent': ` - - `, + 'textContent': '\n ', 'type': 3, }, { @@ -158,9 +147,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT }, { 'id': 19, - 'textContent': ` - - `, + 'textContent': '\n ', 'type': 3, }, { @@ -180,15 +167,43 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT }, { 'id': 22, - 'textContent': ` - `, + 'textContent': '\n ', + 'type': 3, + }, + { + 'attributes': { + 'rr_height': '1264px', + 'rr_width': '1264px', + }, + 'childNodes': [], + 'id': 23, + 'isSVG': true, + 'tagName': 'svg', + 'type': 2, + }, + { + 'id': 24, + 'textContent': '\n ', + 'type': 3, + }, + { + 'attributes': { + 'rr_height': '0px', + 'rr_width': '0px', + }, + 'childNodes': [], + 'id': 25, + 'tagName': 'img', + 'type': 2, + }, + { + 'id': 26, + 'textContent': '\n ', 'type': 3, }, { - 'id': 23, - 'textContent': ` - -`, + 'id': 27, + 'textContent': '\n\n', 'type': 3, }, ], diff --git a/packages/integration-tests/utils/helpers.ts b/packages/integration-tests/utils/helpers.ts index 4538a210dfd3..fcfcac7f8141 100644 --- a/packages/integration-tests/utils/helpers.ts +++ b/packages/integration-tests/utils/helpers.ts @@ -17,8 +17,8 @@ export const envelopeParser = (request: Request | null): unknown[] => { }); }; -export const envelopeRequestParser = (request: Request | null, index = 2): Event => { - return envelopeParser(request)[index] as Event; +export const envelopeRequestParser = (request: Request | null, index = 2): T => { + return envelopeParser(request)[index] as T; }; export const envelopeHeaderRequestParser = (request: Request | null): EventEnvelopeHeaders => { diff --git a/packages/replay/src/index.ts b/packages/replay/src/index.ts index 0baefd4e9c37..3fb98fbc067e 100644 --- a/packages/replay/src/index.ts +++ b/packages/replay/src/index.ts @@ -1 +1,3 @@ export { Replay } from './integration'; + +export type {RecordingEvent} from './types' diff --git a/packages/replay/src/types/rrweb.ts b/packages/replay/src/types/rrweb.ts index 3628d45ef9ab..78fadee56ce7 100644 --- a/packages/replay/src/types/rrweb.ts +++ b/packages/replay/src/types/rrweb.ts @@ -3,7 +3,7 @@ type blockClass = string | RegExp; type maskTextClass = string | RegExp; -enum EventType { +export enum EventType { DomContentLoaded = 0, Load = 1, FullSnapshot = 2, From 01de9df3e45dab3ad6d3c193fce13afa6dd712f2 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Mon, 6 Feb 2023 11:37:26 -0500 Subject: [PATCH 03/16] undo unnecessary change --- packages/replay/src/types/rrweb.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/replay/src/types/rrweb.ts b/packages/replay/src/types/rrweb.ts index 78fadee56ce7..3628d45ef9ab 100644 --- a/packages/replay/src/types/rrweb.ts +++ b/packages/replay/src/types/rrweb.ts @@ -3,7 +3,7 @@ type blockClass = string | RegExp; type maskTextClass = string | RegExp; -export enum EventType { +enum EventType { DomContentLoaded = 0, Load = 1, FullSnapshot = 2, From 2eadb32cef4877a8a1c6412a071305d599a4b012 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Wed, 8 Feb 2023 11:11:37 -0500 Subject: [PATCH 04/16] Update packages/integration-tests/suites/replay/privacy/test.ts Co-authored-by: Lukas Stracke --- packages/integration-tests/suites/replay/privacy/test.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/integration-tests/suites/replay/privacy/test.ts b/packages/integration-tests/suites/replay/privacy/test.ts index c8dec10b472d..4e7bad481732 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts +++ b/packages/integration-tests/suites/replay/privacy/test.ts @@ -7,9 +7,8 @@ import { envelopeRequestParser } from '../../../utils/helpers'; import { waitForReplayRequest } from '../../../utils/replayHelpers'; sentryTest('should have the correct default privacy settings', async ({ getLocalTestPath, page }) => { - // For this test, we skip all bundle tests, as we're only interested in Replay being correctly - // exported from the `@sentry/browser` npm package. - if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle_')) { + // Replay bundles are es6 only + if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle_es5')) { sentryTest.skip(); } From f4cbc5778628d7e16a00a0f0d8ddccac515e5842 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Wed, 8 Feb 2023 11:13:39 -0500 Subject: [PATCH 05/16] change types --- packages/integration-tests/suites/replay/privacy/test.ts | 2 +- packages/replay/src/index.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/integration-tests/suites/replay/privacy/test.ts b/packages/integration-tests/suites/replay/privacy/test.ts index 4e7bad481732..e32f18d6f518 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts +++ b/packages/integration-tests/suites/replay/privacy/test.ts @@ -1,6 +1,6 @@ import { expect } from '@playwright/test'; import { EventType } from '@sentry-internal/rrweb'; -import type { RecordingEvent } from '@sentry/replay'; +import type { RecordingEvent } from '@sentry/replay/build/npm/types/types'; import { sentryTest } from '../../../utils/fixtures'; import { envelopeRequestParser } from '../../../utils/helpers'; diff --git a/packages/replay/src/index.ts b/packages/replay/src/index.ts index 3fb98fbc067e..0baefd4e9c37 100644 --- a/packages/replay/src/index.ts +++ b/packages/replay/src/index.ts @@ -1,3 +1 @@ export { Replay } from './integration'; - -export type {RecordingEvent} from './types' From 39543e5f690aceb44845e85f18c1caa0c93c6614 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Wed, 8 Feb 2023 11:30:03 -0500 Subject: [PATCH 06/16] lint --- .../suites/replay/privacy/test.ts | 381 +++++++++--------- 1 file changed, 189 insertions(+), 192 deletions(-) diff --git a/packages/integration-tests/suites/replay/privacy/test.ts b/packages/integration-tests/suites/replay/privacy/test.ts index e32f18d6f518..2f22216a5067 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts +++ b/packages/integration-tests/suites/replay/privacy/test.ts @@ -26,200 +26,197 @@ sentryTest('should have the correct default privacy settings', async ({ getLocal await page.goto(url); const replayPayload = envelopeRequestParser(await reqPromise0, 5); - const checkoutEvent = replayPayload.find(({type}) => type === EventType.FullSnapshot); + const checkoutEvent = replayPayload.find(({ type }) => type === EventType.FullSnapshot); - expect(checkoutEvent?.data).toMatchObject( - { - 'initialOffset': { - 'left': 0, - 'top': 0, - }, - 'node': { - 'childNodes': [ - { - 'id': 2, - 'name': 'html', - 'publicId': '', - 'systemId': '', - 'type': 1, - }, - { - 'attributes': {}, - 'childNodes': [ - { - 'attributes': {}, - 'childNodes': [ - { - 'attributes': { - 'charset': 'utf-8', - }, - 'childNodes': [], - 'id': 5, - 'tagName': 'meta', - 'type': 2, - }, - ], - 'id': 4, - 'tagName': 'head', - 'type': 2, - }, - { - 'id': 6, - 'textContent': '\n ', - 'type': 3, - }, - { - 'attributes': {}, - 'childNodes': [ - { - 'id': 8, - 'textContent': '\n ', - 'type': 3, - }, - { - 'attributes': { - 'aria-label': 'Click me', - 'onclick': "console.log('Test log')", - }, - 'childNodes': [ - { - 'id': 10, - 'textContent': '***** **', - 'type': 3, - }, - ], - 'id': 9, - 'tagName': 'button', - 'type': 2, - }, - { - 'id': 11, - 'textContent': '\n ', - 'type': 3, - }, - { - 'attributes': {}, - 'childNodes': [ - { - 'id': 13, - 'textContent': '**** ****** ** ****** ** *******', - 'type': 3, - }, - ], - 'id': 12, - 'tagName': 'div', - 'type': 2, - }, - { - 'id': 14, - 'textContent': '\n ', - 'type': 3, - }, - { - 'attributes': { - 'data-sentry-unmask': '', - }, - 'childNodes': [ - { - 'id': 16, - 'textContent': 'This should be unmasked due to data attribute', - 'type': 3, - }, - ], - 'id': 15, - 'tagName': 'div', - 'type': 2, - }, - { - 'id': 17, - 'textContent': '\n ', - 'type': 3, - }, - { - 'attributes': { - 'placeholder': 'Placeholder should be masked', - }, - 'childNodes': [], - 'id': 18, - 'tagName': 'input', - 'type': 2, - }, - { - 'id': 19, - 'textContent': '\n ', - 'type': 3, - }, - { - 'attributes': { - 'title': 'Title should be masked', - }, - 'childNodes': [ - { - 'id': 21, - 'textContent': '***** ****** ** ******', - 'type': 3, - }, - ], - 'id': 20, - 'tagName': 'div', - 'type': 2, - }, - { - 'id': 22, - 'textContent': '\n ', - 'type': 3, - }, - { - 'attributes': { - 'rr_height': '1264px', - 'rr_width': '1264px', - }, - 'childNodes': [], - 'id': 23, - 'isSVG': true, - 'tagName': 'svg', - 'type': 2, + expect(checkoutEvent?.data).toMatchObject({ + initialOffset: { + left: 0, + top: 0, + }, + node: { + childNodes: [ + { + id: 2, + name: 'html', + publicId: '', + systemId: '', + type: 1, + }, + { + attributes: {}, + childNodes: [ + { + attributes: {}, + childNodes: [ + { + attributes: { + charset: 'utf-8', + }, + childNodes: [], + id: 5, + tagName: 'meta', + type: 2, + }, + ], + id: 4, + tagName: 'head', + type: 2, + }, + { + id: 6, + textContent: '\n ', + type: 3, + }, + { + attributes: {}, + childNodes: [ + { + id: 8, + textContent: '\n ', + type: 3, + }, + { + attributes: { + 'aria-label': 'Click me', + onclick: "console.log('Test log')", + }, + childNodes: [ + { + id: 10, + textContent: '***** **', + type: 3, }, - { - 'id': 24, - 'textContent': '\n ', - 'type': 3, + ], + id: 9, + tagName: 'button', + type: 2, + }, + { + id: 11, + textContent: '\n ', + type: 3, + }, + { + attributes: {}, + childNodes: [ + { + id: 13, + textContent: '**** ****** ** ****** ** *******', + type: 3, }, - { - 'attributes': { - 'rr_height': '0px', - 'rr_width': '0px', - }, - 'childNodes': [], - 'id': 25, - 'tagName': 'img', - 'type': 2, + ], + id: 12, + tagName: 'div', + type: 2, + }, + { + id: 14, + textContent: '\n ', + type: 3, + }, + { + attributes: { + 'data-sentry-unmask': '', + }, + childNodes: [ + { + id: 16, + textContent: 'This should be unmasked due to data attribute', + type: 3, }, - { - 'id': 26, - 'textContent': '\n ', - 'type': 3, - }, - { - 'id': 27, - 'textContent': '\n\n', - 'type': 3, - }, - ], - 'id': 7, - 'tagName': 'body', - 'type': 2, - }, - ], - 'id': 3, - 'tagName': 'html', - 'type': 2, - }, - ], - 'id': 1, - 'type': 0, - }, - } - - ); + ], + id: 15, + tagName: 'div', + type: 2, + }, + { + id: 17, + textContent: '\n ', + type: 3, + }, + { + attributes: { + placeholder: 'Placeholder should be masked', + }, + childNodes: [], + id: 18, + tagName: 'input', + type: 2, + }, + { + id: 19, + textContent: '\n ', + type: 3, + }, + { + attributes: { + title: 'Title should be masked', + }, + childNodes: [ + { + id: 21, + textContent: '***** ****** ** ******', + type: 3, + }, + ], + id: 20, + tagName: 'div', + type: 2, + }, + { + id: 22, + textContent: '\n ', + type: 3, + }, + { + attributes: { + rr_height: '1264px', + rr_width: '1264px', + }, + childNodes: [], + id: 23, + isSVG: true, + tagName: 'svg', + type: 2, + }, + { + id: 24, + textContent: '\n ', + type: 3, + }, + { + attributes: { + rr_height: '0px', + rr_width: '0px', + }, + childNodes: [], + id: 25, + tagName: 'img', + type: 2, + }, + { + id: 26, + textContent: '\n ', + type: 3, + }, + { + id: 27, + textContent: '\n\n', + type: 3, + }, + ], + id: 7, + tagName: 'body', + type: 2, + }, + ], + id: 3, + tagName: 'html', + type: 2, + }, + ], + id: 1, + type: 0, + }, + }); }); From aaebc8bdc166a6090d6c9671c35eeddef5b02905 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 9 Feb 2023 11:09:20 -0500 Subject: [PATCH 07/16] add test for unblock --- .../suites/replay/privacy/template.html | 5 +++-- .../suites/replay/privacy/test.ts | 22 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/integration-tests/suites/replay/privacy/template.html b/packages/integration-tests/suites/replay/privacy/template.html index 32444337f993..a4a7ad5d9a0f 100644 --- a/packages/integration-tests/suites/replay/privacy/template.html +++ b/packages/integration-tests/suites/replay/privacy/template.html @@ -7,7 +7,8 @@
This should be unmasked due to data attribute
Title should be masked
- - + + + diff --git a/packages/integration-tests/suites/replay/privacy/test.ts b/packages/integration-tests/suites/replay/privacy/test.ts index 2f22216a5067..c0ce6b9a8e1a 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts +++ b/packages/integration-tests/suites/replay/privacy/test.ts @@ -186,8 +186,8 @@ sentryTest('should have the correct default privacy settings', async ({ getLocal }, { attributes: { - rr_height: '0px', - rr_width: '0px', + rr_height: '100px', + rr_width: '100px', }, childNodes: [], id: 25, @@ -196,11 +196,27 @@ sentryTest('should have the correct default privacy settings', async ({ getLocal }, { id: 26, - textContent: '\n ', + textContent: '\n ', type: 3, }, { + attributes: { + "data-sentry-unblock": "", + src: "file://foo/foo.png", + style: "width:100px;height:100px", + }, + childNodes: [], id: 27, + tagName: 'img', + type: 2, + }, + { + id: 28, + textContent: '\n ', + type: 3, + }, + { + id: 29, textContent: '\n\n', type: 3, }, From 26d37f167b09b90266b4df1fb7c6794483f3cfa3 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 9 Feb 2023 13:34:41 -0500 Subject: [PATCH 08/16] add snapshots, test without img --- .../suites/replay/privacy/template.html | 3 +- .../suites/replay/privacy/test.ts | 208 +----------------- .../privacy-chromium-darwin.json | 205 +++++++++++++++++ .../test.ts-snapshots/privacy-darwin.json | 205 +++++++++++++++++ .../privacy-firefox-darwin.json | 205 +++++++++++++++++ .../privacy-webkit-darwin.json | 205 +++++++++++++++++ .../privacy/test.ts-snapshots/privacy.json | 0 7 files changed, 822 insertions(+), 209 deletions(-) create mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium-darwin.json create mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-darwin.json create mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox-darwin.json create mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit-darwin.json create mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy.json diff --git a/packages/integration-tests/suites/replay/privacy/template.html b/packages/integration-tests/suites/replay/privacy/template.html index a4a7ad5d9a0f..8d78285b4aa8 100644 --- a/packages/integration-tests/suites/replay/privacy/template.html +++ b/packages/integration-tests/suites/replay/privacy/template.html @@ -8,7 +8,6 @@
Title should be masked
- - + diff --git a/packages/integration-tests/suites/replay/privacy/test.ts b/packages/integration-tests/suites/replay/privacy/test.ts index c0ce6b9a8e1a..53187dc7e9f7 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts +++ b/packages/integration-tests/suites/replay/privacy/test.ts @@ -28,211 +28,5 @@ sentryTest('should have the correct default privacy settings', async ({ getLocal const replayPayload = envelopeRequestParser(await reqPromise0, 5); const checkoutEvent = replayPayload.find(({ type }) => type === EventType.FullSnapshot); - expect(checkoutEvent?.data).toMatchObject({ - initialOffset: { - left: 0, - top: 0, - }, - node: { - childNodes: [ - { - id: 2, - name: 'html', - publicId: '', - systemId: '', - type: 1, - }, - { - attributes: {}, - childNodes: [ - { - attributes: {}, - childNodes: [ - { - attributes: { - charset: 'utf-8', - }, - childNodes: [], - id: 5, - tagName: 'meta', - type: 2, - }, - ], - id: 4, - tagName: 'head', - type: 2, - }, - { - id: 6, - textContent: '\n ', - type: 3, - }, - { - attributes: {}, - childNodes: [ - { - id: 8, - textContent: '\n ', - type: 3, - }, - { - attributes: { - 'aria-label': 'Click me', - onclick: "console.log('Test log')", - }, - childNodes: [ - { - id: 10, - textContent: '***** **', - type: 3, - }, - ], - id: 9, - tagName: 'button', - type: 2, - }, - { - id: 11, - textContent: '\n ', - type: 3, - }, - { - attributes: {}, - childNodes: [ - { - id: 13, - textContent: '**** ****** ** ****** ** *******', - type: 3, - }, - ], - id: 12, - tagName: 'div', - type: 2, - }, - { - id: 14, - textContent: '\n ', - type: 3, - }, - { - attributes: { - 'data-sentry-unmask': '', - }, - childNodes: [ - { - id: 16, - textContent: 'This should be unmasked due to data attribute', - type: 3, - }, - ], - id: 15, - tagName: 'div', - type: 2, - }, - { - id: 17, - textContent: '\n ', - type: 3, - }, - { - attributes: { - placeholder: 'Placeholder should be masked', - }, - childNodes: [], - id: 18, - tagName: 'input', - type: 2, - }, - { - id: 19, - textContent: '\n ', - type: 3, - }, - { - attributes: { - title: 'Title should be masked', - }, - childNodes: [ - { - id: 21, - textContent: '***** ****** ** ******', - type: 3, - }, - ], - id: 20, - tagName: 'div', - type: 2, - }, - { - id: 22, - textContent: '\n ', - type: 3, - }, - { - attributes: { - rr_height: '1264px', - rr_width: '1264px', - }, - childNodes: [], - id: 23, - isSVG: true, - tagName: 'svg', - type: 2, - }, - { - id: 24, - textContent: '\n ', - type: 3, - }, - { - attributes: { - rr_height: '100px', - rr_width: '100px', - }, - childNodes: [], - id: 25, - tagName: 'img', - type: 2, - }, - { - id: 26, - textContent: '\n ', - type: 3, - }, - { - attributes: { - "data-sentry-unblock": "", - src: "file://foo/foo.png", - style: "width:100px;height:100px", - }, - childNodes: [], - id: 27, - tagName: 'img', - type: 2, - }, - { - id: 28, - textContent: '\n ', - type: 3, - }, - { - id: 29, - textContent: '\n\n', - type: 3, - }, - ], - id: 7, - tagName: 'body', - type: 2, - }, - ], - id: 3, - tagName: 'html', - type: 2, - }, - ], - id: 1, - type: 0, - }, - }); + expect(JSON.stringify(checkoutEvent?.data, null, 2)).toMatchSnapshot('privacy.json'); }); diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium-darwin.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium-darwin.json new file mode 100644 index 000000000000..33581c9d9020 --- /dev/null +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium-darwin.json @@ -0,0 +1,205 @@ +{ + "node": { + "type": 0, + "childNodes": [ + { + "type": 1, + "name": "html", + "publicId": "", + "systemId": "", + "id": 2 + }, + { + "type": 2, + "tagName": "html", + "attributes": {}, + "childNodes": [ + { + "type": 2, + "tagName": "head", + "attributes": {}, + "childNodes": [ + { + "type": 2, + "tagName": "meta", + "attributes": { + "charset": "utf-8" + }, + "childNodes": [], + "id": 5 + } + ], + "id": 4 + }, + { + "type": 3, + "textContent": "\n ", + "id": 6 + }, + { + "type": 2, + "tagName": "body", + "attributes": {}, + "childNodes": [ + { + "type": 3, + "textContent": "\n ", + "id": 8 + }, + { + "type": 2, + "tagName": "button", + "attributes": { + "aria-label": "Click me", + "onclick": "console.log('Test log')" + }, + "childNodes": [ + { + "type": 3, + "textContent": "***** **", + "id": 10 + } + ], + "id": 9 + }, + { + "type": 3, + "textContent": "\n ", + "id": 11 + }, + { + "type": 2, + "tagName": "div", + "attributes": {}, + "childNodes": [ + { + "type": 3, + "textContent": "**** ****** ** ****** ** *******", + "id": 13 + } + ], + "id": 12 + }, + { + "type": 3, + "textContent": "\n ", + "id": 14 + }, + { + "type": 2, + "tagName": "div", + "attributes": { + "data-sentry-unmask": "" + }, + "childNodes": [ + { + "type": 3, + "textContent": "This should be unmasked due to data attribute", + "id": 16 + } + ], + "id": 15 + }, + { + "type": 3, + "textContent": "\n ", + "id": 17 + }, + { + "type": 2, + "tagName": "input", + "attributes": { + "placeholder": "Placeholder should be masked" + }, + "childNodes": [], + "id": 18 + }, + { + "type": 3, + "textContent": "\n ", + "id": 19 + }, + { + "type": 2, + "tagName": "div", + "attributes": { + "title": "Title should be masked" + }, + "childNodes": [ + { + "type": 3, + "textContent": "***** ****** ** ******", + "id": 21 + } + ], + "id": 20 + }, + { + "type": 3, + "textContent": "\n ", + "id": 22 + }, + { + "type": 2, + "tagName": "svg", + "attributes": { + "rr_width": "1264px", + "rr_height": "1264px" + }, + "childNodes": [], + "isSVG": true, + "id": 23 + }, + { + "type": 3, + "textContent": "\n ", + "id": 24 + }, + { + "type": 2, + "tagName": "svg", + "attributes": { + "class": "sentry-unblock", + "viewBox": "0 0 80 80", + "data-sentry-unblock": "" + }, + "childNodes": [ + { + "type": 2, + "tagName": "path", + "attributes": { + "rr_width": "1264.1212158203125px", + "rr_height": "1126.5677490234375px" + }, + "childNodes": [], + "isSVG": true, + "id": 26 + } + ], + "isSVG": true, + "id": 25 + }, + { + "type": 3, + "textContent": "\n ", + "id": 27 + }, + { + "type": 3, + "textContent": "\n\n", + "id": 28 + } + ], + "id": 7 + } + ], + "id": 3 + } + ], + "id": 1 + }, + "initialOffset": { + "left": 0, + "top": 0 + } +} \ No newline at end of file diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-darwin.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-darwin.json new file mode 100644 index 000000000000..33581c9d9020 --- /dev/null +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-darwin.json @@ -0,0 +1,205 @@ +{ + "node": { + "type": 0, + "childNodes": [ + { + "type": 1, + "name": "html", + "publicId": "", + "systemId": "", + "id": 2 + }, + { + "type": 2, + "tagName": "html", + "attributes": {}, + "childNodes": [ + { + "type": 2, + "tagName": "head", + "attributes": {}, + "childNodes": [ + { + "type": 2, + "tagName": "meta", + "attributes": { + "charset": "utf-8" + }, + "childNodes": [], + "id": 5 + } + ], + "id": 4 + }, + { + "type": 3, + "textContent": "\n ", + "id": 6 + }, + { + "type": 2, + "tagName": "body", + "attributes": {}, + "childNodes": [ + { + "type": 3, + "textContent": "\n ", + "id": 8 + }, + { + "type": 2, + "tagName": "button", + "attributes": { + "aria-label": "Click me", + "onclick": "console.log('Test log')" + }, + "childNodes": [ + { + "type": 3, + "textContent": "***** **", + "id": 10 + } + ], + "id": 9 + }, + { + "type": 3, + "textContent": "\n ", + "id": 11 + }, + { + "type": 2, + "tagName": "div", + "attributes": {}, + "childNodes": [ + { + "type": 3, + "textContent": "**** ****** ** ****** ** *******", + "id": 13 + } + ], + "id": 12 + }, + { + "type": 3, + "textContent": "\n ", + "id": 14 + }, + { + "type": 2, + "tagName": "div", + "attributes": { + "data-sentry-unmask": "" + }, + "childNodes": [ + { + "type": 3, + "textContent": "This should be unmasked due to data attribute", + "id": 16 + } + ], + "id": 15 + }, + { + "type": 3, + "textContent": "\n ", + "id": 17 + }, + { + "type": 2, + "tagName": "input", + "attributes": { + "placeholder": "Placeholder should be masked" + }, + "childNodes": [], + "id": 18 + }, + { + "type": 3, + "textContent": "\n ", + "id": 19 + }, + { + "type": 2, + "tagName": "div", + "attributes": { + "title": "Title should be masked" + }, + "childNodes": [ + { + "type": 3, + "textContent": "***** ****** ** ******", + "id": 21 + } + ], + "id": 20 + }, + { + "type": 3, + "textContent": "\n ", + "id": 22 + }, + { + "type": 2, + "tagName": "svg", + "attributes": { + "rr_width": "1264px", + "rr_height": "1264px" + }, + "childNodes": [], + "isSVG": true, + "id": 23 + }, + { + "type": 3, + "textContent": "\n ", + "id": 24 + }, + { + "type": 2, + "tagName": "svg", + "attributes": { + "class": "sentry-unblock", + "viewBox": "0 0 80 80", + "data-sentry-unblock": "" + }, + "childNodes": [ + { + "type": 2, + "tagName": "path", + "attributes": { + "rr_width": "1264.1212158203125px", + "rr_height": "1126.5677490234375px" + }, + "childNodes": [], + "isSVG": true, + "id": 26 + } + ], + "isSVG": true, + "id": 25 + }, + { + "type": 3, + "textContent": "\n ", + "id": 27 + }, + { + "type": 3, + "textContent": "\n\n", + "id": 28 + } + ], + "id": 7 + } + ], + "id": 3 + } + ], + "id": 1 + }, + "initialOffset": { + "left": 0, + "top": 0 + } +} \ No newline at end of file diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox-darwin.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox-darwin.json new file mode 100644 index 000000000000..6c3d84bded6c --- /dev/null +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox-darwin.json @@ -0,0 +1,205 @@ +{ + "node": { + "type": 0, + "childNodes": [ + { + "type": 1, + "name": "html", + "publicId": "", + "systemId": "", + "id": 2 + }, + { + "type": 2, + "tagName": "html", + "attributes": {}, + "childNodes": [ + { + "type": 2, + "tagName": "head", + "attributes": {}, + "childNodes": [ + { + "type": 2, + "tagName": "meta", + "attributes": { + "charset": "utf-8" + }, + "childNodes": [], + "id": 5 + } + ], + "id": 4 + }, + { + "type": 3, + "textContent": "\n ", + "id": 6 + }, + { + "type": 2, + "tagName": "body", + "attributes": {}, + "childNodes": [ + { + "type": 3, + "textContent": "\n ", + "id": 8 + }, + { + "type": 2, + "tagName": "button", + "attributes": { + "aria-label": "Click me", + "onclick": "console.log('Test log')" + }, + "childNodes": [ + { + "type": 3, + "textContent": "***** **", + "id": 10 + } + ], + "id": 9 + }, + { + "type": 3, + "textContent": "\n ", + "id": 11 + }, + { + "type": 2, + "tagName": "div", + "attributes": {}, + "childNodes": [ + { + "type": 3, + "textContent": "**** ****** ** ****** ** *******", + "id": 13 + } + ], + "id": 12 + }, + { + "type": 3, + "textContent": "\n ", + "id": 14 + }, + { + "type": 2, + "tagName": "div", + "attributes": { + "data-sentry-unmask": "" + }, + "childNodes": [ + { + "type": 3, + "textContent": "This should be unmasked due to data attribute", + "id": 16 + } + ], + "id": 15 + }, + { + "type": 3, + "textContent": "\n ", + "id": 17 + }, + { + "type": 2, + "tagName": "input", + "attributes": { + "placeholder": "Placeholder should be masked" + }, + "childNodes": [], + "id": 18 + }, + { + "type": 3, + "textContent": "\n ", + "id": 19 + }, + { + "type": 2, + "tagName": "div", + "attributes": { + "title": "Title should be masked" + }, + "childNodes": [ + { + "type": 3, + "textContent": "***** ****** ** ******", + "id": 21 + } + ], + "id": 20 + }, + { + "type": 3, + "textContent": "\n ", + "id": 22 + }, + { + "type": 2, + "tagName": "svg", + "attributes": { + "rr_width": "1264px", + "rr_height": "1264px" + }, + "childNodes": [], + "isSVG": true, + "id": 23 + }, + { + "type": 3, + "textContent": "\n ", + "id": 24 + }, + { + "type": 2, + "tagName": "svg", + "attributes": { + "class": "sentry-unblock", + "viewBox": "0 0 80 80", + "data-sentry-unblock": "" + }, + "childNodes": [ + { + "type": 2, + "tagName": "path", + "attributes": { + "rr_width": "1264.2666015625px", + "rr_height": "1126.816650390625px" + }, + "childNodes": [], + "isSVG": true, + "id": 26 + } + ], + "isSVG": true, + "id": 25 + }, + { + "type": 3, + "textContent": "\n ", + "id": 27 + }, + { + "type": 3, + "textContent": "\n\n", + "id": 28 + } + ], + "id": 7 + } + ], + "id": 3 + } + ], + "id": 1 + }, + "initialOffset": { + "left": 0, + "top": 0 + } +} \ No newline at end of file diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit-darwin.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit-darwin.json new file mode 100644 index 000000000000..0baf9b7631a2 --- /dev/null +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit-darwin.json @@ -0,0 +1,205 @@ +{ + "node": { + "type": 0, + "childNodes": [ + { + "type": 1, + "name": "html", + "publicId": "", + "systemId": "", + "id": 2 + }, + { + "type": 2, + "tagName": "html", + "attributes": {}, + "childNodes": [ + { + "type": 2, + "tagName": "head", + "attributes": {}, + "childNodes": [ + { + "type": 2, + "tagName": "meta", + "attributes": { + "charset": "utf-8" + }, + "childNodes": [], + "id": 5 + } + ], + "id": 4 + }, + { + "type": 3, + "textContent": "\n ", + "id": 6 + }, + { + "type": 2, + "tagName": "body", + "attributes": {}, + "childNodes": [ + { + "type": 3, + "textContent": "\n ", + "id": 8 + }, + { + "type": 2, + "tagName": "button", + "attributes": { + "aria-label": "Click me", + "onclick": "console.log('Test log')" + }, + "childNodes": [ + { + "type": 3, + "textContent": "***** **", + "id": 10 + } + ], + "id": 9 + }, + { + "type": 3, + "textContent": "\n ", + "id": 11 + }, + { + "type": 2, + "tagName": "div", + "attributes": {}, + "childNodes": [ + { + "type": 3, + "textContent": "**** ****** ** ****** ** *******", + "id": 13 + } + ], + "id": 12 + }, + { + "type": 3, + "textContent": "\n ", + "id": 14 + }, + { + "type": 2, + "tagName": "div", + "attributes": { + "data-sentry-unmask": "" + }, + "childNodes": [ + { + "type": 3, + "textContent": "This should be unmasked due to data attribute", + "id": 16 + } + ], + "id": 15 + }, + { + "type": 3, + "textContent": "\n ", + "id": 17 + }, + { + "type": 2, + "tagName": "input", + "attributes": { + "placeholder": "Placeholder should be masked" + }, + "childNodes": [], + "id": 18 + }, + { + "type": 3, + "textContent": "\n ", + "id": 19 + }, + { + "type": 2, + "tagName": "div", + "attributes": { + "title": "Title should be masked" + }, + "childNodes": [ + { + "type": 3, + "textContent": "***** ****** ** ******", + "id": 21 + } + ], + "id": 20 + }, + { + "type": 3, + "textContent": "\n ", + "id": 22 + }, + { + "type": 2, + "tagName": "svg", + "attributes": { + "rr_width": "1264px", + "rr_height": "1264px" + }, + "childNodes": [], + "isSVG": true, + "id": 23 + }, + { + "type": 3, + "textContent": "\n ", + "id": 24 + }, + { + "type": 2, + "tagName": "svg", + "attributes": { + "class": "sentry-unblock", + "viewBox": "0 0 80 80", + "data-sentry-unblock": "" + }, + "childNodes": [ + { + "type": 2, + "tagName": "path", + "attributes": { + "rr_width": "1264.12109375px", + "rr_height": "1126.56787109375px" + }, + "childNodes": [], + "isSVG": true, + "id": 26 + } + ], + "isSVG": true, + "id": 25 + }, + { + "type": 3, + "textContent": "\n ", + "id": 27 + }, + { + "type": 3, + "textContent": "\n\n", + "id": 28 + } + ], + "id": 7 + } + ], + "id": 3 + } + ], + "id": 1 + }, + "initialOffset": { + "left": 0, + "top": 0 + } +} \ No newline at end of file diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy.json new file mode 100644 index 000000000000..e69de29bb2d1 From 2c3927eca4bcede85f266d349e4c04d6e6f89a83 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 9 Feb 2023 13:55:54 -0500 Subject: [PATCH 09/16] remove snapshot suffix --- packages/integration-tests/utils/fixtures.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/integration-tests/utils/fixtures.ts b/packages/integration-tests/utils/fixtures.ts index 3926bf1f9d74..1618bbce9ddd 100644 --- a/packages/integration-tests/utils/fixtures.ts +++ b/packages/integration-tests/utils/fixtures.ts @@ -35,6 +35,11 @@ export type TestFixtures = { }; const sentryTest = base.extend({ + _autoSnapshotSuffix: [async ({ }, use, testInfo) => { + testInfo.snapshotSuffix = ''; + await use(); + }, { auto: true }], + getLocalTestPath: ({}, use, testInfo) => { return use(async ({ testDir }) => { const pagePath = `file:///${path.resolve(testDir, './dist/index.html')}`; From 8f1c6cadf8dad991c708c823473b5eddf11001fb Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 9 Feb 2023 13:56:05 -0500 Subject: [PATCH 10/16] remove svg --- packages/integration-tests/suites/replay/privacy/template.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/integration-tests/suites/replay/privacy/template.html b/packages/integration-tests/suites/replay/privacy/template.html index 8d78285b4aa8..9e41ac7a11ab 100644 --- a/packages/integration-tests/suites/replay/privacy/template.html +++ b/packages/integration-tests/suites/replay/privacy/template.html @@ -7,7 +7,5 @@
This should be unmasked due to data attribute
Title should be masked
- - From e88b81b3e1e1ec9381cf9d222e77881092d3a38d Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 9 Feb 2023 14:19:04 -0500 Subject: [PATCH 11/16] remove snapshot suffix, remove more html --- .../suites/replay/privacy/template.html | 3 - ...mium-darwin.json => privacy-chromium.json} | 0 .../test.ts-snapshots/privacy-darwin.json | 205 ------------------ ...refox-darwin.json => privacy-firefox.json} | 0 ...webkit-darwin.json => privacy-webkit.json} | 0 .../privacy/test.ts-snapshots/privacy.json | 0 packages/integration-tests/utils/fixtures.ts | 12 +- 7 files changed, 8 insertions(+), 212 deletions(-) rename packages/integration-tests/suites/replay/privacy/test.ts-snapshots/{privacy-chromium-darwin.json => privacy-chromium.json} (100%) delete mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-darwin.json rename packages/integration-tests/suites/replay/privacy/test.ts-snapshots/{privacy-firefox-darwin.json => privacy-firefox.json} (100%) rename packages/integration-tests/suites/replay/privacy/test.ts-snapshots/{privacy-webkit-darwin.json => privacy-webkit.json} (100%) delete mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy.json diff --git a/packages/integration-tests/suites/replay/privacy/template.html b/packages/integration-tests/suites/replay/privacy/template.html index 9e41ac7a11ab..113f2caf783a 100644 --- a/packages/integration-tests/suites/replay/privacy/template.html +++ b/packages/integration-tests/suites/replay/privacy/template.html @@ -4,8 +4,5 @@
This should be masked by default
-
This should be unmasked due to data attribute
- -
Title should be masked
diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium-darwin.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json similarity index 100% rename from packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium-darwin.json rename to packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-darwin.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-darwin.json deleted file mode 100644 index 33581c9d9020..000000000000 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-darwin.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "node": { - "type": 0, - "childNodes": [ - { - "type": 1, - "name": "html", - "publicId": "", - "systemId": "", - "id": 2 - }, - { - "type": 2, - "tagName": "html", - "attributes": {}, - "childNodes": [ - { - "type": 2, - "tagName": "head", - "attributes": {}, - "childNodes": [ - { - "type": 2, - "tagName": "meta", - "attributes": { - "charset": "utf-8" - }, - "childNodes": [], - "id": 5 - } - ], - "id": 4 - }, - { - "type": 3, - "textContent": "\n ", - "id": 6 - }, - { - "type": 2, - "tagName": "body", - "attributes": {}, - "childNodes": [ - { - "type": 3, - "textContent": "\n ", - "id": 8 - }, - { - "type": 2, - "tagName": "button", - "attributes": { - "aria-label": "Click me", - "onclick": "console.log('Test log')" - }, - "childNodes": [ - { - "type": 3, - "textContent": "***** **", - "id": 10 - } - ], - "id": 9 - }, - { - "type": 3, - "textContent": "\n ", - "id": 11 - }, - { - "type": 2, - "tagName": "div", - "attributes": {}, - "childNodes": [ - { - "type": 3, - "textContent": "**** ****** ** ****** ** *******", - "id": 13 - } - ], - "id": 12 - }, - { - "type": 3, - "textContent": "\n ", - "id": 14 - }, - { - "type": 2, - "tagName": "div", - "attributes": { - "data-sentry-unmask": "" - }, - "childNodes": [ - { - "type": 3, - "textContent": "This should be unmasked due to data attribute", - "id": 16 - } - ], - "id": 15 - }, - { - "type": 3, - "textContent": "\n ", - "id": 17 - }, - { - "type": 2, - "tagName": "input", - "attributes": { - "placeholder": "Placeholder should be masked" - }, - "childNodes": [], - "id": 18 - }, - { - "type": 3, - "textContent": "\n ", - "id": 19 - }, - { - "type": 2, - "tagName": "div", - "attributes": { - "title": "Title should be masked" - }, - "childNodes": [ - { - "type": 3, - "textContent": "***** ****** ** ******", - "id": 21 - } - ], - "id": 20 - }, - { - "type": 3, - "textContent": "\n ", - "id": 22 - }, - { - "type": 2, - "tagName": "svg", - "attributes": { - "rr_width": "1264px", - "rr_height": "1264px" - }, - "childNodes": [], - "isSVG": true, - "id": 23 - }, - { - "type": 3, - "textContent": "\n ", - "id": 24 - }, - { - "type": 2, - "tagName": "svg", - "attributes": { - "class": "sentry-unblock", - "viewBox": "0 0 80 80", - "data-sentry-unblock": "" - }, - "childNodes": [ - { - "type": 2, - "tagName": "path", - "attributes": { - "rr_width": "1264.1212158203125px", - "rr_height": "1126.5677490234375px" - }, - "childNodes": [], - "isSVG": true, - "id": 26 - } - ], - "isSVG": true, - "id": 25 - }, - { - "type": 3, - "textContent": "\n ", - "id": 27 - }, - { - "type": 3, - "textContent": "\n\n", - "id": 28 - } - ], - "id": 7 - } - ], - "id": 3 - } - ], - "id": 1 - }, - "initialOffset": { - "left": 0, - "top": 0 - } -} \ No newline at end of file diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox-darwin.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json similarity index 100% rename from packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox-darwin.json rename to packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit-darwin.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json similarity index 100% rename from packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit-darwin.json rename to packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy.json deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/packages/integration-tests/utils/fixtures.ts b/packages/integration-tests/utils/fixtures.ts index 1618bbce9ddd..15c41ab10c14 100644 --- a/packages/integration-tests/utils/fixtures.ts +++ b/packages/integration-tests/utils/fixtures.ts @@ -22,6 +22,7 @@ const getAsset = (assetDir: string, asset: string): string => { }; export type TestFixtures = { + _autoSnapshotSuffix: void; testDir: string; getLocalTestPath: (options: { testDir: string }) => Promise; runInChromium: (fn: (...args: unknown[]) => unknown, args?: unknown[]) => unknown; @@ -35,10 +36,13 @@ export type TestFixtures = { }; const sentryTest = base.extend({ - _autoSnapshotSuffix: [async ({ }, use, testInfo) => { - testInfo.snapshotSuffix = ''; - await use(); - }, { auto: true }], + _autoSnapshotSuffix: [ + async ({}, use, testInfo) => { + testInfo.snapshotSuffix = ''; + await use(); + }, + { auto: true }, + ], getLocalTestPath: ({}, use, testInfo) => { return use(async ({ testDir }) => { From 3ddb7b0718d1df28022161d155ee33a266417e89 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 9 Feb 2023 14:21:05 -0500 Subject: [PATCH 12/16] import replay from @sentry/replay --- packages/integration-tests/suites/replay/privacy/init.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/integration-tests/suites/replay/privacy/init.js b/packages/integration-tests/suites/replay/privacy/init.js index 10f4385a1369..ccb9689a14d6 100644 --- a/packages/integration-tests/suites/replay/privacy/init.js +++ b/packages/integration-tests/suites/replay/privacy/init.js @@ -1,7 +1,8 @@ import * as Sentry from '@sentry/browser'; +import { Replay } from '@sentry/replay'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = new Replay({ flushMinDelay: 200, flushMaxDelay: 200, useCompression: false, From 6e8399c374c73fe4575623a400ccca568981185a Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 9 Feb 2023 14:29:52 -0500 Subject: [PATCH 13/16] undo template changes --- .../suites/replay/privacy/template.html | 7 ++++ .../test.ts-snapshots/privacy-chromium.json | 35 +++++++++++++++++-- .../test.ts-snapshots/privacy-firefox.json | 35 +++++++++++++++++-- .../test.ts-snapshots/privacy-webkit.json | 35 +++++++++++++++++-- 4 files changed, 106 insertions(+), 6 deletions(-) diff --git a/packages/integration-tests/suites/replay/privacy/template.html b/packages/integration-tests/suites/replay/privacy/template.html index 113f2caf783a..03fceeef140d 100644 --- a/packages/integration-tests/suites/replay/privacy/template.html +++ b/packages/integration-tests/suites/replay/privacy/template.html @@ -4,5 +4,12 @@
This should be masked by default
+
This should be unmasked due to data attribute
+ +
Title should be masked
+ + + + diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json index 33581c9d9020..7bff0fada070 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json @@ -181,13 +181,44 @@ }, { "type": 3, - "textContent": "\n ", + "textContent": "\n ", "id": 27 }, + { + "type": 2, + "tagName": "img", + "attributes": { + "rr_width": "100px", + "rr_height": "100px" + }, + "childNodes": [], + "id": 28 + }, + { + "type": 3, + "textContent": "\n ", + "id": 29 + }, + { + "type": 2, + "tagName": "img", + "attributes": { + "data-sentry-unblock": "", + "style": "width:100px;height:100px", + "src": "file:///none.png" + }, + "childNodes": [], + "id": 30 + }, + { + "type": 3, + "textContent": "\n ", + "id": 31 + }, { "type": 3, "textContent": "\n\n", - "id": 28 + "id": 32 } ], "id": 7 diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json index 6c3d84bded6c..db82af829cda 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json @@ -181,13 +181,44 @@ }, { "type": 3, - "textContent": "\n ", + "textContent": "\n ", "id": 27 }, + { + "type": 2, + "tagName": "img", + "attributes": { + "rr_width": "100px", + "rr_height": "100px" + }, + "childNodes": [], + "id": 28 + }, + { + "type": 3, + "textContent": "\n ", + "id": 29 + }, + { + "type": 2, + "tagName": "img", + "attributes": { + "data-sentry-unblock": "", + "style": "width:100px;height:100px", + "src": "file:///none.png" + }, + "childNodes": [], + "id": 30 + }, + { + "type": 3, + "textContent": "\n ", + "id": 31 + }, { "type": 3, "textContent": "\n\n", - "id": 28 + "id": 32 } ], "id": 7 diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json index 0baf9b7631a2..3ecc74c79389 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json @@ -181,13 +181,44 @@ }, { "type": 3, - "textContent": "\n ", + "textContent": "\n ", "id": 27 }, + { + "type": 2, + "tagName": "img", + "attributes": { + "rr_width": "100px", + "rr_height": "100px" + }, + "childNodes": [], + "id": 28 + }, + { + "type": 3, + "textContent": "\n ", + "id": 29 + }, + { + "type": 2, + "tagName": "img", + "attributes": { + "data-sentry-unblock": "", + "style": "width:100px;height:100px", + "src": "file:///none.png" + }, + "childNodes": [], + "id": 30 + }, + { + "type": 3, + "textContent": "\n ", + "id": 31 + }, { "type": 3, "textContent": "\n\n", - "id": 28 + "id": 32 } ], "id": 7 From 174531c5e6d00bac4bf6628159bfb8507208219f Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 9 Feb 2023 15:03:24 -0500 Subject: [PATCH 14/16] empty path --- .../suites/replay/privacy/template.html | 4 ++-- .../privacy/test.ts-snapshots/privacy-chromium.json | 9 +++++---- .../privacy/test.ts-snapshots/privacy-firefox.json | 9 +++++---- .../replay/privacy/test.ts-snapshots/privacy-webkit.json | 9 +++++---- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/packages/integration-tests/suites/replay/privacy/template.html b/packages/integration-tests/suites/replay/privacy/template.html index 03fceeef140d..aa916d3f116e 100644 --- a/packages/integration-tests/suites/replay/privacy/template.html +++ b/packages/integration-tests/suites/replay/privacy/template.html @@ -7,8 +7,8 @@
This should be unmasked due to data attribute
Title should be masked
- - + + diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json index 7bff0fada070..c9e633b2c16c 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json @@ -143,8 +143,8 @@ "type": 2, "tagName": "svg", "attributes": { - "rr_width": "1264px", - "rr_height": "1264px" + "rr_width": "200px", + "rr_height": "200px" }, "childNodes": [], "isSVG": true, @@ -159,6 +159,7 @@ "type": 2, "tagName": "svg", "attributes": { + "style": "width:200px;height:200px", "class": "sentry-unblock", "viewBox": "0 0 80 80", "data-sentry-unblock": "" @@ -168,8 +169,8 @@ "type": 2, "tagName": "path", "attributes": { - "rr_width": "1264.1212158203125px", - "rr_height": "1126.5677490234375px" + "rr_width": "0px", + "rr_height": "0px" }, "childNodes": [], "isSVG": true, diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json index db82af829cda..c9e633b2c16c 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json @@ -143,8 +143,8 @@ "type": 2, "tagName": "svg", "attributes": { - "rr_width": "1264px", - "rr_height": "1264px" + "rr_width": "200px", + "rr_height": "200px" }, "childNodes": [], "isSVG": true, @@ -159,6 +159,7 @@ "type": 2, "tagName": "svg", "attributes": { + "style": "width:200px;height:200px", "class": "sentry-unblock", "viewBox": "0 0 80 80", "data-sentry-unblock": "" @@ -168,8 +169,8 @@ "type": 2, "tagName": "path", "attributes": { - "rr_width": "1264.2666015625px", - "rr_height": "1126.816650390625px" + "rr_width": "0px", + "rr_height": "0px" }, "childNodes": [], "isSVG": true, diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json index 3ecc74c79389..c9e633b2c16c 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json +++ b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json @@ -143,8 +143,8 @@ "type": 2, "tagName": "svg", "attributes": { - "rr_width": "1264px", - "rr_height": "1264px" + "rr_width": "200px", + "rr_height": "200px" }, "childNodes": [], "isSVG": true, @@ -159,6 +159,7 @@ "type": 2, "tagName": "svg", "attributes": { + "style": "width:200px;height:200px", "class": "sentry-unblock", "viewBox": "0 0 80 80", "data-sentry-unblock": "" @@ -168,8 +169,8 @@ "type": 2, "tagName": "path", "attributes": { - "rr_width": "1264.12109375px", - "rr_height": "1126.56787109375px" + "rr_width": "0px", + "rr_height": "0px" }, "childNodes": [], "isSVG": true, From 57365dac9740ccf98cb484d0ae25dcb54cbb6d10 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 10 Feb 2023 09:06:28 -0500 Subject: [PATCH 15/16] remove snapshots for now --- .../suites/replay/privacy/test.ts | 238 +++++++++++++++++- .../test.ts-snapshots/privacy-chromium.json | 237 ----------------- .../test.ts-snapshots/privacy-firefox.json | 237 ----------------- .../test.ts-snapshots/privacy-webkit.json | 237 ----------------- packages/integration-tests/utils/fixtures.ts | 9 - 5 files changed, 237 insertions(+), 721 deletions(-) delete mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json delete mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json delete mode 100644 packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json diff --git a/packages/integration-tests/suites/replay/privacy/test.ts b/packages/integration-tests/suites/replay/privacy/test.ts index 53187dc7e9f7..288a927976be 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts +++ b/packages/integration-tests/suites/replay/privacy/test.ts @@ -28,5 +28,241 @@ sentryTest('should have the correct default privacy settings', async ({ getLocal const replayPayload = envelopeRequestParser(await reqPromise0, 5); const checkoutEvent = replayPayload.find(({ type }) => type === EventType.FullSnapshot); - expect(JSON.stringify(checkoutEvent?.data, null, 2)).toMatchSnapshot('privacy.json'); + expect(checkoutEvent?.data).toEqual({ + 'node': { + 'type': 0, + 'childNodes': [ + { + 'type': 1, + 'name': 'html', + 'publicId': '', + 'systemId': '', + 'id': 2 + }, + { + 'type': 2, + 'tagName': 'html', + 'attributes': {}, + 'childNodes': [ + { + 'type': 2, + 'tagName': 'head', + 'attributes': {}, + 'childNodes': [ + { + 'type': 2, + 'tagName': 'meta', + 'attributes': { + 'charset': 'utf-8' + }, + 'childNodes': [], + 'id': 5 + } + ], + 'id': 4 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 6 + }, + { + 'type': 2, + 'tagName': 'body', + 'attributes': {}, + 'childNodes': [ + { + 'type': 3, + 'textContent': '\n ', + 'id': 8 + }, + { + 'type': 2, + 'tagName': 'button', + 'attributes': { + 'aria-label': 'Click me', + 'onclick': "console.log('Test log')" + }, + 'childNodes': [ + { + 'type': 3, + 'textContent': '***** **', + 'id': 10 + } + ], + 'id': 9 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 11 + }, + { + 'type': 2, + 'tagName': 'div', + 'attributes': {}, + 'childNodes': [ + { + 'type': 3, + 'textContent': '**** ****** ** ****** ** *******', + 'id': 13 + } + ], + 'id': 12 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 14 + }, + { + 'type': 2, + 'tagName': 'div', + 'attributes': { + 'data-sentry-unmask': '' + }, + 'childNodes': [ + { + 'type': 3, + 'textContent': 'This should be unmasked due to data attribute', + 'id': 16 + } + ], + 'id': 15 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 17 + }, + { + 'type': 2, + 'tagName': 'input', + 'attributes': { + 'placeholder': 'Placeholder should be masked' + }, + 'childNodes': [], + 'id': 18 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 19 + }, + { + 'type': 2, + 'tagName': 'div', + 'attributes': { + 'title': 'Title should be masked' + }, + 'childNodes': [ + { + 'type': 3, + 'textContent': '***** ****** ** ******', + 'id': 21 + } + ], + 'id': 20 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 22 + }, + { + 'type': 2, + 'tagName': 'svg', + 'attributes': { + 'rr_width': '200px', + 'rr_height': '200px' + }, + 'childNodes': [], + 'isSVG': true, + 'id': 23 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 24 + }, + { + 'type': 2, + 'tagName': 'svg', + 'attributes': { + 'style': 'width:200px;height:200px', + 'class': 'sentry-unblock', + 'viewBox': '0 0 80 80', + 'data-sentry-unblock': '' + }, + 'childNodes': [ + { + 'type': 2, + 'tagName': 'path', + 'attributes': { + 'rr_width': '0px', + 'rr_height': '0px' + }, + 'childNodes': [], + 'isSVG': true, + 'id': 26 + } + ], + 'isSVG': true, + 'id': 25 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 27 + }, + { + 'type': 2, + 'tagName': 'img', + 'attributes': { + 'rr_width': '100px', + 'rr_height': '100px' + }, + 'childNodes': [], + 'id': 28 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 29 + }, + { + 'type': 2, + 'tagName': 'img', + 'attributes': { + 'data-sentry-unblock': '', + 'style': 'width:100px;height:100px', + 'src': 'file:///none.png' + }, + 'childNodes': [], + 'id': 30 + }, + { + 'type': 3, + 'textContent': '\n ', + 'id': 31 + }, + { + 'type': 3, + 'textContent': '\n\n', + 'id': 32 + } + ], + 'id': 7 + } + ], + 'id': 3 + } + ], + 'id': 1 + }, + 'initialOffset': { + 'left': 0, + 'top': 0 + } + }) }); diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json deleted file mode 100644 index c9e633b2c16c..000000000000 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-chromium.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "node": { - "type": 0, - "childNodes": [ - { - "type": 1, - "name": "html", - "publicId": "", - "systemId": "", - "id": 2 - }, - { - "type": 2, - "tagName": "html", - "attributes": {}, - "childNodes": [ - { - "type": 2, - "tagName": "head", - "attributes": {}, - "childNodes": [ - { - "type": 2, - "tagName": "meta", - "attributes": { - "charset": "utf-8" - }, - "childNodes": [], - "id": 5 - } - ], - "id": 4 - }, - { - "type": 3, - "textContent": "\n ", - "id": 6 - }, - { - "type": 2, - "tagName": "body", - "attributes": {}, - "childNodes": [ - { - "type": 3, - "textContent": "\n ", - "id": 8 - }, - { - "type": 2, - "tagName": "button", - "attributes": { - "aria-label": "Click me", - "onclick": "console.log('Test log')" - }, - "childNodes": [ - { - "type": 3, - "textContent": "***** **", - "id": 10 - } - ], - "id": 9 - }, - { - "type": 3, - "textContent": "\n ", - "id": 11 - }, - { - "type": 2, - "tagName": "div", - "attributes": {}, - "childNodes": [ - { - "type": 3, - "textContent": "**** ****** ** ****** ** *******", - "id": 13 - } - ], - "id": 12 - }, - { - "type": 3, - "textContent": "\n ", - "id": 14 - }, - { - "type": 2, - "tagName": "div", - "attributes": { - "data-sentry-unmask": "" - }, - "childNodes": [ - { - "type": 3, - "textContent": "This should be unmasked due to data attribute", - "id": 16 - } - ], - "id": 15 - }, - { - "type": 3, - "textContent": "\n ", - "id": 17 - }, - { - "type": 2, - "tagName": "input", - "attributes": { - "placeholder": "Placeholder should be masked" - }, - "childNodes": [], - "id": 18 - }, - { - "type": 3, - "textContent": "\n ", - "id": 19 - }, - { - "type": 2, - "tagName": "div", - "attributes": { - "title": "Title should be masked" - }, - "childNodes": [ - { - "type": 3, - "textContent": "***** ****** ** ******", - "id": 21 - } - ], - "id": 20 - }, - { - "type": 3, - "textContent": "\n ", - "id": 22 - }, - { - "type": 2, - "tagName": "svg", - "attributes": { - "rr_width": "200px", - "rr_height": "200px" - }, - "childNodes": [], - "isSVG": true, - "id": 23 - }, - { - "type": 3, - "textContent": "\n ", - "id": 24 - }, - { - "type": 2, - "tagName": "svg", - "attributes": { - "style": "width:200px;height:200px", - "class": "sentry-unblock", - "viewBox": "0 0 80 80", - "data-sentry-unblock": "" - }, - "childNodes": [ - { - "type": 2, - "tagName": "path", - "attributes": { - "rr_width": "0px", - "rr_height": "0px" - }, - "childNodes": [], - "isSVG": true, - "id": 26 - } - ], - "isSVG": true, - "id": 25 - }, - { - "type": 3, - "textContent": "\n ", - "id": 27 - }, - { - "type": 2, - "tagName": "img", - "attributes": { - "rr_width": "100px", - "rr_height": "100px" - }, - "childNodes": [], - "id": 28 - }, - { - "type": 3, - "textContent": "\n ", - "id": 29 - }, - { - "type": 2, - "tagName": "img", - "attributes": { - "data-sentry-unblock": "", - "style": "width:100px;height:100px", - "src": "file:///none.png" - }, - "childNodes": [], - "id": 30 - }, - { - "type": 3, - "textContent": "\n ", - "id": 31 - }, - { - "type": 3, - "textContent": "\n\n", - "id": 32 - } - ], - "id": 7 - } - ], - "id": 3 - } - ], - "id": 1 - }, - "initialOffset": { - "left": 0, - "top": 0 - } -} \ No newline at end of file diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json deleted file mode 100644 index c9e633b2c16c..000000000000 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-firefox.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "node": { - "type": 0, - "childNodes": [ - { - "type": 1, - "name": "html", - "publicId": "", - "systemId": "", - "id": 2 - }, - { - "type": 2, - "tagName": "html", - "attributes": {}, - "childNodes": [ - { - "type": 2, - "tagName": "head", - "attributes": {}, - "childNodes": [ - { - "type": 2, - "tagName": "meta", - "attributes": { - "charset": "utf-8" - }, - "childNodes": [], - "id": 5 - } - ], - "id": 4 - }, - { - "type": 3, - "textContent": "\n ", - "id": 6 - }, - { - "type": 2, - "tagName": "body", - "attributes": {}, - "childNodes": [ - { - "type": 3, - "textContent": "\n ", - "id": 8 - }, - { - "type": 2, - "tagName": "button", - "attributes": { - "aria-label": "Click me", - "onclick": "console.log('Test log')" - }, - "childNodes": [ - { - "type": 3, - "textContent": "***** **", - "id": 10 - } - ], - "id": 9 - }, - { - "type": 3, - "textContent": "\n ", - "id": 11 - }, - { - "type": 2, - "tagName": "div", - "attributes": {}, - "childNodes": [ - { - "type": 3, - "textContent": "**** ****** ** ****** ** *******", - "id": 13 - } - ], - "id": 12 - }, - { - "type": 3, - "textContent": "\n ", - "id": 14 - }, - { - "type": 2, - "tagName": "div", - "attributes": { - "data-sentry-unmask": "" - }, - "childNodes": [ - { - "type": 3, - "textContent": "This should be unmasked due to data attribute", - "id": 16 - } - ], - "id": 15 - }, - { - "type": 3, - "textContent": "\n ", - "id": 17 - }, - { - "type": 2, - "tagName": "input", - "attributes": { - "placeholder": "Placeholder should be masked" - }, - "childNodes": [], - "id": 18 - }, - { - "type": 3, - "textContent": "\n ", - "id": 19 - }, - { - "type": 2, - "tagName": "div", - "attributes": { - "title": "Title should be masked" - }, - "childNodes": [ - { - "type": 3, - "textContent": "***** ****** ** ******", - "id": 21 - } - ], - "id": 20 - }, - { - "type": 3, - "textContent": "\n ", - "id": 22 - }, - { - "type": 2, - "tagName": "svg", - "attributes": { - "rr_width": "200px", - "rr_height": "200px" - }, - "childNodes": [], - "isSVG": true, - "id": 23 - }, - { - "type": 3, - "textContent": "\n ", - "id": 24 - }, - { - "type": 2, - "tagName": "svg", - "attributes": { - "style": "width:200px;height:200px", - "class": "sentry-unblock", - "viewBox": "0 0 80 80", - "data-sentry-unblock": "" - }, - "childNodes": [ - { - "type": 2, - "tagName": "path", - "attributes": { - "rr_width": "0px", - "rr_height": "0px" - }, - "childNodes": [], - "isSVG": true, - "id": 26 - } - ], - "isSVG": true, - "id": 25 - }, - { - "type": 3, - "textContent": "\n ", - "id": 27 - }, - { - "type": 2, - "tagName": "img", - "attributes": { - "rr_width": "100px", - "rr_height": "100px" - }, - "childNodes": [], - "id": 28 - }, - { - "type": 3, - "textContent": "\n ", - "id": 29 - }, - { - "type": 2, - "tagName": "img", - "attributes": { - "data-sentry-unblock": "", - "style": "width:100px;height:100px", - "src": "file:///none.png" - }, - "childNodes": [], - "id": 30 - }, - { - "type": 3, - "textContent": "\n ", - "id": 31 - }, - { - "type": 3, - "textContent": "\n\n", - "id": 32 - } - ], - "id": 7 - } - ], - "id": 3 - } - ], - "id": 1 - }, - "initialOffset": { - "left": 0, - "top": 0 - } -} \ No newline at end of file diff --git a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json b/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json deleted file mode 100644 index c9e633b2c16c..000000000000 --- a/packages/integration-tests/suites/replay/privacy/test.ts-snapshots/privacy-webkit.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "node": { - "type": 0, - "childNodes": [ - { - "type": 1, - "name": "html", - "publicId": "", - "systemId": "", - "id": 2 - }, - { - "type": 2, - "tagName": "html", - "attributes": {}, - "childNodes": [ - { - "type": 2, - "tagName": "head", - "attributes": {}, - "childNodes": [ - { - "type": 2, - "tagName": "meta", - "attributes": { - "charset": "utf-8" - }, - "childNodes": [], - "id": 5 - } - ], - "id": 4 - }, - { - "type": 3, - "textContent": "\n ", - "id": 6 - }, - { - "type": 2, - "tagName": "body", - "attributes": {}, - "childNodes": [ - { - "type": 3, - "textContent": "\n ", - "id": 8 - }, - { - "type": 2, - "tagName": "button", - "attributes": { - "aria-label": "Click me", - "onclick": "console.log('Test log')" - }, - "childNodes": [ - { - "type": 3, - "textContent": "***** **", - "id": 10 - } - ], - "id": 9 - }, - { - "type": 3, - "textContent": "\n ", - "id": 11 - }, - { - "type": 2, - "tagName": "div", - "attributes": {}, - "childNodes": [ - { - "type": 3, - "textContent": "**** ****** ** ****** ** *******", - "id": 13 - } - ], - "id": 12 - }, - { - "type": 3, - "textContent": "\n ", - "id": 14 - }, - { - "type": 2, - "tagName": "div", - "attributes": { - "data-sentry-unmask": "" - }, - "childNodes": [ - { - "type": 3, - "textContent": "This should be unmasked due to data attribute", - "id": 16 - } - ], - "id": 15 - }, - { - "type": 3, - "textContent": "\n ", - "id": 17 - }, - { - "type": 2, - "tagName": "input", - "attributes": { - "placeholder": "Placeholder should be masked" - }, - "childNodes": [], - "id": 18 - }, - { - "type": 3, - "textContent": "\n ", - "id": 19 - }, - { - "type": 2, - "tagName": "div", - "attributes": { - "title": "Title should be masked" - }, - "childNodes": [ - { - "type": 3, - "textContent": "***** ****** ** ******", - "id": 21 - } - ], - "id": 20 - }, - { - "type": 3, - "textContent": "\n ", - "id": 22 - }, - { - "type": 2, - "tagName": "svg", - "attributes": { - "rr_width": "200px", - "rr_height": "200px" - }, - "childNodes": [], - "isSVG": true, - "id": 23 - }, - { - "type": 3, - "textContent": "\n ", - "id": 24 - }, - { - "type": 2, - "tagName": "svg", - "attributes": { - "style": "width:200px;height:200px", - "class": "sentry-unblock", - "viewBox": "0 0 80 80", - "data-sentry-unblock": "" - }, - "childNodes": [ - { - "type": 2, - "tagName": "path", - "attributes": { - "rr_width": "0px", - "rr_height": "0px" - }, - "childNodes": [], - "isSVG": true, - "id": 26 - } - ], - "isSVG": true, - "id": 25 - }, - { - "type": 3, - "textContent": "\n ", - "id": 27 - }, - { - "type": 2, - "tagName": "img", - "attributes": { - "rr_width": "100px", - "rr_height": "100px" - }, - "childNodes": [], - "id": 28 - }, - { - "type": 3, - "textContent": "\n ", - "id": 29 - }, - { - "type": 2, - "tagName": "img", - "attributes": { - "data-sentry-unblock": "", - "style": "width:100px;height:100px", - "src": "file:///none.png" - }, - "childNodes": [], - "id": 30 - }, - { - "type": 3, - "textContent": "\n ", - "id": 31 - }, - { - "type": 3, - "textContent": "\n\n", - "id": 32 - } - ], - "id": 7 - } - ], - "id": 3 - } - ], - "id": 1 - }, - "initialOffset": { - "left": 0, - "top": 0 - } -} \ No newline at end of file diff --git a/packages/integration-tests/utils/fixtures.ts b/packages/integration-tests/utils/fixtures.ts index 15c41ab10c14..3926bf1f9d74 100644 --- a/packages/integration-tests/utils/fixtures.ts +++ b/packages/integration-tests/utils/fixtures.ts @@ -22,7 +22,6 @@ const getAsset = (assetDir: string, asset: string): string => { }; export type TestFixtures = { - _autoSnapshotSuffix: void; testDir: string; getLocalTestPath: (options: { testDir: string }) => Promise; runInChromium: (fn: (...args: unknown[]) => unknown, args?: unknown[]) => unknown; @@ -36,14 +35,6 @@ export type TestFixtures = { }; const sentryTest = base.extend({ - _autoSnapshotSuffix: [ - async ({}, use, testInfo) => { - testInfo.snapshotSuffix = ''; - await use(); - }, - { auto: true }, - ], - getLocalTestPath: ({}, use, testInfo) => { return use(async ({ testDir }) => { const pagePath = `file:///${path.resolve(testDir, './dist/index.html')}`; From 57f21df7769c45ef61403956baf3fe19e9255496 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 10 Feb 2023 09:22:23 -0500 Subject: [PATCH 16/16] lint --- .../suites/replay/privacy/test.ts | 322 +++++++++--------- 1 file changed, 161 insertions(+), 161 deletions(-) diff --git a/packages/integration-tests/suites/replay/privacy/test.ts b/packages/integration-tests/suites/replay/privacy/test.ts index 288a927976be..3ad8ee5684fb 100644 --- a/packages/integration-tests/suites/replay/privacy/test.ts +++ b/packages/integration-tests/suites/replay/privacy/test.ts @@ -29,240 +29,240 @@ sentryTest('should have the correct default privacy settings', async ({ getLocal const checkoutEvent = replayPayload.find(({ type }) => type === EventType.FullSnapshot); expect(checkoutEvent?.data).toEqual({ - 'node': { - 'type': 0, - 'childNodes': [ + node: { + type: 0, + childNodes: [ { - 'type': 1, - 'name': 'html', - 'publicId': '', - 'systemId': '', - 'id': 2 + type: 1, + name: 'html', + publicId: '', + systemId: '', + id: 2, }, { - 'type': 2, - 'tagName': 'html', - 'attributes': {}, - 'childNodes': [ + type: 2, + tagName: 'html', + attributes: {}, + childNodes: [ { - 'type': 2, - 'tagName': 'head', - 'attributes': {}, - 'childNodes': [ + type: 2, + tagName: 'head', + attributes: {}, + childNodes: [ { - 'type': 2, - 'tagName': 'meta', - 'attributes': { - 'charset': 'utf-8' + type: 2, + tagName: 'meta', + attributes: { + charset: 'utf-8', }, - 'childNodes': [], - 'id': 5 - } + childNodes: [], + id: 5, + }, ], - 'id': 4 + id: 4, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 6 + type: 3, + textContent: '\n ', + id: 6, }, { - 'type': 2, - 'tagName': 'body', - 'attributes': {}, - 'childNodes': [ + type: 2, + tagName: 'body', + attributes: {}, + childNodes: [ { - 'type': 3, - 'textContent': '\n ', - 'id': 8 + type: 3, + textContent: '\n ', + id: 8, }, { - 'type': 2, - 'tagName': 'button', - 'attributes': { + type: 2, + tagName: 'button', + attributes: { 'aria-label': 'Click me', - 'onclick': "console.log('Test log')" + onclick: "console.log('Test log')", }, - 'childNodes': [ + childNodes: [ { - 'type': 3, - 'textContent': '***** **', - 'id': 10 - } + type: 3, + textContent: '***** **', + id: 10, + }, ], - 'id': 9 + id: 9, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 11 + type: 3, + textContent: '\n ', + id: 11, }, { - 'type': 2, - 'tagName': 'div', - 'attributes': {}, - 'childNodes': [ + type: 2, + tagName: 'div', + attributes: {}, + childNodes: [ { - 'type': 3, - 'textContent': '**** ****** ** ****** ** *******', - 'id': 13 - } + type: 3, + textContent: '**** ****** ** ****** ** *******', + id: 13, + }, ], - 'id': 12 + id: 12, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 14 + type: 3, + textContent: '\n ', + id: 14, }, { - 'type': 2, - 'tagName': 'div', - 'attributes': { - 'data-sentry-unmask': '' + type: 2, + tagName: 'div', + attributes: { + 'data-sentry-unmask': '', }, - 'childNodes': [ + childNodes: [ { - 'type': 3, - 'textContent': 'This should be unmasked due to data attribute', - 'id': 16 - } + type: 3, + textContent: 'This should be unmasked due to data attribute', + id: 16, + }, ], - 'id': 15 + id: 15, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 17 + type: 3, + textContent: '\n ', + id: 17, }, { - 'type': 2, - 'tagName': 'input', - 'attributes': { - 'placeholder': 'Placeholder should be masked' + type: 2, + tagName: 'input', + attributes: { + placeholder: 'Placeholder should be masked', }, - 'childNodes': [], - 'id': 18 + childNodes: [], + id: 18, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 19 + type: 3, + textContent: '\n ', + id: 19, }, { - 'type': 2, - 'tagName': 'div', - 'attributes': { - 'title': 'Title should be masked' + type: 2, + tagName: 'div', + attributes: { + title: 'Title should be masked', }, - 'childNodes': [ + childNodes: [ { - 'type': 3, - 'textContent': '***** ****** ** ******', - 'id': 21 - } + type: 3, + textContent: '***** ****** ** ******', + id: 21, + }, ], - 'id': 20 + id: 20, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 22 + type: 3, + textContent: '\n ', + id: 22, }, { - 'type': 2, - 'tagName': 'svg', - 'attributes': { - 'rr_width': '200px', - 'rr_height': '200px' + type: 2, + tagName: 'svg', + attributes: { + rr_width: '200px', + rr_height: '200px', }, - 'childNodes': [], - 'isSVG': true, - 'id': 23 + childNodes: [], + isSVG: true, + id: 23, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 24 + type: 3, + textContent: '\n ', + id: 24, }, { - 'type': 2, - 'tagName': 'svg', - 'attributes': { - 'style': 'width:200px;height:200px', - 'class': 'sentry-unblock', - 'viewBox': '0 0 80 80', - 'data-sentry-unblock': '' + type: 2, + tagName: 'svg', + attributes: { + style: 'width:200px;height:200px', + class: 'sentry-unblock', + viewBox: '0 0 80 80', + 'data-sentry-unblock': '', }, - 'childNodes': [ + childNodes: [ { - 'type': 2, - 'tagName': 'path', - 'attributes': { - 'rr_width': '0px', - 'rr_height': '0px' + type: 2, + tagName: 'path', + attributes: { + rr_width: '0px', + rr_height: '0px', }, - 'childNodes': [], - 'isSVG': true, - 'id': 26 - } + childNodes: [], + isSVG: true, + id: 26, + }, ], - 'isSVG': true, - 'id': 25 + isSVG: true, + id: 25, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 27 + type: 3, + textContent: '\n ', + id: 27, }, { - 'type': 2, - 'tagName': 'img', - 'attributes': { - 'rr_width': '100px', - 'rr_height': '100px' + type: 2, + tagName: 'img', + attributes: { + rr_width: '100px', + rr_height: '100px', }, - 'childNodes': [], - 'id': 28 + childNodes: [], + id: 28, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 29 + type: 3, + textContent: '\n ', + id: 29, }, { - 'type': 2, - 'tagName': 'img', - 'attributes': { + type: 2, + tagName: 'img', + attributes: { 'data-sentry-unblock': '', - 'style': 'width:100px;height:100px', - 'src': 'file:///none.png' + style: 'width:100px;height:100px', + src: 'file:///none.png', }, - 'childNodes': [], - 'id': 30 + childNodes: [], + id: 30, }, { - 'type': 3, - 'textContent': '\n ', - 'id': 31 + type: 3, + textContent: '\n ', + id: 31, }, { - 'type': 3, - 'textContent': '\n\n', - 'id': 32 - } + type: 3, + textContent: '\n\n', + id: 32, + }, ], - 'id': 7 - } + id: 7, + }, ], - 'id': 3 - } + id: 3, + }, ], - 'id': 1 + id: 1, + }, + initialOffset: { + left: 0, + top: 0, }, - 'initialOffset': { - 'left': 0, - 'top': 0 - } - }) + }); });