addBrowser method

Class: ConfigurationPlatform: PuppeteerLanguage: JavaScript SDK:

Request that the checkpoint be rendered by the Ultrafast Grid using a particular target desktop or mobile device browser.

The following types of targets can be specified by passing different types of parameters:

  • Desktop browser: The page is rendered using a desktop browser you specify. The set of supported browsers is defined by the enum browsertype. To request a browser from this list pass a DesktopBrowserInfo object, as shown for parameter below. You can also request a browser directly using the parameter as shown below.
  • Emulated mobile device: The page is rendered using Chrome device emulation. The set of supported devices is defined by the enum devicename. To request a device from this list pass a chromeEmulationInfo object, as shown for parameter below.
  • Simulated iOS mobile device: The page is rendered using a Safari browser running on a mobile device simulator. The set of supported devices is defined by the enum iosdevicename. To request a device from this list pass an iosDeviceInfo object, as shown for parameter below.

When requesting a Desktop browser you also specify the required viewport size. When specifying a mobile device the viewport size is based on the device screen size, and you simply specify if you want to render using portrait (vertical) or landscape (horizontal) screen orientation.

You may define multiple targets with different browsers/devices and viewports/orientations by calling this method as many times as required. Eyes will produce a test results for each such configuration. Alternatively, pass a list of browsers and devices to the method addBrowsers.

Syntax

let configval = config.addBrowser(browserInfo_dsktp);

let configval = config.addBrowser(browserInfo_chrm);

let configval = config.addBrowser(browserInfo_ios);

let configval = config.addBrowser(browserInfo_obj);

let configval = config.addBrowser(width, height, name);

let configval = config.addBrowser(width, height);

Parameters

browserInfo_dsktp
Type:DesktopBrowserInfo

An object that defines the attributes of the browser and the viewport.

DesktopBrowserInfo

browserInfo_chrm
Type:ChromeEmulationInfo

An object that defines the attributes of the browser and the viewport.

ChromeEmulationInfo

browserInfo_ios
Type:IOSDeviceInfo

An object that defines the attributes of the browser and the viewport.

IOSDeviceInfo

browserInfo_obj
Type:
{
  deviceName: DeviceNamePlain;
  screenOrientation?: ScreenOrientationPlain;
};

An object that defines the attributes of the browser and the viewport.

{
  deviceName: DeviceNamePlain;
  screenOrientation?: ScreenOrientationPlain;
};

Type definitions

DeviceNamePlain
This type allows passing strings instead of enumerated values, for the list of enum values see DeviceName.
ScreenOrientationPlain
This type allows passing strings instead of enumerated values, for the list of enum values see ScreenOrientation.
width
Type:number

The width of the browser viewport for this target. The maximum viewport width for all browsers is 5120. If this limit is exceeded, then execution of the checkpoint will fail.

Use this in conjunction with the parameter.

height
Type:number

The height of the browser viewport for this target. There is no height limit.

Use this in conjunction with the parameter.

name
Type:BrowserType [Optional ]

The type of browser for this target.

    suiteConfig = new Configuration() 
        .addBrowser(viewPortWidth, viewPortHeight, BrowserType.CHROME)  
/* ... other configurations */  ; 
    /*
     * Assign the configuration to all newly created Eyes instances
     */
    eyes = new Eyes(runner);
    eyes.setConfiguration(suiteConfig);

Return value

Type: Configuration
The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

Remarks

By default, the entire page is rendered. The viewport width and height parameters impact the baseline that is chosen, unless the baseline environment configuration has been provided. The viewport passed to the Eyes.open method does not impact the baseline used, but could impact the page layout if the page has any viewport size-sensitive factors such as HTML, CSS or Javascript.