bstack-a11y-automation-report
v1.0.1
Published
Generate accessibility reports from BrowserStack TestHub builds
Downloads
6
Maintainers
Readme
BrowserStack Accessibility Report Generator
A Node.js package to generate accessibility reports from BrowserStack Accessibility Automation Runs. This tool fetches accessibility test results and generates a comprehensive PDF report with detailed insights into accessibility issues and WCAG violations.
Prerequisites
- Node.js >= 18
- A BrowserStack account and access to BrowserStack Accessibility Automation
Installation
npm install bstack-a11y-automation-reportConfiguration
You need to provide your BrowserStack credentials and Testhub build ID. This can be done in two ways:
1. Environment Variables
export BROWSERSTACK_USERNAME="your_username"
export BROWSERSTACK_ACCESS_KEY="your_access_key"
export TESTHUB_BUILD_ID="your_build_id"2. YAML Configuration
Create a file named accessibility_report.yml in your project root:
userName: your_username
accessKey: your_access_key
buildId: your_build_idNote: Environment variables take precedence over YAML configuration.
Usage
Command Line
npx generate-accessibility-reportProgrammatic Usage
const { generateAccessibilityReport } = require('browserstack-accessibility-report');
async function main() {
try {
const result = await generateAccessibilityReport();
if (result.success) {
console.log('Report generated successfully!');
} else {
console.error('Error:', result.message);
}
} catch (error) {
console.error('Unexpected error:', error.message);
}
}
main();Output
The tool generates:
- A PDF report containing:
- Executive summary
- Detailed accessibility issues with severity levels
- WCAG compliance statistics
- Test environment details
- A temporary CSV file (automatically cleaned up after PDF generation)
Troubleshooting
Common Issues
Authentication Errors
- Verify your BrowserStack credentials
- Ensure environment variables are properly set
- Check YAML configuration file permissions
Build ID Issues
- Get the TestHub build ID from console or browserstack.debug.log file
- Ensure the build has completed running
- Verify accessibility tests were included in the build
PDF Generation Errors
- Ensure Node.js version is 18 or higher (PDF generation may fail with lower versions)
- Check system memory availability
- Ensure write permissions in the output directory
- Verify Puppeteer installation
Configuration File Not Found
- Ensure you are in the correct directory when executing the test command
- The
accessibility_report.ymlfile should be present at the root of your project - Verify the YAML file has the correct permissions
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
Please ensure your PR includes:
- Detailed description of changes
- Updated tests if applicable
- Updated documentation
License
MIT
Support
For support, please:
- Check the troubleshooting guide
- Open an issue on GitHub
- Contact BrowserStack support for account-related issues
