addBrowser method
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.
- browserInfo_chrm
- Type:ChromeEmulationInfo
An object that defines the attributes of the browser and the viewport.
- browserInfo_ios
- Type:IOSDeviceInfo
An object that defines the attributes of the browser and the viewport.
- browserInfo_obj
- Type:
{ deviceName: | DeviceName | "BlackBerry Z30" | "Blackberry PlayBook" | "Galaxy A5" | "Galaxy Note 10" | "Galaxy Note 10 Plus" | "Galaxy Note 2" | "Galaxy Note 3" | "Galaxy Note 4" | "Galaxy Note 8" | "Galaxy Note 9" | "Galaxy S10" | "Galaxy S10 Plus" | "Galaxy S3" | "Galaxy S5" | "Galaxy S8" | "Galaxy S8 Plus" | "Galaxy S9" | "Galaxy S9 Plus" | "Kindle Fire HDX" | "LG G6" | "LG Optimus L70" | "Laptop with HiDPI screen" | "Laptop with MDPI screen" | "Laptop with touch" | "Microsoft Lumia 550" | "Microsoft Lumia 950" | "Nexus 10" | "Nexus 4" | "Nexus 5" | "Nexus 5X" | "Nexus 6" | "Nexus 6P" | "Nexus 7" | "Nokia Lumia 520" | "Nokia N9" | "OnePlus 7T" | "OnePlus 7T Pro" | "Pixel 2" | "Pixel 2 XL" | "Pixel 3" | "Pixel 3 XL" | "Pixel 4" | "Pixel 4 XL" | "iPad" | "iPad 6th Gen" | "iPad 7th Gen" | "iPad Air 2" | "iPad Mini" | "iPad Pro" | "iPhone 11" | "iPhone 11 Pro" | "iPhone 11 Pro Max" | "iPhone 4" | "iPhone 5/SE" | "iPhone 6/7/8" | "iPhone 6/7/8 Plus" | "iPhone X" | "iPhone XR" | "iPhone XS" | "iPhone XS Max"; screenOrientation?: ScreenOrientation | "landscape" | "portrait"; };
An object that defines the attributes of the browser and the viewport.
{ deviceName: | DeviceName | "BlackBerry Z30" | "Blackberry PlayBook" | "Galaxy A5" | "Galaxy Note 10" | "Galaxy Note 10 Plus" | "Galaxy Note 2" | "Galaxy Note 3" | "Galaxy Note 4" | "Galaxy Note 8" | "Galaxy Note 9" | "Galaxy S10" | "Galaxy S10 Plus" | "Galaxy S3" | "Galaxy S5" | "Galaxy S8" | "Galaxy S8 Plus" | "Galaxy S9" | "Galaxy S9 Plus" | "Kindle Fire HDX" | "LG G6" | "LG Optimus L70" | "Laptop with HiDPI screen" | "Laptop with MDPI screen" | "Laptop with touch" | "Microsoft Lumia 550" | "Microsoft Lumia 950" | "Nexus 10" | "Nexus 4" | "Nexus 5" | "Nexus 5X" | "Nexus 6" | "Nexus 6P" | "Nexus 7" | "Nokia Lumia 520" | "Nokia N9" | "OnePlus 7T" | "OnePlus 7T Pro" | "Pixel 2" | "Pixel 2 XL" | "Pixel 3" | "Pixel 3 XL" | "Pixel 4" | "Pixel 4 XL" | "iPad" | "iPad 6th Gen" | "iPad 7th Gen" | "iPad Air 2" | "iPad Mini" | "iPad Pro" | "iPhone 11" | "iPhone 11 Pro" | "iPhone 11 Pro Max" | "iPhone 4" | "iPhone 5/SE" | "iPhone 6/7/8" | "iPhone 6/7/8 Plus" | "iPhone X" | "iPhone XR" | "iPhone XS" | "iPhone XS Max"; screenOrientation?: ScreenOrientation | "landscape" | "portrait"; };
- 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.