5.9 KiB
Persistent Connection Test Plan
Overview
This test plan verifies that the Chrome extension implements persistent connection management as requested:
- Connections remain active after manual connect until explicit disconnect
- Connections persist across popup open/close cycles
- Connections survive browser events (tab switches, window focus changes, idle periods)
- No automatic disconnection after tool operations
Prerequisites
-
Remote Server Running: Start the remote server on
ws://localhost:3001/chrome
cd app/remote-server npm run dev
-
Extension Loaded: Load the built extension from
app/chrome-extension/.output/chrome-mv3
Test Cases
Test 1: Basic Persistent Connection
Objective: Verify connection persists after popup close
Steps:
- Open Chrome extension popup
- Click "Connect" button
- Verify connection status shows "Connected (Persistent)" with green checkmark
- Note the persistent connection indicator: "🔗 Persistent: Active"
- Close the popup window
- Wait 30 seconds
- Reopen the popup
Expected Result:
- Connection status still shows "Connected (Persistent)"
- Connection time continues counting from original connection
- No reconnection attempts logged
Test 2: Connection Persistence Across Browser Events
Objective: Verify connection survives browser lifecycle events
Steps:
- Establish connection (Test 1)
- Switch between multiple tabs
- Change window focus to different applications
- Minimize/restore browser window
- Open new browser windows
- Check popup status after each event
Expected Result:
- Connection remains active throughout all events
- No disconnection or reconnection attempts
- Status consistently shows "Connected (Persistent)"
Test 3: Tool Execution Without Disconnection
Objective: Verify connection persists during and after tool operations
Steps:
- Establish connection
- Use Cherry Studio or another MCP client to send tool requests:
chrome_navigate
to navigate to a websitechrome_screenshot
to take screenshotschrome_extract_content
to extract page content
- Execute multiple tool operations in sequence
- Check connection status after each operation
Expected Result:
- All tool operations complete successfully
- Connection remains active after each operation
- No automatic disconnection after tool completion
Test 4: Extended Idle Period Test
Objective: Verify connection survives long idle periods
Steps:
- Establish connection
- Leave browser idle for 30 minutes
- Do not interact with the extension or browser
- After 30 minutes, check popup status
- Test tool functionality by sending a simple request
Expected Result:
- Connection remains active after idle period
- Tool operations work immediately without reconnection
- Connection time shows full duration including idle time
Test 5: Manual Disconnect Only
Objective: Verify connection only terminates on explicit disconnect
Steps:
- Establish connection
- Perform various activities (tabs, tools, idle time)
- Click "Disconnect" button in popup
- Verify disconnection
- Close and reopen popup
Expected Result:
- Connection terminates only when "Disconnect" is clicked
- After disconnect, status shows "Disconnected - Click Connect for persistent connection"
- Popup reopening shows disconnected state
- No automatic reconnection attempts
Test 6: Browser Restart Connection Restoration
Objective: Verify connection state restoration after browser restart
Steps:
- Establish connection
- Close entire browser (all windows)
- Restart browser
- Open extension popup immediately
Expected Result:
- Extension attempts to restore previous connection
- If server is still running, connection is re-established automatically
- If successful, shows "Connected (Persistent)" status
Test 7: Server Reconnection Behavior
Objective: Verify robust reconnection when server becomes unavailable
Steps:
- Establish connection
- Stop the remote server
- Wait for connection loss detection
- Restart the remote server
- Monitor reconnection attempts
Expected Result:
- Extension detects connection loss
- Automatic reconnection attempts begin
- Connection is restored when server comes back online
- Persistent connection behavior resumes
Verification Points
UI Indicators
- ✅ Status shows "Connected (Persistent)" when connected
- ✅ Persistent badge shows "🔗 Persistent: Active"
- ✅ Info text: "🔗 Connection will persist until manually disconnected"
- ✅ Connection time continues counting accurately
- ✅ Disconnect button changes to "Disconnect" when connected
Console Logs
Monitor browser console for these log messages:
Background: Remote server client initialized (not connected)
Background: Browser event listeners initialized for connection persistence
Background: Connection health check started (5-minute intervals)
RemoteServerClient: Connection state saved
Background: Tab switched to X, connection maintained
Background: Window focus changed to X, connection maintained
Connection State Persistence
- Connection state is saved to chrome.storage.local
- State includes: wasConnected, connectionTime, serverUrl, lastSaveTime
- State is restored on extension startup if recent (within 24 hours)
Success Criteria
All test cases pass with:
- ✅ Connections persist until manual disconnect
- ✅ No automatic disconnection after tool operations
- ✅ Connections survive all browser lifecycle events
- ✅ UI clearly indicates persistent connection status
- ✅ Robust reconnection when server connectivity is restored
- ✅ Connection state restoration after browser restart
Troubleshooting
If tests fail, check:
- Remote server is running on correct port (3001)
- Extension has proper permissions
- Browser console for error messages
- Chrome storage for saved connection state
- Network connectivity between extension and server