From 6312fc19ee9beeb62fa7508f93d22d95eef7d92e Mon Sep 17 00:00:00 2001 From: k-fish Date: Tue, 27 Jun 2023 17:33:29 -0400 Subject: [PATCH] Update tests, limit to chrome + FF, substitute empty state for version --- .../tracing/browsertracing/http-timings/test.ts | 15 +++++++++------ packages/tracing-internal/src/browser/request.ts | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/browser-integration-tests/suites/tracing/browsertracing/http-timings/test.ts b/packages/browser-integration-tests/suites/tracing/browsertracing/http-timings/test.ts index 1ef777b9f4fe..c4b5d3e92e62 100644 --- a/packages/browser-integration-tests/suites/tracing/browsertracing/http-timings/test.ts +++ b/packages/browser-integration-tests/suites/tracing/browsertracing/http-timings/test.ts @@ -4,11 +4,13 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should create fetch spans with http timing', async ({ getLocalTestPath, page }) => { - if (shouldSkipTracingTest()) { +sentryTest('should create fetch spans with http timing', async ({ browserName, getLocalTestPath, page }) => { + const supportedBrowsers = ['chromium', 'firefox']; + + if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { sentryTest.skip(); } - await page.route('https://example.com/*', async route => { + await page.route('http://example.com/*', async route => { const request = route.request(); const postData = await request.postDataJSON(); @@ -28,6 +30,7 @@ sentryTest('should create fetch spans with http timing', async ({ getLocalTestPa expect(requestSpans).toHaveLength(3); + await page.pause(); requestSpans?.forEach((span, index) => expect(span).toMatchObject({ description: `GET http://example.com/${index}`, @@ -37,9 +40,9 @@ sentryTest('should create fetch spans with http timing', async ({ getLocalTestPa timestamp: expect.any(Number), trace_id: tracingEvent.contexts?.trace?.trace_id, data: expect.objectContaining({ - 'http.client.connect_start': expect.any(Number), - 'http.client.request_start': expect.any(Number), - 'http.client.response_start': expect.any(Number), + 'http.request.connect_start': expect.any(Number), + 'http.request.request_start': expect.any(Number), + 'http.request.response_start': expect.any(Number), 'network.protocol.version': expect.any(String), }), }), diff --git a/packages/tracing-internal/src/browser/request.ts b/packages/tracing-internal/src/browser/request.ts index cce3791698b0..2c08918ed548 100644 --- a/packages/tracing-internal/src/browser/request.ts +++ b/packages/tracing-internal/src/browser/request.ts @@ -182,7 +182,7 @@ function addHTTPTimings(span: Span): void { } function resourceTimingEntryToSpanData(resourceTiming: PerformanceResourceTiming): [string, string | number][] { - const version = resourceTiming.nextHopProtocol.split('/')[1]; + const version = resourceTiming.nextHopProtocol.split('/')[1] || 'none'; const timingSpanData: [string, string | number][] = []; if (version) {