|
1 | 1 | import { expect } from '@playwright/test';
|
2 | 2 |
|
3 | 3 | import { sentryTest } from '../../../../utils/fixtures';
|
4 |
| -import { getReplayRecordingContent, shouldSkipReplayTest, waitForReplayRequest } from '../../../../utils/replayHelpers'; |
| 4 | +import { |
| 5 | + getReplayRecordingContent, |
| 6 | + getReplaySnapshot, |
| 7 | + shouldSkipReplayTest, |
| 8 | + waitForReplayRequest, |
| 9 | +} from '../../../../utils/replayHelpers'; |
5 | 10 |
|
6 | 11 | sentryTest(
|
7 |
| - 'handles large mutations with _experiments.mutationLimit configured', |
| 12 | + 'handles large mutations by stopping replay when `mutationLimit` configured', |
8 | 13 | async ({ getLocalTestPath, page, forceFlushReplay, browserName }) => {
|
9 | 14 | if (shouldSkipReplayTest() || ['webkit', 'firefox'].includes(browserName)) {
|
10 | 15 | sentryTest.skip();
|
@@ -34,36 +39,29 @@ sentryTest(
|
34 | 39 | await forceFlushReplay();
|
35 | 40 | const res1 = await reqPromise1;
|
36 | 41 |
|
37 |
| - const reqPromise2 = waitForReplayRequest(page); |
| 42 | + // replay should be stopped due to mutation limit |
| 43 | + let replay = await getReplaySnapshot(page); |
| 44 | + expect(replay.session).toBe(undefined); |
| 45 | + expect(replay._isEnabled).toBe(false); |
38 | 46 |
|
39 | 47 | void page.click('#button-modify');
|
40 | 48 | await forceFlushReplay();
|
41 |
| - const res2 = await reqPromise2; |
42 | 49 |
|
43 |
| - const reqPromise3 = waitForReplayRequest(page); |
44 |
| - |
45 |
| - void page.click('#button-remove'); |
| 50 | + await page.click('#button-remove'); |
46 | 51 | await forceFlushReplay();
|
47 |
| - const res3 = await reqPromise3; |
48 | 52 |
|
49 | 53 | const replayData0 = getReplayRecordingContent(res0);
|
50 |
| - const replayData1 = getReplayRecordingContent(res1); |
51 |
| - const replayData2 = getReplayRecordingContent(res2); |
52 |
| - const replayData3 = getReplayRecordingContent(res3); |
53 |
| - |
54 | 54 | expect(replayData0.fullSnapshots.length).toBe(1);
|
55 | 55 | expect(replayData0.incrementalSnapshots.length).toBe(0);
|
56 | 56 |
|
57 |
| - // This includes both a full snapshot as well as some incremental snapshots |
58 |
| - expect(replayData1.fullSnapshots.length).toBe(1); |
| 57 | + // Breadcrumbs (click and mutation); |
| 58 | + const replayData1 = getReplayRecordingContent(res1); |
| 59 | + expect(replayData1.fullSnapshots.length).toBe(0); |
59 | 60 | expect(replayData1.incrementalSnapshots.length).toBeGreaterThan(0);
|
| 61 | + expect(replayData1.breadcrumbs.map(({ category }) => category).sort()).toEqual(['replay.mutations', 'ui.click']); |
60 | 62 |
|
61 |
| - // This does not trigger mutations, for whatever reason - so no full snapshot either! |
62 |
| - expect(replayData2.fullSnapshots.length).toBe(0); |
63 |
| - expect(replayData2.incrementalSnapshots.length).toBeGreaterThan(0); |
64 |
| - |
65 |
| - // This includes both a full snapshot as well as some incremental snapshots |
66 |
| - expect(replayData3.fullSnapshots.length).toBe(1); |
67 |
| - expect(replayData3.incrementalSnapshots.length).toBeGreaterThan(0); |
| 63 | + replay = await getReplaySnapshot(page); |
| 64 | + expect(replay.session).toBe(undefined); |
| 65 | + expect(replay._isEnabled).toBe(false); |
68 | 66 | },
|
69 | 67 | );
|
0 commit comments