Skip to content

Commit 535bdf2

Browse files
committed
PR feedback
1 parent 3a38653 commit 535bdf2

File tree

9 files changed

+21
-29
lines changed

9 files changed

+21
-29
lines changed

packages/integration-tests/suites/replay/captureReplay/test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { expect } from '@playwright/test';
22
import { SDK_VERSION } from '@sentry/browser';
3-
import type { ReplayEvent } from '@sentry/types';
43

54
import { sentryTest } from '../../../utils/fixtures';
6-
import { envelopeRequestParser } from '../../../utils/helpers';
7-
import { shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers';
5+
import { getReplayEvent, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers';
86

97
sentryTest('should capture replays', async ({ getLocalTestPath, page }) => {
108
if (shouldSkipReplayTest()) {
@@ -25,10 +23,10 @@ sentryTest('should capture replays', async ({ getLocalTestPath, page }) => {
2523
const url = await getLocalTestPath({ testDir: __dirname });
2624

2725
await page.goto(url);
28-
const replayEvent0 = envelopeRequestParser(await reqPromise0) as ReplayEvent;
26+
const replayEvent0 = getReplayEvent(await reqPromise0);
2927

3028
await page.click('button');
31-
const replayEvent1 = envelopeRequestParser(await reqPromise1) as ReplayEvent;
29+
const replayEvent1 = getReplayEvent(await reqPromise1);
3230

3331
expect(replayEvent0).toBeDefined();
3432
expect(replayEvent0).toEqual({

packages/integration-tests/suites/replay/captureReplayViaBrowser/test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { expect } from '@playwright/test';
22
import { SDK_VERSION } from '@sentry/browser';
3-
import type { ReplayEvent } from '@sentry/types';
43

54
import { sentryTest } from '../../../utils/fixtures';
6-
import { envelopeRequestParser } from '../../../utils/helpers';
7-
import { waitForReplayRequest } from '../../../utils/replayHelpers';
5+
import { getReplayEvent, waitForReplayRequest } from '../../../utils/replayHelpers';
86

97
sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalTestPath, page }) => {
108
// For this test, we skip all bundle tests, as we're only interested in Replay being correctly
@@ -27,10 +25,10 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT
2725
const url = await getLocalTestPath({ testDir: __dirname });
2826

2927
await page.goto(url);
30-
const replayEvent0 = envelopeRequestParser(await reqPromise0) as ReplayEvent;
28+
const replayEvent0 = getReplayEvent(await reqPromise0);
3129

3230
await page.click('button');
33-
const replayEvent1 = envelopeRequestParser(await reqPromise1) as ReplayEvent;
31+
const replayEvent1 = getReplayEvent(await reqPromise1);
3432

3533
expect(replayEvent0).toBeDefined();
3634
expect(replayEvent0).toEqual({

packages/integration-tests/suites/replay/sessionExpiry/test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { expect } from '@playwright/test';
2-
import type { ReplayEvent } from '@sentry/types';
32

43
import { sentryTest } from '../../../utils/fixtures';
5-
import { envelopeRequestParser } from '../../../utils/helpers';
64
import { getExpectedReplayEvent } from '../../../utils/replayEventTemplates';
75
import {
86
getFullRecordingSnapshots,
97
getIncrementalRecordingSnapshots,
8+
getReplayEvent,
109
getReplaySnapshot,
1110
normalize,
1211
shouldSkipReplayTest,
@@ -36,7 +35,7 @@ sentryTest('handles an expired session', async ({ getLocalTestPath, page }) => {
3635

3736
await page.goto(url);
3837

39-
const replayEvent0 = envelopeRequestParser(await reqPromise0) as ReplayEvent;
38+
const replayEvent0 = getReplayEvent(await reqPromise0);
4039
expect(replayEvent0).toEqual(getExpectedReplayEvent({}));
4140

4241
const fullSnapshots0 = getFullRecordingSnapshots(await reqPromise0);
@@ -48,7 +47,7 @@ sentryTest('handles an expired session', async ({ getLocalTestPath, page }) => {
4847
const reqPromise2 = waitForReplayRequest(page, 0);
4948

5049
await page.click('#button1');
51-
const replayEvent1 = envelopeRequestParser(await reqPromise1) as ReplayEvent;
50+
const replayEvent1 = getReplayEvent(await reqPromise1);
5251
expect(replayEvent1).toEqual(getExpectedReplayEvent({ replay_start_timestamp: undefined, segment_id: 1, urls: [] }));
5352

5453
const fullSnapshots1 = getFullRecordingSnapshots(await reqPromise1);
@@ -85,7 +84,7 @@ sentryTest('handles an expired session', async ({ getLocalTestPath, page }) => {
8584

8685
expect(replay2.session?.id).not.toEqual(oldSessionId);
8786

88-
const replayEvent2 = envelopeRequestParser(await reqPromise2) as ReplayEvent;
87+
const replayEvent2 = getReplayEvent(await reqPromise2);
8988
expect(replayEvent2).toEqual(getExpectedReplayEvent({}));
9089

9190
const fullSnapshots2 = getFullRecordingSnapshots(await reqPromise2);

packages/integration-tests/suites/replay/sessionInactive/test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { expect } from '@playwright/test';
2-
import type { ReplayEvent } from '@sentry/types';
32

43
import { sentryTest } from '../../../utils/fixtures';
5-
import { envelopeRequestParser } from '../../../utils/helpers';
64
import { getExpectedReplayEvent } from '../../../utils/replayEventTemplates';
75
import {
86
getFullRecordingSnapshots,
9-
getIncrementalRecordingSnapshots,
7+
getReplayEvent,
108
getReplaySnapshot,
119
normalize,
1210
shouldSkipReplayTest,
@@ -35,7 +33,7 @@ sentryTest('handles an inactive session', async ({ getLocalTestPath, page }) =>
3533

3634
await page.goto(url);
3735

38-
const replayEvent0 = envelopeRequestParser(await reqPromise0) as ReplayEvent;
36+
const replayEvent0 = getReplayEvent(await reqPromise0);
3937
expect(replayEvent0).toEqual(getExpectedReplayEvent({}));
4038

4139
const fullSnapshots0 = getFullRecordingSnapshots(await reqPromise0);
@@ -78,7 +76,7 @@ sentryTest('handles an inactive session', async ({ getLocalTestPath, page }) =>
7876
// @ts-ignore private api
7977
expect(replay3._isPaused).toEqual(false);
8078

81-
const replayEvent1 = envelopeRequestParser(await reqPromise1) as ReplayEvent;
79+
const replayEvent1 = getReplayEvent(await reqPromise1);
8280
expect(replayEvent1).toEqual(getExpectedReplayEvent({}));
8381

8482
const fullSnapshots1 = getFullRecordingSnapshots(await reqPromise0);

packages/integration-tests/suites/replay/sessionMaxAge/test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { expect } from '@playwright/test';
2-
import type { ReplayEvent } from '@sentry/types';
32

43
import { sentryTest } from '../../../utils/fixtures';
5-
import { envelopeRequestParser } from '../../../utils/helpers';
64
import { getExpectedReplayEvent } from '../../../utils/replayEventTemplates';
75
import {
86
getFullRecordingSnapshots,
97
getIncrementalRecordingSnapshots,
8+
getReplayEvent,
109
getReplaySnapshot,
1110
normalize,
1211
shouldSkipReplayTest,
@@ -40,7 +39,7 @@ sentryTest('handles session that exceeds max age', async ({ getLocalTestPath, pa
4039

4140
await page.goto(url);
4241

43-
const replayEvent0 = envelopeRequestParser(await reqPromise0) as ReplayEvent;
42+
const replayEvent0 = getReplayEvent(await reqPromise0);
4443
expect(replayEvent0).toEqual(getExpectedReplayEvent({}));
4544

4645
const fullSnapshots0 = getFullRecordingSnapshots(await reqPromise0);
@@ -54,7 +53,7 @@ sentryTest('handles session that exceeds max age', async ({ getLocalTestPath, pa
5453
await new Promise(resolve => setTimeout(resolve, SESSION_MAX_AGE / 2));
5554
await page.click('#button1');
5655

57-
const replayEvent1 = envelopeRequestParser(await reqPromise1) as ReplayEvent;
56+
const replayEvent1 = getReplayEvent(await reqPromise1);
5857
expect(replayEvent1).toEqual(getExpectedReplayEvent({ replay_start_timestamp: undefined, segment_id: 1, urls: [] }));
5958

6059
const fullSnapshots1 = getFullRecordingSnapshots(await reqPromise1);
@@ -91,7 +90,7 @@ sentryTest('handles session that exceeds max age', async ({ getLocalTestPath, pa
9190

9291
expect(replay2.session?.id).not.toEqual(oldSessionId);
9392

94-
const replayEvent2 = envelopeRequestParser(await reqPromise2) as ReplayEvent;
93+
const replayEvent2 = getReplayEvent(await reqPromise2);
9594
expect(replayEvent2).toEqual(getExpectedReplayEvent({}));
9695

9796
const fullSnapshots2 = getFullRecordingSnapshots(await reqPromise2);

packages/replay/test/integration/flush.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as SentryUtils from '@sentry/utils';
22

3-
import { DEFAULT_FLUSH_MIN_DELAY, SESSION_IDLE_DURATION, WINDOW } from '../../src/constants';
3+
import { DEFAULT_FLUSH_MIN_DELAY, WINDOW } from '../../src/constants';
44
import type { ReplayContainer } from '../../src/replay';
55
import type { EventBuffer } from '../../src/types';
66
import * as AddMemoryEntry from '../../src/util/addMemoryEntry';

packages/replay/test/integration/rateLimiting.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getCurrentHub } from '@sentry/core';
22
import type { Transport } from '@sentry/types';
33

4-
import { DEFAULT_FLUSH_MIN_DELAY, SESSION_IDLE_DURATION } from '../../src/constants';
4+
import { DEFAULT_FLUSH_MIN_DELAY } from '../../src/constants';
55
import type { ReplayContainer } from '../../src/replay';
66
import * as SendReplayRequest from '../../src/util/sendReplayRequest';
77
import { BASE_TIMESTAMP, mockSdk } from '../index';

packages/replay/test/integration/sendReplayEvent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as SentryCore from '@sentry/core';
22
import type { Transport } from '@sentry/types';
33
import * as SentryUtils from '@sentry/utils';
44

5-
import { DEFAULT_FLUSH_MIN_DELAY, SESSION_IDLE_DURATION, WINDOW } from '../../src/constants';
5+
import { DEFAULT_FLUSH_MIN_DELAY, WINDOW } from '../../src/constants';
66
import type { ReplayContainer } from '../../src/replay';
77
import { addEvent } from '../../src/util/addEvent';
88
import * as SendReplayRequest from '../../src/util/sendReplayRequest';

rollup/plugins/bundlePlugins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function makeTerserPlugin() {
116116
'_driver',
117117
'_initStorage',
118118
'_support',
119-
// We want to keept some replay fields unmangled to enable integration tests to access them
119+
// We want to keep some replay fields unmangled to enable integration tests to access them
120120
'_replay',
121121
'_isEnabled',
122122
'_isPaused',

0 commit comments

Comments
 (0)