File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,22 @@ test.describe('API calls and events around init', () => {
183
183
const viewContext = await page . evaluate ( ( ) => window . DD_RUM ?. getViewContext ( ) )
184
184
expect ( viewContext ) . toEqual ( { foo : 'bar' } )
185
185
} )
186
+
187
+ createTest ( 'context set right after init should be applied to events generated during init' )
188
+ . withRum ( )
189
+ . withRumInit ( ( configuration ) => {
190
+ window . DD_RUM ! . init ( configuration )
191
+ window . DD_RUM ! . setViewContext ( { viewContext : true } )
192
+ window . DD_RUM ! . setGlobalContext ( { globalContext : true } )
193
+ window . DD_RUM ! . setUser ( { id : 'user-id' } )
194
+ } )
195
+ . run ( async ( { intakeRegistry, flushEvents } ) => {
196
+ await flushEvents ( )
197
+
198
+ const initialView = intakeRegistry . rumViewEvents [ 0 ]
199
+ expect ( initialView . context ) . toEqual ( { viewContext : true , globalContext : true } )
200
+ expect ( initialView . usr ) . toEqual ( expect . objectContaining ( { id : 'user-id' } ) )
201
+ } )
186
202
} )
187
203
188
204
test . describe ( 'beforeSend' , ( ) => {
You can’t perform that action at this time.
0 commit comments