diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts index 0ed99e3b7ec9..4bf1d1f7d49a 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts @@ -18,15 +18,24 @@ sentryTest('creates a new trace on each navigation', async ({ getLocalTestPath, const navigationEvent1 = await getFirstSentryEnvelopeRequest(page, `${url}#foo`); const navigationEvent2 = await getFirstSentryEnvelopeRequest(page, `${url}#bar`); - expect(navigationEvent1.contexts?.trace?.op).toBe('navigation'); - expect(navigationEvent2.contexts?.trace?.op).toBe('navigation'); - - const navigation1TraceId = navigationEvent1.contexts?.trace?.trace_id; - const navigation2TraceId = navigationEvent2.contexts?.trace?.trace_id; - - expect(navigation1TraceId).toMatch(/^[0-9a-f]{32}$/); - expect(navigation2TraceId).toMatch(/^[0-9a-f]{32}$/); - expect(navigation1TraceId).not.toEqual(navigation2TraceId); + const navigation1TraceContext = navigationEvent1.contexts?.trace; + const navigation2TraceContext = navigationEvent2.contexts?.trace; + + expect(navigation1TraceContext).toMatchObject({ + op: 'navigation', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(navigation1TraceContext).not.toHaveProperty('parent_span_id'); + + expect(navigation2TraceContext).toMatchObject({ + op: 'navigation', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(navigation2TraceContext).not.toHaveProperty('parent_span_id'); + + expect(navigation1TraceContext?.trace_id).not.toEqual(navigation2TraceContext?.trace_id); }); sentryTest('error after navigation has navigation traceId', async ({ getLocalTestPath, page }) => { @@ -40,17 +49,24 @@ sentryTest('error after navigation has navigation traceId', async ({ getLocalTes await getFirstSentryEnvelopeRequest(page, url); const navigationEvent = await getFirstSentryEnvelopeRequest(page, `${url}#foo`); - expect(navigationEvent.contexts?.trace?.op).toBe('navigation'); + const navigationTraceContext = navigationEvent.contexts?.trace; - const navigationTraceId = navigationEvent.contexts?.trace?.trace_id; - expect(navigationTraceId).toMatch(/^[0-9a-f]{32}$/); + expect(navigationTraceContext).toMatchObject({ + op: 'navigation', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); const errorEventPromise = getFirstSentryEnvelopeRequest(page); await page.locator('#errorBtn').click(); const errorEvent = await errorEventPromise; - const errorTraceId = errorEvent.contexts?.trace?.trace_id; - expect(errorTraceId).toBe(navigationTraceId); + const errorTraceContext = errorEvent.contexts?.trace; + expect(errorTraceContext).toEqual({ + trace_id: navigationTraceContext?.trace_id, + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); }); sentryTest('error during navigation has new navigation traceId', async ({ getLocalTestPath, page }) => { @@ -71,13 +87,20 @@ sentryTest('error during navigation has new navigation traceId', async ({ getLoc const navigationEvent = events.find(event => event.type === 'transaction'); const errorEvent = events.find(event => !event.type); - expect(navigationEvent?.contexts?.trace?.op).toBe('navigation'); - - const navigationTraceId = navigationEvent?.contexts?.trace?.trace_id; - expect(navigationTraceId).toMatch(/^[0-9a-f]{32}$/); - - const errorTraceId = errorEvent?.contexts?.trace?.trace_id; - expect(errorTraceId).toBe(navigationTraceId); + const navigationTraceContext = navigationEvent?.contexts?.trace; + expect(navigationTraceContext).toMatchObject({ + op: 'navigation', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); + + const errorTraceContext = errorEvent?.contexts?.trace; + expect(errorTraceContext).toMatchObject({ + op: 'navigation', + trace_id: errorTraceContext?.trace_id, + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); }); sentryTest( @@ -93,10 +116,14 @@ sentryTest( await getFirstSentryEnvelopeRequest(page, url); const navigationEvent = await getFirstSentryEnvelopeRequest(page, `${url}#foo`); - expect(navigationEvent.contexts?.trace?.op).toBe('navigation'); - const navigationTraceId = navigationEvent.contexts?.trace?.trace_id; - expect(navigationTraceId).toMatch(/^[0-9a-f]{32}$/); + const navigationTraceContext = navigationEvent.contexts?.trace; + expect(navigationTraceContext).toMatchObject({ + op: 'navigation', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); const requestPromise = page.waitForRequest('http://example.com/*'); await page.locator('#fetchBtn').click(); @@ -104,6 +131,7 @@ sentryTest( const headers = request.headers(); // sampling decision is deferred b/c of no active span at the time of request + const navigationTraceId = navigationTraceContext?.trace_id; expect(headers['sentry-trace']).toMatch(new RegExp(`^${navigationTraceId}-[0-9a-f]{16}$`)); expect(headers['baggage']).toEqual( `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${navigationTraceId}`, @@ -129,14 +157,90 @@ sentryTest( await page.locator('#fetchBtn').click(); const [navigationEvent, request] = await Promise.all([navigationEventPromise, requestPromise]); - expect(navigationEvent.contexts?.trace?.op).toBe('navigation'); + const navigationTraceContext = navigationEvent.contexts?.trace; + expect(navigationTraceContext).toMatchObject({ + op: 'navigation', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); + + const headers = request.headers(); + + // sampling decision is propagated from active span sampling decision + const navigationTraceId = navigationTraceContext?.trace_id; + expect(headers['sentry-trace']).toMatch(new RegExp(`^${navigationTraceId}-[0-9a-f]{16}-1$`)); + expect(headers['baggage']).toEqual( + `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${navigationTraceId},sentry-sample_rate=1,sentry-sampled=true`, + ); + }, +); + +sentryTest( + 'outgoing XHR request after navigation has navigation traceId in headers', + async ({ getLocalTestPath, page }) => { + if (shouldSkipTracingTest()) { + sentryTest.skip(); + } + + const url = await getLocalTestPath({ testDir: __dirname }); + + // ensure navigation transaction is finished + await getFirstSentryEnvelopeRequest(page, url); + + const navigationEvent = await getFirstSentryEnvelopeRequest(page, `${url}#foo`); + + const navigationTraceContext = navigationEvent.contexts?.trace; + expect(navigationTraceContext).toMatchObject({ + op: 'navigation', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); + + const xhrPromise = page.waitForRequest('http://example.com/*'); + await page.locator('#xhrBtn').click(); + const request = await xhrPromise; + const headers = request.headers(); + + // sampling decision is deferred b/c of no active span at the time of request + const navigationTraceId = navigationTraceContext?.trace_id; + expect(headers['sentry-trace']).toMatch(new RegExp(`^${navigationTraceId}-[0-9a-f]{16}$`)); + expect(headers['baggage']).toEqual( + `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${navigationTraceId}`, + ); + }, +); + +sentryTest( + 'outgoing XHR request during navigation has navigation traceId in headers', + async ({ getLocalTestPath, page }) => { + if (shouldSkipTracingTest()) { + sentryTest.skip(); + } - const navigationTraceId = navigationEvent.contexts?.trace?.trace_id; - expect(navigationTraceId).toMatch(/^[0-9a-f]{32}$/); + const url = await getLocalTestPath({ testDir: __dirname }); + + // ensure navigation transaction is finished + await getFirstSentryEnvelopeRequest(page, url); + + const navigationEventPromise = getFirstSentryEnvelopeRequest(page); + const requestPromise = page.waitForRequest('http://example.com/*'); + await page.goto(`${url}#foo`); + await page.locator('#xhrBtn').click(); + const [navigationEvent, request] = await Promise.all([navigationEventPromise, requestPromise]); + const navigationTraceContext = navigationEvent.contexts?.trace; + expect(navigationTraceContext).toMatchObject({ + op: 'navigation', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); const headers = request.headers(); // sampling decision is propagated from active span sampling decision + const navigationTraceId = navigationTraceContext?.trace_id; expect(headers['sentry-trace']).toMatch(new RegExp(`^${navigationTraceId}-[0-9a-f]{16}-1$`)); expect(headers['baggage']).toEqual( `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${navigationTraceId},sentry-sample_rate=1,sentry-sampled=true`, diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/template.html b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/template.html index 61372c8605e5..dd44e58fbb4a 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/template.html +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/template.html @@ -9,5 +9,6 @@ + diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/test.ts index 2f872b398d87..d037bac433aa 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/test.ts @@ -157,3 +157,61 @@ sentryTest( expect(headers['baggage']).toBe(META_TAG_BAGGAGE); }, ); + +sentryTest( + 'outgoing XHR request after tag pageload has pageload traceId in headers', + async ({ getLocalTestPath, page }) => { + if (shouldSkipTracingTest()) { + sentryTest.skip(); + } + + const url = await getLocalTestPath({ testDir: __dirname }); + + const pageloadEvent = await getFirstSentryEnvelopeRequest(page, url); + expect(pageloadEvent?.contexts?.trace).toMatchObject({ + op: 'pageload', + trace_id: META_TAG_TRACE_ID, + parent_span_id: META_TAG_PARENT_SPAN_ID, + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + + const requestPromise = page.waitForRequest('http://example.com/*'); + await page.locator('#xhrBtn').click(); + const request = await requestPromise; + const headers = request.headers(); + + // sampling decision is propagated from meta tag's sentry-trace sampled flag + expect(headers['sentry-trace']).toMatch(new RegExp(`^${META_TAG_TRACE_ID}-[0-9a-f]{16}-1$`)); + expect(headers['baggage']).toBe(META_TAG_BAGGAGE); + }, +); + +sentryTest( + 'outgoing XHR request during tag pageload has pageload traceId in headers', + async ({ getLocalTestPath, page }) => { + if (shouldSkipTracingTest()) { + sentryTest.skip(); + } + + const url = await getLocalTestPath({ testDir: __dirname }); + + const pageloadEventPromise = getFirstSentryEnvelopeRequest(page); + const requestPromise = page.waitForRequest('http://example.com/*'); + await page.goto(url); + await page.locator('#xhrBtn').click(); + const [pageloadEvent, request] = await Promise.all([pageloadEventPromise, requestPromise]); + + expect(pageloadEvent?.contexts?.trace).toMatchObject({ + op: 'pageload', + trace_id: META_TAG_TRACE_ID, + parent_span_id: META_TAG_PARENT_SPAN_ID, + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + + const headers = request.headers(); + + // sampling decision is propagated from meta tag's sentry-trace sampled flag + expect(headers['sentry-trace']).toMatch(new RegExp(`^${META_TAG_TRACE_ID}-[0-9a-f]{16}-1$`)); + expect(headers['baggage']).toBe(META_TAG_BAGGAGE); + }, +); diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload/test.ts index 69141a107bbc..333381d28b9a 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload/test.ts @@ -17,17 +17,26 @@ sentryTest( const url = await getLocalTestPath({ testDir: __dirname }); const pageloadEvent = await getFirstSentryEnvelopeRequest(page, url); - const navigationEvent1 = await getFirstSentryEnvelopeRequest(page, `${url}#foo`); - - expect(pageloadEvent.contexts?.trace?.op).toBe('pageload'); - expect(navigationEvent1.contexts?.trace?.op).toBe('navigation'); - - const pageloadTraceId = pageloadEvent.contexts?.trace?.trace_id; - const navigation1TraceId = navigationEvent1.contexts?.trace?.trace_id; - - expect(pageloadTraceId).toMatch(/^[0-9a-f]{32}$/); - expect(navigation1TraceId).toMatch(/^[0-9a-f]{32}$/); - expect(pageloadTraceId).not.toEqual(navigation1TraceId); + const navigationEvent = await getFirstSentryEnvelopeRequest(page, `${url}#foo`); + + const pageloadTraceContext = pageloadEvent.contexts?.trace; + const navigationTraceContext = navigationEvent.contexts?.trace; + + expect(pageloadTraceContext).toMatchObject({ + op: 'pageload', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); + + expect(navigationTraceContext).toMatchObject({ + op: 'navigation', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); + + expect(pageloadTraceContext?.span_id).not.toEqual(navigationTraceContext?.span_id); }, ); @@ -39,18 +48,25 @@ sentryTest('error after pageload has pageload traceId', async ({ getLocalTestPat const url = await getLocalTestPath({ testDir: __dirname }); const pageloadEvent = await getFirstSentryEnvelopeRequest(page, url); - expect(pageloadEvent.contexts?.trace?.op).toBe('pageload'); + const pageloadTraceContext = pageloadEvent.contexts?.trace; - const pageloadTraceId = pageloadEvent.contexts?.trace?.trace_id; - expect(pageloadTraceId).toMatch(/^[0-9a-f]{32}$/); + expect(pageloadTraceContext).toMatchObject({ + op: 'pageload', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); - const [, errorEvent] = await Promise.all([ - page.locator('#errorBtn').click(), - getFirstSentryEnvelopeRequest(page), - ]); + const errorEventPromise = getFirstSentryEnvelopeRequest(page); + await page.locator('#errorBtn').click(); + const errorEvent = await errorEventPromise; - const errorTraceId = errorEvent.contexts?.trace?.trace_id; - expect(errorTraceId).toBe(pageloadTraceId); + const errorTraceContext = errorEvent.contexts?.trace; + + expect(errorTraceContext).toEqual({ + trace_id: pageloadTraceContext?.trace_id, + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); }); sentryTest('error during pageload has pageload traceId', async ({ getLocalTestPath, page }) => { @@ -68,13 +84,20 @@ sentryTest('error during pageload has pageload traceId', async ({ getLocalTestPa const pageloadEvent = events.find(event => event.type === 'transaction'); const errorEvent = events.find(event => !event.type); - expect(pageloadEvent?.contexts?.trace?.op).toBe('pageload'); - - const pageloadTraceId = pageloadEvent?.contexts?.trace?.trace_id; - expect(pageloadTraceId).toMatch(/^[0-9a-f]{32}$/); - - const errorTraceId = errorEvent?.contexts?.trace?.trace_id; - expect(errorTraceId).toBe(pageloadTraceId); + const pageloadTraceContext = pageloadEvent?.contexts?.trace; + expect(pageloadTraceContext).toMatchObject({ + op: 'pageload', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); + + const errorTraceContext = errorEvent?.contexts?.trace; + expect(errorTraceContext).toMatchObject({ + op: 'pageload', + trace_id: pageloadTraceContext?.trace_id, + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); }); sentryTest( @@ -87,10 +110,14 @@ sentryTest( const url = await getLocalTestPath({ testDir: __dirname }); const pageloadEvent = await getFirstSentryEnvelopeRequest(page, url); - expect(pageloadEvent.contexts?.trace?.op).toBe('pageload'); + const pageloadTraceContext = pageloadEvent.contexts?.trace; - const pageloadTraceId = pageloadEvent.contexts?.trace?.trace_id; - expect(pageloadTraceId).toMatch(/^[0-9a-f]{32}$/); + expect(pageloadTraceContext).toMatchObject({ + op: 'pageload', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); const requestPromise = page.waitForRequest('http://example.com/*'); await page.locator('#fetchBtn').click(); @@ -98,6 +125,7 @@ sentryTest( const headers = request.headers(); // sampling decision is deferred b/c of no active span at the time of request + const pageloadTraceId = pageloadTraceContext?.trace_id; expect(headers['sentry-trace']).toMatch(new RegExp(`^${pageloadTraceId}-[0-9a-f]{16}$`)); expect(headers['baggage']).toEqual( `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${pageloadTraceId}`, @@ -120,17 +148,88 @@ sentryTest( await page.locator('#fetchBtn').click(); const [pageloadEvent, request] = await Promise.all([pageloadEventPromise, requestPromise]); - expect(pageloadEvent.contexts?.trace?.op).toBe('pageload'); + const pageloadTraceContext = pageloadEvent.contexts?.trace; + expect(pageloadTraceContext).toMatchObject({ + op: 'pageload', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); + + const headers = request.headers(); + + // sampling decision is propagated from active span sampling decision + const pageloadTraceId = pageloadTraceContext?.trace_id; + expect(headers['sentry-trace']).toMatch(new RegExp(`^${pageloadTraceId}-[0-9a-f]{16}-1$`)); + expect(headers['baggage']).toEqual( + `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${pageloadTraceId},sentry-sample_rate=1,sentry-sampled=true`, + ); + }, +); + +sentryTest( + 'outgoing XHR request after pageload has pageload traceId in headers', + async ({ getLocalTestPath, page }) => { + if (shouldSkipTracingTest()) { + sentryTest.skip(); + } + + const url = await getLocalTestPath({ testDir: __dirname }); + + const pageloadEvent = await getFirstSentryEnvelopeRequest(page, url); + const pageloadTraceContext = pageloadEvent.contexts?.trace; + + expect(pageloadTraceContext).toMatchObject({ + op: 'pageload', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); + + const requestPromise = page.waitForRequest('http://example.com/*'); + await page.locator('#xhrBtn').click(); + const request = await requestPromise; + const headers = request.headers(); + + // sampling decision is deferred b/c of no active span at the time of request + const pageloadTraceId = pageloadTraceContext?.trace_id; + expect(headers['sentry-trace']).toMatch(new RegExp(`^${pageloadTraceId}-[0-9a-f]{16}$`)); + expect(headers['baggage']).toEqual( + `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${pageloadTraceId}`, + ); + }, +); + +sentryTest( + 'outgoing XHR request during pageload has pageload traceId in headers', + async ({ getLocalTestPath, page }) => { + if (shouldSkipTracingTest()) { + sentryTest.skip(); + } + + const url = await getLocalTestPath({ testDir: __dirname }); + + const pageloadEventPromise = getFirstSentryEnvelopeRequest(page); + const requestPromise = page.waitForRequest('http://example.com/*'); + await page.goto(url); + await page.locator('#xhrBtn').click(); + const [pageloadEvent, request] = await Promise.all([pageloadEventPromise, requestPromise]); - const navigationTraceId = pageloadEvent.contexts?.trace?.trace_id; - expect(navigationTraceId).toMatch(/^[0-9a-f]{32}$/); + const pageloadTraceContext = pageloadEvent.contexts?.trace; + expect(pageloadTraceContext).toMatchObject({ + op: 'pageload', + trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + }); + expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); const headers = request.headers(); // sampling decision is propagated from active span sampling decision - expect(headers['sentry-trace']).toMatch(new RegExp(`^${navigationTraceId}-[0-9a-f]{16}-1$`)); + const pageloadTraceId = pageloadTraceContext?.trace_id; + expect(headers['sentry-trace']).toMatch(new RegExp(`^${pageloadTraceId}-[0-9a-f]{16}-1$`)); expect(headers['baggage']).toEqual( - `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${navigationTraceId},sentry-sample_rate=1,sentry-sampled=true`, + `sentry-environment=production,sentry-public_key=public,sentry-trace_id=${pageloadTraceId},sentry-sample_rate=1,sentry-sampled=true`, ); }, ); 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 38e475a5f216..71e03b3c8a7c 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 @@ -7,3 +7,10 @@ const fetchBtn = document.getElementById('fetchBtn'); fetchBtn.addEventListener('click', async () => { await fetch('http://example.com'); }); + +const xhrBtn = document.getElementById('xhrBtn'); +xhrBtn.addEventListener('click', () => { + const xhr = new XMLHttpRequest(); + xhr.open('GET', 'http://example.com'); + xhr.send(); +}); diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/template.html b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/template.html index 218c42031ccf..a3c17f442605 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/template.html +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/template.html @@ -6,5 +6,6 @@ +