From 487b9201d3740798425fba1b8cc8723a1fc5e814 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Fri, 29 Nov 2024 13:57:32 +0000 Subject: [PATCH] Don't capture small stylesheets as assets as timing issues are causing 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) --- .../__snapshots__/integration.test.ts.snap | 65 ++----------------- packages/rrweb/test/integration.test.ts | 4 +- 2 files changed, 6 insertions(+), 63 deletions(-) diff --git a/packages/rrweb/test/__snapshots__/integration.test.ts.snap b/packages/rrweb/test/__snapshots__/integration.test.ts.snap index d0de597eff..f019117a2e 100644 --- a/packages/rrweb/test/__snapshots__/integration.test.ts.snap +++ b/packages/rrweb/test/__snapshots__/integration.test.ts.snap @@ -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\\": [ { @@ -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; }\\" - ] } } }, @@ -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\\": [ { @@ -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 - } - ] + } } }, { @@ -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\\": { @@ -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\\": [ { @@ -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; }\\" - ] } } }, diff --git a/packages/rrweb/test/integration.test.ts b/packages/rrweb/test/integration.test.ts index 84c41198fe..9958b0c051 100644 --- a/packages/rrweb/test/integration.test.ts +++ b/packages/rrweb/test/integration.test.ts @@ -25,9 +25,9 @@ describe('record integration tests', function (this: ISuite) { options: recordOptions = {}, ): 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}`);