/
test.ts
27 lines (22 loc) · 838 Bytes
/
test.ts
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
import { expect, Request } from '@playwright/test';
import { sentryTest } from '../../../../../utils/fixtures';
sentryTest(
'should not attach `sentry-trace` and `baggage` header to request not matching default tracePropagationTargets',
async ({ getLocalTestPath, page }) => {
const url = await getLocalTestPath({ testDir: __dirname });
const requests = (
await Promise.all([
page.goto(url),
Promise.all([0, 1, 2].map(idx => page.waitForRequest(`http://example.com/${idx}`))),
])
)[1];
expect(requests).toHaveLength(3);
requests?.forEach(async (request: Request) => {
const requestHeaders = await request.allHeaders();
expect(requestHeaders).not.toMatchObject({
'sentry-trace': expect.any(String),
baggage: expect.any(String),
});
});
},
);