Skip to content

test(integration): Add support for snapshots in integration tests #7145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"postpublish": "lerna run --stream --concurrency 1 postpublish",
"test": "lerna run --ignore @sentry-internal/* test",
"test-ci-browser": "lerna run test --ignore \"@sentry/{node,opentelemetry-node,serverless,nextjs,remix,gatsby}\" --ignore @sentry-internal/*",
"test-ci-node": "ts-node ./scripts/node-unit-tests.ts"
"test-ci-node": "ts-node ./scripts/node-unit-tests.ts",
"test:update-snapshots": "lerna run test:update-snapshots"
},
"volta": {
"node": "16.19.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"test:bundle:replay:es6:min": "PW_BUNDLE=bundle_replay_es6_min yarn test",
"test:cjs": "PW_BUNDLE=cjs yarn test",
"test:esm": "PW_BUNDLE=esm yarn test",
"test:ci": "playwright test ./suites --browser='all' --reporter='line'"
"test:ci": "playwright test ./suites --browser='all' --reporter='line'",
"test:update-snapshots": "yarn test --update-snapshots --browser='all'"
},
"dependencies": {
"@babel/preset-typescript": "^7.16.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
<svg style="width:200px;height:200px" viewBox="0 0 80 80" data-sentry-unblock><path d=""/><area /><rect /></svg>
<img style="width:100px;height:100px" src="file:///none.png" />
<img data-sentry-unblock style="width:100px;height:100px" src="file:///none.png" />
<video style="width:30px;height:30px"><source src="file://foo.mp4" /></video>
</body>
</html>
252 changes: 1 addition & 251 deletions packages/integration-tests/suites/replay/privacy/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,255 +27,5 @@ sentryTest('should have the correct default privacy settings', async ({ getLocal
const replayPayload = envelopeRequestParser<RecordingEvent[]>(await reqPromise0, 5);
const checkoutEvent = replayPayload.find(({ type }) => type === EventType.FullSnapshot);

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': '***** **',
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: '*********** ****** ** ******',
},
childNodes: [],
id: 18,
},
{
type: 3,
textContent: '\n ',
id: 19,
},
{
type: 2,
tagName: 'div',
attributes: {
title: '***** ****** ** ******',
},
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',
viewBox: '0 0 80 80',
'data-sentry-unblock': '',
},
childNodes: [
{
type: 2,
tagName: 'path',
attributes: {
d: '',
},
childNodes: [],
isSVG: true,
id: 26,
},
{
type: 2,
tagName: 'area',
attributes: {},
childNodes: [],
isSVG: true,
id: 27,
},
{
type: 2,
tagName: 'rect',
attributes: {},
childNodes: [],
isSVG: true,
id: 28,
},
],
isSVG: true,
id: 25,
},
{
type: 3,
textContent: '\n ',
id: 29,
},
{
type: 2,
tagName: 'img',
attributes: {
rr_width: '100px',
rr_height: '100px',
},
childNodes: [],
id: 30,
},
{
type: 3,
textContent: '\n ',
id: 31,
},
{
type: 2,
tagName: 'img',
attributes: {
'data-sentry-unblock': '',
style: 'width:100px;height:100px',
src: 'file:///none.png',
},
childNodes: [],
id: 32,
},
{
type: 3,
textContent: '\n ',
id: 33,
},
{
type: 3,
textContent: '\n\n',
id: 34,
},
],
id: 7,
},
],
id: 3,
},
],
id: 1,
},
initialOffset: {
left: 0,
top: 0,
},
});
expect(JSON.stringify(checkoutEvent?.data, null, 2)).toMatchSnapshot('privacy.json');
});
Loading