-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
35 lines (31 loc) · 1.4 KB
/
test.ts
File metadata and controls
35 lines (31 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { expect } from '@playwright/test';
import type { EventEnvelopeHeaders } from '@sentry/core';
import { sentryTest } from '../../../utils/fixtures';
import {
envelopeHeaderRequestParser,
getFirstSentryEnvelopeRequest,
shouldSkipTracingTest,
} from '../../../utils/helpers';
sentryTest(
'should send dynamic sampling context data in trace envelope header of a transaction envelope',
async ({ getLocalTestUrl, page }) => {
if (shouldSkipTracingTest()) {
sentryTest.skip();
}
const url = await getLocalTestUrl({ testDir: __dirname });
const envHeader = await getFirstSentryEnvelopeRequest<EventEnvelopeHeaders>(page, url, envelopeHeaderRequestParser);
// In this test, we don't expect trace.transaction to be present because without a custom routing instrumentation
// we for now don't have parameterization. This might change in the future but for now the only way of having
// transaction in DSC with the default browserTracingIntegration is when the transaction name is set manually.
// This scenario is covered in another integration test (envelope-header-transaction-name).
expect(envHeader.trace).toBeDefined();
expect(envHeader.trace).toEqual({
environment: 'production',
sample_rate: '1',
trace_id: expect.stringMatching(/[a-f\d]{32}/),
public_key: 'public',
sampled: 'true',
sample_rand: expect.any(String),
});
},
);