Skip to content

Commit

Permalink
remove isNotScroll filter
Browse files Browse the repository at this point in the history
  • Loading branch information
billyvg committed Aug 7, 2023
1 parent 4418a4b commit f26c65a
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 75 deletions.
7 changes: 6 additions & 1 deletion packages/rrweb-snapshot/test/snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ describe('transformAttribute()', () => {

describe('isBlockedElement()', () => {
const subject = (html: string, opt: any = {}) =>
_isBlockedElement(render(html), 'rr-block', opt.blockSelector, opt.unblockSelector);
_isBlockedElement(
render(html),
'rr-block',
opt.blockSelector,
opt.unblockSelector,
);

const render = (html: string): HTMLElement =>
JSDOM.fragment(html).querySelector('div')!;
Expand Down
81 changes: 42 additions & 39 deletions packages/rrweb/test/__snapshots__/integration.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2789,7 +2789,7 @@ exports[`record integration tests can record form interactions 1`] = `
\\"type\\": 3,
\\"data\\": {
\\"source\\": 5,
\\"text\\": \\"\\",
\\"text\\": \\"AA\\",
\\"isChecked\\": false,
\\"id\\": 62
}
Expand Down Expand Up @@ -5335,7 +5335,7 @@ exports[`record integration tests can use maskInputOptions to configure which ty
\\"type\\": 3,
\\"data\\": {
\\"source\\": 5,
\\"text\\": \\"\\",
\\"text\\": \\"AA\\",
\\"isChecked\\": false,
\\"id\\": 62
}
Expand Down Expand Up @@ -6105,7 +6105,7 @@ exports[`record integration tests can use maskTextSelector to configure which in
\\"type\\": 3,
\\"data\\": {
\\"source\\": 5,
\\"text\\": \\"\\",
\\"text\\": \\"AA\\",
\\"isChecked\\": false,
\\"id\\": 62
}
Expand Down Expand Up @@ -12235,28 +12235,28 @@ exports[`record integration tests should not record input values if dynamically
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 5,
\\"text\\": \\"************************\\",
\\"isChecked\\": false,
\\"id\\": 21
\\"source\\": 3,
\\"id\\": 21,
\\"x\\": 12.5,
\\"y\\": 0
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 5,
\\"text\\": \\"*************************\\",
\\"text\\": \\"************************\\",
\\"isChecked\\": false,
\\"id\\": 21
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 3,
\\"id\\": 21,
\\"x\\": 27.5,
\\"y\\": 0
\\"source\\": 5,
\\"text\\": \\"*************************\\",
\\"isChecked\\": false,
\\"id\\": 21
}
}
]"
Expand Down Expand Up @@ -12474,6 +12474,15 @@ exports[`record integration tests should not record input values if dynamically
\\"id\\": 21
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 3,
\\"id\\": 21,
\\"x\\": 12.5,
\\"y\\": 0
}
},
{
\\"type\\": 3,
\\"data\\": {
Expand Down Expand Up @@ -13454,7 +13463,7 @@ exports[`record integration tests should not record input values if maskAllInput
\\"type\\": 3,
\\"data\\": {
\\"source\\": 5,
\\"text\\": \\"\\",
\\"text\\": \\"**\\",
\\"isChecked\\": false,
\\"id\\": 62
}
Expand Down Expand Up @@ -16084,14 +16093,6 @@ exports[`record integration tests should record images inside iframe with blob u
\\"isAttachIframe\\": true
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 4,
\\"width\\": 1920,
\\"height\\": 1080
}
},
{
\\"type\\": 3,
\\"data\\": {
Expand Down Expand Up @@ -17554,7 +17555,7 @@ exports[`record integration tests should record input userTriggered values if us
\\"type\\": 3,
\\"data\\": {
\\"source\\": 5,
\\"text\\": \\"\\",
\\"text\\": \\"AA\\",
\\"isChecked\\": false,
\\"userTriggered\\": false,
\\"id\\": 62
Expand Down Expand Up @@ -17757,6 +17758,15 @@ exports[`record integration tests should record input values if dynamically adde
\\"id\\": 21
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 3,
\\"id\\": 21,
\\"x\\": 24,
\\"y\\": 0
}
},
{
\\"type\\": 3,
\\"data\\": {
Expand Down Expand Up @@ -18007,6 +18017,15 @@ exports[`record integration tests should record input values if dynamically adde
\\"id\\": 21
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 3,
\\"id\\": 21,
\\"x\\": 27.5,
\\"y\\": 0
}
},
{
\\"type\\": 3,
\\"data\\": {
Expand Down Expand Up @@ -18380,7 +18399,7 @@ exports[`record integration tests should record moved shadow DOM 2 1`] = `
]"
`;

exports[`record integration tests should record mutations in iframes accross pages 1`] = `
exports[`record integration tests should record mutations in iframes across pages 1`] = `
"[
{
\\"type\\": 0,
Expand Down Expand Up @@ -18616,14 +18635,6 @@ exports[`record integration tests should record mutations in iframes accross pag
\\"isAttachIframe\\": true
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 4,
\\"width\\": 1920,
\\"height\\": 1080
}
},
{
\\"type\\": 3,
\\"data\\": {
Expand Down Expand Up @@ -19025,14 +19036,6 @@ exports[`record integration tests should record nested iframes and shadow doms 1
\\"isAttachIframe\\": true
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 4,
\\"width\\": 1920,
\\"height\\": 1080
}
},
{
\\"type\\": 3,
\\"data\\": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 14 additions & 28 deletions packages/rrweb/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ import {
} from '@sentry-internal/rrweb-types';
import { visitSnapshot, NodeType } from '@sentry-internal/rrweb-snapshot';

/**
* Used to filter scroll events out of snapshots as they are flakey
*/
function isNotScroll(snapshot: eventWithTime) {
return !(
snapshot.type === EventType.IncrementalSnapshot &&
snapshot.data.source === IncrementalSource.Scroll
);
}

describe('record integration tests', function (this: ISuite) {
jest.setTimeout(10_000);

Expand Down Expand Up @@ -256,7 +246,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots.filter(isNotScroll));
assertSnapshot(snapshots);
});

it('can record style changes compactly and preserve css var() functions', async () => {
Expand Down Expand Up @@ -331,8 +321,7 @@ describe('record integration tests', function (this: ISuite) {
}
});

const snapshots = await page.evaluate('window.snapshots');
assertSnapshot(snapshots);
await assertSnapshot(page);

const lastMutationsLength = await page.evaluate(
'window.lastMutationsLength',
Expand Down Expand Up @@ -573,7 +562,6 @@ describe('record integration tests', function (this: ISuite) {

it('should record unblocked elements that are also blocked more generically', async () => {
const page: puppeteer.Page = await browser.newPage();
page.on('console', (msg) => console.log(msg.text()));
await page.goto('about:blank');
const html = getHtml.call(this, 'unblock.html', {
blockSelector: 'div',
Expand Down Expand Up @@ -610,7 +598,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots.filter(isNotScroll));
assertSnapshot(snapshots);
});

it('mutations should work when blocked class is unblocked', async () => {
Expand Down Expand Up @@ -689,7 +677,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots.filter(isNotScroll));
assertSnapshot(snapshots);
});

it('should record canvas mutations', async () => {
Expand Down Expand Up @@ -738,7 +726,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots.filter(isNotScroll));
assertSnapshot(snapshots);
});

it('should record textarea values if dynamically added and maskAllInputs is false', async () => {
Expand All @@ -763,7 +751,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots.filter(isNotScroll));
assertSnapshot(snapshots);
});

it('should not record input values if dynamically added, maskAllInputs is false, and mask selector is used', async () => {
Expand Down Expand Up @@ -791,7 +779,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots.filter(isNotScroll));
assertSnapshot(snapshots);
});

it('should not record input values if dynamically added and maskAllInputs is true', async () => {
Expand Down Expand Up @@ -837,7 +825,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots.filter(isNotScroll));
assertSnapshot(snapshots);
});

it('should record input values if dynamically added, maskAllInputs is true, and unmask selector is used', async () => {
Expand Down Expand Up @@ -865,7 +853,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots.filter(isNotScroll));
assertSnapshot(snapshots);
});

it('should record webgl canvas mutations', async () => {
Expand Down Expand Up @@ -1050,7 +1038,6 @@ describe('record integration tests', function (this: ISuite) {

it('should record images with blob url', async () => {
const page: puppeteer.Page = await browser.newPage();
page.on('console', (msg) => console.log(msg.text()));
await page.goto(`${serverURL}/html`);
page.setContent(
getHtml.call(this, 'image-blob-url.html', { inlineImages: true }),
Expand All @@ -1067,7 +1054,6 @@ describe('record integration tests', function (this: ISuite) {

it('should record images inside iframe with blob url', async () => {
const page: puppeteer.Page = await browser.newPage();
page.on('console', (msg) => console.log(msg.text()));
await page.goto(`${serverURL}/html`);
await page.setContent(
getHtml.call(this, 'frame-image-blob-url.html', { inlineImages: true }),
Expand All @@ -1084,7 +1070,6 @@ describe('record integration tests', function (this: ISuite) {

it('should record images inside iframe with blob url after iframe was reloaded', async () => {
const page: puppeteer.Page = await browser.newPage();
page.on('console', (msg) => console.log(msg.text()));
await page.goto(`${serverURL}/html`);
await page.setContent(
getHtml.call(this, 'frame2.html', { inlineImages: true }),
Expand Down Expand Up @@ -1310,13 +1295,12 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots.filter(isNotScroll));
assertSnapshot(snapshots);
});

it('should record mutations in iframes accross pages', async () => {
it('should record mutations in iframes across pages', async () => {
const page: puppeteer.Page = await browser.newPage();
await page.goto(`${serverURL}/html`);
page.on('console', (msg) => console.log(msg.text()));
await page.setContent(getHtml.call(this, 'frame2.html'));

await page.waitForSelector('iframe'); // wait for iframe to get added
Expand Down Expand Up @@ -1475,7 +1459,9 @@ describe('record integration tests', function (this: ISuite) {
}),
);

const snapshots = await page.evaluate('window.snapshots');
const snapshots = (await page.evaluate(
'window.snapshots',
)) as eventWithTime[];
assertSnapshot(snapshots);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2123,7 +2123,7 @@ exports[`cross origin iframes form.html should map input events correctly 1`] =
\\"type\\": 3,
\\"data\\": {
\\"source\\": 5,
\\"text\\": \\"\\",
\\"text\\": \\"AA\\",
\\"isChecked\\": false,
\\"id\\": 74
}
Expand Down
7 changes: 1 addition & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5503,15 +5503,10 @@ csso@^4.0.2:
dependencies:
css-tree "^1.1.2"

cssom@^0.4.4, "cssom@https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz":
cssom@^0.4.4, cssom@^0.5.0, "cssom@https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz":
version "0.6.0"
resolved "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz#ed298055b97cbddcdeb278f904857629dec5e0e1"

cssom@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36"
integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==

cssom@~0.3.6:
version "0.3.8"
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a"
Expand Down

0 comments on commit f26c65a

Please sign in to comment.