-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
27 lines (21 loc) · 1.09 KB
/
test.ts
File metadata and controls
27 lines (21 loc) · 1.09 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
import { expect } from '@playwright/test';
import { sentryTest } from '../../../utils/fixtures';
import { shouldSkipTracingTest } from '../../../utils/helpers';
import { getSpanOp, waitForStreamedSpans } from '../../../utils/spanUtils';
sentryTest('httpContextIntegration captures url, user-agent, and referer', async ({ getLocalTestUrl, page }) => {
sentryTest.skip(shouldSkipTracingTest());
const url = await getLocalTestUrl({ testDir: __dirname });
const spansPromise = waitForStreamedSpans(page, spans => spans.some(s => getSpanOp(s) === 'pageload'));
await page.goto(url, { referer: 'https://sentry.io/' });
const spans = await spansPromise;
const pageloadSpan = spans.find(s => getSpanOp(s) === 'pageload');
expect(pageloadSpan!.attributes?.['url.full']).toEqual({ type: 'string', value: expect.any(String) });
expect(pageloadSpan!.attributes?.['http.request.header.user_agent']).toEqual({
type: 'string',
value: expect.any(String),
});
expect(pageloadSpan!.attributes?.['http.request.header.referer']).toEqual({
type: 'string',
value: 'https://sentry.io/',
});
});