Cross Browser Testing With The Applitools Ultrafast Grid | Applitools Documentation

Overview

Applitools Ultrafast Grid allows you perform visual testing across multiple browsers and devices in seconds, to make sure that your content is visually perfect on every device, screen size, and browser combination.

Users access your website using many different devices, browsers, and screen sizes. This means that a page may be displayed in dozens of different ways depending on the devices and settings of the user accessing the page. Using Ultrafast Grid you can open a page once, and then almost immediately see how the page would be rendered on dozens of devices and Applitools Eyes can alert you to any visual bugs. This means that you do not need to set up an in house QA lab or use a lab provider and run a test dozens of times to test on each device, browser, and screen setting.

For example, a change to a CSS file may not have any impact when viewing a page using Chrome on a laptop, or on an iOS phone, but the text does not wrap correctly when the page is rendered on a tablet in landscape mode.

Because the navigation runs once, and not on each device, the process is significantly faster and is much more stable than running the test multiple times. Ultrafast Grid eliminates common issues such as network instability or time lag while running a test on multiple devices.

Benefits of the Ultrafast Grid

Using the Ultrafast Grid provides the following advantages:

Auto-Accept Infrastructure Diffs on the Ultrafast Grid

Eyes can automatically detect, validate, and accept visual differences caused strictly by infrastructure changes on the Ultrafast Grid, such as a browser rendering engine or version update, rather than by changes to your application or test. This keeps you focused only on the differences that actually require review.

How the validation works: when a visual difference appears after an infrastructure change, Eyes re-renders the affected checkpoint using the prior browser version from the last successful run. If that re-render still matches the existing baseline, but the difference only appears on the upgraded infrastructure, Eyes treats it as infrastructure-related and auto-accepts it. If the re-render on the prior version also differs from the baseline, the difference isn't infrastructure-related, and Eyes leaves it for you to review.

This check happens per-checkpoint, so a test with several checkpoints can have some diffs auto-accepted and others held for review, depending on what each one traces back to.

Eyes will not auto-accept a test under any of the following conditions:

You can filter your test results for auto-accepted tests by clicking the "Filter test results" and selecting "Has auto-accepted steps" in the "Auto-accepted browser/OS update" field.

If needed, you can easily override and revert any auto-accepted test to the previous baseline by clicking Reject on the desired test and then Save.

Ultrafast Grid workflow

The process works as follows:

  1. Open a web page on a device to generate a baseline.
  2. Ultrafast Grid uses DOM, HTML, CSS file, and other page resources to create checkpoints as they would appear on selected devices and screen sizes.
  3. Applitools Eyes compares the generated checkpoints to baseline images and identifies any visual changes or anomalies that need to be investigated.

Pages are recreated on virtual devices maintained by Applitools, this means that you always have current versions of each device available without needing to maintain an in-house QA lab with multiple devices. As Ultrafast Grid uses cached images and data to recreate screen elements that have not changed, the process requires a fraction of the time and bandwidth that would be needed to run tests separately on each device.

Types of rendering environments

Ultrafast Grid supports the following rendering environments:

When specifying a mobile device the viewport size is based on the device screen size, you can specify whether to render the page in portrait or landscape orientation.

Configuring Tests With the Ultrafast Grid

Select SDK

Cypress uses the Ultrafast Grid by default. Therefore, no extra configuration is required to run tests with the Ultrafast Grid.

You can specify the browsers and devices you'd like to run tests with a few different ways:

cy.eyesOpen

cy.eyesOpen({
    ...
    browser: [
        {width: 800, height: 600, name: 'firefox'},
        {width: 1024, height: 768, name: 'chrome'},
        {width: 1024, height: 768, name: 'ie11'},
        {
            deviceName: 'iPhone X',
            screenOrientation: 'landscape',
            name: 'chrome' // optional, just to make it explicit this is browser emulation and not a real device. Only chrome is supported for device emulation.
        }
    ]
})

applitools.config.js

You can set the browsers globally by using an applitools.config.js file in the root of your project:

module.exports = {
    ...
    browser: [
        {width: 800, height: 600, name: 'firefox'},
        {width: 1024, height: 768, name: 'chrome'},
        {width: 1024, height: 768, name: 'ie11'},
        {
            deviceName: 'iPhone X',
            screenOrientation: 'landscape',
            name: 'chrome' // optional, just to make it explicit this is browser emulation and not a real device. Only chrome is supported for device emulation.
        }
    ]
}

Fluent interface example

The snippet below demonstrates how to use the configuration class fluent to define browsers and emulated devices for the Ultrafast Grid.

Select SDK

Cypress

An example for Cypress is not currently available. The example below is using Selenium for Java

@BeforeSuite
public void beforeTestSuite() {
        // ...
        suiteConfig = new Configuration();
        suiteConfig
            // Visual Grid configurations
            .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.CHROME))
            .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.CHROME_ONE_VERSION_BACK))
            .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.CHROME_TWO_VERSIONS_BACK))
            .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.FIREFOX))
            .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.SAFARI))
            .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.IE_10))
            .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.IE_11))
            .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.EDGE_CHROMIUM))
            .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.EDGE_LEGACY))
            .addBrowser(new IosDeviceInfo(IosDeviceName.iPhone_X, ScreenOrientation.LANDSCAPE))
            .addBrowser(new ChromeEmulationInfo(DeviceName.Galaxy_S5, ScreenOrientation.PORTRAIT))
           // Checkpoint configurations
            // other configurations ....
           .setViewportSize( new RectangleSize(viewPortWidth, viewPortHeight))
                          // Test suite configurations
           .setApiKey(apiKey)
           .setServerUrl(myEyesServer)
           .setAppName(appName)
           .setBatch(new BatchInfo(batchName));
}

