Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷‍♀️ [RUM 6237] Add e2e test for view context API init #3025

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/e2e/scenario/rum/init.scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,23 @@ describe('API calls and events around init', () => {
{ name: 'after manual view', viewId: initialView.view.id, viewName: 'after manual view' }
)
})

createTest('should be able to set view context')
.withRum({ enableExperimentalFeatures: ['view_specific_context'] })
.withRumSlim()
.withRumInit((configuration) => {
window.DD_RUM!.init(configuration)
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
;(window.DD_RUM as any).setViewContext({ foo: 'bar' })
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
;(window.DD_RUM as any).setViewContextProperty('bar', 'foo')
})
.run(async ({ intakeRegistry }) => {
await flushEvents()

const initialView = intakeRegistry.rumViewEvents[0]
expect(initialView.context).toEqual(jasmine.objectContaining({ foo: 'bar', bar: 'foo' }))
})
})

describe('beforeSend', () => {
Expand Down