Updating UI Tests for the Spring ’20 App Launcher

Since release Spring ’20 Patch 5, the behavior of the App Launcher has changed as described in this Release Note. If you have automated UI tests using this feature, you will have to adapt your test scripts. In this post I will give an example how to fix it when using Selenium.

Not familiar with Selenium WebDriver? It is the de-facto standard open-source tool for testing web applications like the Salesforce app. Learn more about Selenium WebDriver on its homepage or this Wikipedia article. This 5 Minute Getting Started Guide leads you through the first steps to run tests automatically. In June 2013 the tool was also the topic of this Salesforce Developer blog post.

Below is a screenshot of the App Launcher in the upper left corner, marked by a red circle:


Prior to the Spring ’20 Patch 5, clicking the App Launcher icon would have opened the dialog box straight away:



Now you’ll notice that clicking the App Launcher will open a combo box instead:





For any existing automated UI test, clicking on the icon will continue to work but the script will eventually get stuck because it expects the old dialog to appear. An elaborate fix would be to enter a value in the search field and then click on the desired item is the list. There is, however, a much easier way to fix this: let your automated scripts click on the “View All” link at the bottom, noted here with the red circle:





Once you click this link, you are presented with the old dialog depicted above. In other words: just insert a click on the link and continue with the same code you had been using before.

Now let’s look at an example of how to implement this fix using Selenium.

The next code snippet assumes you have already such a helper method in place. Just insert line 5 to bring up the old dialog and you are almost(!) back in business:

public void navigateViaAppLauncher(By element) {
    // your old code opening the App Picker
    ...
    
    jsClick(By.xpath("//button[text()='View All']"));
    
    // your old code continues here
    ...
}

Please note: the method jsClick(..) is referring to code sample 3 in this Knowledge article.

Why only “almost” back in business? Well, it’s important to remember locators of web elements tend to change from release to release, and that’s what remains to be done. Here’s an example using an XPath locator for clicking on “Accounts”.

navigateViaAppLauncher(By.xpath("//a[@data-label='Accounts']"));

In case you have not yet introduced such a helper method, here is a simple implementation:

public void navigateViaAppLauncher(By element) {
   driver.findElement(By.xpath("//nav[contains(@class,'appLauncher')]//button")).click();
   jsClick(By.xpath("//button[text()='View All']"));
   jsClick(element);
}

Please feel free to rename and modify this helper method as you see fit, because your needs will likely be different.

About the Author

Georg Neumann is a test automation aficionado for 20+ years and therefore intimately familiar with Selenium since version 1. He is part of the Prerelease Business Scenario Testing (BST) program run by Salesforce. The BST program offers qualified customers the opportunity for prerelease testing of their Salesforce application. As part of the program, this team executes a subset of customer automated UI tests against a copy of their sandbox org on a pre-release instance. Contact your account team if you are interested in learning more about BST. Follow Georg on Trailblazer or LinkedIn.

Source: Salesforce