File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,24 @@ 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
+ window . DD_RUM ! . addFeatureFlagEvaluation ( 'foo' , true )
195
+ } )
196
+ . run ( async ( { intakeRegistry, flushEvents } ) => {
197
+ await flushEvents ( )
198
+
199
+ const initialView = intakeRegistry . rumViewEvents [ 0 ]
200
+ expect ( initialView . context ) . toEqual ( { viewContext : true , globalContext : true } )
201
+ expect ( initialView . usr ) . toEqual ( expect . objectContaining ( { id : 'user-id' } ) )
202
+ expect ( initialView . feature_flags ) . toEqual ( { foo : true } )
203
+ } )
186
204
} )
187
205
188
206
test . describe ( 'beforeSend' , ( ) => {
You can’t perform that action at this time.
0 commit comments