Skip to content

Commit a71149d

Browse files
author
Nitish [C] Dhok
committed
added test case automation support for /agent swap
1 parent 3f3cf14 commit a71149d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

e2etests/tests/agent/test_agent_commands.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,3 +532,30 @@ fn test_agent_generate_command() -> Result<(), Box<dyn std::error::Error>> {
532532
Ok(())
533533

534534
}
535+
536+
// Tests the /agent swap command to swap the agents
537+
// Verifies agent swap process and response validation
538+
#[test]
539+
#[cfg(all(feature = "agent", feature = "sanity"))]
540+
fn test_agent_swap_command() -> Result<(), Box<dyn std::error::Error>> {
541+
println!("\n🔍 Testing /agent swap command... | Description: Tests the <code> /agent swap</code>command.");
542+
543+
let session = q_chat_helper::get_chat_session();
544+
let mut chat = session.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
545+
546+
// Start the command and wait for name prompt
547+
let _response1 = chat.execute_command("/agent swap")?;
548+
println!("📝 Agent swap response: {} bytes", _response1.len());
549+
println!("📝 Full output: {}", _response1);
550+
println!("📝 End output");
551+
let _response2 = chat.execute_command("1")?;
552+
println!("📝 Agent swap response: {} bytes", _response2.len());
553+
println!("📝 Agent swap response Full output : {}", _response2);
554+
555+
assert!(
556+
_response2.contains("✓") || _response2.contains("Choose one of the following agents"),
557+
"Expected agent swap confirmation"
558+
);
559+
drop(chat);
560+
Ok(())
561+
}

0 commit comments

Comments
 (0)