11import { expect } from '@playwright/test' ;
2- import type { OtelLogEnvelope } from '@sentry/core' ;
2+ import type { LogEnvelope } from '@sentry/core' ;
33
44import { sentryTest } from '../../../../utils/fixtures' ;
55import { getFirstSentryEnvelopeRequest , properFullEnvelopeRequestParser } from '../../../../utils/helpers' ;
@@ -13,237 +13,88 @@ sentryTest('should capture console object calls', async ({ getLocalTestUrl, page
1313
1414 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
1515
16- const event = await getFirstSentryEnvelopeRequest < OtelLogEnvelope > ( page , url , properFullEnvelopeRequestParser ) ;
16+ const event = await getFirstSentryEnvelopeRequest < LogEnvelope > ( page , url , properFullEnvelopeRequestParser ) ;
1717 const envelopeItems = event [ 1 ] ;
1818
1919 expect ( envelopeItems [ 0 ] ) . toEqual ( [
2020 {
21- type : 'otel_log' ,
21+ type : 'log' ,
22+ item_count : 7 ,
23+ content_type : 'application/vnd.sentry.items.log+json' ,
2224 } ,
2325 {
24- severityText : 'trace' ,
25- body : { stringValue : 'console.trace 123 false' } ,
26- attributes : [
26+ items : [
2727 {
28- key : 'sentry.origin' ,
29- value : {
30- stringValue : 'auto.console.logging' ,
28+ timestamp : expect . any ( Number ) ,
29+ level : 'trace' ,
30+ body : 'console.trace 123 false' ,
31+ attributes : {
32+ 'sentry.origin' : { value : 'auto.console.logging' , type : 'string' } ,
33+ 'sentry.sdk.name' : { value : 'sentry.javascript.browser' , type : 'string' } ,
34+ 'sentry.sdk.version' : { value : expect . any ( String ) , type : 'string' } ,
3135 } ,
3236 } ,
3337 {
34- key : 'sentry.sdk.name' ,
35- value : {
36- stringValue : 'sentry.javascript.browser' ,
38+ timestamp : expect . any ( Number ) ,
39+ level : 'debug' ,
40+ body : 'console.debug 123 false' ,
41+ attributes : {
42+ 'sentry.origin' : { value : 'auto.console.logging' , type : 'string' } ,
43+ 'sentry.sdk.name' : { value : 'sentry.javascript.browser' , type : 'string' } ,
44+ 'sentry.sdk.version' : { value : expect . any ( String ) , type : 'string' } ,
3745 } ,
3846 } ,
3947 {
40- key : 'sentry.sdk.version' ,
41- value : {
42- stringValue : expect . any ( String ) ,
43- } ,
44- } ,
45- ] ,
46- timeUnixNano : expect . any ( String ) ,
47- traceId : expect . any ( String ) ,
48- severityNumber : 1 ,
49- } ,
50- ] ) ;
51-
52- expect ( envelopeItems [ 1 ] ) . toEqual ( [
53- {
54- type : 'otel_log' ,
55- } ,
56- {
57- severityText : 'debug' ,
58- body : { stringValue : 'console.debug 123 false' } ,
59- attributes : [
60- {
61- key : 'sentry.origin' ,
62- value : {
63- stringValue : 'auto.console.logging' ,
64- } ,
65- } ,
66- {
67- key : 'sentry.sdk.name' ,
68- value : {
69- stringValue : 'sentry.javascript.browser' ,
70- } ,
71- } ,
72- {
73- key : 'sentry.sdk.version' ,
74- value : {
75- stringValue : expect . any ( String ) ,
76- } ,
77- } ,
78- ] ,
79- timeUnixNano : expect . any ( String ) ,
80- traceId : expect . any ( String ) ,
81- severityNumber : 5 ,
82- } ,
83- ] ) ;
84-
85- expect ( envelopeItems [ 2 ] ) . toEqual ( [
86- {
87- type : 'otel_log' ,
88- } ,
89- {
90- severityText : 'info' ,
91- body : { stringValue : 'console.log 123 false' } ,
92- attributes : [
93- {
94- key : 'sentry.origin' ,
95- value : {
96- stringValue : 'auto.console.logging' ,
97- } ,
98- } ,
99- {
100- key : 'sentry.sdk.name' ,
101- value : {
102- stringValue : 'sentry.javascript.browser' ,
103- } ,
104- } ,
105- {
106- key : 'sentry.sdk.version' ,
107- value : {
108- stringValue : expect . any ( String ) ,
109- } ,
110- } ,
111- ] ,
112- timeUnixNano : expect . any ( String ) ,
113- traceId : expect . any ( String ) ,
114- severityNumber : 10 ,
115- } ,
116- ] ) ;
117-
118- expect ( envelopeItems [ 3 ] ) . toEqual ( [
119- {
120- type : 'otel_log' ,
121- } ,
122- {
123- severityText : 'info' ,
124- body : { stringValue : 'console.info 123 false' } ,
125- attributes : [
126- {
127- key : 'sentry.origin' ,
128- value : {
129- stringValue : 'auto.console.logging' ,
48+ timestamp : expect . any ( Number ) ,
49+ level : 'info' ,
50+ body : 'console.log 123 false' ,
51+ attributes : {
52+ 'sentry.origin' : { value : 'auto.console.logging' , type : 'string' } ,
53+ 'sentry.sdk.name' : { value : 'sentry.javascript.browser' , type : 'string' } ,
54+ 'sentry.sdk.version' : { value : expect . any ( String ) , type : 'string' } ,
13055 } ,
13156 } ,
13257 {
133- key : 'sentry.sdk.name' ,
134- value : {
135- stringValue : 'sentry.javascript.browser' ,
58+ timestamp : expect . any ( Number ) ,
59+ level : 'info' ,
60+ body : 'console.info 123 false' ,
61+ attributes : {
62+ 'sentry.origin' : { value : 'auto.console.logging' , type : 'string' } ,
63+ 'sentry.sdk.name' : { value : 'sentry.javascript.browser' , type : 'string' } ,
64+ 'sentry.sdk.version' : { value : expect . any ( String ) , type : 'string' } ,
13665 } ,
13766 } ,
13867 {
139- key : 'sentry.sdk.version' ,
140- value : {
141- stringValue : expect . any ( String ) ,
142- } ,
143- } ,
144- ] ,
145- timeUnixNano : expect . any ( String ) ,
146- traceId : expect . any ( String ) ,
147- severityNumber : 9 ,
148- } ,
149- ] ) ;
150-
151- expect ( envelopeItems [ 4 ] ) . toEqual ( [
152- {
153- type : 'otel_log' ,
154- } ,
155- {
156- severityText : 'warn' ,
157- body : { stringValue : 'console.warn 123 false' } ,
158- attributes : [
159- {
160- key : 'sentry.origin' ,
161- value : {
162- stringValue : 'auto.console.logging' ,
163- } ,
164- } ,
165- {
166- key : 'sentry.sdk.name' ,
167- value : {
168- stringValue : 'sentry.javascript.browser' ,
169- } ,
170- } ,
171- {
172- key : 'sentry.sdk.version' ,
173- value : {
174- stringValue : expect . any ( String ) ,
175- } ,
176- } ,
177- ] ,
178- timeUnixNano : expect . any ( String ) ,
179- traceId : expect . any ( String ) ,
180- severityNumber : 13 ,
181- } ,
182- ] ) ;
183-
184- expect ( envelopeItems [ 5 ] ) . toEqual ( [
185- {
186- type : 'otel_log' ,
187- } ,
188- {
189- severityText : 'error' ,
190- body : { stringValue : 'console.error 123 false' } ,
191- attributes : [
192- {
193- key : 'sentry.origin' ,
194- value : {
195- stringValue : 'auto.console.logging' ,
196- } ,
197- } ,
198- {
199- key : 'sentry.sdk.name' ,
200- value : {
201- stringValue : 'sentry.javascript.browser' ,
202- } ,
203- } ,
204- {
205- key : 'sentry.sdk.version' ,
206- value : {
207- stringValue : expect . any ( String ) ,
208- } ,
209- } ,
210- ] ,
211- timeUnixNano : expect . any ( String ) ,
212- traceId : expect . any ( String ) ,
213- severityNumber : 17 ,
214- } ,
215- ] ) ;
216-
217- expect ( envelopeItems [ 6 ] ) . toEqual ( [
218- {
219- type : 'otel_log' ,
220- } ,
221- {
222- severityText : 'error' ,
223- body : { stringValue : 'Assertion failed: console.assert 123 false' } ,
224- attributes : [
225- {
226- key : 'sentry.origin' ,
227- value : {
228- stringValue : 'auto.console.logging' ,
68+ timestamp : expect . any ( Number ) ,
69+ level : 'warn' ,
70+ body : 'console.warn 123 false' ,
71+ attributes : {
72+ 'sentry.origin' : { value : 'auto.console.logging' , type : 'string' } ,
73+ 'sentry.sdk.name' : { value : 'sentry.javascript.browser' , type : 'string' } ,
74+ 'sentry.sdk.version' : { value : expect . any ( String ) , type : 'string' } ,
22975 } ,
23076 } ,
23177 {
232- key : 'sentry.sdk.name' ,
233- value : {
234- stringValue : 'sentry.javascript.browser' ,
78+ timestamp : expect . any ( Number ) ,
79+ level : 'error' ,
80+ body : 'console.error 123 false' ,
81+ attributes : {
82+ 'sentry.origin' : { value : 'auto.console.logging' , type : 'string' } ,
83+ 'sentry.sdk.name' : { value : 'sentry.javascript.browser' , type : 'string' } ,
84+ 'sentry.sdk.version' : { value : expect . any ( String ) , type : 'string' } ,
23585 } ,
23686 } ,
23787 {
238- key : 'sentry.sdk.version' ,
239- value : {
240- stringValue : expect . any ( String ) ,
88+ timestamp : expect . any ( Number ) ,
89+ level : 'error' ,
90+ body : 'Assertion failed: console.assert 123 false' ,
91+ attributes : {
92+ 'sentry.origin' : { value : 'auto.console.logging' , type : 'string' } ,
93+ 'sentry.sdk.name' : { value : 'sentry.javascript.browser' , type : 'string' } ,
94+ 'sentry.sdk.version' : { value : expect . any ( String ) , type : 'string' } ,
24195 } ,
24296 } ,
24397 ] ,
244- timeUnixNano : expect . any ( String ) ,
245- traceId : expect . any ( String ) ,
246- severityNumber : 17 ,
24798 } ,
24899 ] ) ;
249100} ) ;
0 commit comments