diff --git a/packages/rrweb/test/events/touch-all-pointer-id.ts b/packages/rrweb/test/events/touch-all-pointer-id.ts index b29b987876..fd2dca1cb3 100644 --- a/packages/rrweb/test/events/touch-all-pointer-id.ts +++ b/packages/rrweb/test/events/touch-all-pointer-id.ts @@ -1,4 +1,5 @@ import { + EventType, IncrementalSource, MouseInteractions, } from '@sentry-internal/rrweb-types'; @@ -170,6 +171,11 @@ const events: eventWithTime[] = [ }, timestamp: 155, }, + { + type: EventType.IncrementalSnapshot, + data: { source: IncrementalSource.Scroll, id: 1, x: 0, y: 250 }, + timestamp: 220, + }, ]; export default events; diff --git a/packages/rrweb/test/events/touch-some-pointer-id.ts b/packages/rrweb/test/events/touch-some-pointer-id.ts index 32fb6e431b..63c637d309 100644 --- a/packages/rrweb/test/events/touch-some-pointer-id.ts +++ b/packages/rrweb/test/events/touch-some-pointer-id.ts @@ -1,4 +1,5 @@ import { + EventType, IncrementalSource, MouseInteractions, } from '@sentry-internal/rrweb-types'; @@ -167,6 +168,11 @@ const events: eventWithTime[] = [ }, timestamp: 155, }, + { + type: EventType.IncrementalSnapshot, + data: { source: IncrementalSource.Scroll, id: 1, x: 0, y: 250 }, + timestamp: 220, + }, ]; export default events; diff --git a/packages/rrweb/test/replayer.test.ts b/packages/rrweb/test/replayer.test.ts index 0362e6a52e..ae7587ddcb 100644 --- a/packages/rrweb/test/replayer.test.ts +++ b/packages/rrweb/test/replayer.test.ts @@ -39,7 +39,7 @@ type IWindow = Window & typeof globalThis & { rrweb: typeof import('../src'); events: typeof events }; describe('replayer', function () { - jest.setTimeout(300_000); + jest.setTimeout(10_000); let code: ISuite['code']; let browser: ISuite['browser']; @@ -797,7 +797,7 @@ describe('replayer', function () { // No active pointers should exist await expect( await page.evaluate( - () => document.querySelectorAll('.replayer-mouse')!.length, + () => document.querySelectorAll('.touch-active')!.length, ), ).toEqual(0); @@ -808,7 +808,7 @@ describe('replayer', function () { // 2 pointers should exist await expect( await page.evaluate( - () => document.querySelectorAll('.replayer-mouse')!.length, + () => document.querySelectorAll('.touch-active')!.length, ), ).toEqual(2); @@ -817,6 +817,8 @@ describe('replayer', function () { replayer.play(); `); + await page.waitForTimeout(160); + // Both pointers should be removed after the TouchEnd event await expect( await page.evaluate( @@ -826,7 +828,7 @@ describe('replayer', function () { }); // This should't happen, but we want to test/capture the behavior - it.only('has a pointer for touch interactions with some pointerIds', async () => { + it('has a pointer for touch interactions with some pointerIds', async () => { await page.evaluate(`events = ${JSON.stringify(touchSomePointerEvents)}`); await page.evaluate(` const { Replayer } = rrweb; @@ -837,27 +839,28 @@ describe('replayer', function () { // No active pointers should exist await expect( await page.evaluate( - () => document.querySelectorAll('.replayer-mouse')!.length, + () => document.querySelectorAll('.touch-active')!.length, ), ).toEqual(0); await page.evaluate(` replayer.pause(101); - window.pointers = replayer.pointers; `); // 2 pointers should exist await expect( await page.evaluate( - () => document.querySelectorAll('.replayer-mouse')!.length, + () => document.querySelectorAll('.touch-active')!.length, ), ).toEqual(2); await page.evaluate(` - replayer.pause(200); + replayer.pause(220); replayer.play(); `); + await page.waitForTimeout(220); + // Both pointers should be removed after the TouchEnd event await expect( await page.evaluate(