The Salesforce1 mobile app is an enterprise-class app that provides users on phones or tablets with instant access to a company’s customer relationship management (CRM) data. Additionally, the Salesforce1 mobile application enables users to retrieve and update organization data. Before deciding to automate testing of the Salesforce1 application using standard mobile automation tools like Appium or Native Framework (e.g., Espresso for Android & XCUITest for iOS), there are a few challenges that enterprise customers should consider.
Hybrid App Challenges
Salesforce1 is a hybrid app by nature. All challenges associated with hybrid app automation also apply to Salesforce1. There are some native components and some components developed in Html5. Many components cannot be identified in automation.
Three key challenges of working on hybrid app automation vs. native app are:
Switching context in different frameworks
If you are automating the Salesforce1 app for the Android platform using Espresso Native Framework, no separate code is needed to write for switching context from Native to WebView. Instead, you simply implement the “onWebView ()” method and perform whatever actions or verifications are needed. It offers a powerful and fast way to interact with the elements because Espresso test needs to write inside your application codebase. As such, users can access most of the elements, including any custom controls.
However, Espresso is only available for the Android platform; iOS requires a separate framework called XCUITest. Handling WebView in the XCUITest framework is tricky. It does not support a direct way to locate the element using CSS or Xpath-based strategies that are generally used in web automation. Additionally, WebView in iOS will only open in Safari, so you need an instance of Safari in your test to work with web elements.
If you want to get maximum reusability from one code base to automate for various platforms, Appium could be the better option compared to native frameworks for both native and hybrid apps. Appium API supports context switch between native to web and web to native.
Can’t get debug build
Salesforce doesn’t provide any debug Android package kit (APK). Users are dependent on the Play Store App, which can’t be instrumented due to security reasons. As such, Salesforce cannot identify many objects in the mobile app.
In Android, Appium requires a debug build in order to switch context to WebView from the native container. In this case, you may need to work with the development team to do the required changes in application source code to make WebView accessible for outside users. This is not required in iOS.
Salesforce Forms are dynamic in nature. As such, users can’t depend on xpath or an index-based locator strategy. Instead, users should use a label or relative locator strategy.
Using an open-source framework like our partner’s QMetry Automation Framework, which has in-built support for Salesforce applications, helps minimize efforts to handle complex form filling and provides label-based locator strategies. It also has in-built components to handle various complex controls like grid, selector, date picker and others.
Many times on Android, Salesforce won’t allow a user to take a screenshot due to Android security features. When this happens, you may need to work with the developer to disable the Android security flag or rely on a third-party screenshot solution like Screenshot Ultimate to solve the problem.
The Salesforce1 app performance on mobile platforms is a little slow. As such, your script may time out and fail. When designing your automation framework, you also need to account for the fact that the Salesforce platform is very data-heavy. Not having the right automation framework may cause failures. Following are tips to ensure better performance while automating Salesforce1:
Finalizing the right automation framework for the Salesforce Mobile App requires a detailed review and analysis of your applications and business objectives. Apexon can help identify the best automation strategy to get the most optimal coverage for your specific testing needs on Salesforce.