Skip to content

Commit d30c73f

Browse files
author
Nitish [C] Dhok
committed
kiro-cli e2e tests: Automated kiro-cli issue -v, --verbose subcommand.
1 parent a3d2f9f commit d30c73f

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed

e2etests/tests/issue_subcommand/test_kiro_cli_issue_subcommand.rs

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,5 +178,141 @@ fn test_kiro_cli_issue_f_subcommand() -> Result<(), Box<dyn std::error::Error>>
178178

179179
println!("✅ Kiro Cli issue -f subcommand executed successfully!");
180180

181+
Ok(())
182+
}
183+
184+
#[test]
185+
#[cfg(all(feature = "issue_subcommand", feature = "sanity"))]
186+
fn test_kiro_cli_issue_verbose_subcommand() -> Result<(), Box<dyn std::error::Error>> {
187+
println!("\n🔍 Testing kiro-cli issue --verbose ... | Description: Tests the <code> kiro-cli issue --verbose </code> subcommand to verify interactive issue creation. using --verbose ");
188+
189+
println!("\n🔍 Executing 'kiro-cli issue --verbose' subcommand...");
190+
191+
let session = q_chat_helper::get_chat_session();
192+
let mut chat = session.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
193+
194+
// Execute the command with longer timeout
195+
let response = chat.execute_command_with_timeout("!kiro-cli issue --verbose", Some(1000))?;
196+
197+
println!("📝 INITIAL OUTPUT:");
198+
println!("{}", response);
199+
200+
// Check if we got the interactive prompt
201+
if response.contains("Issue Title") {
202+
println!("🔍 Detected interactive prompt, sending test title...");
203+
204+
// Send the issue title
205+
let title_response = chat.send_key_input("Bug: Created from verbose command")?;
206+
207+
println!("📝 TITLE INPUT RESPONSE:");
208+
println!("{}", title_response);
209+
210+
// Send Enter to confirm the input and wait longer for GitHub processing
211+
let enter_response = chat.send_key_input_with_timeout("\r", Some(1000))?;
212+
213+
println!("📝 ENTER RESPONSE:");
214+
println!("{}", enter_response);
215+
216+
// Wait additional time for GitHub redirect and read any remaining output
217+
std::thread::sleep(std::time::Duration::from_secs(3));
218+
let final_response = chat.send_key_input_with_timeout("", Some(1000))?;
219+
220+
println!("📝 FINAL OUTPUT:");
221+
println!("{}", final_response);
222+
223+
// Combine all outputs
224+
let combined_output = format!("{}{}{}{}", response, title_response, enter_response, final_response);
225+
226+
// Basic success criteria
227+
assert!(!combined_output.contains("Error"), "Should not contain error messages");
228+
assert!(combined_output.contains("Bug: Created from verbose command"), "Should contain our input text");
229+
230+
// Check for GitHub redirect message
231+
if combined_output.contains("Heading over to GitHub") {
232+
println!("✅ Issue creation process completed with GitHub redirect!");
233+
} else if combined_output.contains("GitHub") ||
234+
combined_output.contains("Issue created") ||
235+
combined_output.contains("✔") {
236+
println!("✅ Issue creation process completed successfully!");
237+
} else {
238+
println!("ℹ️ Issue creation process completed (interactive input successful)");
239+
println!("🔍 Debug: Looking for 'Heading over to GitHub' in output...");
240+
}
241+
} else {
242+
// If no interactive prompt, check for other expected behaviors
243+
assert!(!response.contains("Error"), "Should not contain error messages");
244+
println!("ℹ️ Command executed without interactive prompt");
245+
}
246+
247+
println!("✅ Kiro Cli issue --verbose subcommand executed successfully!");
248+
249+
Ok(())
250+
}
251+
252+
#[test]
253+
#[cfg(all(feature = "issue_subcommand", feature = "sanity"))]
254+
fn test_kiro_cli_issue_v_subcommand() -> Result<(), Box<dyn std::error::Error>> {
255+
println!("\n🔍 Testing kiro-cli issue --verbose ... | Description: Tests the <code> kiro-cli issue -v </code> subcommand to verify interactive issue creation. using -v ");
256+
257+
println!("\n🔍 Executing 'kiro-cli issue -v' subcommand...");
258+
259+
let session = q_chat_helper::get_chat_session();
260+
let mut chat = session.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
261+
262+
// Execute the command with longer timeout
263+
let response = chat.execute_command_with_timeout("!kiro-cli issue -v", Some(1000))?;
264+
265+
println!("📝 INITIAL OUTPUT:");
266+
println!("{}", response);
267+
268+
// Check if we got the interactive prompt
269+
if response.contains("Issue Title") {
270+
println!("🔍 Detected interactive prompt, sending test title...");
271+
272+
// Send the issue title
273+
let title_response = chat.send_key_input("Bug: Created from -v command")?;
274+
275+
println!("📝 TITLE INPUT RESPONSE:");
276+
println!("{}", title_response);
277+
278+
// Send Enter to confirm the input and wait longer for GitHub processing
279+
let enter_response = chat.send_key_input_with_timeout("\r", Some(1000))?;
280+
281+
println!("📝 ENTER RESPONSE:");
282+
println!("{}", enter_response);
283+
284+
// Wait additional time for GitHub redirect and read any remaining output
285+
std::thread::sleep(std::time::Duration::from_secs(3));
286+
let final_response = chat.send_key_input_with_timeout("", Some(1000))?;
287+
288+
println!("📝 FINAL OUTPUT:");
289+
println!("{}", final_response);
290+
291+
// Combine all outputs
292+
let combined_output = format!("{}{}{}{}", response, title_response, enter_response, final_response);
293+
294+
// Basic success criteria
295+
assert!(!combined_output.contains("Error"), "Should not contain error messages");
296+
assert!(combined_output.contains("Bug: Created from -v command"), "Should contain our input text");
297+
298+
// Check for GitHub redirect message
299+
if combined_output.contains("Heading over to GitHub") {
300+
println!("✅ Issue creation process completed with GitHub redirect!");
301+
} else if combined_output.contains("GitHub") ||
302+
combined_output.contains("Issue created") ||
303+
combined_output.contains("✔") {
304+
println!("✅ Issue creation process completed successfully!");
305+
} else {
306+
println!("ℹ️ Issue creation process completed (interactive input successful)");
307+
println!("🔍 Debug: Looking for 'Heading over to GitHub' in output...");
308+
}
309+
} else {
310+
// If no interactive prompt, check for other expected behaviors
311+
assert!(!response.contains("Error"), "Should not contain error messages");
312+
println!("ℹ️ Command executed without interactive prompt");
313+
}
314+
315+
println!("✅ Kiro Cli issue -v subcommand executed successfully!");
316+
181317
Ok(())
182318
}

0 commit comments

Comments
 (0)