Skip to content

Commit

Permalink
Update tests, limit to chrome + FF, substitute empty state for version
Browse files Browse the repository at this point in the history
  • Loading branch information
k-fish committed Jun 27, 2023
1 parent 12da836 commit 6312fc1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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}`,
Expand All @@ -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),
}),
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6312fc1

Please sign in to comment.