@@ -17,9 +17,11 @@ const baseSalesforceRumConfiguration = {
1717 trackUserInteractions : true ,
1818}
1919
20- const salesforceApps : SalesforceApp [ ] = [ 'lwc' , 'experience-cloud' ]
20+ const salesforceApps : SalesforceApp [ ] = [ 'lwc' , 'experience-cloud' , 'experience-cloud-headmarkup' ]
2121
2222for ( const app of salesforceApps ) {
23+ const canCallRumFromComponents = app !== 'experience-cloud-headmarkup'
24+
2325 createTest ( `salesforce ${ app } views` )
2426 . withRum ( baseSalesforceRumConfiguration )
2527 . withSalesforceApp ( app )
@@ -59,19 +61,23 @@ for (const app of salesforceApps) {
5961 }
6062 } )
6163
62- createTest ( `salesforce ${ app } long tasks and vitals` )
64+ createTest ( `salesforce ${ app } long tasks${ canCallRumFromComponents ? ' and vitals' : '' } ` )
6365 . withRum ( baseSalesforceRumConfiguration )
6466 . withSalesforceApp ( app )
6567 . run ( async ( { page, intakeRegistry, flushEvents } ) => {
6668 await expect ( page . getByTestId ( 'home-custom-actions' ) ) . toBeVisible ( { timeout : 30000 } )
6769
6870 await page . getByTestId ( 'long-task' ) . click ( )
69- await page . getByRole ( 'button' , { name : 'Add Duration Vital' } ) . click ( )
71+ if ( canCallRumFromComponents ) {
72+ await page . getByRole ( 'button' , { name : 'Add Duration Vital' } ) . click ( )
73+ }
7074
7175 await flushEvents ( )
7276
7377 expect ( intakeRegistry . rumLongTaskEvents . length ) . toBeGreaterThanOrEqual ( 1 )
74- expect ( intakeRegistry . rumVitalEvents . length ) . toBeGreaterThanOrEqual ( 1 )
78+ if ( canCallRumFromComponents ) {
79+ expect ( intakeRegistry . rumVitalEvents . length ) . toBeGreaterThanOrEqual ( 1 )
80+ }
7581 } )
7682
7783 createTest ( `salesforce ${ app } actions` )
@@ -87,10 +93,12 @@ for (const app of salesforceApps) {
8793 const actionTypes = new Set ( intakeRegistry . rumActionEvents . map ( ( e ) => e . action . type ) )
8894 expect ( actionTypes . has ( 'click' ) ) . toBe ( true )
8995
90- const customAction = intakeRegistry . rumActionEvents . find (
91- ( e ) => e . action . type === 'custom' && e . action . target ?. name ?. includes ( 'custom action 1' ) === true
92- )
93- expect ( customAction ) . toBeDefined ( )
96+ if ( canCallRumFromComponents ) {
97+ const customAction = intakeRegistry . rumActionEvents . find (
98+ ( e ) => e . action . type === 'custom' && e . action . target ?. name ?. includes ( 'custom action 1' ) === true
99+ )
100+ expect ( customAction ) . toBeDefined ( )
101+ }
94102 } )
95103
96104 createTest ( `salesforce ${ app } errors` )
@@ -99,7 +107,9 @@ for (const app of salesforceApps) {
99107 . run ( async ( { page, intakeRegistry, flushEvents, withBrowserLogs } ) => {
100108 await expect ( page . getByTestId ( 'home-custom-actions' ) ) . toBeVisible ( { timeout : 30000 } )
101109
102- await page . getByTestId ( 'custom-error-1' ) . click ( )
110+ if ( canCallRumFromComponents ) {
111+ await page . getByTestId ( 'custom-error-1' ) . click ( )
112+ }
103113 await page . getByTestId ( 'runtime-error' ) . click ( )
104114 await page . evaluate ( ( ) => window . console . error ( 'salesforce console error test' ) )
105115
@@ -119,9 +129,11 @@ for (const app of salesforceApps) {
119129 )
120130 expect ( errorEvent ) . toBeDefined ( )
121131
122- const customError = intakeRegistry . rumErrorEvents . find (
123- ( e ) => e . error . source === 'custom' && e . error . message ?. includes ( 'custom error 1' ) === true
124- )
125- expect ( customError ) . toBeDefined ( )
132+ if ( canCallRumFromComponents ) {
133+ const customError = intakeRegistry . rumErrorEvents . find (
134+ ( e ) => e . error . source === 'custom' && e . error . message ?. includes ( 'custom error 1' ) === true
135+ )
136+ expect ( customError ) . toBeDefined ( )
137+ }
126138 } )
127139}
0 commit comments