The UI Action (or ‘UI Do Action’) API is used to perform an action on a field, e.g. setting a field value or clicking a button. This is one of the most common Test Steps in UI testing. UI Action Test Steps are generally added through the Test Builder.
Use the following links to navigate to the relevant section:
It is often best to add this kind of Test Step through the Test Builder, by mapping the element and selecting an Interaction Type such as ‘Click’ or ‘Set’. This is recommended as the fastest way to add this kind of Test Step, although it is also possible to use drag-and-drop from the API Palette.
Sample Test Case
The screenshot below shows a Test Case with various UI Action Test Steps:
In the Test Step highlighted above, a value is being set of ‘Provar Plc’ in the ‘Account Name’ field. The parent UI On Screen Test Step shows us that this is happening on the Account ‘New’ screen.
Above the current Test Step, several other UI Action Test Steps can be seen setting values in other fields: ‘Active’, ‘SLA’, ‘SLA Serial Number’ and ‘SLA Expiration Date’. Immediately after the current Test Step, another UI Action clicks ‘Save’ on the record.
Since UI Action Test Steps are generally created and populated through the Test Builder, the user does not need to know how to populate these fields from scratch. However it is useful to describe all the available parameters for editing and debugging purposes.
The full UI Action parameters are as follows:
- Control Type: The screen and element type. This will be ‘Salesforce Button or Field’ when on standard Salesforce screens, or ‘Page Object Operation’ or ‘Page Object Button or Field’ when on Visualforce or non-Salesforce pages
- Screen Section: The section of the page layout where the Control is located
- Control/Field: The field, button or other test element on which the action is being performed
- Action: The action to be performed, e.g. ‘Set’, ‘Click’, ‘Activate Inline Edit’, ‘Check’. There is a special ‘Today Link’ available for date fields which inputs today’s date
- Value: The value to be added to a field (if a ‘Set’ Action is being used). The Value could be a static value, e.g. ‘Provar Plc’, a variable, a function or a combination of all three
- Tab off field: Indicates whether Provar should press ‘tab’ after this Test Step is completed
- Press Enter: Indicates whether Provar should press ‘Enter’ after this Test Step is completed
Refer to Common Test Step Parameters for more information on Wait, Timeout, Screenshot Above and Screenshot Below.
As of Version 18.104.22.168, Provar now supports “IE Click Method” options to perform Click interaction on any field in the Internet Explorer browser. The following interactions are supported:
- Click via Selenium
- Send Enter Key via Selenium
- Send Space Key via Selenium
Note that the ‘Default’ option is for existing test steps.
The setting will be ignored if not running on IE browser:
Test runner logs will confirm the click method under IE:
Example 1: Creating and submitting an account for approval
This example creates a new Salesforce Account using UI On Screen and UI Action Test APIs performing various actions and submits the Account for approval.
Step 1: Launch the Test Builder and navigate to the ‘Accounts’ tab. list view.
Step 2: Right-click on the ‘New’ button and select ‘Add to Test Case’:
Step 3: Configure the draft Test Step as follows:
Note that Interaction Type is set to ‘Click’.
Step 5: Navigate to Provar Desktop and review the Test Case:
Note that an On Screen Test Step has been added above the UI Action Test Step. This hierarchy has been generated automatically through the Test Builder.
Step 6: Navigate back to the Test Builder. Right-click on the ‘Account Name’ button and select ‘Add to Test Case’:
Step 7: Configure the draft Test Step as follows:
Note that Interaction Type is set to ‘Click’ and Value is ‘Account4’.
Step 8: Click ‘Add & Do’ to save the Test Step, then repeat Steps 6-8 to map additional fields. Make sure that all required fields are populated.
Step 9: Right-click on the ‘Save’ button and select ‘Add to Test Case’. Select an Interaction Type of ‘Click’ and then click ‘Add & Do’.
Step 10: Review the newly created Account and verify that the information has been populated as specified:
Step 11: Right-click on the ‘Submit for Approval’ button and select ‘Add to Test Case’. In the draft Test Step, set the Interaction Type to ‘Click and Confirm’, then click ‘Add & Do’:
Step 12: Navigate to Provar Desktop and review the Test Case: