RadiaCode-Spectrometer/ESP32-S3-Touch/_archive_previous_project/COMPREHENSIVE_DIAGNOSTIC_TEST.md

8.3 KiB

🔍 COMPREHENSIVE BUILDER DIAGNOSTIC TEST

CRITICAL ISSUES FOUND

Issue 1: JSON Presets Error

Error: "Failed to load presets: JSON.parse: unexpected end of data at line 1 column 1" Root Cause: /presets.json file exists but is empty or corrupted Impact: Builder throws error on startup, but presets aren't essential

Issue 2: Builder Not Showing Base Widget Colors

Reported: "Builder does not show current colors cards have" Suspicion: Base layout widgets aren't being loaded or displayed Investigation Needed: Check if /api/pages/base is working


STEP 1: Check Device API Endpoints

Test 1A: Check /api/pages/all

What this does: Lists all available pages (built-in and custom)

Open your browser and visit:

http://<device-ip>/api/pages/all

Expected response:

{
  "builtins": [
    {"id": 0, "name": "Home"},
    {"id": 1, "name": "Boiler"},
    {"id": 2, "name": "Stats"},
    {"id": 3, "name": "Controls"},
    {"id": 4, "name": "Settings"}
  ],
  "pages": []
}

Check:

  • Response is valid JSON? YES / NO
  • Contains "builtins" array? YES / NO
  • Has 5 built-in pages? YES / NO

Test 1B: Check /api/pages/base for HOME page

What this does: Returns the base widget definitions for HOME page (id=0)

Open your browser and visit:

http://<device-ip>/api/pages/base?base=0

Expected response (should contain color, x, y, w, h for each widget):

{
  "widgets": [
    {
      "id": "home.header",
      "type": "label",
      "text": "Header",
      "color": "#ffffff",
      "fontSize": 2,
      "x": 10,
      "y": 0,
      "w": 460,
      "h": 24
    },
    {
      "id": "home.weather.panel",
      "type": "panel",
      "text": "Weather Panel",
      "color": "#ffffff",
      "fontSize": 2,
      "x": 45,
      "y": 20,
      ...
    },
    ...
  ]
}

Check:

  • Response is valid JSON? YES / NO
  • Contains "widgets" array? YES / NO
  • Each widget has: id, type, color, x, y, w, h? YES / NO
  • Color values present (like "#ffffff")? YES / NO
  • At least 5 widgets? YES / NO

IF TEST 1B FAILS: The backend is broken. We need to rebuild firmware.


Test 1C: Check /api/pages/overlay for HOME page

What this does: Returns saved customizations for HOME page (should be empty initially)

Open your browser and visit:

http://<device-ip>/api/pages/overlay?base=0

Expected response (empty initially):

{"widgets": []}

OR if you've saved customizations:

{
  "widgets": [
    {
      "id": "home.weather.panel",
      "type": "panel",
      "color": "#FF0000",
      ...
    }
  ]
}

Check:

  • Response is valid JSON? YES / NO
  • Contains "widgets" array? YES / NO

Test 1D: Check /api/presets/list

What this does: Lists saved presets (this is where the error is)

Open your browser and visit:

http://<device-ip>/api/presets/list

Expected response:

{"presets": []}

Actual response if error:

  • Empty response
  • Invalid JSON
  • 500 error

Check:

  • Response is valid JSON? YES / NO
  • Contains "presets"? YES / NO

IF THIS FAILS: The /presets.json file is corrupted. Fix: Delete it from device or send empty file.


STEP 2: Test Browser/Builder Loading

Test 2A: Open Builder & Check Console

  1. Open builder in browser
  2. Press F12 to open developer tools
  3. Click "Console" tab
  4. Reload page (F5)
  5. Watch the console - you should see:

Expected console output (No errors):

[BUILDER] Applying properties to widget...
Loading pages...
Loaded built-in page 0

Bad console output (Errors like):

Failed to load pages
TypeError: Cannot read property...
JSON.parse: unexpected end of data

Check:

  • ANY red errors in console? YES / NO
  • "Failed to load presets" error? YES / NO
  • "Failed to load pages" error? YES / NO

Test 2B: Select HOME Page & Look for Cyan Boxes

  1. In builder, find the page selector (dropdown showing "Select page...")
  2. Click dropdown
  3. Select "Home"
  4. Look at the canvas - should show cyan boxes with labels

Expected: Cyan colored boxes for:

  • Weather Panel (large box at top)
  • Clock Panel (below weather)
  • Badges (temperature, humidity, pressure, wind)
  • Status bar

