diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/README.md b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/README.md index d7330f233425..3413aac3bcbf 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/README.md +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/README.md @@ -5,5 +5,6 @@ connected to a trace. This suite distinguishes the following cases: 2. `pageload-meta` - Traces started on the initial pageload as a continuation of the trace on the server (via `` tags) 3. `navigation` - Traces started during navigations on a page +4. `tracing-without-performance` - Traces originating from an app configured for "Tracing without Performance". Tests scenarios should be fairly similar for all three cases but it's important we test all of them. diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/subject.js b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/subject.js index 71e03b3c8a7c..9528f861a723 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/subject.js +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/subject.js @@ -1,6 +1,6 @@ const errorBtn = document.getElementById('errorBtn'); errorBtn.addEventListener('click', () => { - throw new Error('Sentry Test Error'); + throw new Error(`Sentry Test Error ${Math.random()}`); }); const fetchBtn = document.getElementById('fetchBtn'); diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/init.js b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/init.js new file mode 100644 index 000000000000..c273986e1a94 --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/init.js @@ -0,0 +1,10 @@ +import * as Sentry from '@sentry/browser'; + +window.Sentry = Sentry; + +Sentry.init({ + // in browser TwP means not setting tracesSampleRate but adding browserTracingIntegration, + dsn: 'https://public@dsn.ingest.sentry.io/1337', + integrations: [Sentry.browserTracingIntegration()], + tracePropagationTargets: ['http://example.com'], +}); diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/template.html b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/template.html new file mode 100644 index 000000000000..7cf101e4cf9e --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/template.html @@ -0,0 +1,15 @@ + + +
+ + + + + + + + + + + diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/test.ts new file mode 100644 index 000000000000..151842337970 --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/test.ts @@ -0,0 +1,104 @@ +import { expect } from '@playwright/test'; +import type { Event } from '@sentry/types'; +import { sentryTest } from '../../../../utils/fixtures'; +import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; + +const META_TAG_TRACE_ID = '12345678901234567890123456789012'; +const META_TAG_PARENT_SPAN_ID = '1234567890123456'; +const META_TAG_BAGGAGE = + 'sentry-trace_id=12345678901234567890123456789012,sentry-public_key=public,sentry-release=1.0.0,sentry-environment=prod'; + +sentryTest('error has new traceId after navigation', async ({ getLocalTestPath, page }) => { + if (shouldSkipTracingTest()) { + sentryTest.skip(); + } + + const url = await getLocalTestPath({ testDir: __dirname }); + await page.goto(url); + + const errorEventPromise = getFirstSentryEnvelopeRequest