Skip to content

Commit 3d012c1

Browse files
✅ [RUM-10144] add an e2e test
1 parent a3f665b commit 3d012c1

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/e2e/scenario/rum/init.scenario.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,23 @@ test.describe('API calls and events around init', () => {
183183
const viewContext = await page.evaluate(() => window.DD_RUM?.getViewContext())
184184
expect(viewContext).toEqual({ foo: 'bar' })
185185
})
186+
187+
createTest('context set right after init should be applied to events generated during init')
188+
.withRum()
189+
.withRumSlim()
190+
.withRumInit((configuration) => {
191+
window.DD_RUM!.init(configuration)
192+
window.DD_RUM!.setViewContext({ viewContext: true })
193+
window.DD_RUM!.setGlobalContext({ globalContext: true })
194+
window.DD_RUM!.setUser({ id: 'user-id' })
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({ id: 'user-id' })
202+
})
186203
})
187204

188205
test.describe('beforeSend', () => {

0 commit comments

Comments
 (0)