Add end-to-end tests for workspace switching and backend tests for ask_question tool

- Implemented E2E tests for workspace switching functionality, covering scenarios such as switching workspaces, data isolation, language preference maintenance, and UI updates.
- Added tests to ensure workspace data is cleared on logout and handles unsaved changes during workspace switches.
- Created comprehensive backend tests for the ask_question tool, validating question creation, execution, answer handling, cancellation, and timeout scenarios.
- Included edge case tests to ensure robustness against duplicate questions and invalid answers.
This commit is contained in:
catlog22
2026-01-31 16:02:20 +08:00
parent 715ef12c92
commit 345437415f
33 changed files with 7049 additions and 105 deletions

View File

@@ -219,6 +219,7 @@ export function useWebSocket(options: UseWebSocketOptions = {}): UseWebSocketRet
completeExecution,
updateNode,
addOutput,
addA2UINotification,
onMessage,
]
);
@@ -314,7 +315,20 @@ export function useWebSocket(options: UseWebSocketOptions = {}): UseWebSocketRet
connect();
}
// Listen for A2UI action events and send via WebSocket
const handleA2UIAction = (event: CustomEvent) => {
if (wsRef.current?.readyState === WebSocket.OPEN) {
wsRef.current.send(JSON.stringify(event.detail));
} else {
console.warn('[WebSocket] Cannot send A2UI action: not connected');
}
};
// Type the event listener properly
window.addEventListener('a2ui-action', handleA2UIAction as EventListener);
return () => {
window.removeEventListener('a2ui-action', handleA2UIAction as EventListener);
if (reconnectTimeoutRef.current) {
clearTimeout(reconnectTimeoutRef.current);
}