Skip to content

Commit 29e2920

Browse files
✅ Add Salesforce LWC Test Application. (#4757)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 945420e commit 29e2920

26 files changed

Lines changed: 863 additions & 0 deletions

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ yarn.lock
1212
/generated-docs
1313
/developer-extension/.output
1414
/developer-extension/.wxt
15+
/test/apps/sf-lwc-app/*
1516

1617
# Auto-generated by API Extractor — do not format
1718
/packages/js-core/api

eslint.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default defineConfig(
5252
'test/apps/vue-router-v4-app',
5353
'test/apps/nuxt-app',
5454
'test/apps/nuxt-vue-router-v4-app',
55+
'test/apps/sf-lwc-app',
5556
'sandbox',
5657
'coverage',
5758
'.yarn',

test/apps/sf-lwc-app/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.sf
2+
.sfdx
3+
/force-app/main/default/staticresources/datadog_rum_slim.js

test/apps/sf-lwc-app/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SF LWC App
2+
3+
Salesforce DX project used to exercise browser-sdk behavior in a real Lightning Web Components runtime.
4+
5+
This app is Lightning-only.
6+
7+
## What It Contains
8+
9+
- A Lightning app named `SF LWC App`
10+
- A trimmed Home page with Datadog test controls
11+
- A `Product Explorer` app page with three hardcoded editable products
12+
- `c:datadogInit` in the utility bar, backed by the `datadog_rum_slim` static resource
13+
14+
## Deploy
15+
16+
From this directory:
17+
18+
```sh
19+
yarn run setup -o engrumdev --ignore-conflicts
20+
```
21+
22+
The setup script copies the local RUM slim bundle into the static resource, deploys the app, assigns the app permission set to the target user, and prints the app-specific Home URL.
23+
24+
If prompted for a user. Log into 1Password and use `beltran.bulbarella@datadoghq.com.engrumdev`
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<actionOverrides>
4+
<actionName>Tab</actionName>
5+
<content>SF_LWC_App_Home</content>
6+
<formFactor>Large</formFactor>
7+
<type>Flexipage</type>
8+
<pageOrSobjectType>standard-home</pageOrSobjectType>
9+
</actionOverrides>
10+
<formFactors>Large</formFactors>
11+
<label>SF LWC App</label>
12+
<navType>Standard</navType>
13+
<tabs>standard-home</tabs>
14+
<tabs>Product_Explorer</tabs>
15+
<uiType>Lightning</uiType>
16+
<utilityBar>SF_LWC_App_UtilityBar</utilityBar>
17+
</CustomApplication>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<CspTrustedSite xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<canAccessCamera>false</canAccessCamera>
4+
<canAccessMicrophone>false</canAccessMicrophone>
5+
<context>All</context>
6+
<description>Datadog browser RUM intake for US1</description>
7+
<endpointUrl>https://browser-intake-datadoghq.com</endpointUrl>
8+
<isActive>true</isActive>
9+
<isApplicableToConnectSrc>true</isApplicableToConnectSrc>
10+
</CspTrustedSite>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<flexiPageRegions>
4+
<itemInstances>
5+
<componentInstance>
6+
<componentName>productExplorer</componentName>
7+
<identifier>productExplorer</identifier>
8+
</componentInstance>
9+
</itemInstances>
10+
<name>main</name>
11+
<type>Region</type>
12+
</flexiPageRegions>
13+
<masterLabel>Product Explorer</masterLabel>
14+
<template>
15+
<name>flexipage:defaultAppHomeTemplate</name>
16+
</template>
17+
<type>AppPage</type>
18+
</FlexiPage>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<flexiPageRegions>
4+
<itemInstances>
5+
<componentInstance>
6+
<componentName>customActionButtons</componentName>
7+
<identifier>customActionButtons</identifier>
8+
</componentInstance>
9+
</itemInstances>
10+
<name>top</name>
11+
<type>Region</type>
12+
</flexiPageRegions>
13+
<masterLabel>SF LWC App Home</masterLabel>
14+
<template>
15+
<name>home:desktopTemplate</name>
16+
</template>
17+
<type>HomePage</type>
18+
</FlexiPage>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<flexiPageRegions>
4+
<itemInstances>
5+
<componentInstance>
6+
<componentInstanceProperties>
7+
<name>eager</name>
8+
<type>decorator</type>
9+
<value>true</value>
10+
</componentInstanceProperties>
11+
<componentInstanceProperties>
12+
<name>label</name>
13+
<type>decorator</type>
14+
<value>Datadog Init</value>
15+
</componentInstanceProperties>
16+
<componentName>datadogInit</componentName>
17+
<identifier>datadogInit</identifier>
18+
</componentInstance>
19+
</itemInstances>
20+
<name>utilityItems</name>
21+
<type>Region</type>
22+
</flexiPageRegions>
23+
<masterLabel>SF LWC App UtilityBar</masterLabel>
24+
<template>
25+
<name>one:utilityBarTemplateDesktop</name>
26+
</template>
27+
<type>UtilityBar</type>
28+
</FlexiPage>
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<template>
2+
<section data-testid="home-custom-actions">
3+
<div>
4+
<h2>Datadog Custom Actions</h2>
5+
<p>Use these buttons to send manual RUM custom actions from the home page.</p>
6+
</div>
7+
<div>
8+
<lightning-button
9+
label="Custom Action 1"
10+
variant="brand"
11+
data-action-name="custom action 1"
12+
data-testid="custom-action-1"
13+
onclick="{handleActionClick}"
14+
></lightning-button>
15+
<lightning-button
16+
label="Custom Action 2"
17+
variant="neutral"
18+
data-action-name="custom action 2"
19+
onclick="{handleActionClick}"
20+
></lightning-button>
21+
</div>
22+
<template lwc:if="{lastActionName}">
23+
<p>Last sent: {lastActionName}</p>
24+
</template>
25+
</section>
26+
<section>
27+
<div>
28+
<h2>Datadog Custom Errors</h2>
29+
<p>Use these buttons to send manual RUM custom errors from the home page.</p>
30+
</div>
31+
<div>
32+
<lightning-button
33+
label="Custom Error 1"
34+
variant="destructive"
35+
data-error-name="custom error 1"
36+
data-testid="custom-error-1"
37+
onclick="{handleErrorClick}"
38+
></lightning-button>
39+
<lightning-button
40+
label="Custom Error 2"
41+
variant="destructive-text"
42+
data-error-name="custom error 2"
43+
onclick="{handleErrorClick}"
44+
></lightning-button>
45+
</div>
46+
<template lwc:if="{lastErrorName}">
47+
<p>Last sent: {lastErrorName}</p>
48+
</template>
49+
</section>
50+
<section>
51+
<div>
52+
<h2>Datadog Runtime Errors</h2>
53+
<p>Use this button to trigger an unhandled error that should be captured via window.onerror.</p>
54+
</div>
55+
<div>
56+
<lightning-button
57+
label="Runtime Error"
58+
variant="destructive"
59+
onclick="{handleRuntimeErrorClick}"
60+
></lightning-button>
61+
</div>
62+
</section>
63+
<section>
64+
<div>
65+
<h2>Datadog Long Tasks</h2>
66+
<p>Blocks the main thread to generate a long_task RUM event.</p>
67+
</div>
68+
<div>
69+
<lightning-button
70+
label="Long Task"
71+
variant="brand"
72+
data-testid="long-task"
73+
onclick="{handleLongTaskClick}"
74+
></lightning-button>
75+
</div>
76+
</section>
77+
<section>
78+
<div>
79+
<h2>Datadog Vitals</h2>
80+
<p>Add Duration Vital and Start/Stop Vital use the DD_RUM vitals API directly.</p>
81+
</div>
82+
<div>
83+
<lightning-button
84+
label="Add Duration Vital"
85+
variant="brand"
86+
onclick="{handleAddDurationVitalClick}"
87+
></lightning-button>
88+
<lightning-button
89+
label="Start/Stop Vital"
90+
variant="brand"
91+
onclick="{handleStartStopVitalClick}"
92+
></lightning-button>
93+
</div>
94+
</section>
95+
<section>
96+
<div>
97+
<h2>Datadog Resources</h2>
98+
<p>Use these buttons to generate resource timing entries for fetch and XHR.</p>
99+
</div>
100+
<div>
101+
<lightning-button
102+
label="Fetch Resource"
103+
variant="brand"
104+
onclick="{handleFetchResourceClick}"
105+
></lightning-button>
106+
<lightning-button
107+
label="XHR Resource"
108+
variant="brand"
109+
onclick="{handleXhrResourceClick}"
110+
></lightning-button>
111+
</div>
112+
<template lwc:if="{lastResourceName}">
113+
<p>Last requested: {lastResourceName}</p>
114+
</template>
115+
</section>
116+
<section>
117+
<div>
118+
<h2>Datadog Selector Probe</h2>
119+
<p>Use this button to compare the LWC internal click target with the automatic RUM click selector.</p>
120+
</div>
121+
<div>
122+
<button
123+
data-dd-action-name="inner selector probe button"
124+
data-testid="inner-selector-probe-button"
125+
onclick="{handleSelectorProbeClick}"
126+
style="margin: 0.75rem 0; padding: 0.25rem 0.75rem"
127+
>
128+
Inner Selector Probe
129+
</button>
130+
</div>
131+
<template lwc:if="{lastSelectorProbe}">
132+
<p>Last probe: {lastSelectorProbe}</p>
133+
</template>
134+
</section>
135+
</template>

0 commit comments

Comments
 (0)