Connect & Get help from fellow developers on our Discord community.
Ask the Community
Configuration options for automated accessibility testing
Customize accessibility testing in automated tests.
Configuration options
The following table lists the keys you can use to configure accessibility testing:
| Use-case | Key | Description | Values |
|---|---|---|---|
| Specify WCAG version |
wcagVersion(add under accessibilityOptions) |
Specify the WCAG ruleset that is targeted during automatic issue detection. |
wcag22aaa, wcag22aa, wcag22a, wcag21aaa, wcag21aa, or wcag21a.Default is wcag21aa. |
| Include or exclude best practice issues |
bestPractice(add under includeIssueType,nested within accessibilityOptions) |
Issues marked as best practices aren’t Accessibility guideline violations, but resolving them will improve the overall user experience. |
true or false.Default is true. |
| Scanner processing timeout at the end of a test case |
scannerProcessingTimeout(add under accessibilityOptions) |
Set a timeout for scanner processing to completely stop processing when a test case ends. | Specify the timeout value in seconds. The default is 360. There is no maximum limit. |
| Platform selection | accessibility |
Enables accessibility testing only on specific device and OS combinations. Add the accessibility flag at the device level in the platforms section for YAML and under capabilities section for JavaScript. |
true or false.This is an optional flag that overrides the accessibility flag set at the root level. |
| Include test cases | includeTagsInTestingScope |
Test cases with these tags, annotations or groups will be included in the accessibility testing scope. Learn to include specific test cases in accessibility testing scope. | List of test case tags |
| Exclude test cases | excludeTagsInTestingScope |
Test cases with these tags, annotations or groups will be excluded from the accessibility testing scope. Learn to exclude specific test cases in accessibility testing scope. | List of test case tags |
| Include or exclude issues that need manual review |
needsReview(add under includeIssueType,nested within accessibilityOptions) |
Include or exclude issues that require manual review. Issues that need manual review are flagged as Needs review in your test reports. For more information, see Managing Needs Review. |
true or false.Default is true. Set to false to exclude these issues from the report. |
| Start and stop automatic App Accessibility scans |
autoScanning(add under accessibilityOptions) |
Enable or disable automatic accessibility scans. This allows you to run targeted accessibility checks on specific screens, workflows, or components in your mobile app. Learn more about targeted scans. |
true or false.Default is true. Set to false to disable automatic scans. |
| Generate Screen Reader Report |
screenReaderAutomationReport(add under accessibilityOptions) |
Generate a detailed report highlighting how your app’s UI is interpreted by screen readers. For more information, see Generating a Screen Reader Report. |
true or false.Default is false. Set to true to generate the report. |
| Exclude rules |
excludeRule(add under accessibilityOptions) |
Excludes specific accessibility rules from automated testing by specifying their rule IDs. | List of rule IDs. For a complete list of rule IDs, refer to the Accessibility rule mapping. |
| Exclude rule categories |
excludeRuleCategory(add under accessibilityOptions) |
Excludes entire categories of accessibility rules from automated testing by specifying their category names. All rules within the category are excluded. | List of category names. For a complete list of category names, refer to the Accessibility rule mapping. |
If you add a rule to the excludeRule list and its corresponding category to the excludeRuleCategory list, the category setting takes precedence and the entire category is excluded.
Example
The following code snippets show how to add the configuration options to your test suite:
...
accessibility: true # Root level accessibility flag.
accessibilityOptions:
wcagVersion: wcag21aaa # Default: wcag21aa
scannerProcessingTimeout: 20 # Default: 10
includeTagsInTestingScope: ["accessibility", "workflow"] # Tags to include test cases
excludeTagsInTestingScope: ["old"] # Tags to exclude test cases
autoScanning: true # Disable automatic accessibility scans. Default: true
screenReaderAutomationReport: true # Enable Screen Reader Report generation
excludeRule: ["interactive-element-label", "non-text-contrast"] # List of rule IDs to be excluded from the scan
excludeRuleCategory: ["touch-target-size"] # List of rule categories to be excluded from the scan
includeIssueType:
bestPractice: true # Include best practice issues. Default: true
needsReview: true # Include issues that need manual review. Default: true
platforms:
- platformName: android
deviceName: Samsung Galaxy S22
platformVersion: 12.0
accessibility: true # Device level accessibility flag. Testing will be conducted on this device combination
- platformName: android
deviceName: Google Pixel 6
platformVersion: 13.0
accessibility: false # Device level accessibility flag. Testing will not be conducted on this device combination
...
...
services: [
['browserstack', {
...
accessibility: true, // Root level accessibility flag.
accessibilityOptions: {
wcagVersion: 'wcag21aaa', // Default: wcag21aa
scannerProcessingTimeout: 20, // Default: 10
includeTagsInTestingScope: ["accessibility", "workflow"], // Tags to include test cases
excludeTagsInTestingScope: ["old"], // Tags to exclude test cases
autoScanning: true, // Disable automatic accessibility scans. Default: true
screenReaderAutomationReport: true, // Enable Screen Reader Report generation
excludeRule: ["interactive-element-label", "non-text-contrast"], // List of rule IDs to be excluded from the scan
excludeRuleCategory: ["touch-target-size"], // List of rule categories to be excluded from the scan
includeIssueType: {
bestPractice: true // Include best practice issues. Default: true
needsReview: true // Include issues that need manual review. Default: true
}
},
}],
],
capabilities: [{
'bstack:options': {
deviceName: 'Samsung Galaxy S22',
osVersion: "12.0",
accessibility: true, // Device level accessibility flag. Testing will be conducted on this device combination
}
}, {
'bstack:options': {
deviceName: 'Google Pixel 6',
osVersion: "13.0",
accessibility: false, // Device level accessibility flag. Testing will not be conducted on this device combination
}
}],
...
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!