|
1 | 1 | import { expect } from '@playwright/test';
|
2 | 2 |
|
| 3 | +import { |
| 4 | + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, |
| 5 | + SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, |
| 6 | + SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, |
| 7 | +} from '@sentry/browser'; |
3 | 8 | import { sentryTest } from '../../../../utils/fixtures';
|
4 | 9 | import {
|
5 | 10 | envelopeRequestParser,
|
6 | 11 | shouldSkipTracingTest,
|
7 | 12 | waitForTransactionRequestOnUrl,
|
8 | 13 | } from '../../../../utils/helpers';
|
9 | 14 |
|
10 |
| -sentryTest('should send a transaction in an envelope', async ({ getLocalTestPath, page }) => { |
11 |
| - if (shouldSkipTracingTest()) { |
12 |
| - sentryTest.skip(); |
13 |
| - } |
14 |
| - |
15 |
| - const url = await getLocalTestPath({ testDir: __dirname }); |
16 |
| - const req = await waitForTransactionRequestOnUrl(page, url); |
17 |
| - const transaction = envelopeRequestParser(req); |
18 |
| - |
19 |
| - expect(transaction.transaction).toBe('parent_span'); |
20 |
| - expect(transaction.spans).toBeDefined(); |
21 |
| -}); |
| 15 | +sentryTest( |
| 16 | + 'sends a transaction in an envelope with manual origin and custom source', |
| 17 | + async ({ getLocalTestPath, page }) => { |
| 18 | + if (shouldSkipTracingTest()) { |
| 19 | + sentryTest.skip(); |
| 20 | + } |
| 21 | + |
| 22 | + const url = await getLocalTestPath({ testDir: __dirname }); |
| 23 | + const req = await waitForTransactionRequestOnUrl(page, url); |
| 24 | + const transaction = envelopeRequestParser(req); |
| 25 | + |
| 26 | + const attributes = transaction.contexts?.trace?.data; |
| 27 | + expect(attributes).toEqual({ |
| 28 | + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', |
| 29 | + [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, |
| 30 | + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', |
| 31 | + }); |
| 32 | + |
| 33 | + expect(transaction.transaction_info?.source).toBe('custom'); |
| 34 | + |
| 35 | + expect(transaction.transaction).toBe('parent_span'); |
| 36 | + expect(transaction.spans).toBeDefined(); |
| 37 | + }, |
| 38 | +); |
22 | 39 |
|
23 | 40 | sentryTest('should report finished spans as children of the root transaction', async ({ getLocalTestPath, page }) => {
|
24 | 41 | if (shouldSkipTracingTest()) {
|
|
0 commit comments