7.5 KiB
7.5 KiB
Resource Monitor Testing Guide
Phase 2 Frontend Implementation - Testing Plan
Prerequisites
- Backend monitoring service is running (auto-starts with ComfyUI).
- Python dependencies installed:
psutil,pynvml,py-cpuinfo,torch(VRAM fallback). - ComfyUI server restarted to load backend changes.
- Browser cache cleared (hard refresh: Ctrl+Shift+R or Cmd+Shift+R).
SwissArmyKnife.debug_modeenabled when you need verbose console logs.
Test Checklist
1. Visual Placement & Layout
- Floating glass bar renders ~50px below the main toolbar and remains centered on scroll.
- Wrapper has rounded corners, blur backdrop, and sits above other UI elements (
z-index: 9999). - Monitor tiles appear to the left, Restart button appears on the right with a divider.
- Hover and active states animate smoothly on both the monitors and the restart button.
2. Backend Connection Test
Open browser console (F12) and check:
- No JavaScript errors on page load.
- Debug log shows "Resource Monitor extension setup started" and "inserted as floating bar" when debug mode is on.
- Initial
fetch /swissarmyknife/monitor/statussucceeds; failures must surface as console errors. - Listener registered for
swissarmyknife.monitorevents (watch forMonitor update receivedlogs when data arrives).
3. Monitor Display Test
Expected tiles are driven entirely by backend capabilities:
If psutil is available:
CPUtile shows percentage (0-100%).RAMtile shows GB used with a decimal (e.g.,12.4 GB).Temptile appears only if CPU temperature is reported.
If torch or pynvml is available:
VRAM {index} (Model)tile appears for each detected GPU.GPU {index} (Model)utilization tile appears when pynvml exposes utilization stats.TEMP {index} (Model)appears when GPU temperature is reported.
For multi-GPU systems:
- Additional sets render for GPU 1, GPU 2, etc. Labels include compact model identifiers (e.g.,
3090Ti).
4. Real-Time Update Test
- Tiles update roughly every two seconds without manual refresh.
- Debug logs show
Monitor update receivedpayloads at the same cadence in debug mode. - Induce load (e.g., start a workflow) and confirm the numbers change accordingly.
5. Gradient Fill & Threshold Test
Trigger different load levels and verify the gradient color + fill percentage logic:
| Usage Level | Expected Color (Linear Gradient) |
|---|---|
| 0-49% | Green rgba(34, 197, 94, 0.25) |
| 50-69% | Yellow rgba(234, 179, 8, 0.25) |
| 70-89% | Orange rgba(249, 115, 22, 0.25) |
| 90%+ | Red rgba(239, 68, 68, 0.25) |
- Fill width matches the numeric percentage (use dev tools to inspect the inline
backgroundstyle if needed). - When no percentage is available, tiles revert to the default translucent background.
6. Restart Button Flow
- Default state shows
Restartwith ComfyUI button styling. - On click, button disables + label changes to
Restarting...and a toast appears (severity: warn, detail "Waiting for ComfyUI to become available..."). /swissarmyknife/restartPOST fires (confirm via network tab) and errors are ignored silently if the server drops.- Button remains disabled while
/system_statspolling runs; debug logs show health check attempts every 5 seconds. - When the server responds OK, a success toast appears and the page hard-reloads.
- If the timeout (60 attempts) expires, a warning toast appears and the button re-enables with the original label.
- Any caught error shows an error toast with the message body.
7. API Endpoint Smoke Test
# Get current status
curl http://localhost:8188/swissarmyknife/monitor/status | jq
# Get GPU 0 info
curl http://localhost:8188/swissarmyknife/monitor/gpu/0 | jq
# Clear VRAM (all devices)
curl -X POST http://localhost:8188/swissarmyknife/monitor/clear-vram | jq
# Update monitoring interval to 5 seconds
curl -X PATCH http://localhost:8188/swissarmyknife/monitor/settings \
-H "Content-Type: application/json" \
-d '{"interval": 5}' | jq
Expected responses:
/statusreturnssuccess: trueplushardware+gpupayloads used by the UI./gpu/0returns a detailed entry for the requested device./clear-vramresponds withsuccess: trueand performs the backend cleanup./settingsechoescurrent_settings.intervalwith the updated value.
8. Graceful Degradation
| Missing Dependency | Expected UI Behavior |
|---|---|
| psutil | No CPU/RAM/CPU Temp tiles render, restart button still works. |
| pynvml | GPU utilization + GPU temps are hidden, VRAM tiles render if torch is available. |
| torch + pynvml | No GPU/VRAM tiles render; only CPU tiles (if psutil exists) plus restart. |
| Backend offline | Tiles stay blank (--) and console logs errors, but page continues functioning. |
9. Browser Compatibility
- Chrome / Chromium.
- Firefox.
- Safari.
- Edge.
Confirm that the floating bar respects viewport width (no clipping on smaller windows) and that the restart toasts display across browsers.
10. Styling Regression Pass
- 16px border radius and blur remain consistent.
- Letter spacing on labels is subtle but readable; values use 14px semi-bold font.
- Restart button uses the same red palette as defined in CSS (
#dc3545hover ->#c82333). - Divider pseudo-element (
::before) appears only on the restart button and aligns vertically. - Wrapper maintains drop shadow depth without overlapping default ComfyUI dialogs.
Common Issues & Fix Paths
Monitors never appear
- Check browser console for failed
/statuscalls. - Verify backend monitor service is running (server logs).
- Hit
/swissarmyknife/monitor/statusmanually to ensure JSON is returned. - Clear the browser cache and hard refresh.
Tiles show -- indefinitely
- Confirm backend dependencies (psutil/pynvml/torch) are installed inside the Docker environment.
- Inspect backend logs for sensor access errors.
- In debug mode ensure
Monitor update receivedlogs are flowing. - Validate REST endpoints above return actual numeric values.
Gradient colors never change
- Inspect element and confirm inline
style.backgroundupdates as percentages change. - Ensure the backend is sending non-null
percentfields (inspect REST payload). - Force a workload that crosses multiple thresholds (e.g., launch a heavy workflow or GPU benchmark).
Restart button stays disabled
- Watch the Network tab to ensure
/system_statsis eventually reachable. - Check Docker/container logs to make sure ComfyUI actually restarted.
- Verify toast message (should warn about manual refresh) and re-enable behavior.
- Reload manually, then reproduce with debug logs enabled to capture attempts.
Performance Expectations
- Initial status fetch + DOM build: < 500ms on modern browsers.
- Update cadence: ~2s (matches backend interval, configurable through
/settings). - CPU overhead: < 1% in Chrome DevTools performance captures.
- Memory overhead: < 10 MB total (DOM + JS state).
Wrap-Up / Follow-Up Items
- Capture screenshots of the floating HUD for
docs/web-js/RESOURCE_MONITOR.md(include GPU + CPU heavy scenarios). - Document any backend sensor anomalies in
docs/infrastructure/debug/if issues persist. - File issues for Phase 3 items (Clear VRAM button, visibility toggles, interval slider) as separate tickets once baseline testing passes.