Skip to content

Commit b4dd8fa

Browse files
committed
fix tests?
1 parent 3b2cbb6 commit b4dd8fa

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ import { expect } from '@playwright/test';
22
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
5-
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
5+
import {
6+
envelopeRequestParser,
7+
shouldSkipTracingTest,
8+
waitForTransactionRequestOnUrl,
9+
} from '../../../../utils/helpers';
610

711
sentryTest('should send a transaction in an envelope', async ({ getLocalTestPath, page }) => {
812
if (shouldSkipTracingTest()) {
913
sentryTest.skip();
1014
}
1115

1216
const url = await getLocalTestPath({ testDir: __dirname });
13-
const transaction = await getFirstSentryEnvelopeRequest<Event>(page, url);
17+
const req = await waitForTransactionRequestOnUrl(page, url);
18+
const transaction = envelopeRequestParser(req);
1419

1520
expect(transaction.transaction).toBe('parent_span');
1621
expect(transaction.spans).toBeDefined();
@@ -22,7 +27,8 @@ sentryTest('should report finished spans as children of the root transaction', a
2227
}
2328

2429
const url = await getLocalTestPath({ testDir: __dirname });
25-
const transaction = await getFirstSentryEnvelopeRequest<Event>(page, url);
30+
const req = await waitForTransactionRequestOnUrl(page, url);
31+
const transaction = envelopeRequestParser(req);
2632

2733
expect(transaction.spans).toHaveLength(1);
2834

packages/core/src/utils/applyScopeDataToEvent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,13 @@ function applySdkMetadataToEvent(event: Event, sdkProcessingMetadata: ScopeData[
171171

172172
function applySpanToEvent(event: Event, span: Span): void {
173173
event.contexts = { trace: spanToTraceContext(span), ...event.contexts };
174-
const rootSpan = getRootSpan(span);
174+
175175
event.sdkProcessingMetadata = {
176176
dynamicSamplingContext: getDynamicSamplingContextFromSpan(span),
177177
...event.sdkProcessingMetadata,
178178
};
179179

180+
const rootSpan = getRootSpan(span);
180181
const transactionName = spanToJSON(rootSpan).description;
181182
if (transactionName && !event.transaction) {
182183
event.transaction = transactionName;

0 commit comments

Comments
 (0)