Salesforce Lightning tests
You can record and play back Web UI tests for the Salesforce applications that are designed by using Salesforce Lightning controls. Salesforce applications usually include complex workflows, integrations, and customizations. By testing these applications, you can verify that the elements and the functionality as a whole work as expected.
Salesforce Lightning (SFL) controls are composite controls that are built using several other controls. When you record a test, the action on the composite control gets recorded. If the playback on these controls does not work, then you must generate an event on its parent control, which can be a hyperlink or an image button. To change the control, in the Elements view, you must click the required control, and then select Use this element as step target. The step then gets modified.
Here are the sample scenarios that require test edits after recording:
- If any option from the drop-down menu records as a span element, then you must select
the SFL Base Combo item from the Elements view as the target
element. Note: When you record actions on the drop-down menu, you must click the left part of the drop-down text value. You should avoid clicking the middle or right side of the drop-down text value.
- For an SVG element, you must select its parent, which is either an SFL Icon or SFL Primitive Icon that is nearest to the element in the hierarchy.
- If you want to create steps or verification points, you must use the Elements view. You cannot use the SmartShot view to create steps or verification points for Salesforce applications.
- After you record a test, if any step that is recorded as span fails when you play back, then you must select the actionable parent control as the target element for the user action.
- While recording, when you perform user actions, the highlight might be on some other element. You must ignore this behaviour.
| Control type | Control name |
| Base Lightning Components | |
| Button | lightning-button |
| Input field | lightning-input |
| Text area | lightning-textarea |
| Select (Drop-down) | lightning-select |
| Card (Container for content) | lightning-card |
| Icon | lightning-icon |
| Form Controls | |
| Input field (Text, Number, Date) | lightning-input |
| Select (Drop-down) | lightning-select |
| Checkbox group | lightning-checkbox-group |
| Drop-down control | lightning-combobox |
| Radio button group | lightning-radio-group |
| Toggle switch | lightning-input-toggle |
| Layout Components | |
| Grid layout | lightning-layout |
| Layout item | lightning-layout-item |
| Card | lightning-card |
| Navigation | |
| Navigation | lightning-navigation |
| Breadcrumbs | lightning-breadcrumbs |
| Menu | lightning-menu |
| Action Components | |
| Button | lightning-button |
| Button icon | lightning-button-icon |
| Button menu | lightning-button-menu |
| Feedback | |
| Modal (Dialog) | lightning-modal |
| Message | lightning-message |
| Utility Components | |
| Instant search | lightning-instant-search |
| Quick action | lightning-quick-action |
| lightning-record-edit-create | |
| lightning-record-edit-form | |
| Apex-Driven Components | |
| Lightning Web Components (LWC) | <c-my-custom-component> |