Skip to content

Commit

Permalink
Don't capture small stylesheets as assets as timing issues are causin…
Browse files Browse the repository at this point in the history
…g nondeterminism in the test (e.g. in 'should nest record iframe' between the emission of the iframe and emission of the style asset which are both (asynchronously) triggered by the fullsnapshot)
  • Loading branch information
eoghanmurray committed Nov 29, 2024
1 parent 8d01e6e commit 487b920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 63 deletions.
65 changes: 4 additions & 61 deletions packages/rrweb/test/__snapshots__/integration.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5694,7 +5694,7 @@ exports[`record integration tests > mutations should work when blocked class is
\\"type\\": 2,
\\"tagName\\": \\"style\\",
\\"attributes\\": {
\\"rr_css_text\\": \\"about: blank#rr_style_el:1\\"
\\"_cssText\\": \\"#b-class, #b-class-2 { height: 33px; width: 200px; }\\"
},
\\"childNodes\\": [
{
Expand Down Expand Up @@ -6137,25 +6137,6 @@ exports[`record integration tests > mutations should work when blocked class is
\\"initialOffset\\": {
\\"left\\": 0,
\\"top\\": 0
},
\\"capturedAssetStatuses\\": [
{
\\"url\\": \\"about: blank#rr_style_el:1\\",
\\"status\\": \\"capturing\\",
\\"timeout\\": 25
}
]
}
},
{
\\"type\\": 7,
\\"data\\": {
\\"url\\": \\"about: blank#rr_style_el:1\\",
\\"payload\\": {
\\"rr_type\\": \\"CssText\\",
\\"cssTexts\\": [
\\"#b-class, #b-class-2 { height: 33px; width: 200px; }\\"
]
}
}
},
Expand Down Expand Up @@ -8430,7 +8411,7 @@ exports[`record integration tests > should nest record iframe 1`] = `
\\"type\\": 2,
\\"tagName\\": \\"style\\",
\\"attributes\\": {
\\"rr_css_text\\": \\"http://localhost:3030/html#rr_style_el:1\\"
\\"_cssText\\": \\"iframe { width: 500px; height: 500px; }\\"
},
\\"childNodes\\": [
{
Expand Down Expand Up @@ -8526,14 +8507,7 @@ exports[`record integration tests > should nest record iframe 1`] = `
\\"initialOffset\\": {
\\"left\\": 0,
\\"top\\": 0
},
\\"capturedAssetStatuses\\": [
{
\\"url\\": \\"http://localhost:3030/html#rr_style_el:1\\",
\\"status\\": \\"capturing\\",
\\"timeout\\": 25
}
]
}
}
},
{
Expand Down Expand Up @@ -8584,18 +8558,6 @@ exports[`record integration tests > should nest record iframe 1`] = `
\\"isAttachIframe\\": true
}
},
{
\\"type\\": 7,
\\"data\\": {
\\"url\\": \\"http://localhost:3030/html#rr_style_el:1\\",
\\"payload\\": {
\\"rr_type\\": \\"CssText\\",
\\"cssTexts\\": [
\\"iframe { width: 500px; height: 500px; }\\"
]
}
}
},
{
\\"type\\": 3,
\\"data\\": {
Expand Down Expand Up @@ -11986,7 +11948,7 @@ exports[`record integration tests > should record dynamic CSS changes 1`] = `
\\"attributes\\": {
\\"data-styled\\": \\"active\\",
\\"data-styled-version\\": \\"5.0.1\\",
\\"rr_css_text\\": \\"about:blank#rr_style_el:1\\"
\\"_cssText\\": \\".ixzlRK { font-size: 1.5em; text-align: center; color: palevioletred; }.eOXmez { font-size: 1.5em; text-align: center; color: rebeccapurple; }.bJCmFu { padding: 4em; background: papayawhip; }\\"
},
\\"childNodes\\": [
{
Expand Down Expand Up @@ -12191,25 +12153,6 @@ exports[`record integration tests > should record dynamic CSS changes 1`] = `
\\"initialOffset\\": {
\\"left\\": 0,
\\"top\\": 0
},
\\"capturedAssetStatuses\\": [
{
\\"url\\": \\"about:blank#rr_style_el:1\\",
\\"status\\": \\"capturing\\",
\\"timeout\\": 25
}
]
}
},
{
\\"type\\": 7,
\\"data\\": {
\\"url\\": \\"about:blank#rr_style_el:1\\",
\\"payload\\": {
\\"rr_type\\": \\"CssText\\",
\\"cssTexts\\": [
\\".ixzlRK { font-size: 1.5em; text-align: center; color: palevioletred; }.eOXmez { font-size: 1.5em; text-align: center; color: rebeccapurple; }.bJCmFu { padding: 4em; background: papayawhip; }\\"
]
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions packages/rrweb/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ describe('record integration tests', function (this: ISuite) {
options: recordOptions<eventWithTime> = {},
): string => {
if (!options.captureAssets) {
// for consistency in the tests
// for consistency in the tests, don't create small stylesheet assets
options.captureAssets = {
processStylesheetsWithin: 50,
stylesheetsRuleThreshold: 10,
};
}
const filePath = path.resolve(__dirname, `./html/${fileName}`);
Expand Down

0 comments on commit 487b920

Please sign in to comment.