# Testing Guide - Kill Process on Disconnect ## Quick Test Steps ### Test 1: Verify Initial State 1. **Run the application** 2. **Open Settings** (File ? Settings) 3. **Navigate to "Pianobar Config & Auth" tab** 4. **Verify**: - [ ] "Enable Profile Credentials and Custom Config Generation" checkbox is **unchecked** - [ ] "Kill process" checkbox is **disabled** (grayed out, cannot be clicked) - [ ] Config file path field is **disabled** - [ ] Browse button is **disabled** - [ ] Username field is **disabled** - [ ] Password field is **disabled** ### Test 2: Enable Override and Kill Process 1. **Check** "Enable Profile Credentials and Custom Config Generation" 2. **Verify**: - [ ] "Kill process" checkbox becomes **enabled** - [ ] All credential fields become **enabled** 3. **Check** "Kill process" checkbox 4. **Click Save** 5. **Re-open Settings** 6. **Verify**: - [ ] "Enable Profile Credentials..." remains **checked** - [ ] "Kill process" checkbox remains **checked** - [ ] Setting persists correctly ### Test 3: Connect and Kill on Disconnect 1. **Ensure a profile with Kill Process enabled is active** 2. **Set Pianobar executable path** if not already set 3. **Click Connect** 4. **Verify**: - [ ] Pianobar starts (status shows "Connected to Pianobar") - [ ] PID is displayed in status bar (e.g., "PID: 12345") 5. **Click Disconnect** 6. **Verify**: - [ ] Status shows "Pianobar process killed (PID: XXXX)" - [ ] Pianobar process is **terminated** (check Task Manager) ### Test 4: Connect and Detach on Disconnect 1. **Open Settings** 2. **Navigate to "Pianobar Config & Auth" tab** 3. **Verify** "Enable Profile Credentials..." is **checked** 4. **Uncheck** "Kill process" checkbox 5. **Click Save** 6. **Click Connect** 7. **Verify**: - [ ] Pianobar starts successfully 8. **Click Disconnect** 9. **Verify**: - [ ] Status shows "Disconnected from Pianobar (process detached)" - [ ] Pianobar process is **still running** in Task Manager - [ ] Music continues playing ### Test 5: Disable Override (Gating) 1. **Open Settings** 2. **Navigate to "Pianobar Config & Auth" tab** 3. **Uncheck** "Enable Profile Credentials and Custom Config Generation" 4. **Verify**: - [ ] "Kill process" checkbox becomes **disabled** (grayed out) - [ ] All credential fields become **disabled** - [ ] Cannot check "Kill process" 5. **Try to check "Kill process"** (should not be possible) 6. **Click Save** 7. **Close Settings** ### Test 6: Output Folder Browse Button 1. **Open Settings** 2. **Navigate to "Outputs" tab** 3. **Click** the **Browse** button next to the output folder text box (ID: `output_folder_browse_button`) 4. **Verify**: - [ ] SaveFileDialog opens with title "Select Text File Output Path" - [ ] Default filename is "now_playing.txt" - [ ] Can select a location 5. **Select a location** and click OK 6. **Verify**: - [ ] Selected path appears in the output folder text box 7. **Click Save** 8. **Verify**: - [ ] Output path is saved to the profile ## Edge Case Tests ### Edge 1: Switch Profiles with Different Settings 1. **Create two profiles**: - Profile A: Kill process **enabled** - Profile B: Kill process **disabled** 2. **Switch to Profile A** and connect 3. **Disconnect** ? Should **kill** the process 4. **Switch to Profile B** and connect 5. **Disconnect** ? Should **detach** (not kill) ### Edge 2: Override Disabled Mid-Session 1. **Have Kill process enabled** 2. **Open Settings** while connected 3. **Uncheck** "Enable Profile Credentials..." 4. **Verify** "Kill process" becomes **disabled** 5. **Click Save** 6. **Disconnect** 7. **Verify** process is **detached** (not killed), since override was disabled ### Edge 3: No Active Profile 1. **Delete all profiles** or ensure no profile is active 2. **Try to connect** 3. **Verify**: - [ ] Error message: "No active profile selected..." - [ ] Cannot connect without a profile ## Expected Behavior Summary | Override Enabled? | Kill Process Checked? | Disconnect Behavior | |-------------------|----------------------|---------------------| | ? No | N/A (disabled) | Detach | | ? Yes | ? No | Detach | | ? Yes | ? Yes | **Kill by PID** | ## Status Bar Messages - **Connect starting**: "Starting Pianobar..." - **Connect success**: "Connected to Pianobar (PID: XXXX)" - **Connect failed**: "Failed to start Pianobar" - **Disconnect (kill)**: "Pianobar process killed (PID: XXXX)" - **Disconnect (detach)**: "Disconnected from Pianobar (process detached)" ## Troubleshooting ### Issue: Kill checkbox is always disabled **Solution**: Make sure "Enable Profile Credentials and Custom Config Generation" is **checked** ### Issue: Setting doesn't persist **Solution**: Make sure you clicked **Save** before closing the Settings dialog ### Issue: Process not killed on disconnect **Checks**: - Is "Enable Profile Credentials..." checked? - Is "Kill process" checkbox checked? - Did you save the profile? - Is the correct profile active? ### Issue: Cannot connect **Checks**: - Is a profile selected and active? - Is the Pianobar executable path set correctly? - Does the Pianobar.exe file exist at that path? ## Files to Monitor - `profiles.json` in `%APPDATA%\PianoBarHelper\` - Check that `"KillProcessOnDisconnect": true` is saved for profiles where it's enabled - Task Manager ? Details - Watch for `pianobar.exe` process appearing/disappearing during connect/disconnect