Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ jobs:
needs: [job_get_metadata, job_build]
if: needs.job_get_metadata.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04
timeout-minutes: 15
timeout-minutes: 18
strategy:
fail-fast: false
matrix:
Expand Down
16 changes: 12 additions & 4 deletions packages/browser-integration-tests/suites/replay/dsc/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import type { EventEnvelopeHeaders } from '@sentry/types';
import { sentryTest } from '../../../utils/fixtures';
import {
envelopeHeaderRequestParser,
envelopeRequestParser,
getFirstSentryEnvelopeRequest,
shouldSkipTracingTest,
waitForTransactionRequest,
} from '../../../utils/helpers';
import { getReplaySnapshot, shouldSkipReplayTest, waitForReplayRunning } from '../../../utils/replayHelpers';

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

await waitForReplayRunning(page);

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

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

await waitForReplayRunning(page);
const replay = await getReplaySnapshot(page);

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

await waitForReplayRunning(page);

const transactionReq = waitForTransactionRequest(page);

await page.evaluate(async () => {
await (window as unknown as TestWindow).Replay.stop();

Expand All @@ -74,12 +81,13 @@ sentryTest(
});
});

const envHeader = await getFirstSentryEnvelopeRequest<EventEnvelopeHeaders>(page, url, envelopeHeaderRequestParser);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually does page.goto(url) under the hood, so we were reloading the page, re-initializing replay.

const req0 = await transactionReq;

const envHeader = envelopeRequestParser(req0, 0) as EventEnvelopeHeaders;

await waitForReplayRunning(page);
const replay = await getReplaySnapshot(page);

expect(replay.session?.id).toBeDefined();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just incorrect, we expect this to be undefined now 😅

expect(replay.session).toBeUndefined();

expect(envHeader.trace).toBeDefined();
expect(envHeader.trace).toEqual({
Expand Down