Cross-Browser and Cross-Platform Scripting
An Eggplant Functional Functional script can typically be used across all browsers on all underlying operating systems with little or no modification. This is because the script simply describes the user workflow, which is always the same.
The vast majority of reference images can also be reused across all browsers (e.g., Chrome, Firefox, Safari, Internet Explorer, and Opera) on all operating systems (e.g., Windows 7, Windows 8, Mac, and Linux). But there are two situations in which reference images may not be re-usable in all environments:
- Different browsers render fonts differently, so text search (rather than image search) should be used as described below.
- The actual browser controls (e.g., the refresh button) are different for each browser. So these specific reference images are different for each browser.
To facilitate cross-browser testing, Eggplant Functional supports integration with Sauce Labs. Sauce Labs makes it easy to test a multitude of Browser and OS combinations. Click Here for more information.
Best Practices for Cross-Browser and Cross-Platform Scripting
This document presents best practices for efficient cross-browser scripting. In summary:
- Use the Smooth search type for images by default.
- Use text searches, rather than image searches, for interacting with text.
- Separate out core code from OS-specific code for easier test creation.
- Run an environment setup script at the start of every test.
- Run your test from a primary suite.
- Create a naming convention for SUTs.
- Use keyboard commands wherever possible to reduce the need for image capture.
Set the Default Search Type to Smooth
Images that don’t contain any text only need to be captured once and work across most major web browsers. You should set your default search type to Smooth in the Viewer Preferences as shown below:
This is proven to handle the small variations between platforms robustly. In cases where you need to interact with text, you should use optical character recognition (OCR), as it is not affected by text being rendered differently across different browsers.