Skip to content

Commit 67b062e

Browse files
committed
[PANA-6072] add e2e test + fix types
1 parent d39f0c5 commit 67b062e

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

packages/core/src/domain/telemetry/telemetryEvent.types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,11 @@ export type TelemetryConfigurationEvent = CommonTelemetryProperties & {
476476
*/
477477
beta_encode_cookie_options?: boolean
478478
[k: string]: unknown
479+
480+
/**
481+
* Whether the allowed HTML attributes list is used
482+
*/
483+
use_allowed_html_attributes?: boolean
479484
}
480485
[k: string]: unknown
481486
}

test/e2e/scenario/rum/actions.scenario.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,3 +781,46 @@ test.describe('custom actions with startAction/stopAction', () => {
781781
expect(relatedFetch).toBeDefined()
782782
})
783783
})
784+
785+
test.describe('action collection with composed path selector', () => {
786+
createTest('should not return a composed_path_selector if flag is disabled')
787+
.withRum({ trackUserInteractions: true })
788+
.withBody(html`
789+
<div id="container">
790+
<button>Click</button>
791+
<button id="my-button" data-test-allowed="test-btn" data-random="secret" class="foo bar baz">Click me</button>
792+
</div>
793+
`)
794+
.run(async ({ intakeRegistry, flushEvents, page }) => {
795+
const button = page.locator('#my-button')
796+
await button.click()
797+
await flushEvents()
798+
799+
const actionEvents = intakeRegistry.rumActionEvents
800+
expect(actionEvents).toHaveLength(1)
801+
expect(actionEvents[0]._dd.action?.target?.composed_path_selector).toBeUndefined()
802+
})
803+
createTest('should return a composed_path_selector if flag is enabled')
804+
.withRum({
805+
trackUserInteractions: true,
806+
enableExperimentalFeatures: ['composed_path_selector'],
807+
allowedHtmlAttributes: ['data-test-allowed'],
808+
})
809+
.withBody(html`
810+
<div id="container">
811+
<button>Click</button>
812+
<button id="my-button" data-test-allowed="test-btn" data-random="secret" class="foo bar baz">Click me</button>
813+
</div>
814+
`)
815+
.run(async ({ intakeRegistry, flushEvents, page }) => {
816+
const button = page.locator('#my-button')
817+
await button.click()
818+
await flushEvents()
819+
820+
const actionEvents = intakeRegistry.rumActionEvents
821+
expect(actionEvents).toHaveLength(1)
822+
expect(actionEvents[0]._dd.action?.target?.composed_path_selector).toBe(
823+
'BUTTON#my-button[data-test-allowed="test-btn"].bar.baz.foo:nth-child(2):nth-of-type(2);DIV#container;'
824+
)
825+
})
826+
})

0 commit comments

Comments
 (0)