Fix async assertions in test files (#1510)

* fix: await assertSnapshot in test files for async assertions
This commit is contained in:
Justin Halsall
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 5540e450a1
commit 5fd6ea43b4
8 changed files with 94 additions and 92 deletions

View File

@@ -0,0 +1,2 @@
---
---

View File

@@ -149,7 +149,7 @@ describe('cross origin iframes & packer', function (this: ISuite) {
const unpackedSnapshots = packedSnapshots.map((packed) => const unpackedSnapshots = packedSnapshots.map((packed) =>
unpack(packed), unpack(packed),
) as eventWithTime[]; ) as eventWithTime[];
assertSnapshot(unpackedSnapshots); await assertSnapshot(unpackedSnapshots);
}); });
}); });
}); });

View File

@@ -87,7 +87,7 @@ describe('rrweb-plugin-console-record', () => {
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
// The snapshots should containe 1 console log, not multiple. // The snapshots should containe 1 console log, not multiple.
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record console messages', async () => { it('should record console messages', async () => {
@@ -123,6 +123,6 @@ describe('rrweb-plugin-console-record', () => {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
}); });

View File

@@ -153,7 +153,7 @@ describe('integration tests', function (this: ISuite) {
'blob:http://localhost:xxxx/...', 'blob:http://localhost:xxxx/...',
); );
assertSnapshot(rebuildHtml); await assertSnapshot(rebuildHtml);
}); });
} }
@@ -427,7 +427,7 @@ describe('iframe integration tests', function (this: ISuite) {
null, null,
2, 2,
); );
assertSnapshot(snapshotResult); await assertSnapshot(snapshotResult);
}); });
}); });
@@ -470,6 +470,6 @@ describe('shadow DOM integration tests', function (this: ISuite) {
null, null,
2, 2,
); );
assertSnapshot(snapshotResult); await assertSnapshot(snapshotResult);
}); });
}); });

View File