Actual (if broken):

  • Gray boxes instead of cyan
  • No boxes at all
  • Canvas is blank

Check:

  • Do you see ANY boxes on canvas? YES / NO
  • Are they cyan color? YES / NO
  • Can you read labels? YES / NO
  • Do they match device layout? YES / NO

Test 2C: Try to Select a Widget

  1. Click on the Weather Panel (large cyan box at top)
  2. Look for property panel on the RIGHT side

Expected: Properties panel appears showing:

  • X field (position)
  • Y field (position)
  • Width field
  • Height field
  • Color field (showing current color)
  • Other properties

Actual (if broken):

  • No properties appear
  • Click does nothing
  • Different widget gets selected

Check:

  • Properties panel appears? YES / NO
  • Shows color field? YES / NO
  • Shows current color value? YES / NO
  • Can you see the color picker? YES / NO

Test 2D: Try to Change Color

  1. With Weather Panel selected
  2. Find the "Color" field in properties
  3. Click the color picker (colored square)
  4. Choose RED
  5. The preview should update

Expected: Cyan box becomes RED on canvas immediately

Actual (if broken):

  • Color picker doesn't open
  • Color doesn't change
  • Preview doesn't update

Check:

  • Color picker opens? YES / NO
  • Can you select RED? YES / NO
  • Canvas box turns RED? YES / NO

Test 2E: Click "Apply Changes"

  1. With Weather Panel showing RED
  2. Click blue "Apply Changes" button
  3. Watch the console (F12)

Expected console:

[BUILDER] Applying properties...
[BUILDER] Saving overlay for page 0
✓ Changes saved to device

Actual (if broken):

[Missing messages]
OR
✗ Failed to save: [error]

Check:

  • Toast shows "Saving..."? YES / NO
  • Toast shows "✓ Changes saved"? YES / NO
  • Console shows [BUILDER] logs? YES / NO
  • Any error in console? YES / NO

Test 2F: Check Device LCD

  1. Look at your ESP32 display
  2. Is Weather Panel RED?

Expected: Weather Panel color changed to RED on device

Actual (if broken):

  • Still original blue
  • Frozen/not responding
  • Different widget changed

Check:

  • Does LCD respond? YES / NO
  • Is Weather Panel RED? YES / NO
  • Are other things still visible? YES / NO

STEP 3: Comprehensive Report

Run ALL tests above and report:

TEST RESULTS:

API Tests:
1A (/api/pages/all): PASS / FAIL
1B (/api/pages/base?base=0): PASS / FAIL  
1C (/api/pages/overlay?base=0): PASS / FAIL
1D (/api/presets/list): PASS / FAIL

Browser Tests:
2A (Console errors): NONE / MINOR / MAJOR
2B (Cyan boxes visible): YES / NO
2C (Can select widget): YES / NO
2D (Can change color): YES / NO
2E (Apply button works): YES / NO
2F (LCD updates): YES / NO

CONSOLE ERRORS (copy any red text):
[paste here]

DESCRIPTION OF PROBLEM:
[describe what you observe vs what should happen]

STEP 4: Fix Based on Failures

If API Test 1B FAILS

  • Problem: Backend not returning base layout
  • Fix: Rebuild firmware
  • Command: pio run -e esp32-s3-devkitc-1 -t upload

If API Test 1D FAILS

  • Problem: /presets.json corrupted
  • Fix: Delete the file from device and restart
  • Or: Send empty presets file

If Test 2B FAILS (No cyan boxes)

  • Problem: Base widgets not being rendered
  • Possible Causes:
    • Page not loading
    • Canvas drawing broken
    • showBase checkbox unchecked
  • Check: Is "Show Base" checkbox CHECKED?

If Test 2E FAILS (Apply doesn't work)

  • Problem: Save/persist not working
  • Cause: Network issue or backend API broken
  • Fix: Check network tab (F12) for failed POST requests

If Test 2F FAILS (LCD doesn't update)

  • Problem: Device received data but didn't redraw
  • Fix: Power cycle device (unplug 10 seconds)

FINAL DIAGNOSIS

Once you complete ALL tests, I'll know:

  1. ✅ If API is working (Tests 1A-1D)
  2. ✅ If builder UI loads (Test 2A-2B)
  3. ✅ If you can interact with widgets (Tests 2C-2D)
  4. ✅ If changes save (Test 2E)
  5. ✅ If LCD updates (Test 2F)

Then I can provide EXACT fix for YOUR specific problem! 🎯