Capturing Multiple Assets Hosts
In the SmartUI SDK, the allowedHostnames
option is used to configure the capture of assets from specific hostnames during UI testing. By default, SmartUI captures only assets that are hosted on the same domain as the snapshot location. For example, if snapshots are taken on https://xyz.com
, assets hosted on https://cdn.xyz.com
will not be captured unless explicitly specified. The allowedHostnames
configuration allows you to define multiple hostnames, ensuring assets from those sources are included during test execution.
Purpose of allowedHostnames
The primary purpose of the allowedHostnames
is to allow users to specify which external domains or subdomains should be trusted for asset capture. This is particularly useful when assets are hosted across multiple servers or CDNs, and you want to ensure that the complete set of resources required for rendering a page is captured during your tests.
Configuration File Structure
The allowedHostnames
configuration option can be defined in your config file for SmartUI. You need to explicitly list each hostname from which assets should be captured. The SmartUI configuration file follows a JSON structure. Below is a sample configuration file:
{
..// mobile or web configurations...
"allowedHostnames": ["cdn.xyz.com"]
}