Skip to content

Latest commit

 

History

History
248 lines (201 loc) · 6.58 KB

DAA_DEBUG_VERSION_GUIDE.md

File metadata and controls

248 lines (201 loc) · 6.58 KB

DAA Dijkstra - DEBUG VERSION WITH TEST BUTTON ✅

What I Added for Testing

1. ✅ Direct TEST PLAY Button

Location: In the controls section (below the graph)

Appearance: Green button labeled "🎬 TEST PLAY"

Purpose: Bypasses the skeleton component and directly calls start() method

How to use:

  1. Refresh page
  2. Look for green "TEST PLAY" button below graph
  3. Click it
  4. Watch console and graph

2. ✅ Status Display

Location: Below the TV caption

Shows:

  • ▶ PLAYING (green) or ⏸ STOPPED (red)
  • Current step / Total steps
  • Speed setting
  • Animation delay in milliseconds

Purpose: Visual confirmation that animation system is working

3. ✅ Enhanced Console Logging

Added logs:

🚀 DAA Dijkstra ngOnInit called
📊 Graph generated, nodes: 6 edges: 12
✅ buildSteps complete! Total steps: 50
⚙️ Initial speed: 6 delay: 1000
✅ DAA Dijkstra initialization complete

Complete Testing Steps

Step 1: Hard Refresh

Ctrl + Shift + R (Windows)
Cmd + Shift + R (Mac)

Step 2: Open Console

Press F12
Click Console tab

Step 3: Check Initial Logs

You should see:

🚀 DAA Dijkstra ngOnInit called
📊 Graph generated, nodes: 6 edges: 12
✅ buildSteps complete! Total steps: 50
⚙️ Initial speed: 6 delay: 1000
✅ DAA Dijkstra initialization complete

✅ If you see these logs = Component loaded successfully ❌ If not = Page not loading correctly, try different browser

Step 4: Look at Status Display

Below the TV caption, you should see:

Status: ⏸ STOPPED | Step: 0/50 | Speed: 6 (1000ms)

Step 5: Click GREEN "TEST PLAY" Button

NOT the skeleton's play button, use the green button in controls section

Step 6: Watch Console

You should see:

🎬 Start called! Steps: 50 Current: 0
isPlaying before: false isPaused: false
isPlaying after: true
Starting animation...
🏃 Running animation step: 0 / 50
📝 Applying step: visit Visit source node A
🎬 Initial visit node: 0
⏰ Setting timer for next step, delay: 1000
🏃 Running animation step: 1 / 50
📝 Applying step: extract Extract minimum distance node
🔵 Extract node: 0
⏰ Setting timer for next step, delay: 1000
...

Step 7: Watch Status Display

Should change to:

Status: ▶ PLAYING | Step: 1/50 | Speed: 6 (1000ms)

Step number should increment every second!

Step 8: Watch Graph

  • Node A should glow yellow → turn green
  • Edges should pulse yellow
  • Weight boxes should glow
  • Other nodes should change color

Troubleshooting by Symptoms

Symptom 1: "No console logs at all"

Problem: Component not loading Solutions:

  1. Check URL is correct: localhost:4201/daa/dijkstra
  2. Try different browser (Chrome, Firefox, Edge)
  3. Check terminal for compile errors
  4. Restart dev server: npm start

Symptom 2: "Logs show but status stays STOPPED"

Problem: start() method not being called Solutions:

  1. Click the GREEN "TEST PLAY" button (not skeleton's play)
  2. Check if button is visible
  3. Check console for "Start called" log

Symptom 3: "Status shows PLAYING but no visual changes"

Problem: CSS animations not applying or too fast Solutions:

  1. Check if activeNode is changing in status
  2. Use browser inspector (F12) → Elements
  3. Select a node <circle> element
  4. Check if classes are being added: .node-active, .node-visited
  5. Try slowing down: Set speed to 1 (slowest)

Symptom 4: "Animations happen but too fast to see"

Solution:

  1. Look at status display delay: should be 1000ms for speed 6
  2. Use speed slider to set to 1 (2000ms = 2 seconds per step)
  3. Watch step counter incrementing slowly

Symptom 5: "Steps increment but colors don't change"

Problem: CSS not loaded or classes not applying Solutions:

  1. Check browser inspector → Elements
  2. Find <circle> element for Node A
  3. Check classes while animation runs
  4. Should see: node-source → node-active → node-visited
  5. If classes present but no color = CSS issue
  6. Hard refresh or clear cache

Symptom 6: "ExpressionChanged error still shows"

Problem: Browser cache not cleared Solutions:

  1. Close browser completely
  2. Reopen browser
  3. Clear all cache: F12 → Application → Clear storage
  4. Hard refresh: Ctrl + Shift + R

What SHOULD Happen (Expected Behavior)

Timeline (Speed 6, 1000ms per step):

Second 0: Click TEST PLAY

  • Status: ▶ PLAYING | Step: 0/50
  • Console: "🎬 Start called!"
  • Node A: Blue (source)

Second 1:

  • Status: ▶ PLAYING | Step: 1/50
  • Console: "🏃 Running animation step: 1"
  • Node A: Glows yellow (active)

Second 2:

  • Status: ▶ PLAYING | Step: 2/50
  • Node A: Turns green (visited)
  • Edges from A: Pulse yellow

Seconds 3-50:

  • Status keeps updating
  • Different nodes glow yellow → green
  • Edges pulse when checked
  • Weight boxes glow
  • Table updates

After ~50 seconds:

  • Status: ⏸ STOPPED | Step: 50/50
  • Console: "✅ Animation complete!"
  • All reachable nodes: Green
  • Shortest paths: Green edges

Visual Checklist

When animation runs, check for:

  • Status display shows ▶ PLAYING (green)
  • Step counter increments (0→1→2→3...)
  • Node A glows yellow at some point
  • Node A turns green
  • Other nodes change colors
  • Edges pulse yellow
  • Weight numbers glow yellow
  • Table values update
  • Console logs appear continuously
  • Animation completes after ~50 seconds

Debug Commands

If nothing works, copy/paste this in browser console:

// Check if component exists
const component = document.querySelector('app-dijkstra');
console.log('Component found:', !!component);

// Check if nodes exist
const nodes = document.querySelectorAll('circle');
console.log('Nodes found:', nodes.length);

// Check classes on first node
if (nodes.length > 0) {
  console.log('First node classes:', nodes[0].className.baseVal);
}

// Try to find the component instance
const angularComp = ng.getComponent(component);
console.log('Steps:', angularComp?.steps?.length);
console.log('Is playing:', angularComp?.isPlaying);

Files Modified

  1. ✅ daa/dijkstra.component.ts

    • Added TEST PLAY button
    • Added status display
    • Enhanced logging
    • Made animationDelay public
  2. ✅ Removed quiz binding (fixed ExpressionChanged error)

Next Steps

  1. Try the TEST PLAY button first!
  2. Watch the status display
  3. Check console logs
  4. Report back what you see:
    • Do logs appear?
    • Does status change to PLAYING?
    • Do steps increment?
    • Do colors change?
    • Any errors in console?

This will help me identify exactly where the problem is! 🔍