Learn How To Use Include/Exclude Rules

When you want to test only a subset of your UI states, you can use Include and Exclude rules.

These rules can be set as options in your screener.config.js file.


  1. Project Rules
  2. Browser-specific Rules
  3. Resolution-specific Rules

Project Rules

includeRulesOptional array of regular expressions to filter states by. Rules are matched against state name. All matching states will be kept.

Example of using the includeRules option:

// screener.config.js
module.exports = {
  ...
   
  includeRules: [
    /^Component/    // RegExp expression
  ]
}

excludeRulesOptional array of regular expressions to filter states by. Rules are matched against state name. All matching states will be removed.

Example of using the excludeRules option:

// screener.config.js
module.exports = {
  ...
   
  excludeRules: [
    /^Component/    // RegExp expression
  ]
}

Browser-specific Rules

You can use include/exclude rules to filter what UI states are tested in a particular browser.

For example, to exclude a UI state from being tested in IE11 only:

// screener.config.js
module.exports = {
  ...
   
  browsers: [
    {
      browserName: 'internet explorer',
      version: '11',
      excludeRules: /^Component/
    }
  ]
}

Resolution-specific Rules

You can use include/exclude rules to filter what UI states are tested in a particular resolution.

For example, to exclude a UI state from being tested in 768x1024 resolution only:

// screener.config.js
module.exports = {
  ...
   
  resolutions: [
    {
      width: 768,
      height: 1024,
      excludeRules: /^Component/
    }
  ]
}

Got Questions? Ask Us