This document describes how regression test baselines are managed in the Linknode project. Baselines are used to track expected visual appearance, performance metrics, and feature behavior to detect unintended changes.
- Location:
test-baselines/ - Main File:
test-baselines/baseline.json - Format: JSON containing visual snapshots, performance metrics, and feature states
- Retention: 90 days for historical baselines in artifacts
- Version Control: Baselines are tracked in git for consistency
The regression test workflow automatically updates baselines when:
-
Conventional Commits are detected on the main branch:
feat:- New features addedfix:- Bug fixes appliedBREAKING:- Breaking changes introducedstyle:- Significant style changes (when included)refactor:- Code refactoring that may affect behavior
-
Explicit Request via commit message:
- Include
[update-baseline]anywhere in your commit message - Example:
feat: Add dark mode [update-baseline]
- Include
-
Via GitHub Actions (Recommended):
gh workflow run regression-tests.yml -f capture_baseline=true
-
Locally:
npm run baseline:capture
- Automatic: Runs on every push to main branch
- Manual:
npm run baseline:compare
npm run baseline:view- Significant changes trigger baseline update
- Workflow creates a PR with updated baseline
- Review the PR to ensure changes are intentional
- Merge to establish new baseline
- Run capture command (see above)
- Review changes in
test-baselines/ - Commit if changes are expected:
npm run baseline:update git commit -m "chore: Update regression test baseline"
{
"summary": {
"total": 50,
"passed": 45,
"warnings": 3,
"failed": 2
},
"results": [
{
"category": "visual",
"item": "homepage",
"status": "pass|warn|fail",
"difference": "Description of change"
}
]
}- pass: No significant changes detected
- warn: Minor changes within threshold (e.g., < 5% performance difference)
- fail: Significant unexpected changes requiring attention
- Review Before Merging: Always review baseline update PRs carefully
- Document Changes: Include rationale for baseline updates in commit messages
- Regular Updates: Update baselines when making intentional UI changes
- Performance Thresholds: Consider performance variations (±5%) as normal
-
Baseline Not Found
- First run captures initial baseline automatically
- Check if
test-baselines/baseline.jsonexists
-
False Positives
- Performance metrics can vary; consider increasing thresholds
- Visual tests may be affected by font loading; ensure consistent environment
-
Baseline Update PR Not Created
- Verify you're on main branch
- Check if changes meet update criteria
- Manually trigger with
[update-baseline]in commit
# Check baseline file
cat test-baselines/baseline.json | jq '.summary'
# Run comparison with verbose output
npm run baseline:compare -- --verbose
# Force baseline capture
npm run baseline:capture -- --forceThe regression testing workflow:
- Runs on every push to main
- Compares against stored baseline
- Reports results in PR comments
- Creates baseline update PRs when needed
capture_baseline: Set totrueto capture new baselinecompare_only: Set totrueto skip full tests and only compare