Skip to content

Commit 25175d4

Browse files
author
Nitish [C] Dhok
committed
kiro-cli e2e tests: refactor translate command
1 parent 2f0a50f commit 25175d4

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

e2etests/tests/kiro_cli_subcommand/test_kiro_cli_chat_subcommand.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ fn test_kiro_cli_subcommand() -> Result<(), Box<dyn std::error::Error>> {
3737
println!("📝 END OUTPUT");
3838

3939
// Validate we got help output
40-
//check if mcp present
41-
if response.contains("mcp") {
42-
assert!(response.contains("loaded"), "Expected 'loaded' in reponse");
43-
assert!(response.contains("in"), "Expected 'in' in reponse");
44-
}
4540
assert!(response.contains("Did you know"), "Expected 'Did you know' in reponse.");
4641
assert!(response.contains("Model"), "Expected 'Model' in reponse.");
4742
assert!(response.contains("Auto"), "Expected 'Auto' in reponse.");

e2etests/tests/kiro_cli_subcommand/test_kiro_cli_translate_subcommand.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,40 @@ use q_cli_e2e_tests::q_chat_helper;
66
fn test_kiro_cli_translate_subcommand() -> Result<(), Box<dyn std::error::Error>> {
77
println!("\n🔍 Testing kiro-cli translate subcommand... | Description: Tests the <code> kiro-cli translate </code> subcommand for Natural Language to Shell translation");
88

9+
let session = q_chat_helper::get_chat_session();
10+
let mut chat = session.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
11+
912
println!("\n🔍 Executing 'kiro-cli translate' subcommand with input 'hello'...");
1013

1114
// Use stdin function for translate subcommand
1215
println!("\n🔍 Testing kiro-cli translate subcommand to create and delete a project directory...");
13-
let response = q_chat_helper::execute_q_subcommand_with_stdin("kiro-cli", &["translate"], Some("Create a project directory named demoproject."))?;
16+
let response = q_chat_helper::execute_q_subcommand_with_stdin("kiro-cli", &["translate"], Some("print the create a file with name testkirocli in current working directory."))?;
1417

1518
println!("📝 Translate response: {} bytes", response.len());
1619
println!("📝 FULL OUTPUT:");
1720
println!("{}", response);
1821
println!("📝 END OUTPUT");
1922

23+
24+
let insert_response = chat.send_key_input("\r")?;
25+
println!("Select response: {}", insert_response);
26+
2027
// Verify translation output contains shell subcommand
21-
assert!(response.contains("mkdir"), "Missing mkdir command");
22-
assert!(response.contains("demoproject"), "Missing demoproject name");
28+
assert!(response.contains("touch"), "Expected 'touch' in response.");
29+
// assert!(response.contains("demoproject"), "Missing demoproject name");
2330

24-
// now I want to delete the demoproject directory
25-
println!("\n🔍 Testing kiro-cli translate subcommand to delete the project directory...");
26-
let response = q_chat_helper::execute_q_subcommand_with_stdin("kiro-cli", &["translate"], Some("Delete the demoproject directory."))?;
31+
// now I want to delete the demoproject directory
32+
println!("\n🔍 Testing kiro-cli translate subcommand to delete created testkiro file...");
33+
let response = q_chat_helper::execute_q_subcommand_with_stdin("kiro-cli", &["translate"], Some("print the delete file testkirocli in curent working directory."))?;
2734

2835
println!("📝 Translate response: {} bytes", response.len());
2936
println!("📝 FULL OUTPUT:");
3037
println!("{}", response);
3138
println!("📝 END OUTPUT");
3239

3340
// Verify translation output contains shell subcommand
34-
assert!(response.contains("rm -rf "), "Missing rm -rf command");
35-
assert!(response.contains("demoproject"), "Missing demoproject name");
41+
assert!(response.contains("-delete"), "Expected '-delete' in reponse.");
42+
// assert!(response.contains("demoproject"), "Missing demoproject name");
3643

3744
println!("✅ Translate subcommand executed successfully!");
3845

0 commit comments

Comments
 (0)