Skip to content

Sfdc

Salesforce (Sfdc) helpers for Rapise. Provides:

  • Login to and logout from a Salesforce instance
  • Opening applications via the App Launcher (Waffle menu)
  • Navigation to modules through the navigation bar
  • List view selection and table search
  • Form field interactions: text fields, checkboxes, comboboxes, lookup fields
  • Record detail verification and inline editing
  • Related list actions and card detail verification
  • Modal dialog handling and validation
  • File upload and attachment verification
  • Report filter management
  • Date formatting for Salesforce date fields

All of these act on the Salesforce Lightning Experience (LEX) web interface. The library handles both Lightning Web Components (LWC) and Aura-based UI patterns.

Credentials and configuration are resolved from environment variables (SF_URL, SF_USERNAME, SF_PASSWORD), test parameters, or Shared\Config.xlsx.

Requires the DomSalesforce library to be loaded.

Action Summary

Action Description
AddReportFilter Add a filter to a report in the Report Builder.
ClickButton Click a button by its name or title.
FormatDate Compute a date relative to today (or a given base) and return it formatted
for Salesforce date input fields.
InlineEdit Click the inline edit pencil icon for a field on a record detail page.
Launch Launch Salesforce in a browser and log in.
NavigateModule Navigate to a module using the navigation bar.
OpenApp Open a Salesforce application from the App Launcher (Waffle menu).
RelatedListAction Click an action from a Related List's dropdown menu.
RelatedListItemAction Click an action from a specific item's dropdown menu within a Related List.
SearchModalTable Search and select an item in a modal table (e.g.
SearchTable Search data in a list view table.
SelectComboboxItem Select an item from a combobox (picklist).
SelectInnerTab Select an inner tab on a record page.
SelectListView Select a list view from the list view dropdown.
SelectLookupItem Select an item from a lookup field.
SetCheckbox Set a checkbox on a form to the specified state.
SetPathStep Set the active Path step on a record page.
SetTextField Set text into a form field.
UploadFile Upload a file to a related list on the current record page.
VerifyAttachmentExists Verify that an attachment with the given name exists in a related list.
VerifyCardDetail Verify a field value displayed inside a related list card (preview card layout).
VerifyDetailsField Verify the value of a field on a record detail page.
VerifyFieldInvalid Verify that a form field is in an invalid state (has validation error).
VerifyModalTitle Verify the title of a modal dialog.
VerifyRecordTitle Verify the record page header: entity type and record name.

Action Detail

AddReportFilter

Add a filter to a report in the Report Builder.

Opens the filter selector, chooses the field, selects the operator, enters the value, and applies the filter.

Examples:

Sfdc.AddReportFilter("Account Name", "contains", "Auto");

Sfdc.AddReportFilter(filter, operator, value)

Parameters:

Name Type Description
filter string Name of the filter field (e.g. Account Name, Amount).
operator string Filter operator (e.g. contains, equals, greater than).
value string Value to filter by.

Returns:

boolean: true if the filter was added successfully, false otherwise.

ClickButton

Click a button by its name or title.

Searches for the button by its name attribute, title attribute, or visible text. When inside a modal dialog, the button within the active modal is preferred.

Examples:

Sfdc.ClickButton("Save");

Sfdc.ClickButton(name)

Parameters:

Name Type Description
name string Name, title, or visible text of the button to click.

Returns:

boolean: true if the button was found and clicked, false otherwise.

FormatDate

Compute a date relative to today (or a given base) and return it formatted for Salesforce date input fields.

The format is read from Config.xlsx key DateFormat (default: M/d/yyyy — US locale). Supported tokens: M, MM, d, dd, yyyy, yy.

Examples:

Sfdc.FormatDate(60);

Sfdc.FormatDate(offsetDays, baseDate)

Parameters:

Name Type Description
offsetDays number Number of days to add (can be negative). Default 0.
Optional, Default: "0".
baseDate string Base date string (ISO format yyyy-MM-dd) or 'today'. Default 'today'.
Optional, Default: "today".

Returns:

string: Formatted date string ready for SetTextField, or empty string on error.

InlineEdit

Click the inline edit pencil icon for a field on a record detail page.

Opens the field for inline editing by clicking its pencil icon.

Examples:

Sfdc.InlineEdit("Website");

Sfdc.InlineEdit(name)

Parameters:

Name Type Description
name string Label of the field to edit.

Returns:

boolean: true if the edit button was found and clicked, false otherwise.

Launch

Launch Salesforce in a browser and log in.

Credentials and the login URL are resolved in this order: environment variables (SF_URL, SF_USERNAME, SF_PASSWORD), test parameters (SfdcUrl, SfdcUserName, SfdcPassword), then Shared\Config.xlsx. If any value is still unknown, Rapise prompts for it and saves the answer into Shared\Config.xlsx.

When two-factor authentication is enabled, the OTP secret is resolved similarly (SF_OTP environment variable, OTP Secret test parameter, or Secret in Shared\Config.xlsx). The OTP public module must be installed.

Examples:

Sfdc.Launch();

Sfdc.Launch()

Returns:

boolean: true if the login completed and the home page loaded, false if a required setting was not provided.

Navigate to a module using the navigation bar.

Clicks the module link in the top navigation bar to open that module's list view.

Examples:

Sfdc.NavigateModule("Leads");

Sfdc.NavigateModule(module)

Parameters:

Name Type Description
module string Name of the module to navigate to (e.g. Leads, Contacts, Opportunities, Accounts).

Returns:

boolean: true if the module link was found and clicked, false otherwise.

OpenApp

Open a Salesforce application from the App Launcher (Waffle menu).

Clicks the waffle icon, searches for the application by name, and clicks it. If the app is not visible in the initial list, the "View All" button is clicked to show the full app list.

Examples:

Sfdc.OpenApp("Sales");

Sfdc.OpenApp(app)

Parameters:

Name Type Description
app string Name of the application to open (e.g. Sales, Service, Marketing).

Returns:

boolean: true if the application was found and clicked, false otherwise.

RelatedListAction

Click an action from a Related List's dropdown menu.

Locates the related list by its aria-label, opens the dropdown trigger, and selects the specified menu item.

Examples:

Sfdc.RelatedListAction("Products", "Add Products");

Sfdc.RelatedListAction(listName, actionName)

Parameters:

Name Type Description
listName string Name of the related list (e.g. Contact Roles, Products).
actionName string Name of the action in the dropdown menu.

Returns:

boolean: true if the action was found and clicked, false otherwise.

RelatedListItemAction

Click an action from a specific item's dropdown menu within a Related List.

Locates the item row by name within the related list, opens its dropdown, and clicks the specified action.

Examples:

Sfdc.RelatedListItemAction("Products", "AutoProduct Basic", "Edit");

Sfdc.RelatedListItemAction(listName, itemName, actionName)

Parameters:

Name Type Description
listName string Name of the related list (e.g. Products, Contact Roles).
itemName string Name/text of the item row.
actionName string Name of the action in the row dropdown (e.g. Edit, Delete).

Returns:

boolean: true if the action was found and clicked, false otherwise.

SearchModalTable

Search and select an item in a modal table (e.g. Add Products dialog).

Types the search value into the autocomplete input inside the modal, waits for results, and presses Enter to select.

Examples:

Sfdc.SearchModalTable("AutoProduct Basic");

Sfdc.SearchModalTable(value)

Parameters:

Name Type Description
value string Text to search for in the modal table.

Returns:

boolean: true if the search was performed, false if the input was not found.

SearchTable

Search data in a list view table.

Enters the search value into the table's search input and presses Enter.

Examples:

Sfdc.SearchTable("Acme");

Sfdc.SearchTable(value)

Parameters:

Name Type Description
value string Text to search for in the table.

Returns:

boolean: true if the search input was found and the search was performed, false otherwise.

SelectComboboxItem

Select an item from a combobox (picklist).

Supports Lightning combobox (lightning-combobox), classic Aura picklist (forceInputPicklist), and native HTML select elements (uiInputSelect).

Examples:

Sfdc.SelectComboboxItem("Lead Status", "Working - Contacted");

Sfdc.SelectComboboxItem(name, item)

Parameters:

Name Type Description
name string Label of the combobox field.
item string Text of the item to select.

Returns:

boolean: true if the item was found and selected, false otherwise.

SelectInnerTab

Select an inner tab on a record page.

Clicks the tab link to switch to that tab's content.

Examples:

Sfdc.SelectInnerTab("Details");

Sfdc.SelectInnerTab(name)

Parameters:

Name Type Description
name string Name of the tab to select (e.g. Details, Activity, Related).

Returns:

boolean: true if the tab was found and clicked, false otherwise.

SelectListView

Select a list view from the list view dropdown.

Opens the list view selector and clicks the specified view option.

Examples:

Sfdc.SelectListView("Recently Viewed");

Sfdc.SelectListView(view)

Parameters:

Name Type Description
view string Name of the list view to select (e.g. Recently Viewed, All Open Leads).

Returns:

boolean: true if the view was found and selected, false otherwise.

SelectLookupItem

Select an item from a lookup field.

Types the item name into the lookup field, waits for search results, and clicks the matching item.

Examples:

Sfdc.SelectLookupItem("Account Name", "Acme Corp");

Sfdc.SelectLookupItem(name, item)

Parameters:

Name Type Description
name string Label of the lookup field.
item string Name of the item to search for and select.

Returns:

boolean: true if the item was found and selected, false otherwise.

SetCheckbox

Set a checkbox on a form to the specified state.

Finds the checkbox by its label text or name attribute and checks or unchecks it. If the checkbox is already in the desired state, no action is taken.

Examples:

Sfdc.SetCheckbox("Do Not Call", true);

Sfdc.SetCheckbox(name, state)

Parameters:

Name Type Description
name string Label or name of the checkbox field.
state boolean Desired state: true to check, false to uncheck.

Returns:

boolean: true if the checkbox was found and set to the desired state, false otherwise.

SetPathStep

Set the active Path step on a record page.

Clicks the specified step in the Path component to mark it as current.

Examples:

Sfdc.SetPathStep("Qualification");

Sfdc.SetPathStep(name)

Parameters:

Name Type Description
name string Name of the Path step to set as active.

Returns:

boolean: true if the step was found and set, false otherwise.

SetTextField

Set text into a form field.

Finds the input or textarea by its label text, name attribute, or placeholder attribute, and enters the specified value.

Examples:

Sfdc.SetTextField("Last Name", "Smith");

Sfdc.SetTextField(name, value)

Parameters:

Name Type Description
name string Label, name, or placeholder of the input field.
value string Text to enter into the field.

Returns:

boolean: true if the field was found and the text was set, false otherwise.

UploadFile

Upload a file to a related list on the current record page.

Finds the file input within the specified related list, uploads the file, and clicks the Done button to confirm.

Examples:

Sfdc.UploadFile("Notes & Attachments", "TestData\\document.pdf");

Sfdc.UploadFile(relatedListName, fileName)

Parameters:

Name Type Description
relatedListName string Name of the related list (defaults to 'Notes & Attachments' if empty).
Optional, Default: "Notes & Attachments".
fileName string Relative path to the file to upload.

Returns:

boolean: true if the file was uploaded successfully, false otherwise.

VerifyAttachmentExists

Verify that an attachment with the given name exists in a related list.

Searches for the attachment item by its title within the related list.

Examples:

Sfdc.VerifyAttachmentExists("Notes & Attachments", "document");

Sfdc.VerifyAttachmentExists(relatedListName, name)

Parameters:

Name Type Description
relatedListName string Name of the related list (defaults to 'Notes & Attachments' if empty).
Optional, Default: "Notes & Attachments".
name string Expected attachment file name (without extension).

Returns:

boolean: true if the attachment is found, false otherwise.

VerifyCardDetail

Verify a field value displayed inside a related list card (preview card layout).

Locates the related list card by its aria-label, finds the specific item by name, then reads and verifies the field value.

Examples:

Sfdc.VerifyCardDetail("Products", "AutoProduct Basic", "Sales Price", "$100.00");

Sfdc.VerifyCardDetail(cardName, itemName, fieldName, value)

Parameters:

Name Type Description
cardName string Name of the related list card (matches aria-label, e.g. Products, Contact Roles).
itemName string Name of the item within the card to scope the lookup.
fieldName string Label of the field to verify (e.g. Sales Price, Quantity, Role).
value string Expected value text.

Returns:

boolean: true if the field value matches the expected value, false otherwise.

VerifyDetailsField

Verify the value of a field on a record detail page.

Finds the field by its label and compares the displayed value to the expected one. Supports text fields, links, and checkbox fields.

Examples:

Sfdc.VerifyDetailsField("Account Name", "Acme Corp");

Sfdc.VerifyDetailsField(name, value)

Parameters:

Name Type Description
name string Label of the field to verify.
value string Expected value of the field.

Returns:

boolean: true if the field value matches the expected value, false otherwise.

VerifyFieldInvalid

Verify that a form field is in an invalid state (has validation error).

Checks that the field has aria-invalid="true", indicating a validation error.

Examples:

Sfdc.VerifyFieldInvalid("Last Name");

Sfdc.VerifyFieldInvalid(name)

Parameters:

Name Type Description
name string Label of the field to check.

Returns:

boolean: true if the field shows a validation error, false otherwise.

VerifyModalTitle

Verify the title of a modal dialog.

Checks that the currently open modal has the expected title.

Examples:

Sfdc.VerifyModalTitle("New Lead");

Sfdc.VerifyModalTitle(title)

Parameters:

Name Type Description
title string Expected modal title text.

Returns:

boolean: true if the modal title matches, false otherwise.

VerifyRecordTitle

Verify the record page header: entity type and record name.

Checks that the page header shows the expected entity type (e.g. Account, Lead) and record name.

Examples:

Sfdc.VerifyRecordTitle("Account", "Acme Corp");

Sfdc.VerifyRecordTitle(entityName, recordName)

Parameters:

Name Type Description
entityName string Expected entity label (e.g. Account, Lead, Opportunity).
recordName string Expected record name.

Returns:

boolean: true if both entity type and record name match, false otherwise.