@@ -81,7 +81,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can record form interactions', async () => { it('can record form interactions', async () => {
@@ -98,7 +98,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can record textarea mutations correctly', async () => { it('can record textarea mutations correctly', async () => {
@@ -142,7 +142,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
// check after each mutation and text input // check after each mutation and text input
const replayTextareaValues = await page.evaluate(` const replayTextareaValues = await page.evaluate(`
@@ -183,7 +183,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can record character data muatations', async () => { it('can record character data muatations', async () => {
@@ -205,7 +205,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can record attribute mutation', async () => { it('can record attribute mutation', async () => {
@@ -225,7 +225,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('handles null attribute values', async () => { it('handles null attribute values', async () => {
@@ -253,7 +253,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can record node mutations', async () => { it('can record node mutations', async () => {
@@ -272,7 +272,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can record style changes compactly and preserve css var() functions', async () => { it('can record style changes compactly and preserve css var() functions', async () => {
@@ -322,7 +322,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can freeze mutations', async () => { it('can freeze mutations', async () => {
@@ -358,7 +358,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should not record input events on ignored elements', async () => { it('should not record input events on ignored elements', async () => {
@@ -394,7 +394,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can use maskInputOptions to configure which type of inputs should be masked', async () => { it('can use maskInputOptions to configure which type of inputs should be masked', async () => {
@@ -420,7 +420,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should mask password value attribute with maskInputOptions', async () => { it('should mask password value attribute with maskInputOptions', async () => {
@@ -444,7 +444,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should mask inputs via function call', async () => { it('should mask inputs via function call', async () => {
@@ -474,7 +474,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record input userTriggered values if userTriggeredOnInput is enabled', async () => { it('should record input userTriggered values if userTriggeredOnInput is enabled', async () => {
@@ -494,7 +494,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should not record blocked elements and its child nodes', async () => { it('should not record blocked elements and its child nodes', async () => {
@@ -509,7 +509,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should not record blocked elements dynamically added', async () => { it('should not record blocked elements dynamically added', async () => {
@@ -531,7 +531,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('mutations should work when blocked class is unblocked', async () => { it('mutations should work when blocked class is unblocked', async () => {
@@ -552,7 +552,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record DOM node movement 1', async () => { it('should record DOM node movement 1', async () => {
@@ -572,7 +572,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record DOM node movement 2', async () => { it('should record DOM node movement 2', async () => {
@@ -589,7 +589,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record dynamic CSS changes', async () => { it('should record dynamic CSS changes', async () => {
@@ -600,7 +600,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record canvas mutations', async () => { it('should record canvas mutations', async () => {
@@ -625,7 +625,7 @@ describe('record integration tests', function (this: ISuite) {
}); });
} }
} }
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should not record input values if dynamically added and maskAllInputs is true', async () => { it('should not record input values if dynamically added and maskAllInputs is true', async () => {
@@ -662,7 +662,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can correctly serialize a shader and multiple webgl contexts', async () => { it('can correctly serialize a shader and multiple webgl contexts', async () => {
@@ -677,7 +677,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('will serialize node before record', async () => { it('will serialize node before record', async () => {
@@ -698,7 +698,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('will defer missing next node mutation', async () => { it('will defer missing next node mutation', async () => {
@@ -735,7 +735,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record images with blob url', async () => { it('should record images with blob url', async () => {
@@ -752,7 +752,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record images inside iframe with blob url', async () => { it('should record images inside iframe with blob url', async () => {
@@ -769,7 +769,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record images inside iframe with blob url after iframe was reloaded', async () => { it('should record images inside iframe with blob url after iframe was reloaded', async () => {
@@ -792,7 +792,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record shadow DOM', async () => { it('should record shadow DOM', async () => {
@@ -842,7 +842,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record shadow DOM 2', async () => { it('should record shadow DOM 2', async () => {
@@ -867,7 +867,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record shadow DOM 3', async () => { it('should record shadow DOM 3', async () => {
@@ -888,7 +888,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record moved shadow DOM', async () => { it('should record moved shadow DOM', async () => {
@@ -917,7 +917,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record moved shadow DOM 2', async () => { it('should record moved shadow DOM 2', async () => {
@@ -955,7 +955,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record nested iframes and shadow doms', async () => { it('should record nested iframes and shadow doms', async () => {
@@ -1000,7 +1000,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record mutations in iframes accross pages', async () => { it('should record mutations in iframes accross pages', async () => {
@@ -1030,7 +1030,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
// https://github.com/webcomponents/polyfills/tree/master/packages/shadydom // https://github.com/webcomponents/polyfills/tree/master/packages/shadydom
@@ -1064,7 +1064,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
// https://github.com/salesforce/lwc/tree/master/packages/%40lwc/synthetic-shadow // https://github.com/salesforce/lwc/tree/master/packages/%40lwc/synthetic-shadow
@@ -1106,7 +1106,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should mask texts', async () => { it('should mask texts', async () => {
@@ -1121,7 +1121,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should mask texts using maskTextFn', async () => { it('should mask texts using maskTextFn', async () => {
@@ -1137,7 +1137,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should unmask texts using maskTextFn', async () => { it('should unmask texts using maskTextFn', async () => {
@@ -1157,7 +1157,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can mask character data mutations', async () => { it('can mask character data mutations', async () => {
@@ -1186,7 +1186,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('can mask character data mutations with regexp', async () => { it('can mask character data mutations with regexp', async () => {
@@ -1219,7 +1219,7 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record after DOMContentLoaded event', async () => { it('should record after DOMContentLoaded event', async () => {
@@ -1234,6 +1234,6 @@ describe('record integration tests', function (this: ISuite) {
const snapshots = (await page.evaluate( const snapshots = (await page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
}); });

View File

@@ -206,7 +206,7 @@ describe('record', function (this: ISuite) {
}, 10); }, 10);
}); });
await ctx.page.waitForTimeout(100); await ctx.page.waitForTimeout(100);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('should record scroll position', async () => { it('should record scroll position', async () => {
@@ -223,7 +223,7 @@ describe('record', function (this: ISuite) {
p.scrollLeft = 10; p.scrollLeft = 10;
}); });
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('should record selection event', async () => { it('should record selection event', async () => {
@@ -279,7 +279,7 @@ describe('record', function (this: ISuite) {
}); });
}); });
await ctx.page.waitForTimeout(50); await ctx.page.waitForTimeout(50);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('captures stylesheet rules', async () => { it('captures stylesheet rules', async () => {
@@ -329,7 +329,7 @@ describe('record', function (this: ISuite) {
}, },
]); ]);
expect(removeRuleCount).toEqual(1); expect(removeRuleCount).toEqual(1);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
const captureNestedStylesheetRulesTest = async () => { const captureNestedStylesheetRulesTest = async () => {
@@ -375,7 +375,7 @@ describe('record', function (this: ISuite) {
// sync insert/delete should be ignored // sync insert/delete should be ignored
expect(addRuleCount).toEqual(2); expect(addRuleCount).toEqual(2);
expect(removeRuleCount).toEqual(1); expect(removeRuleCount).toEqual(1);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}; };
it('captures nested stylesheet rules', captureNestedStylesheetRulesTest); it('captures nested stylesheet rules', captureNestedStylesheetRulesTest);
@@ -426,7 +426,7 @@ describe('record', function (this: ISuite) {
}, 0); }, 0);
}); });
await ctx.page.waitForTimeout(50); await ctx.page.waitForTimeout(50);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('captures inserted style text nodes correctly', async () => { it('captures inserted style text nodes correctly', async () => {
@@ -446,7 +446,7 @@ describe('record', function (this: ISuite) {
styleEl.append(document.createTextNode('h1 { color: pink; }')); styleEl.append(document.createTextNode('h1 { color: pink; }'));
}); });
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('captures stylesheets with `blob:` url', async () => { it('captures stylesheets with `blob:` url', async () => {
@@ -473,7 +473,7 @@ describe('record', function (this: ISuite) {
}); });
}); });
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('captures mutations on adopted stylesheets', async () => { it('captures mutations on adopted stylesheets', async () => {
@@ -538,7 +538,7 @@ describe('record', function (this: ISuite) {
}); });
}); });
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('captures adopted stylesheets in nested shadow doms and iframes', async () => { it('captures adopted stylesheets in nested shadow doms and iframes', async () => {
@@ -590,7 +590,7 @@ describe('record', function (this: ISuite) {
}, 150); }, 150);
}); });
await ctx.page.waitForTimeout(200); await ctx.page.waitForTimeout(200);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('captures adopted stylesheets of shadow doms in checkout full snapshot', async () => { it('captures adopted stylesheets of shadow doms in checkout full snapshot', async () => {
@@ -619,7 +619,7 @@ describe('record', function (this: ISuite) {
}); });
}); });
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('captures stylesheets in iframes with `blob:` url', async () => { it('captures stylesheets in iframes with `blob:` url', async () => {
@@ -651,7 +651,7 @@ describe('record', function (this: ISuite) {
}); });
}); });
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('aggregates mutations', async () => { it('aggregates mutations', async () => {
@@ -698,7 +698,7 @@ describe('record', function (this: ISuite) {
); );
expect(mutationEvents.length).toEqual(0); // there was no aggregate effect expect(mutationEvents.length).toEqual(0); // there was no aggregate effect
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('no need for attribute mutations on adds', async () => { it('no need for attribute mutations on adds', async () => {
@@ -737,7 +737,7 @@ describe('record', function (this: ISuite) {
); );
expect(mutationEvents.length).toEqual(1); expect(mutationEvents.length).toEqual(1);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
describe('loading stylesheets', () => { describe('loading stylesheets', () => {
@@ -789,7 +789,7 @@ describe('record', function (this: ISuite) {
await ctx.page.waitForResponse(`${serverURL}/html/assets/style.css`); await ctx.page.waitForResponse(`${serverURL}/html/assets/style.css`);
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('captures stylesheets in iframes that are still loading', async () => { it('captures stylesheets in iframes that are still loading', async () => {
@@ -823,7 +823,7 @@ describe('record', function (this: ISuite) {
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
}); });
@@ -849,7 +849,7 @@ describe('record', function (this: ISuite) {
await ctx.page.waitForResponse(corsStylesheetURL); // wait for stylesheet to be loaded await ctx.page.waitForResponse(corsStylesheetURL); // wait for stylesheet to be loaded
await waitForRAF(ctx.page); // wait for rrweb to emit events await waitForRAF(ctx.page); // wait for rrweb to emit events
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('captures adopted stylesheets in shadow doms and iframe', async () => { it('captures adopted stylesheets in shadow doms and iframe', async () => {
@@ -924,7 +924,7 @@ describe('record', function (this: ISuite) {
}); });
await waitForRAF(ctx.page); // wait till events get sent await waitForRAF(ctx.page); // wait till events get sent
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
}); });
@@ -1025,6 +1025,6 @@ describe('record iframes', function (this: ISuite) {
expect(styleRelatedEvents.length).toEqual(5); expect(styleRelatedEvents.length).toEqual(5);
expect(addRuleCount).toEqual(2); expect(addRuleCount).toEqual(2);
expect(removeRuleCount).toEqual(2); expect(removeRuleCount).toEqual(2);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
}); });

View File

@@ -238,7 +238,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should map scroll events correctly', async () => { it('should map scroll events correctly', async () => {
@@ -261,7 +261,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
}); });
@@ -289,7 +289,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record DOM node removal', async () => { it('should record DOM node removal', async () => {
@@ -301,7 +301,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record DOM attribute changes', async () => { it('should record DOM attribute changes', async () => {
@@ -313,7 +313,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record DOM text changes', async () => { it('should record DOM text changes', async () => {
@@ -325,7 +325,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record canvas elements', async () => { it('should record canvas elements', async () => {
@@ -342,7 +342,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should record custom events', async () => { it('should record custom events', async () => {
@@ -358,7 +358,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('captures mutations on adopted stylesheets', async () => { it('captures mutations on adopted stylesheets', async () => {
@@ -421,7 +421,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('captures mutations on stylesheets', async () => { it('captures mutations on stylesheets', async () => {
@@ -476,7 +476,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
}); });
@@ -505,7 +505,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
}); });
@@ -537,7 +537,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
it('should filter out forwarded cross origin rrweb messages', async () => { it('should filter out forwarded cross origin rrweb messages', async () => {
@@ -564,7 +564,7 @@ describe('cross origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
}); });
}); });
@@ -592,7 +592,7 @@ describe('same origin iframes', function (this: ISuite) {
// two events (full snapshot + meta) from main frame, // two events (full snapshot + meta) from main frame,
// and two (full snapshot + mutation) from iframe // and two (full snapshot + mutation) from iframe
expect(events.length).toBe(4); expect(events.length).toBe(4);
assertSnapshot(events); await assertSnapshot(events);
}); });
it('should record cross-origin iframe in same-origin iframe', async () => { it('should record cross-origin iframe in same-origin iframe', async () => {
@@ -616,6 +616,6 @@ describe('same origin iframes', function (this: ISuite) {
const snapshots = (await ctx.page.evaluate( const snapshots = (await ctx.page.evaluate(
'window.snapshots', 'window.snapshots',
)) as eventWithTime[]; )) as eventWithTime[];
assertSnapshot(snapshots); await assertSnapshot(snapshots);
}); });
}); });

View File

@@ -124,7 +124,7 @@ describe('record webgl', function (this: ISuite) {
], ],
}, },
}); });
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('will record changes to a webgl2 canvas element', async () => { it('will record changes to a webgl2 canvas element', async () => {
@@ -150,7 +150,7 @@ describe('record webgl', function (this: ISuite) {
], ],
}, },
}); });
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('will record changes to a canvas element before the canvas gets added', async () => { it('will record changes to a canvas element before the canvas gets added', async () => {
@@ -165,7 +165,7 @@ describe('record webgl', function (this: ISuite) {
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('will record changes to a canvas element before the canvas gets added (webgl2)', async () => { it('will record changes to a canvas element before the canvas gets added (webgl2)', async () => {
@@ -188,7 +188,7 @@ describe('record webgl', function (this: ISuite) {
// we need to change this // we need to change this
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('will record webgl variables', async () => { it('will record webgl variables', async () => {
@@ -203,7 +203,7 @@ describe('record webgl', function (this: ISuite) {
await ctx.page.waitForTimeout(50); await ctx.page.waitForTimeout(50);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('will record webgl variables in reverse order', async () => { it('will record webgl variables in reverse order', async () => {
@@ -219,7 +219,7 @@ describe('record webgl', function (this: ISuite) {
await ctx.page.waitForTimeout(50); await ctx.page.waitForTimeout(50);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
}); });
it('sets _context on canvas.getContext()', async () => { it('sets _context on canvas.getContext()', async () => {
@@ -264,7 +264,7 @@ describe('record webgl', function (this: ISuite) {
await ctx.page.waitForTimeout(50); await ctx.page.waitForTimeout(50);
assertSnapshot(ctx.events); await assertSnapshot(ctx.events);
expect(ctx.events.length).toEqual(5); expect(ctx.events.length).toEqual(5);
}); });
@@ -312,7 +312,7 @@ describe('record webgl', function (this: ISuite) {
await waitForRAF(ctx.page); await waitForRAF(ctx.page);
// should yield a frame for each change at a max of 60fps // should yield a frame for each change at a max of 60fps
assertSnapshot(stripBase64(ctx.events)); await assertSnapshot(stripBase64(ctx.events));
}); });
}); });
}); });