@@ -37,20 +37,25 @@ sentryTest('should capture console messages in replay', async ({ getLocalTestPat
37
37
38
38
await page . click ( '[data-log]' ) ;
39
39
40
+ // Sometimes this doesn't seem to trigger, so we trigger it twice to be sure...
41
+ await page . click ( '[data-log]' ) ;
42
+
40
43
await forceFlushReplay ( ) ;
41
44
42
45
const { breadcrumbs } = getCustomRecordingEvents ( await reqPromise1 ) ;
43
46
44
- expect ( breadcrumbs . filter ( breadcrumb => breadcrumb . category === 'console' ) ) . toEqual ( [
45
- {
46
- timestamp : expect . any ( Number ) ,
47
- type : 'default' ,
48
- category : 'console' ,
49
- data : { arguments : [ 'Test log' , '[HTMLElement: HTMLBodyElement]' ] , logger : 'console' } ,
50
- level : 'log' ,
51
- message : 'Test log [object HTMLBodyElement]' ,
52
- } ,
53
- ] ) ;
47
+ expect ( breadcrumbs . filter ( breadcrumb => breadcrumb . category === 'console' ) ) . toEqual (
48
+ expect . arrayContaining ( [
49
+ {
50
+ timestamp : expect . any ( Number ) ,
51
+ type : 'default' ,
52
+ category : 'console' ,
53
+ data : { arguments : [ 'Test log' , '[HTMLElement: HTMLBodyElement]' ] , logger : 'console' } ,
54
+ level : 'log' ,
55
+ message : 'Test log [object HTMLBodyElement]' ,
56
+ } ,
57
+ ] ) ,
58
+ ) ;
54
59
} ) ;
55
60
56
61
sentryTest ( 'should capture very large console logs' , async ( { getLocalTestPath, page, forceFlushReplay } ) => {
@@ -87,40 +92,45 @@ sentryTest('should capture very large console logs', async ({ getLocalTestPath,
87
92
88
93
await page . click ( '[data-log-large]' ) ;
89
94
95
+ // Sometimes this doesn't seem to trigger, so we trigger it twice to be sure...
96
+ await page . click ( '[data-log-large]' ) ;
97
+
90
98
await forceFlushReplay ( ) ;
91
99
92
100
const { breadcrumbs } = getCustomRecordingEvents ( await reqPromise1 ) ;
93
101
94
- expect ( breadcrumbs . filter ( breadcrumb => breadcrumb . category === 'console' ) ) . toEqual ( [
95
- {
96
- timestamp : expect . any ( Number ) ,
97
- type : 'default' ,
98
- category : 'console' ,
99
- data : {
100
- arguments : [
101
- expect . objectContaining ( {
102
- 'item-0' : {
103
- aa : expect . objectContaining ( {
104
- 'item-0' : {
105
- aa : expect . any ( Object ) ,
106
- bb : expect . any ( String ) ,
107
- cc : expect . any ( String ) ,
108
- dd : expect . any ( String ) ,
109
- } ,
110
- } ) ,
111
- bb : expect . any ( String ) ,
112
- cc : expect . any ( String ) ,
113
- dd : expect . any ( String ) ,
114
- } ,
115
- } ) ,
116
- ] ,
117
- logger : 'console' ,
118
- _meta : {
119
- warnings : [ 'CONSOLE_ARG_TRUNCATED' ] ,
102
+ expect ( breadcrumbs . filter ( breadcrumb => breadcrumb . category === 'console' ) ) . toEqual (
103
+ expect . arrayContaining ( [
104
+ {
105
+ timestamp : expect . any ( Number ) ,
106
+ type : 'default' ,
107
+ category : 'console' ,
108
+ data : {
109
+ arguments : [
110
+ expect . objectContaining ( {
111
+ 'item-0' : {
112
+ aa : expect . objectContaining ( {
113
+ 'item-0' : {
114
+ aa : expect . any ( Object ) ,
115
+ bb : expect . any ( String ) ,
116
+ cc : expect . any ( String ) ,
117
+ dd : expect . any ( String ) ,
118
+ } ,
119
+ } ) ,
120
+ bb : expect . any ( String ) ,
121
+ cc : expect . any ( String ) ,
122
+ dd : expect . any ( String ) ,
123
+ } ,
124
+ } ) ,
125
+ ] ,
126
+ logger : 'console' ,
127
+ _meta : {
128
+ warnings : [ 'CONSOLE_ARG_TRUNCATED' ] ,
129
+ } ,
120
130
} ,
131
+ level : 'log' ,
132
+ message : '[object Object]' ,
121
133
} ,
122
- level : 'log' ,
123
- message : '[object Object]' ,
124
- } ,
125
- ] ) ;
134
+ ] ) ,
135
+ ) ;
126
136
} ) ;
0 commit comments