We're here to help
Salesforce Lightning Testing
Salesforce Lightning Testing
Provar’s Test Cases are designed to run equally well in Classic and the new Lightning Experience.
Using Provar’s integration to Salesforce metadata, it is possible to build a Test Case in Classic and run it in Lightning, or build a Test Case in Lightning and run it in Classic. This is useful for organizations who are planning an upgrade path to Lightning, as running your Classic Test Cases in Lightning Mode and reviewing their execution can help assess your organization’s readiness for Lightning.
For a full introduction to testing in Lightning, take a look at our Lightning Testing module. This is a downloadable PDF guide intended to teach you some techniques for testing in Lightning and introduce some of the differences you should be aware of.
To execute Test Cases in Lightning, specify this against the Test Connection or an individual Test Case. After this, UI fields can be mapped as normal using the Test Builder, which will automatically identify fields the same way in Lightning UI as in the Classic UI. Page Objects are not required.
If functional behavior differs between Lightning and Classic, you can use logical conditions such as an If step to accommodate them within the same Test Case.
Running an individual Test Case in Lightning
You can set an individual Test Case to run in Lighting even if Lightning is not enabled for a Connection.
To do this, open your Test Case and click into the Salesforce Connect Test Step. Locate the ‘Lightning Mode Override’ dropdown within Advanced Settings, and set this to ‘Enable’:
Using ‘Enable’ will launch this Test Case in Lightning mode regardless of the mode specified on the Connection.
Conversely, if a Connection is enabled for Lightning, but you want to run a Test Case in Classic mode, set the ‘Lightning Mode Override’ option to ‘Disable’:
Then save the Test Case.
Salesforce Lightning Design System (SLDS) Support
As of ver. 1.9, Provar has enhanced support for the testing of Visualforce pages, Custom Lightning Components or any other Salesforce page that use the Salesforce Lightning Design System (SLDS). This is done by providing a new By SLDS Label locator for the page fields.
The Salesforce Lightning Design System enables you to build rich enterprise experiences and custom applications with the patterns and established best practices that are native to Salesforce.
Salesforce provides a standard mechanism for how the elements need to be added in a form for the Lightning Design System. These are applicable for Visualforce or any other Salesforce page in both Classic and Lightning Experience.
The ‘By Label’ in Provar has been enhanced to support this design system. When testing a Salesforce page that has been developed within SLDS guidelines, the Test Builder will suggest the new By SLDS Label when mapping the page’s fields. These will work in both Read and Edit modes.
When added in a Page Object, it will appear as follows:
@FindByLabel(label=”Input Label”, labelType=LabelType.SalesforceLightningDesignSystem)
public WebElement inputElement;
In Lightning Experience
In Provar Desktop Page Object Editor
In Java Source
Custom Lighting Components with Embedded Tables
As of ver. 1.9, Provar supports the testing of Custom Lightning Components with embedded tables where each row is a Lightning Component nested within an <aura:iteration> base component.
An example is the Edit Products component below which has a custom table showing opportunity product rows.
This appears as follows in the Test Builder.
In this example we are mapping the first Product in the table, ‘PV-Fixed-12-Provar Fixed License (12 months)’, and are updating the Product name value:
Note that Provar has recognized the embedded table automatically in the Page Structure.
We can update other values on the same row, such as Quantity, by adding additional steps:
Note that this additional step is using the same On Screen and With Row test steps as the first step.
These steps appear in Provar Desktop as follows.
On Screen test step:
Test step updating the Product name value:
Provar will automatically generate 2 Page Objects for this scenario, one with the table information and the other with column information.
Page Object with table information.
Page Object with row information.
Quick Actions in Header Components
Provar now supports the mapping of Quick Actions in the header component of app page FlexiPages in Lightning. This includes both layout-specific Quick Actions and Global Quick Actions.
What are Quick Actions?
Quick Actions enable users to do more in Salesforce and in the Salesforce mobile app. With custom quick actions, you can make your users’ navigation and workflow as smooth as possible by giving them convenient access to information that’s most important. Salesforce provides both object-specific Quick Actions and global Quick Actions. Refer to Quick Actions in Salesforce help for more information.
Quick Actions in Provar
In Provar, header buttons are mapped as standard Quick Action Flexi Components. The same is true for Quick Actions in a dropdown list; they will also be mapped as Quick Action Flexi Components.
Until now, Provar has treated Quick Actions as Object-Specific, but now in Lightning it is possible to have a Quick Action independently, either through an App Page header or in Global Actions with and in the page header.
Example 1: Mapping Quick Task on a Header Component
Below is an example of Provar mapping the Quick Task button, which is a Global Quick Action on a header component.
Note that there are two buttons, Quick Task and Quick Lead.
When the Quick Task button is mapped, the following step appears in Test Builder:
Below are the same test steps in Provar Desktop.
This is the On Screen test step:
Note that the Quick Task button has its Flexi Component set to the Quick Action List, which is where both the Quick Task button and the Quick Lead buttons are positioned.
Both Quick Actions, Quick Task and Quick Lead, are available in the Control List for the Quick Action Menu:
Once the Quick Task dialogue box appears, elements can be mapped, such as the Subject being set to ‘Call’:
Note that the page is recognized as a Salesforce Layout. The page used will be ‘Salesforce [ActionName] Quick Action screen’, where [ActionName] is the name of the Quick Action being mapped.
Clicking the ‘Add & Do’ button on this test step will display the following:
In Provar Desktop the On Screen test step will display as follows:
Note that the Screen Type has been set to ‘Salesforce Publisher Actions’, which is a new option.
Clicking on the Publisher action parameter below Screen Type will reveal a list of all Quick Actions available in the org:
If the Quick Action selected is Visualforce or a Lightning Component, the relevant Page Object will also be displayed.
The TargetUrl would be as follows:
Finally, note that the Navigate parameter is set to ‘Don’t Navigate’.
When the Quick Action is in a header component, Provar does not have enough information to support a direct navigation to the action. For this reason, you should always ensure that ‘Don’t Navigate’ is chosen and that the preceding steps in the test will navigate the user to the correct point.
Below is the final test step as it appears in Provar Desktop.
And the same test step in Test Runner.
Example 2: Mapping Quick Lead on a Header Component
Follow the same approach as above to map the Quick Lead button in Test Builder.
Once the Quick Task dialogue appears, map the Salutation picklist field.
Note that the page is recognized as a Salesforce Layout and the page used is ‘Salesforce QuickLead Quick Action screen’, where ‘QuickLead’ is the name of the Quick Action being mapped.
Click the ‘Add & Do’ button on this test step and map any additional required fields, then map the ‘Save’ button.
Clicking the ‘Add & Do’ button on this test step will display the following in Test Builder.
And in Provar Desktop.
And in Test Runner.
As of 1.9.4, Provar now supports the mapping of Global Actions in Lightning from the Global Actions (‘+’) button.
When Global Actions are enabled in Lightning, they appear in the application context at the top-right of the screen when the Global Actions (‘+’) button is clicked.
Once an action is selected from the list, it is rendered as a non-modal pop-up overlay from the bottom of the screen. These pop-ups remain open on the screen while navigating around Salesforce, and you can have multiple open at once.
Note that this behavior is different to how actions are normally rendered, as modal overlays in the center of the screen which need to be closed before the user can continue other activities.
In the example below, we have clicked the ‘Log a Call’ Quick Action from the Global Actions list seen above. This step is mapping the Subject field in Test Builder.
Note that the screen is recognized automatically as the ‘Log a Call’ Quick Action.
The On Screen test step appears as follows in Provar Desktop.
And in Test Runner.
Other fields on the Quick Action are also recognized automatically.
Note that Provar has a known limitation that it is not possible to test multiple Global Actions for the same action simultaneously. This means that, if you have 2 ‘Log a Call’ actions open at the same time, Provar can only interact with the first one it finds.
Lightning Path Component
As of 1.9.4, Provar now supports the testing of Salesforce’s Lightning Path Component. Provar supports both standard paths and paths on custom objects.
Example 1: Standard Path (Lead)
Below is an example test step mapping a Path step on a Lead detail page.
Note that various options are provided in the dropdown.
And in Provar Desktop.
Provar can also perform actions on the Path’s key fields, such as Inline Edit.
Below is the UI On Screen test step in Provar Desktop.
And Test Runner.
Example 2: Custom Path
Provar also supports the testing of paths on custom objects.
The process for mapping custom paths is the same, but these will show a Screen Type of ‘SF Flexipage Lightning Component’. This is different from standard paths, which have a Screen Type of ‘Salesforce Object’.
Below is the UI On Screen test step in Provar Desktop:
Guided Action Lists
As of Provar 1.9.7, Provar supports testing of Salesforce’s Guided Action List Component. The Guided Action List allows user to accomplish required tasks in a guided manner using Lightning Flows. Refer to Lightning Flow for Service and the Guided Action List Component for more information.
Provar will recognize Guided Action List Components automatically and map them as a standard Flexi Component. Flows on the Actions tab can be mapped as follows using the Flow name.
Provar also supports the ‘View’ and ‘Remove’ buttons on a given flow.
Provar can also Read/Assert the number of flows available in the list and/or extract the list of all the available flows:
Provar can also Read/Assert information under the History tab, as below. (Note that mapping of the ‘Actions’ or ‘History’ tab is not required as Provar will manage this navigation automatically.)
Below is an example test in Test Builder.
And in Provar Desktop
As of Version 1.9.8, Provar supports intelligent testing of the Lightning Utility Bar with the ability to automatically recognise when you map an element in the Utility Bar without creating your own Page Object. This is currently supported for Recent Items, Rich Text, List View and Visualforce components. Other components in Utility Bar can be mapped as Page Objects.
Testing in the Lightning Utility Bar
To test a component in the Lightning Utility Bar, click on the component to open it and then map the target element. Provar will automatically recognize the component as a Flexi Component.
Once the test step is mapped, it will appear as follows in Test Builder:
Note that the Flexi Component has been recognized automatically as ‘Recent Items’.
Opening and Closing Components
In general it is not necessary to add a test step to open a component in the Utility bar. When you map an element inside a component, Provar will recognize the component as a Flexi Component and open it automatically before executing the next step. Check that the On Screen test step is set to ‘Always Navigate’ to make sure this happens.
To close a component in the utility bar, map the ‘_’ link at the top of the component and add this as a test step.
As of Version 1.9.8, Provar supports the Recent Item component, Rich Text, List View and Visualforce components. Other components in Utility Bar can be mapped as Page Objects.
There are some limitations to Provar’s support for these components:
- For Recent Item components, column assertions are not supported.
- For List View components, column assertions and row count assertions are not supported.
For more information or advice on these limitations please contact Provar support directly.