Know more about Automated Testing in Salesforce
Automated testing is the testing of the software through the specialized tools, which includes performing the following steps: start, initialization, execution, receiving and analysis of the test result.
Selenium is a tool specifically designed to conduct automated testing of web applications in various browsers and within various platforms. It should be noted that any routine actions performed in the browser can be automatically tested using Selenium, not only web applications.
Selenium supports functional and regressive testing.
The main types of locators in Selenium are: ID, ClassName, Name, TagName, LinkText, PartialLinkText, Xpath, CSS Selector, DOM.Xpath is a declarative query language for elements of an XML or XTHML document. It navigates the document based on its logical structure and hierarchy.
- To automate tests on the SF platform, we use the Intelij Idea development environment
- All the tests are related and we use Maven
- pom.xsml is the configuration file of our project
- To write auto tests, we have to use salesforce libraries. Maven automatically downloads them and adds them into our project
- All libraries and their related elements should be enclosed into the Dependencies tag.
- To write auto tests we need junit and selenium webdiver java
- Next, we need to import our changes: click on the link in the lower right corner to Import Changes
- Go to the src folder->test->java, press new package, and define the folder name of our project. We need to make sure that all projects have unique names
In our example, we use Xpath to search elements – we have used it for simplicity although it is not the most reliable way to find the elements. In most cases, it’s better to use unique names as locators.
How to get Xpath for particular element:
- Open the inspector (F12) to find the desired element on the page, click on it;
- After the element is selected in the inspector, right-click on the selected element in the inspector;
- Copy the Xpath element,
- Paste the Xpath into your source where you use driver.findElement (By.xpath (“”)) command.
In our example below, we will log in to the community and create an Idea. For that, we create a Main class containing steps for creating an idea in the Community. We use the AC Enterprise Ideas with Lightning Experience support component v1.28mar19 / 1.28.0
We use the following techniques to post an Idea:
- To find appropriate fields to insert text we use driver.findElement(By.xpath(“”)).sendKeys(“”)
- To find buttons or links to click we, use the driver.findElement(By.xpath(“”)).click()
- To find a drop-down list and select a value from the list, we use
WebElement select = driver.findElement(By.xpath (“”));
List<WebElement>sekect_li = select.findElements(By.tagName (“li”));
- To set the delay in execution, we use the Thread.sleep()
See full source code below
Salesforce Experience Cloud Winter’21 Release Features Overview
The Winter’21 Release is on its way and will delight Admins and Developers with its new features and updates! Here’s the quick overview of the upcoming Winter’21 Release features and functionalities for Salesforce Communities by the AC team.
COMMUNITY GUIDE FOR ABSOLUTE BEGINNERS 2
Here we talk about how to brand your community and make it unique and interesting. You will create your first page and see how it can be added to the Navigation Menu.
What’s new for Salesforce Communities this Winter 20 release?
Are you ready for Winter? No, not in that sense you have to take out all your warm clothes and get ready your sleds, but for the Salesforce Winter 20 Release! And we are ready to slightly open the curtain and tell you what new features await for us in the coming Winter 20 Release for the Community Cloud.