-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
35 lines (29 loc) · 1.2 KB
/
test.ts
File metadata and controls
35 lines (29 loc) · 1.2 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 { sentryTest } from '../../../utils/fixtures';
import { shouldSkipTracingTest, testingCdnBundle } from '../../../utils/helpers';
import { getSpanOp, waitForStreamedSpan } from '../../../utils/spanUtils';
sentryTest('beforeSendSpan applies changes to streamed span', async ({ getLocalTestUrl, page }) => {
sentryTest.skip(shouldSkipTracingTest() || testingCdnBundle());
const url = await getLocalTestUrl({ testDir: __dirname });
const pageloadSpanPromise = waitForStreamedSpan(page, span => getSpanOp(span) === 'pageload');
await page.goto(url);
const pageloadSpan = await pageloadSpanPromise;
expect(pageloadSpan.name).toBe('customPageloadSpanName');
expect(pageloadSpan.links).toEqual([
{
context: {
traceId: '123',
spanId: '456',
},
attributes: {
'sentry.link.type': { type: 'string', value: 'custom_link' },
},
},
]);
expect(pageloadSpan.attributes?.['sentry.custom_attribute']).toEqual({
type: 'string',
value: 'customAttributeValue',
});
// we allow overriding any kinds of fields on the span, so we have to expect invalid values
expect(pageloadSpan.status).toBe('something');
});