Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: update snapshot for test cases
  • Loading branch information
YunFeng0817 committed Sep 29, 2022
commit 10a750dd9b3ef2d81820eda6eb69e8498b25c5d1
6 changes: 0 additions & 6 deletions packages/rrweb/src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1661,12 +1661,6 @@ export class Replayer {
skipChild: true,
hackCss: true,
cache: this.cache,
afterAppend: (node: Node | RRNode, id: number) => {
for (const plugin of this.config.plugins || []) {
if (plugin.onBuild)
plugin.onBuild(node, { id, replayer: this });
}
},
});
const siblingNode = target.nextSibling;
const parentNode = target.parentNode;
Expand Down
74 changes: 48 additions & 26 deletions packages/rrweb/test/__snapshots__/record.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,12 @@ exports[`record captures CORS stylesheets that are still loading 1`] = `
\\"type\\": 3,
\\"data\\": {
\\"source\\": 0,
\\"texts\\": [],
\\"attributes\\": [],
\\"removes\\": [],
\\"adds\\": [
{
\\"parentId\\": 9,
\\"parentId\\": 4,
\\"nextId\\": null,
\\"node\\": {
\\"type\\": 2,
Expand All @@ -188,10 +191,7 @@ exports[`record captures CORS stylesheets that are still loading 1`] = `
\\"id\\": 9
}
}
],
\\"removes\\": [],
\\"texts\\": [],
\\"attributes\\": []
]
}
}
]"
Expand Down Expand Up @@ -2007,7 +2007,19 @@ exports[`record captures stylesheets in iframes that are still loading 1`] = `
\\"type\\": 2,
\\"tagName\\": \\"head\\",
\\"attributes\\": {},
\\"childNodes\\": [],
\\"childNodes\\": [
{
\\"type\\": 2,
\\"tagName\\": \\"link\\",
\\"attributes\\": {
\\"rel\\": \\"stylesheet\\",
\\"href\\": \\"blob:null\\"
},
\\"childNodes\\": [],
\\"rootId\\": 10,
\\"id\\": 13
}
],
\\"rootId\\": 10,
\\"id\\": 12
},
Expand Down Expand Up @@ -2039,25 +2051,17 @@ exports[`record captures stylesheets in iframes that are still loading 1`] = `
\\"type\\": 3,
\\"data\\": {
\\"source\\": 0,
\\"adds\\": [
\\"adds\\": [],
\\"removes\\": [],
\\"texts\\": [],
\\"attributes\\": [
{
\\"parentId\\": 13,
\\"nextId\\": null,
\\"node\\": {
\\"type\\": 2,
\\"tagName\\": \\"link\\",
\\"attributes\\": {
\\"_cssText\\": \\"body { color: pink; }\\"
},
\\"childNodes\\": [],
\\"rootId\\": 10,
\\"id\\": 13
\\"id\\": 13,
\\"attributes\\": {
\\"_cssText\\": \\"body { color: pink; }\\"
}
}
],
\\"removes\\": [],
\\"texts\\": [],
\\"attributes\\": []
]
}
}
]"
Expand Down Expand Up @@ -2286,24 +2290,42 @@ exports[`record captures stylesheets that are still loading 1`] = `
\\"type\\": 3,
\\"data\\": {
\\"source\\": 0,
\\"texts\\": [],
\\"attributes\\": [],
\\"removes\\": [],
\\"adds\\": [
{
\\"parentId\\": 9,
\\"parentId\\": 4,
\\"nextId\\": null,
\\"node\\": {
\\"type\\": 2,
\\"tagName\\": \\"link\\",
\\"attributes\\": {
\\"_cssText\\": \\"body { color: pink; }\\"
\\"rel\\": \\"stylesheet\\",
\\"href\\": \\"blob:null\\"
},
\\"childNodes\\": [],
\\"id\\": 9
}
}
],
]
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 0,
\\"adds\\": [],
\\"removes\\": [],
\\"texts\\": [],
\\"attributes\\": []
\\"attributes\\": [
{
\\"id\\": 9,
\\"attributes\\": {
\\"_cssText\\": \\"body { color: pink; }\\"
}
}
]
}
}
]"
Expand Down
13 changes: 9 additions & 4 deletions packages/rrweb/test/record.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,11 @@ describe('record', function (this: ISuite) {

// `blob:` URLs are not available immediately, so we need to wait for the browser to load them
await waitForRAF(ctx.page);

assertSnapshot(ctx.events);
// 'blob' URL is different in every execution so we need to remove it from the snapshot.
const filteredEvents = JSON.parse(
JSON.stringify(ctx.events).replace(/blob\:[\w\d-/]+"/, 'blob:null"'),
);
assertSnapshot(filteredEvents);
});

it('captures stylesheets in iframes that are still loading', async () => {
Expand Down Expand Up @@ -659,8 +662,10 @@ describe('record', function (this: ISuite) {

// `blob:` URLs are not available immediately, so we need to wait for the browser to load them
await waitForRAF(ctx.page);

assertSnapshot(ctx.events);
const filteredEvents = JSON.parse(
JSON.stringify(ctx.events).replace(/blob\:[\w\d-/]+"/, 'blob:null"'),
);
assertSnapshot(filteredEvents);
});

it('captures CORS stylesheets that are still loading', async () => {
Expand Down