Skip to content

Commit

Permalink
Ensure there is separation of timestamps so mutations can be evaluate…
Browse files Browse the repository at this point in the history
…d separately - was failing in the github build process probably due to higher perf
  • Loading branch information
eoghanmurray committed Apr 23, 2024
1 parent ae6908d commit f45f6b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/rrweb/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,19 @@ describe('record integration tests', function (this: ISuite) {
ta.innerText = 'pre value';
document.body.append(ta);
});
await page.waitForTimeout(5);
await page.evaluate(() => {
const t = document.querySelector('textarea') as HTMLTextAreaElement;
t.innerText = 'ok'; // this mutation should be recorded
});
await page.waitForTimeout(5);
await page.evaluate(() => {
const t = document.querySelector('textarea') as HTMLTextAreaElement;
(t.childNodes[0] as Text).appendData('3'); // this mutation is also valid
});

await page.waitForTimeout(5);
await page.type('textarea', '1'); // types (inserts) at index 0, in front of existing text

await page.waitForTimeout(5);
await page.evaluate(() => {
const t = document.querySelector('textarea') as HTMLTextAreaElement;
// user has typed so childNode content should now be ignored
Expand All @@ -138,7 +140,7 @@ describe('record integration tests', function (this: ISuite) {
// there is nothing explicit in rrweb which enforces this, but this test may protect against
// a future change where a mutation on a textarea incorrectly updates the .value
});

await page.waitForTimeout(5);
await page.type('textarea', '2'); // cursor is at index 1

const snapshots = (await page.evaluate(
Expand Down

0 comments on commit f45f6b5

Please sign in to comment.