An automated URL testing tool that runs on GitHub Actions, tests random URLs for console errors, and checks for element existence on specific pages.
- 🔄 Tests random URLs from a configurable JSON file
- 🐛 Captures console errors and network failures
- 🎯 Tests for specific element existence on hand-coded URLs
- 📊 Generates HTML and JSON reports
- 🚀 Runs automatically on GitHub Actions
- 📄 Deploys reports to GitHub Pages
-
Install dependencies:
npm install
-
Configure GitHub Pages:
- Go to your repository Settings > Pages
- Set Source to "GitHub Actions"
-
Configure URLs and tests:
- Edit
urls.jsonto add/remove URLs for random testing - Edit
config.jsonto modify:randomUrlCount: Number of random URLs to test each runelementTests: Array of element existence tests
- Edit
Contains an array of URLs that will be randomly selected for testing:
{
"urls": [
"https://example.com",
"https://another-site.com"
]
}{
"randomUrlCount": 10,
"errorWhitelist": {
"consoleErrors": [
"CORS",
"Cross-Origin",
"blocked by CORS policy",
"google-analytics",
"AdBlock"
],
"networkErrors": [
"favicon.ico",
"robots.txt",
"ads",
"analytics"
]
},
"elementTests": [
{
"url": "https://example.com",
"selector": ".main-content",
"description": "Main content area"
}
]
}The errorWhitelist feature allows you to ignore common, non-critical errors:
- consoleErrors: Array of strings to match against console error messages
- networkErrors: Array of strings to match against failed network request URLs
- Matching is case-insensitive and uses substring matching
npm startThis will:
- Select random URLs from
urls.json - Test each URL for console errors and load time
- Run element existence tests from
config.json - Generate reports in
./reports/directory
The workflow runs:
- Every 6 hours automatically
- On push to main branch
- Can be triggered manually
Reports are automatically deployed to GitHub Pages at: https://[username].github.io/[repository-name]/
- HTML Report: Visual dashboard with test results (
reports/index.html) - JSON Report: Raw data for programmatic access (
reports/results.json)
- Modify the user agent in
test-runner.js - Adjust timeout values for slow sites
- Add more sophisticated element tests
- Customize the HTML report styling