diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/init.js b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/init.js new file mode 100644 index 000000000000..e2dd69ede824 --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/init.js @@ -0,0 +1,10 @@ +import * as Sentry from '@sentry/browser'; + +window.Sentry = Sentry; + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + integrations: [Sentry.browserTracingIntegration()], + tracePropagationTargets: ['sentry-test-external.io'], + tracesSampleRate: 1, +}); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/subject.js b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/subject.js new file mode 100644 index 000000000000..179c0203e14c --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/subject.js @@ -0,0 +1,3 @@ +Sentry.startSpan({ name: 'standalone_span', experimental: { standalone: true } }, () => { + fetch('http://sentry-test-external.io'); +}); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/template.html b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/template.html new file mode 100644 index 000000000000..f98e1c83e643 --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/template.html @@ -0,0 +1,8 @@ + + +
+ + + + + diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/test.ts new file mode 100644 index 000000000000..2700c8aa5077 --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/standalone-without-baggage/test.ts @@ -0,0 +1,48 @@ +import { expect } from '@playwright/test'; +import type { SpanEnvelope } from '@sentry/core'; +import { sentryTest } from '../../../../utils/fixtures'; +import { + getMultipleSentryEnvelopeRequests, + properFullEnvelopeRequestParser, + shouldSkipTracingTest, +} from '../../../../utils/helpers'; + +const TRACE_ID = '12345678901234567890123456789012'; +const OUTGOING_REQUEST_URL = 'http://sentry-test-external.io'; + +sentryTest( + 'omits the trace envelope header when a standalone span continues a trace without baggage', + async ({ getLocalTestUrl, page }) => { + sentryTest.skip(shouldSkipTracingTest()); + + const url = await getLocalTestUrl({ testDir: __dirname }); + await page.route(OUTGOING_REQUEST_URL, route => route.fulfill({ status: 200, body: 'ok' })); + const outgoingRequestPromise = page.waitForRequest(OUTGOING_REQUEST_URL); + + const [spanEnvelope] = await getMultipleSentryEnvelopeRequests