6. Browsers YAML

A typical cross-browser test involves running your code on multiple browsers. Specifying them in the form of what is referred as “Selenium capabilities” and managing them becomes complex as it requires too much of code.

Cross-browser-tests-runner provides you with a compact and smart format in which you can specify the browsers. This helps you manage the browsers to be used in your tests more efficiently.

6.1. Format

6.1.1. Example

        Chrome x64:
          "45.0-49.0, 54.0":
            resolution: 1920x1200
        Dolphin Mobile:
            Android Nexus 9:
        Maxthon Mobile:
            Android Nexus 9:
              resolution: 1536x2048
    OS X:
      El Capitan:
            resolution: 2560x1440
        iPhone 6s Plus Simulator, iPad Pro Simulator:

6.1.2. Variations

The example above illustrates 3 variations of the format. Desktop Browsers

      {Os Version}:
          {Browser Versions}:
            {Properties} Mobile Browsers

      {Os Version}:
          {Browser Versions}:
              {Properties} Single-Version Native Mobile Browsers

There are cases where a mobile device has exactly one browser that either has exactly one version or has a null version. In such cases, the browser details must be skipped, and the format looks like the following:

      {Os Version}:

6.1.3. Parameters

Parameter Values
Platform BrowserStack, SauceLabs, CrossBrowserTesting
Test Type JS, Selenium
OS Any of the OSes specified in platform-specific configuration for the given Platform and Test Type e.g. node_modules/cross-browser-tests-runner/conf/browserstack-conf.json for BrowserStack
OS Version Any of the versions available for the chosen OS in platform-specific configuration
Browser Any of the browsers available for the chosen OS Version in platform-specific configuration
Browser Versions A comma-separated list of versions from those available for the chosen Browser in platform-specific configuration. As can be seen in the example above, a range of versions can be specified e.g. 12.0-19.0.
Devices A comma-separated list of devices from those available for the chosen Browser in platform-specific configuration
Properties Capabilities like resolution, orientation etc. from those available for the chosen Browser/Device in platform-specific configuration. See Properties for details.

NOTE: Please use double quotes around numeric values to avoid unwanted errors caused by the YAML parser. Properties

Property Values BrowserStack SauceLabs CrossBrowserTesting
deviceType phone tablet
resolution string type
orientation portrait landscape
isPhysicalDevice true false

6.2. Multiple Copies

You can create this file anywhere in your project, and you can have multiple such files if you have various tests, with each using different sets of browsers.

6.3. Samples