@BeforeMethod
public void beforeEachTest(ITestResult result) {
    //  ...
    // Set the configuration values we set up in beforeTestSuite
    eyes.setConfiguration(suiteConfig);
    //  ...
}

You can add as many browser and device configurations as you want. Assign the configuration to the Eyes instance, using eyes.setConfiguration, before starting the test (i.e. before calling eyes.open). Once you configure an Eyes instance to render a set of browser configurations, they apply to all the tests that are run using that Eyes instance and can not be changed.

In the above snippet, we've included the configuration method setViewportSize to illustrate the recommended best practice where a single Configuration object is used to configure the Ultrafast Grid attributes as well as the global Eyes configuration attributes.

Providing a list of browsers and devices

You can provide the required browser configurations as a list using the addBrowsers method. This is useful if, for example, you read the set of devices from a dynamic source like a file or a UI.

Select SDK

Cypress

An example for Cypress is not currently available. The example below is using Selenium for Java

RenderBrowserInfo[] browserList = {
    new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.CHROME),
    new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.CHROME_ONE_VERSION_BACK),
    new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.CHROME_TWO_VERSIONS_BACK),
    new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.FIREFOX),
    new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.SAFARI),
    new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.IE_10),
    new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.IE_11),
    new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.EDGE_CHROMIUM),
    new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.EDGE_LEGACY),
    new IosDeviceInfo(IosDeviceName.iPhone_X, ScreenOrientation.LANDSCAPE),
    new ChromeEmulationInfo(DeviceName.Galaxy_S5, ScreenOrientation.PORTRAIT)
};

suiteConfig = new Configuration();
    suiteConfig
    // Visual Grid configuration
    .addBrowsers(browserList)
    // other configurations ....
    .setViewportSize( new RectangleSize(viewPortWidth, viewPortHeight));

The viewport

When working with the Ultrafast Grid, you specify two types of viewport sizes:

When you run a test without the Ultrafast Grid, the local browser viewport size determines the baseline used for the test. On the other hand, when you run a test using the Ultrafast Grid, it is the rendered viewport size of each browser configuration which determines the baseline used for that browser configuration, and the local browser is only used to determine the resource required to render the page.

In many cases, the value set as the local browser viewport size, is not critical since all elements of the page are available in the DOM irrespective of the viewport size. However, on some sites, the viewport size affects what is downloaded to the browser. For example, consider a site that is responsive and to minimize drawing time, it runs JavaScript that only creates and displays a sidebar menu when the browser is wide. When the browser is narrow, it only displays a hamburger icon and only generates the menu when the hamburger icon is clicked. In this case, if you set a narrow viewport for the local browser, the DOM extracted by the SDK and sent to the Ultrafast Grid includes the hamburger icon element, but not the sidebar menu. If the rendered viewport size is set to a wide value, the layout on the Ultrafast Grid will adjust to include the side menu but the side menu element won't be found in the DOM.

To summarize, if you notice differences in the test results because some DOM elements are missing, make sure that the viewport size you specified for the local browser viewport size is compatible for all the browser configurations of that test. If the browser configurations are not compatible (e.g. they render different layouts with different elements) then run them as separate tests.

Working with Baselines

By default, when running tests using the Ultrafast Grid, every browser configuration uses the baseline implied by the execution environment of that configuration, i.e. the Browser, Viewport size, and Operating system:

If two or more browser configurations are supposed to look the same, then you can use the Eyes baseline environment feature to do cross-browser testing by specifying a common baseline for multiple browser configurations.

Setting up the baseline environment when using the Ultrafast Grid

You can use baseline environments to specify that a specific baseline environment should be used to identify the baseline, instead of the test execution environment. For example, you can assign the name "desktop-browser" to an existing baseline for the Windows/Chrome/1024x768 execution environment. Then you can specify that all the checkpoints should be matched against the "desktop-browser" irrespective of the actual execution environment. For full details on how to use this feature see the article Running cross-environment tests. This article explains how to specify the baseline environment for a browser configuration.

To specify the execution environment for browser configurations, each of the methods that define a browser configuration also supports an optional baseline environment name parameter.

Select SDK

Cypress

An example for Cypress is not currently available. The example below is using Selenium for Java

String desktopBaseline = "desktop baseline";
String mobileBaseline = "mobile baseline";

suiteConfig = new Configuration();
 suiteConfig
 // Visual Grid configuration
   .addBrowser(900, 600, BrowserType.CHROME, desktopBaseline)
   .addBrowser(1024, 786, BrowserType.FIREFOX, desktopBaseline)
   .addBrowser(900, 600, BrowserType.FIREFOX, desktopBaseline)
   .addBrowser(900, 600, BrowserType.IE_10, desktopBaseline)
   .addBrowser(1024, 786, BrowserType.IE_11, desktopBaseline)
   .addBrowser(900, 600, BrowserType.EDGE, desktopBaseline)
   .addDeviceEmulation(DeviceName.iPhone_4, ScreenOrientation.PORTRAIT, mobileBaseline)
   .addDeviceEmulation(DeviceName.Galaxy_S5, ScreenOrientation.LANDSCAPE, mobileBaseline)
    // other configurations ....
   .setMatchLevel(MatchLevel.LAYOUT);

Before running the test, make sure that the environment names you use are defined in the Eyes Test Manager as described in Assign an environment name.

When doing cross browser testing, you should use a match level of LAYOUT. This level focuses on the structure of the page rather than the textual or graphic content, making it more suitable for finding significant differences between browsers.