Skip to content

Commit ec1a441

Browse files
authored
test: Fix flaky replay DSC test (#7973)
Also one test was actually incorrect.
1 parent 5f9b9ce commit ec1a441

File tree

2 files changed

+13
-5
lines changed
  • .github/workflows
  • packages/browser-integration-tests/suites/replay/dsc

2 files changed

+13
-5
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ jobs:
511511
needs: [job_get_metadata, job_build]
512512
if: needs.job_get_metadata.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
513513
runs-on: ubuntu-20.04
514-
timeout-minutes: 15
514+
timeout-minutes: 18
515515
strategy:
516516
fail-fast: false
517517
matrix:

packages/browser-integration-tests/suites/replay/dsc/test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import type { EventEnvelopeHeaders } from '@sentry/types';
55
import { sentryTest } from '../../../utils/fixtures';
66
import {
77
envelopeHeaderRequestParser,
8+
envelopeRequestParser,
89
getFirstSentryEnvelopeRequest,
910
shouldSkipTracingTest,
11+
waitForTransactionRequest,
1012
} from '../../../utils/helpers';
1113
import { getReplaySnapshot, shouldSkipReplayTest, waitForReplayRunning } from '../../../utils/replayHelpers';
1214

@@ -21,6 +23,8 @@ sentryTest('should add replay_id to dsc of transactions', async ({ getLocalTestP
2123
const url = await getLocalTestPath({ testDir: __dirname });
2224
await page.goto(url);
2325

26+
await waitForReplayRunning(page);
27+
2428
await page.evaluate(() => {
2529
(window as unknown as TestWindow).Sentry.configureScope(scope => {
2630
scope.setUser({ id: 'user123', segment: 'segmentB' });
@@ -30,7 +34,6 @@ sentryTest('should add replay_id to dsc of transactions', async ({ getLocalTestP
3034

3135
const envHeader = await getFirstSentryEnvelopeRequest<EventEnvelopeHeaders>(page, url, envelopeHeaderRequestParser);
3236

33-
await waitForReplayRunning(page);
3437
const replay = await getReplaySnapshot(page);
3538

3639
expect(replay.session?.id).toBeDefined();
@@ -65,6 +68,10 @@ sentryTest(
6568
const url = await getLocalTestPath({ testDir: __dirname });
6669
await page.goto(url);
6770

71+
await waitForReplayRunning(page);
72+
73+
const transactionReq = waitForTransactionRequest(page);
74+
6875
await page.evaluate(async () => {
6976
await (window as unknown as TestWindow).Replay.stop();
7077

@@ -74,12 +81,13 @@ sentryTest(
7481
});
7582
});
7683

77-
const envHeader = await getFirstSentryEnvelopeRequest<EventEnvelopeHeaders>(page, url, envelopeHeaderRequestParser);
84+
const req0 = await transactionReq;
85+
86+
const envHeader = envelopeRequestParser(req0, 0) as EventEnvelopeHeaders;
7887

79-
await waitForReplayRunning(page);
8088
const replay = await getReplaySnapshot(page);
8189

82-
expect(replay.session?.id).toBeDefined();
90+
expect(replay.session).toBeUndefined();
8391

8492
expect(envHeader.trace).toBeDefined();
8593
expect(envHeader.trace).toEqual({

0 commit comments

Comments
 (0)