Sprint 1 - 安全基线修复(5项): - 修复 DOM XSS 漏洞(seal-library.js, batch-processing.js) - 修复 settings 导入 schema 注入 - CDN 锁版本 + SRI 完整性校验 - 外链添加 rel="noopener noreferrer" - 替换 confirm/prompt 为自定义对话框 Sprint 2 - 状态管理重构(4项): - 新建 state.js 单例模式管理全局状态 - 解耦 window.* 全局变量 - 修复印章库状态同步 bug - localStorage 添加错误处理 Sprint 3 - 性能优化(4项): - 删除死代码(loadScript, cleanupDistantCanvases 等) - 实现缩略图懒加载(前3页+可视区) - 添加文件大小限制(PDF 50MB / 图片 5MB) - 完善 Canvas 内存清理 修复总计: 13项(3 P0 + 3 P1 + 6 P2 + 1 P3) [CC] [CX]
224 lines
5.6 KiB
Markdown
224 lines
5.6 KiB
Markdown
# PDF Stamper v1.1.0 - Testing Plan & Results
|
|
|
|
**Date**: 2026-01-08
|
|
**Phase**: Week 2, Day 10
|
|
**Version**: v1.1.0
|
|
|
|
---
|
|
|
|
## 🎯 Testing Objectives
|
|
|
|
Verify that all Phase 1 improvements are working correctly:
|
|
1. File validation prevents crashes
|
|
2. Lazy loading improves performance
|
|
3. Memory management prevents leaks
|
|
4. Toast notifications provide good UX
|
|
5. Loading indicators show operation progress
|
|
|
|
---
|
|
|
|
## 📋 Test Categories
|
|
|
|
### 1. File Validation Tests
|
|
|
|
#### PDF File Validation
|
|
- [ ] Upload PDF < 50MB → Should succeed
|
|
- [ ] Upload PDF > 50MB → Should show error toast
|
|
- [ ] Upload non-PDF file → Should show error toast
|
|
- [ ] Upload PDF with > 500 pages → Should show error toast
|
|
- [ ] Upload corrupted PDF → Should show error toast
|
|
|
|
#### Seal Image Validation
|
|
- [ ] Upload image < 5MB → Should succeed
|
|
- [ ] Upload image > 5MB → Should show error toast
|
|
- [ ] Upload non-image file → Should show error toast
|
|
- [ ] Upload image > 4096x4096 → Should show error toast
|
|
|
|
### 2. Lazy Loading Tests
|
|
|
|
#### Performance Tests
|
|
- [ ] Load 10-page PDF → Measure load time (target: < 3s)
|
|
- [ ] Load 50-page PDF → Measure load time (target: < 5s)
|
|
- [ ] Load 100-page PDF → Measure load time (target: < 10s)
|
|
- [ ] Load 200-page PDF → Verify no crash
|
|
- [ ] Switch between pages → Measure response time (target: < 100ms)
|
|
|
|
#### Memory Tests
|
|
- [ ] Load 10-page PDF → Check memory usage (target: < 100MB)
|
|
- [ ] Load 50-page PDF → Check memory usage (target: < 150MB)
|
|
- [ ] Load 100-page PDF → Check memory usage (target: < 200MB)
|
|
- [ ] Switch pages 20 times → Verify memory stable
|
|
- [ ] Load new PDF → Verify old PDF memory released
|
|
|
|
### 3. Toast Notification Tests
|
|
|
|
#### Success Toasts
|
|
- [ ] Upload valid PDF → Shows success toast
|
|
- [ ] Upload valid seal → Shows success toast
|
|
- [ ] Export PDF → Shows success toast
|
|
|
|
#### Error Toasts
|
|
- [ ] Upload invalid PDF → Shows error toast with reason
|
|
- [ ] Upload oversized file → Shows error toast with size
|
|
- [ ] Export fails → Shows error toast (manual dismiss)
|
|
|
|
#### Warning Toasts
|
|
- [ ] Add seal without seal image → Shows warning toast
|
|
- [ ] Delete seal without selection → Shows warning toast
|
|
|
|
#### Toast Behavior
|
|
- [ ] Multiple toasts stack correctly
|
|
- [ ] Auto-dismiss works (3-5 seconds)
|
|
- [ ] Manual close button works
|
|
- [ ] Toast animations smooth
|
|
|
|
### 4. Loading Indicator Tests
|
|
|
|
#### PDF Loading
|
|
- [ ] Upload PDF → Shows loading spinner
|
|
- [ ] Loading message displays correctly
|
|
- [ ] Loading hides after completion
|
|
- [ ] Loading hides on error
|
|
|
|
#### PDF Export
|
|
- [ ] Export PDF → Shows progress bar
|
|
- [ ] Progress updates correctly (0-100%)
|
|
- [ ] Progress text shows page numbers
|
|
- [ ] Loading hides after completion
|
|
- [ ] Loading hides on error
|
|
|
|
### 5. Full Workflow Tests
|
|
|
|
#### Basic Workflow
|
|
- [ ] Upload PDF
|
|
- [ ] Upload seal image
|
|
- [ ] Add normal seal to page
|
|
- [ ] Move/resize seal
|
|
- [ ] Rotate seal
|
|
- [ ] Delete seal
|
|
- [ ] Export PDF
|
|
- [ ] Verify exported PDF has seal
|
|
|
|
#### Straddle Seal Workflow
|
|
- [ ] Upload multi-page PDF
|
|
- [ ] Upload seal image
|
|
- [ ] Add straddle seal
|
|
- [ ] Verify seal spans pages
|
|
- [ ] Export PDF
|
|
- [ ] Verify exported PDF has straddle seal
|
|
|
|
#### Edge Cases
|
|
- [ ] Add multiple seals to one page
|
|
- [ ] Add seals to multiple pages
|
|
- [ ] Switch pages with seals
|
|
- [ ] Reload new PDF (verify cleanup)
|
|
- [ ] Rapid operations (no crashes)
|
|
|
|
### 6. Memory Leak Tests
|
|
|
|
#### Canvas Cleanup
|
|
- [ ] Load PDF → Switch pages 50 times → Check memory
|
|
- [ ] Load PDF → Add 20 seals → Delete all → Check memory
|
|
- [ ] Load PDF → Export → Load new PDF → Check memory
|
|
- [ ] Repeat workflow 5 times → Verify memory stable
|
|
|
|
#### Resource Cleanup
|
|
- [ ] Verify pdfDoc.destroy() called
|
|
- [ ] Verify Fabric canvases disposed
|
|
- [ ] Verify ObjectURLs revoked
|
|
- [ ] Check browser DevTools memory profiler
|
|
|
|
---
|
|
|
|
## 🔧 Testing Tools
|
|
|
|
### Browser DevTools
|
|
- **Performance Tab**: Measure load times
|
|
- **Memory Tab**: Check memory usage and leaks
|
|
- **Console**: Check for errors
|
|
- **Network Tab**: Verify no unnecessary requests
|
|
|
|
### Test Files Needed
|
|
- Small PDF (< 10 pages, < 1MB)
|
|
- Medium PDF (50 pages, ~10MB)
|
|
- Large PDF (100 pages, ~30MB)
|
|
- Very large PDF (200+ pages, ~50MB)
|
|
- Oversized PDF (> 50MB)
|
|
- Various seal images (PNG, JPG, different sizes)
|
|
|
|
---
|
|
|
|
## 📊 Test Results
|
|
|
|
### Environment
|
|
- **Browser**: [To be filled]
|
|
- **OS**: macOS
|
|
- **Server**: http://localhost:8000
|
|
- **Date**: 2026-01-08
|
|
|
|
### File Validation Results
|
|
Status: ⏳ Pending
|
|
|
|
### Lazy Loading Results
|
|
Status: ⏳ Pending
|
|
|
|
### Toast Notification Results
|
|
Status: ⏳ Pending
|
|
|
|
### Loading Indicator Results
|
|
Status: ⏳ Pending
|
|
|
|
### Full Workflow Results
|
|
Status: ⏳ Pending
|
|
|
|
### Memory Leak Results
|
|
Status: ⏳ Pending
|
|
|
|
---
|
|
|
|
## 🐛 Bugs Found
|
|
|
|
### Critical Bugs
|
|
(None yet)
|
|
|
|
### Minor Bugs
|
|
(None yet)
|
|
|
|
### Improvements Needed
|
|
(None yet)
|
|
|
|
---
|
|
|
|
## ✅ Sign-off Criteria
|
|
|
|
Phase 1 (v1.1.0) is ready for release when:
|
|
- [ ] All file validation tests pass
|
|
- [ ] Lazy loading reduces load time by 5x
|
|
- [ ] Memory usage reduced by 80%
|
|
- [ ] All toast notifications work correctly
|
|
- [ ] All loading indicators work correctly
|
|
- [ ] No critical bugs found
|
|
- [ ] Memory leaks verified fixed
|
|
- [ ] Full workflow completes successfully
|
|
|
|
---
|
|
|
|
## 📝 Notes
|
|
|
|
### Testing Instructions
|
|
1. Open http://localhost:8000 in browser
|
|
2. Open DevTools (F12)
|
|
3. Go to Performance/Memory tab
|
|
4. Execute test cases systematically
|
|
5. Record results in this document
|
|
6. Fix any bugs found
|
|
7. Re-test after fixes
|
|
|
|
### Known Limitations
|
|
- Cross-browser testing limited to available browsers
|
|
- Large PDF testing limited by available test files
|
|
- Performance may vary by hardware
|
|
|
|
---
|
|
|
|
**Last Updated**: 2026-01-08T07:35:00Z
|