Skip to content

Commit f7f0763

Browse files
committed
add another test case
1 parent 5aa7e87 commit f7f0763

File tree

2 files changed

+40
-1
lines changed
  • dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans-domexception-details

2 files changed

+40
-1
lines changed

dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans-domexception-details/init.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,22 @@ performance.measure('normal-measure', {
3737
end: performance.now() + 50,
3838
detail: 'this-should-work',
3939
});
40+
41+
// Create a measure with complex detail object
42+
performance.measure('complex-detail-measure', {
43+
start: performance.now(),
44+
end: performance.now() + 25,
45+
detail: {
46+
nested: {
47+
array: [1, 2, 3],
48+
object: {
49+
key: 'value',
50+
},
51+
},
52+
metadata: {
53+
type: 'test',
54+
version: '1.0',
55+
tags: ['complex', 'nested', 'object'],
56+
},
57+
},
58+
});

dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans-domexception-details/test.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ sentryTest(
1717

1818
// Find all measure spans
1919
const measureSpans = eventData.spans?.filter(({ op }) => op === 'measure');
20-
expect(measureSpans?.length).toBe(2); // Both measures should create spans
20+
expect(measureSpans?.length).toBe(3); // All three measures should create spans
2121

2222
// Test 1: Verify the restricted-test-measure span exists but has no detail
2323
const restrictedMeasure = measureSpans?.find(span => span.description === 'restricted-test-measure');
@@ -40,5 +40,25 @@ sentryTest(
4040
'sentry.op': 'measure',
4141
'sentry.origin': 'auto.resource.browser.metrics',
4242
});
43+
44+
// Test 3: Verify the complex detail object is captured correctly
45+
const complexMeasure = measureSpans?.find(span => span.description === 'complex-detail-measure');
46+
expect(complexMeasure).toBeDefined();
47+
expect(complexMeasure?.data).toMatchObject({
48+
'sentry.op': 'measure',
49+
'sentry.origin': 'auto.resource.browser.metrics',
50+
// The entire nested object is stringified as a single value
51+
'sentry.browser.measure.detail.nested': JSON.stringify({
52+
array: [1, 2, 3],
53+
object: {
54+
key: 'value',
55+
},
56+
}),
57+
'sentry.browser.measure.detail.metadata': JSON.stringify({
58+
type: 'test',
59+
version: '1.0',
60+
tags: ['complex', 'nested', 'object'],
61+
}),
62+
});
4363
},
4464
);

0 commit comments

Comments
 (0)