Skip to content

Commit f16c9fe

Browse files
author
Nitish [C] Dhok
committed
kiro-cli e2e tests: added testcase automation for kiro_cli_init_fish_pre_subommand,kiro_cli_init_fish_post_subommand,kiro_cli_init_nu_pre_subommand,kiro_cli_init_nu_post_subommand,kiro_cli_init_help_shorthand_subommand,kiro_cli_init_bash_verbose_bash_pre_subommand,iro_cli_init_bash_verbose_bash_post_subommand,kiro_cli_init_verbose_zsh_pre_subommand,kiro_cli_init_verbose_zsh_post_subommand
1 parent ef0b40a commit f16c9fe

File tree

1 file changed

+248
-0
lines changed

1 file changed

+248
-0
lines changed

e2etests/tests/init/test_kiro_cli_init_subcommand.rs

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,253 @@ fn test_kiro_cli_init_zsh_post_subommand() -> Result<(), Box<dyn std::error::Err
139139

140140
println!("✅ Kiro Cli init zsh post subcommand executed successfully!");
141141

142+
Ok(())
143+
}
144+
145+
#[test]
146+
#[cfg(all(feature = "init", feature = "sanity"))]
147+
fn test_kiro_cli_init_fish_pre_subommand() -> Result<(), Box<dyn std::error::Error>> {
148+
println!("\n🔍 Testing kiro-cli init fish pre ... | Description: Tests the <code> kiro-cli init fish pre </code> subcommand to verify kiro-cli init fish pre subcommand.");
149+
150+
println!("\n🔍 Executing 'kiro-cli init fish pre' subcommand...");
151+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","fish","pre"])?;
152+
153+
println!("📝 FULL OUTPUT:");
154+
println!("{}", response);
155+
println!("📝 END OUTPUT");
156+
157+
assert!(response.contains("command mkdir"), "Expected 'command mkdir' in the output");
158+
assert!(response.contains("Q_NEW_SESSION"), "Expected 'Q_NEW_SESSION' in the output");
159+
160+
assert!(response.contains("Load parent"), "Expected 'Load parent' in the output");
161+
162+
println!("✅ Kiro Cli init fist pre subcommand executed successfully!");
163+
164+
Ok(())
165+
}
166+
167+
#[test]
168+
#[cfg(all(feature = "init", feature = "sanity"))]
169+
fn test_kiro_cli_init_fish_post_subommand() -> Result<(), Box<dyn std::error::Error>> {
170+
println!("\n🔍 Testing kiro-cli init fish post ... | Description: Tests the <code> kiro-cli init fish post </code> subcommand to verify kiro-cli init fish post subcommand.");
171+
172+
println!("\n🔍 Executing 'kiro-cli init fish post' subcommand...");
173+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","fish","post"])?;
174+
175+
println!("📝 FULL OUTPUT:");
176+
println!("{}", response);
177+
println!("📝 END OUTPUT");
178+
179+
assert!(response.contains("set --query"), "Expected 'set --query' in the output");
180+
assert!(response.contains("TTY"), "Expected 'TTY' in the output");
181+
182+
assert!(response.contains("fig_wrap_prompt"), "Expected 'fig_wrap_prompt' in the output");
183+
184+
println!("✅ Kiro Cli init fist post subcommand executed successfully!");
185+
186+
Ok(())
187+
}
188+
189+
#[test]
190+
#[cfg(all(feature = "init", feature = "sanity"))]
191+
fn test_kiro_cli_init_nu_pre_subommand() -> Result<(), Box<dyn std::error::Error>> {
192+
println!("\n🔍 Testing kiro-cli init nu pre ... | Description: Tests the <code> kiro-cli init nu pre </code> subcommand to verify kiro-cli init nu pre subcommand.");
193+
194+
println!("\n🔍 Executing 'kiro-cli init nu pre' subcommand...");
195+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","nu","pre"])?;
196+
197+
println!("📝 FULL OUTPUT:");
198+
println!("{}", response);
199+
println!("📝 END OUTPUT");
200+
201+
assert!(response.contains("Q_SET_PARENT_CHECK"), "Expected 'Q_SET_PARENT_CHECK' in the output");
202+
assert!(response.contains("should_launch"), "Expected 'should_launch' in the output");
203+
204+
assert!(response.contains("with-env"), "Expected 'with-env' in the output");
205+
assert!(response.contains("Q_SET_PARENT_CHECK"), "Expected 'Q_SET_PARENT_CHECK' in the output");
206+
println!("✅ Kiro Cli init nu pre subcommand executed successfully!");
207+
208+
Ok(())
209+
}
210+
211+
#[test]
212+
#[cfg(all(feature = "init", feature = "sanity"))]
213+
fn test_kiro_cli_init_nu_post_subommand() -> Result<(), Box<dyn std::error::Error>> {
214+
println!("\n🔍 Testing kiro-cli init nu pre ... | Description: Tests the <code> kiro-cli init nu post </code> subcommand to verify kiro-cli init nu post subcommand.");
215+
216+
println!("\n🔍 Executing 'kiro-cli init nu post' subcommand...");
217+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","nu","post"])?;
218+
219+
println!("📝 FULL OUTPUT:");
220+
println!("{}", response);
221+
println!("📝 END OUTPUT");
222+
223+
assert!(response.contains("fig_reset_hooks"), "Expected 'fig_reset_hooks' in the output");
224+
assert!(response.contains("let hooks ="), "Expected 'let hooks =' in the output");
225+
226+
assert!(response.contains("fig_pre_execution_hook"), "Expected 'fig_pre_execution_hook' in the output");
227+
assert!(response.contains("fig_set_prompt"), "Expected 'fig_set_prompt' in the output");
228+
assert!(response.contains("StartPrompt"), "Expected 'StartPrompt' in the output");
229+
230+
println!("✅ Kiro Cli init nu post subcommand executed successfully!");
231+
232+
Ok(())
233+
}
234+
235+
236+
#[test]
237+
#[cfg(all(feature = "init", feature = "sanity"))]
238+
fn test_kiro_cli_init_help_shorthand_subommand() -> Result<(), Box<dyn std::error::Error>> {
239+
println!("\n🔍 Testing kiro-cli init -h ... | Description: Tests the <code> kiro-cli init -h </code> subcommand to verify help options.");
240+
241+
println!("\n🔍 Executing 'kiro-cli init -h' subcommand...");
242+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","-h"])?;
243+
244+
println!("📝 FULL OUTPUT:");
245+
println!("{}", response);
246+
println!("📝 END OUTPUT");
247+
248+
assert!(response.contains("Usage"), "Expected 'Usage' in the output");
249+
assert!(response.contains("[OPTIONS]"), "Expected '[OPTIONS]' in the output");
250+
251+
assert!(response.contains("Options:"), "Expected 'Options:' in the output");
252+
assert!(response.contains("Arguments"), "Expected 'Arguments' in the output");
253+
assert!(response.contains("SHELL"), "Expected 'SHELL' in the output");
254+
255+
assert!(response.contains("bash"), "Expected 'bash' in the output");
256+
assert!(response.contains("zsh"), "Expected 'zsh' in the output");
257+
assert!(response.contains("fish"), "Expected 'fish' in the output");
258+
259+
assert!(response.contains("nu"), "Expected 'nu' in the output");
260+
assert!(response.contains("WHEN"), "Expected 'WHEN' in the output");
261+
assert!(response.contains("RCFILE"), "Expected 'RCFILE' in the output");
262+
263+
assert!(response.contains("rcfile"), "Expected 'rcfile' in the output");
264+
265+
assert!(response.contains("-v"), "Expected '-v' in the output");
266+
assert!(response.contains("--verbose"), "Expected '--verbose' in the output");
267+
268+
assert!(response.contains("-h"), "Expected '-h' in the output");
269+
assert!(response.contains("--help"), "Expected '--help' in the output");
270+
271+
println!("✅ Kiro Cli init -h subcommand executed successfully!");
272+
273+
Ok(())
274+
}
275+
276+
#[test]
277+
#[cfg(all(feature = "init", feature = "sanity"))]
278+
fn test_kiro_cli_init_bash_verbose_bash_pre_subommand() -> Result<(), Box<dyn std::error::Error>> {
279+
println!("\n🔍 Testing kiro-cli init --verbose bash pre ... | Description: Tests the <code> kiro-cli init --verbose bash pre </code> subcommand to verify verbose bash pre response.");
280+
281+
println!("\n🔍 Executing 'kiro-cli init -verbose bash pre' subcommand...");
282+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","--verbose","bash","pre"])?;
283+
284+
println!("📝 FULL OUTPUT:");
285+
println!("{}", response);
286+
println!("📝 END OUTPUT");
287+
288+
assert!(response.contains("SHOULD_QTERM_LAUNCH"), "Expected 'SHOULD_QTERM_LAUNCH' in the output");
289+
assert!(response.contains("mkdir -p"), "Expected 'mkdir -p' in the output");
290+
assert!(response.contains("Q_NEW_SESSION"), "Expected 'Q_NEW_SESSION' in the output");
291+
292+
assert!(response.contains("Q_SET_PARENT_CHECK"), "Expected 'Q_SET_PARENT_CHECK' in the output");
293+
assert!(response.contains("kiro-cli-term"), "Expected 'kiro-cli-term' in the output");
294+
assert!(response.contains("Q_EXECUTION_STRING"), "Expected 'Q_EXECUTION_STRING' in the output");
295+
296+
assert!(response.contains("exec -a"), "Expected 'exec -a' in the output");
297+
assert!(!response.contains("SHOULD_QTERM_LAUNCH") || response.contains("bash pre"), "bash post should not contain SHOULD_QTERM_LAUNCH");
298+
299+
println!("✅ Kiro Cli init --verbose bash pre subcommand executed successfully!");
300+
301+
Ok(())
302+
}
303+
304+
#[test]
305+
#[cfg(all(feature = "init", feature = "sanity"))]
306+
fn test_kiro_cli_init_bash_verbose_bash_post_subommand() -> Result<(), Box<dyn std::error::Error>> {
307+
println!("\n🔍 Testing kiro-cli init --verbose bash post ... | Description: Tests the <code> kiro-cli init --verbose bash post </code> subcommand to verify verbose bash post response.");
308+
309+
println!("\n🔍 Executing 'kiro-cli init -verbose bash post' subcommand...");
310+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","--verbose","bash","post"])?;
311+
312+
println!("📝 FULL OUTPUT:");
313+
println!("{}", response);
314+
println!("📝 END OUTPUT");
315+
316+
assert!(response.contains("__fig_preexec"), "Expected '__fig_preexec' in the output");
317+
assert!(response.contains("__fig_pre_prompt"), "Expected '__fig_pre_prompt' in the output");
318+
assert!(response.contains("PROMPT_COMMAND"), "Expected 'PROMPT_COMMAND' in the output");
319+
320+
assert!(response.contains("precmd_functions"), "Expected 'precmd_functions' in the output");
321+
assert!(response.contains("preexec_functions"), "Expected 'preexec_functions' in the output");
322+
assert!(response.contains("fig_osc"), "Expected 'fig_osc' in the output");
323+
324+
assert!(response.contains("StartPrompt"), "Expected 'StartPrompt' in the output");
325+
assert!(response.contains("EndPrompt"), "Expected 'EndPrompt' in the output");
326+
assert!(!response.contains("__fig_preexec") || response.contains("bash post"), "bash pre should not focus on __fig_preexec");
327+
328+
println!("✅ Kiro Cli init --verbose bash post subcommand executed successfully!");
329+
330+
Ok(())
331+
}
332+
333+
#[test]
334+
#[cfg(all(feature = "init", feature = "sanity"))]
335+
fn test_kiro_cli_init_verbose_zsh_pre_subommand() -> Result<(), Box<dyn std::error::Error>> {
336+
println!("\n🔍 Testing kiro-cli init --verbose zsh pre ... | Description: Tests the <code> kiro-cli init --verbose zsh pre </code> subcommand to verify verbose zsh pre response.");
337+
338+
println!("\n🔍 Executing 'kiro-cli init -verbose zsh pre' subcommand...");
339+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","--verbose","zsh","pre"])?;
340+
341+
println!("📝 FULL OUTPUT:");
342+
println!("{}", response);
343+
println!("📝 END OUTPUT");
344+
345+
assert!(response.contains("SHOULD_QTERM_LAUNCH"), "Expected 'SHOULD_QTERM_LAUNCH' in the output");
346+
assert!(response.contains("mkdir -p"), "Expected 'mkdir -p' in the output");
347+
assert!(response.contains("Q_NEW_SESSION"), "Expected 'Q_NEW_SESSION' in the output");
348+
349+
assert!(response.contains("Q_SET_PARENT_CHECK"), "Expected 'Q_SET_PARENT_CHECK' in the output");
350+
assert!(response.contains("kiro-cli-term"), "Expected 'kiro-cli-term' in the output");
351+
assert!(response.contains("Q_EXECUTION_STRING"), "Expected 'Q_EXECUTION_STRING' in the output");
352+
353+
assert!(response.contains("exec -a"), "Expected 'exec -a' in the output");
354+
assert!(response.contains("Q_IS_LOGIN_SHELL"), "Expected 'Q_IS_LOGIN_SHELL' in the output");
355+
assert!(!response.contains("Q_DOTFILES_SOURCED") || response.contains("zsh post"), "zsh pre should not contain autosuggestions");
356+
357+
println!("✅ Kiro Cli init --verbose zsh pre subcommand executed successfully!");
358+
359+
Ok(())
360+
}
361+
362+
#[test]
363+
#[cfg(all(feature = "init", feature = "sanity"))]
364+
fn test_kiro_cli_init_verbose_zsh_post_subommand() -> Result<(), Box<dyn std::error::Error>> {
365+
println!("\n🔍 Testing kiro-cli init --verbose zsh post ... | Description: Tests the <code> kiro-cli init --verbose zsh post </code> subcommand to verify verbose zsh post response.");
366+
367+
println!("\n🔍 Executing 'kiro-cli init -verbose zsh post' subcommand...");
368+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","--verbose","zsh","post"])?;
369+
370+
println!("📝 FULL OUTPUT:");
371+
println!("{}", response);
372+
println!("📝 END OUTPUT");
373+
374+
assert!(response.contains("Q_DOTFILES_SOURCED"), "Expected 'Q_DOTFILES_SOURCED' in the output");
375+
assert!(response.contains("KIRO_CLI_AUTOSUGGEST"), "Expected 'KIRO_CLI_AUTOSUGGEST' in the output");
376+
assert!(response.contains("_kiro_cli_autosuggest"), "Expected '_kiro_cli_autosuggest' in the output");
377+
378+
assert!(response.contains("fig_preexec"), "Expected 'fig_preexec' in the output");
379+
assert!(response.contains("fig_precmd"), "Expected 'fig_precmd' in the output");
380+
assert!(response.contains("precmd_functions"), "Expected 'precmd_functions' in the output");
381+
382+
assert!(response.contains("preexec_functions"), "Expected 'preexec_functions' in the output");
383+
assert!(response.contains("Q_USER_PS1"), "Expected 'Q_USER_PS1' in the output");
384+
assert!(response.contains("inline_shell_completion"), "Expected 'inline_shell_completion' in the output");
385+
386+
assert!(!response.contains("SHOULD_QTERM_LAUNCH") || response.contains("zsh pre"), "zsh post should not contain terminal launch logic");
387+
388+
println!("✅ Kiro Cli init --verbose zsh post subcommand executed successfully!");
389+
142390
Ok(())
143391
}

0 commit comments

Comments
 (0)