-
Notifications
You must be signed in to change notification settings - Fork 190
✅ Add Salesforce LWC Test Application. #4757
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
5dadb50
Add new Browser-rum-salesforce package
BeltranBulbarellaDD 8c6cd15
Add support for Salesforce LWS
BeltranBulbarellaDD 48f1282
Address comments from review
BeltranBulbarellaDD 0fe7170
Address comments from Codex
BeltranBulbarellaDD ecbb855
Add unit tests
BeltranBulbarellaDD d9b95ba
Address location change observable comments
BeltranBulbarellaDD a55b33f
Make window optional in globalObject
BeltranBulbarellaDD 3355032
Fix format and codex reviews
BeltranBulbarellaDD aa6f784
Fix linter
BeltranBulbarellaDD b260896
Initialize sf-lwc-app test app with eslint and prettier ignored
BeltranBulbarellaDD a742145
Add minimal LWC app for testing (Navigation, views, actions, resource…
BeltranBulbarellaDD 14362c2
Merge branch 'main' into salesforce/add-e2e-tests_2
BeltranBulbarellaDD dfab355
fix: build, woke, home url in console output
BeltranBulbarellaDD 93e8012
fix: rename sample json api url
BeltranBulbarellaDD 1e47d83
Format SF html files. Add data-testid
BeltranBulbarellaDD e71a4dc
remove allowed tracing urls
BeltranBulbarellaDD dd7c95f
Cleanup unused code and files
BeltranBulbarellaDD d32e6bf
Merge branch 'main' into salesforce/add-e2e-tests_2
BeltranBulbarellaDD 9565382
Remove unused code
BeltranBulbarellaDD a5f06b4
Use query params for Datadog RUM config
BeltranBulbarellaDD 7c535a0
Clean up Datadog RUM URL parameters, don't initialize RUM if not conf…
BeltranBulbarellaDD 33581fd
chore: remove accidental rum-events-format gitlink
BeltranBulbarellaDD 0560c00
Address codex comments
BeltranBulbarellaDD 07a08a2
reuse cleanUrl function
BeltranBulbarellaDD 4175f81
Fix cleanUrl function
BeltranBulbarellaDD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .sf | ||
| .sfdx | ||
| /force-app/main/default/staticresources/datadog_rum_slim.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # SF LWC App | ||
|
|
||
| Salesforce DX project used to exercise browser-sdk behavior in a real Lightning Web Components runtime. | ||
|
|
||
| This app is Lightning-only. | ||
|
|
||
| ## What It Contains | ||
|
|
||
| - A Lightning app named `SF LWC App` | ||
| - A trimmed Home page with Datadog test controls | ||
| - A `Product Explorer` app page with three hardcoded editable products | ||
| - `c:datadogInit` in the utility bar, backed by the `datadog_rum_slim` static resource | ||
|
|
||
| ## Deploy | ||
|
|
||
| From this directory: | ||
|
|
||
| ```sh | ||
| yarn run setup -o engrumdev --ignore-conflicts | ||
| ``` | ||
|
|
||
| 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. | ||
|
|
||
| If prompted for a user. Log into 1Password and use `beltran.bulbarella@datadoghq.com.engrumdev` |
17 changes: 17 additions & 0 deletions
17
test/apps/sf-lwc-app/force-app/main/default/applications/SF_LWC_App.app-meta.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
| <actionOverrides> | ||
| <actionName>Tab</actionName> | ||
| <content>SF_LWC_App_Home</content> | ||
| <formFactor>Large</formFactor> | ||
| <type>Flexipage</type> | ||
| <pageOrSobjectType>standard-home</pageOrSobjectType> | ||
| </actionOverrides> | ||
| <formFactors>Large</formFactors> | ||
| <label>SF LWC App</label> | ||
| <navType>Standard</navType> | ||
| <tabs>standard-home</tabs> | ||
| <tabs>Product_Explorer</tabs> | ||
| <uiType>Lightning</uiType> | ||
| <utilityBar>SF_LWC_App_UtilityBar</utilityBar> | ||
| </CustomApplication> |
10 changes: 10 additions & 0 deletions
10
...rce-app/main/default/cspTrustedSites/browser_intake_datadoghq_com.cspTrustedSite-meta.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <CspTrustedSite xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
| <canAccessCamera>false</canAccessCamera> | ||
| <canAccessMicrophone>false</canAccessMicrophone> | ||
| <context>All</context> | ||
| <description>Datadog browser RUM intake for US1</description> | ||
| <endpointUrl>https://browser-intake-datadoghq.com</endpointUrl> | ||
| <isActive>true</isActive> | ||
| <isApplicableToConnectSrc>true</isApplicableToConnectSrc> | ||
| </CspTrustedSite> |
18 changes: 18 additions & 0 deletions
18
test/apps/sf-lwc-app/force-app/main/default/flexipages/Product_Explorer.flexipage-meta.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
| <flexiPageRegions> | ||
| <itemInstances> | ||
| <componentInstance> | ||
| <componentName>productExplorer</componentName> | ||
| <identifier>productExplorer</identifier> | ||
| </componentInstance> | ||
| </itemInstances> | ||
| <name>main</name> | ||
| <type>Region</type> | ||
| </flexiPageRegions> | ||
| <masterLabel>Product Explorer</masterLabel> | ||
| <template> | ||
| <name>flexipage:defaultAppHomeTemplate</name> | ||
| </template> | ||
| <type>AppPage</type> | ||
| </FlexiPage> |
18 changes: 18 additions & 0 deletions
18
test/apps/sf-lwc-app/force-app/main/default/flexipages/SF_LWC_App_Home.flexipage-meta.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
| <flexiPageRegions> | ||
| <itemInstances> | ||
| <componentInstance> | ||
| <componentName>customActionButtons</componentName> | ||
| <identifier>customActionButtons</identifier> | ||
| </componentInstance> | ||
| </itemInstances> | ||
| <name>top</name> | ||
| <type>Region</type> | ||
| </flexiPageRegions> | ||
| <masterLabel>SF LWC App Home</masterLabel> | ||
| <template> | ||
| <name>home:desktopTemplate</name> | ||
| </template> | ||
| <type>HomePage</type> | ||
| </FlexiPage> | ||
28 changes: 28 additions & 0 deletions
28
...pps/sf-lwc-app/force-app/main/default/flexipages/SF_LWC_App_UtilityBar.flexipage-meta.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
| <flexiPageRegions> | ||
| <itemInstances> | ||
| <componentInstance> | ||
| <componentInstanceProperties> | ||
| <name>eager</name> | ||
| <type>decorator</type> | ||
| <value>true</value> | ||
| </componentInstanceProperties> | ||
| <componentInstanceProperties> | ||
| <name>label</name> | ||
| <type>decorator</type> | ||
| <value>Datadog Init</value> | ||
| </componentInstanceProperties> | ||
| <componentName>datadogInit</componentName> | ||
| <identifier>datadogInit</identifier> | ||
| </componentInstance> | ||
| </itemInstances> | ||
| <name>utilityItems</name> | ||
| <type>Region</type> | ||
| </flexiPageRegions> | ||
| <masterLabel>SF LWC App UtilityBar</masterLabel> | ||
| <template> | ||
| <name>one:utilityBarTemplateDesktop</name> | ||
| </template> | ||
| <type>UtilityBar</type> | ||
| </FlexiPage> |
135 changes: 135 additions & 0 deletions
135
test/apps/sf-lwc-app/force-app/main/default/lwc/customActionButtons/customActionButtons.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| <template> | ||
| <section data-testid="home-custom-actions"> | ||
| <div> | ||
| <h2>Datadog Custom Actions</h2> | ||
| <p>Use these buttons to send manual RUM custom actions from the home page.</p> | ||
| </div> | ||
| <div> | ||
| <lightning-button | ||
| label="Custom Action 1" | ||
| variant="brand" | ||
| data-action-name="custom action 1" | ||
| data-testid="custom-action-1" | ||
| onclick="{handleActionClick}" | ||
|
BeltranBulbarellaDD marked this conversation as resolved.
|
||
| ></lightning-button> | ||
| <lightning-button | ||
| label="Custom Action 2" | ||
| variant="neutral" | ||
| data-action-name="custom action 2" | ||
| onclick="{handleActionClick}" | ||
| ></lightning-button> | ||
| </div> | ||
| <template lwc:if="{lastActionName}"> | ||
| <p>Last sent: {lastActionName}</p> | ||
| </template> | ||
| </section> | ||
| <section> | ||
| <div> | ||
| <h2>Datadog Custom Errors</h2> | ||
| <p>Use these buttons to send manual RUM custom errors from the home page.</p> | ||
| </div> | ||
| <div> | ||
| <lightning-button | ||
| label="Custom Error 1" | ||
| variant="destructive" | ||
| data-error-name="custom error 1" | ||
| data-testid="custom-error-1" | ||
| onclick="{handleErrorClick}" | ||
| ></lightning-button> | ||
| <lightning-button | ||
| label="Custom Error 2" | ||
| variant="destructive-text" | ||
| data-error-name="custom error 2" | ||
| onclick="{handleErrorClick}" | ||
| ></lightning-button> | ||
| </div> | ||
| <template lwc:if="{lastErrorName}"> | ||
| <p>Last sent: {lastErrorName}</p> | ||
| </template> | ||
| </section> | ||
| <section> | ||
| <div> | ||
| <h2>Datadog Runtime Errors</h2> | ||
| <p>Use this button to trigger an unhandled error that should be captured via window.onerror.</p> | ||
| </div> | ||
| <div> | ||
| <lightning-button | ||
| label="Runtime Error" | ||
| variant="destructive" | ||
| onclick="{handleRuntimeErrorClick}" | ||
| ></lightning-button> | ||
| </div> | ||
| </section> | ||
| <section> | ||
| <div> | ||
| <h2>Datadog Long Tasks</h2> | ||
| <p>Blocks the main thread to generate a long_task RUM event.</p> | ||
| </div> | ||
| <div> | ||
| <lightning-button | ||
| label="Long Task" | ||
| variant="brand" | ||
| data-testid="long-task" | ||
| onclick="{handleLongTaskClick}" | ||
| ></lightning-button> | ||
| </div> | ||
| </section> | ||
| <section> | ||
| <div> | ||
| <h2>Datadog Vitals</h2> | ||
| <p>Add Duration Vital and Start/Stop Vital use the DD_RUM vitals API directly.</p> | ||
| </div> | ||
| <div> | ||
| <lightning-button | ||
| label="Add Duration Vital" | ||
| variant="brand" | ||
| onclick="{handleAddDurationVitalClick}" | ||
| ></lightning-button> | ||
| <lightning-button | ||
| label="Start/Stop Vital" | ||
| variant="brand" | ||
| onclick="{handleStartStopVitalClick}" | ||
| ></lightning-button> | ||
| </div> | ||
| </section> | ||
| <section> | ||
| <div> | ||
| <h2>Datadog Resources</h2> | ||
| <p>Use these buttons to generate resource timing entries for fetch and XHR.</p> | ||
| </div> | ||
| <div> | ||
| <lightning-button | ||
| label="Fetch Resource" | ||
| variant="brand" | ||
| onclick="{handleFetchResourceClick}" | ||
| ></lightning-button> | ||
| <lightning-button | ||
| label="XHR Resource" | ||
| variant="brand" | ||
| onclick="{handleXhrResourceClick}" | ||
| ></lightning-button> | ||
| </div> | ||
| <template lwc:if="{lastResourceName}"> | ||
| <p>Last requested: {lastResourceName}</p> | ||
| </template> | ||
| </section> | ||
| <section> | ||
| <div> | ||
| <h2>Datadog Selector Probe</h2> | ||
| <p>Use this button to compare the LWC internal click target with the automatic RUM click selector.</p> | ||
| </div> | ||
| <div> | ||
| <button | ||
| data-dd-action-name="inner selector probe button" | ||
| data-testid="inner-selector-probe-button" | ||
| onclick="{handleSelectorProbeClick}" | ||
| style="margin: 0.75rem 0; padding: 0.25rem 0.75rem" | ||
| > | ||
| Inner Selector Probe | ||
| </button> | ||
| </div> | ||
| <template lwc:if="{lastSelectorProbe}"> | ||
| <p>Last probe: {lastSelectorProbe}</p> | ||
| </template> | ||
| </section> | ||
| </template> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.