Skip to content

Commit

Permalink
Ensure there is separation of timestamps (#1455)
Browse files Browse the repository at this point in the history
* Ensure there is separation of timestamps so mutations can be evaluated separately - was failing in the github build process probably due to higher perf

* Remove space from test file

* Create curvy-balloons-brake.md

---------

Co-authored-by: Justin Halsall <[email protected]>
  • Loading branch information
eoghanmurray and Juice10 authored May 1, 2024
1 parent ae6908d commit f1e6a51
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .changeset/curvy-balloons-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
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
File renamed without changes.

0 comments on commit f1e6a51

Please sign in to comment.