Skip to content

Commit 3e2047f

Browse files
author
Nitish [C] Dhok
committed
kiro-cli e2e tests: change description for input method, Added test case automation for kiro-cli init zsh pre, kiro-cli init zsh -v post, kiro-cli init nu pre,kiro-cli init -v nu post sub commands.
1 parent 17afe5c commit 3e2047f

File tree

2 files changed

+121
-7
lines changed

2 files changed

+121
-7
lines changed

e2etests/tests/init_subcommand/test_kiro_cli_init_subcommand.rs

Lines changed: 119 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ fn test_kiro_cli_init_zsh_pre_subommand() -> Result<(), Box<dyn std::error::Erro
104104

105105
assert!(response.contains("Q_SHELL"), "Expected 'Q_SHELL' in the output");
106106
assert!(response.contains("SHOULD_QTERM_LAUNCH"), "Expected 'SHOULD_QTERM_LAUNCH' in the output");
107-
108-
assert!(response.contains("mkdir"), "Expected 'mkdir' in the output");
109-
assert!(response.contains("add"), "Expected 'add' in the output");
110-
111-
assert!(response.contains("#"), "Expected '#' in the output");
107+
assert!(response.contains("#!/usr/bin/env bash"), "Expected shebang in the output");
108+
assert!(response.contains("mkdir -p"), "Expected 'mkdir -p' in the output");
109+
assert!(response.contains("~/.local/bin"), "Expected '~/.local/bin' in the output");
110+
assert!(response.contains("Q_NEW_SESSION"), "Expected 'Q_NEW_SESSION' in the output");
111+
assert!(response.contains("Q_SET_PARENT_CHECK"), "Expected 'Q_SET_PARENT_CHECK' in the output");
112+
assert!(response.contains("kiro-cli-term"), "Expected 'kiro-cli-term' in the output");
113+
assert!(response.contains("Q_IS_LOGIN_SHELL"), "Expected 'Q_IS_LOGIN_SHELL' in the output");
112114

113115
println!("✅ Kiro Cli init zsh pre subcommand executed successfully!");
114116

@@ -544,5 +546,117 @@ fn test_kiro_cli_init_verbose_nu_post_subommand() -> Result<(), Box<dyn std::err
544546

545547
println!("✅ Kiro Cli init --verbose nu post subcommand executed successfully!");
546548

549+
Ok(())
550+
}
551+
552+
#[test]
553+
#[cfg(all(feature = "init_subcommand", feature = "sanity"))]
554+
fn test_kiro_cli_init_v_zsh_post_subommand() -> Result<(), Box<dyn std::error::Error>> {
555+
println!("\n🔍 Testing kiro-cli init -v zsh post ... | Description: Tests the <code> kiro-cli init -v zsh post </code> subcommand to verify verbose zsh -v post response.");
556+
557+
println!("\n🔍 Executing 'kiro-cli init -v zsh post' subcommand...");
558+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","-v","zsh","post"])?;
559+
560+
println!("📝 FULL OUTPUT:");
561+
println!("{}", response);
562+
println!("📝 END OUTPUT");
563+
564+
assert!(response.contains("Q_SHELL"), "Expected 'Q_SHELL' in the output");
565+
assert!(response.contains("Q_DOTFILES_SOURCED"), "Expected 'Q_DOTFILES_SOURCED' in the output");
566+
assert!(response.contains("KIRO_CLI_AUTOSUGGEST"), "Expected 'KIRO_CLI_AUTOSUGGEST' in the output");
567+
assert!(response.contains("_zsh_autosuggest_accept"), "Expected '_zsh_autosuggest_accept' in the output");
568+
assert!(response.contains("fig_preexec"), "Expected 'fig_preexec' in the output");
569+
assert!(response.contains("fig_precmd"), "Expected 'fig_precmd' in the output");
570+
assert!(response.contains("fig_osc"), "Expected 'fig_osc' in the output");
571+
assert!(response.contains("QTERM_SESSION_ID"), "Expected 'QTERM_SESSION_ID' in the output");
572+
assert!(response.contains("inline-shell-completion"), "Expected 'inline-shell-completion' in the output");
573+
assert!(!response.contains("mkdir -p"), "zsh post should not contain directory creation");
574+
575+
println!("✅ Kiro Cli init -v zsh post subcommand executed successfully!");
576+
577+
Ok(())
578+
}
579+
580+
#[test]
581+
#[cfg(all(feature = "init_subcommand", feature = "sanity"))]
582+
fn test_kiro_cli_init_v_zsh_pre_subommand() -> Result<(), Box<dyn std::error::Error>> {
583+
println!("\n🔍 Testing kiro-cli init -v zsh pre ... | Description: Tests the <code> kiro-cli init -v zsh pre </code> subcommand to verify verbose zsh -v pre response.");
584+
585+
println!("\n🔍 Executing 'kiro-cli init -v zsh pre' subcommand...");
586+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","-v","zsh","pre"])?;
587+
588+
println!("📝 FULL OUTPUT:");
589+
println!("{}", response);
590+
println!("📝 END OUTPUT");
591+
592+
assert!(response.contains("Q_SHELL"), "Expected 'Q_SHELL' in the output");
593+
assert!(response.contains("SHOULD_QTERM_LAUNCH"), "Expected 'SHOULD_QTERM_LAUNCH' in the output");
594+
assert!(response.contains("#!/usr/bin/env bash"), "Expected shebang in the output");
595+
assert!(response.contains("mkdir -p"), "Expected 'mkdir -p' in the output");
596+
assert!(response.contains("~/.local/bin"), "Expected '~/.local/bin' in the output");
597+
assert!(response.contains("Q_NEW_SESSION"), "Expected 'Q_NEW_SESSION' in the output");
598+
assert!(response.contains("Q_SET_PARENT_CHECK"), "Expected 'Q_SET_PARENT_CHECK' in the output");
599+
assert!(response.contains("kiro-cli-term"), "Expected 'kiro-cli-term' in the output");
600+
assert!(response.contains("Q_IS_LOGIN_SHELL"), "Expected 'Q_IS_LOGIN_SHELL' in the output");
601+
assert!(!response.contains("Q_DOTFILES_SOURCED"), "zsh pre should not contain dotfiles sourced check");
602+
603+
println!("✅ Kiro Cli init -v zsh pre subcommand executed successfully!");
604+
605+
Ok(())
606+
}
607+
608+
#[test]
609+
#[cfg(all(feature = "init_subcommand", feature = "sanity"))]
610+
fn test_kiro_cli_init_v_fish_pre_subommand() -> Result<(), Box<dyn std::error::Error>> {
611+
println!("\n🔍 Testing kiro-cli init -v fish pre ... | Description: Tests the <code> kiro-cli init -v fish pre </code> subcommand to verify verbose fish -v pre response.");
612+
613+
println!("\n🔍 Executing 'kiro-cli init -v fish pre' subcommand...");
614+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","-v","fish","pre"])?;
615+
616+
println!("📝 FULL OUTPUT:");
617+
println!("{}", response);
618+
println!("📝 END OUTPUT");
619+
620+
assert!(response.contains("set -g Q_SHELL"), "Expected 'set -g Q_SHELL' in the output");
621+
assert!(response.contains("SHOULD_QTERM_LAUNCH"), "Expected 'SHOULD_QTERM_LAUNCH' in the output");
622+
assert!(response.contains("command mkdir -p"), "Expected 'command mkdir -p' in the output");
623+
assert!(response.contains("builtin contains"), "Expected 'builtin contains' in the output");
624+
assert!(response.contains("Q_NEW_SESSION"), "Expected 'Q_NEW_SESSION' in the output");
625+
assert!(response.contains("Q_PARENT"), "Expected 'Q_PARENT' in the output");
626+
assert!(response.contains("kiro-cli-term"), "Expected 'kiro-cli-term' in the output");
627+
assert!(response.contains("Q_IS_LOGIN_SHELL"), "Expected 'Q_IS_LOGIN_SHELL' in the output");
628+
assert!(response.contains("exec bash -c"), "Expected 'exec bash -c' in the output");
629+
assert!(!response.contains("fig_preexec"), "fish pre should not contain fig_preexec hooks");
630+
631+
println!("✅ Kiro Cli init -v fish pre subcommand executed successfully!");
632+
633+
Ok(())
634+
}
635+
636+
#[test]
637+
#[cfg(all(feature = "init_subcommand", feature = "sanity"))]
638+
fn test_kiro_cli_init_v_fish_post_subommand() -> Result<(), Box<dyn std::error::Error>> {
639+
println!("\n🔍 Testing kiro-cli init -v fish post ... | Description: Tests the <code> kiro-cli init -v fish post </code> subcommand to verify verbose fish -v post response.");
640+
641+
println!("\n🔍 Executing 'kiro-cli init -v fish post' subcommand...");
642+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","-v","fish","post"])?;
643+
644+
println!("📝 FULL OUTPUT:");
645+
println!("{}", response);
646+
println!("📝 END OUTPUT");
647+
648+
assert!(response.contains("set -g Q_SHELL"), "Expected 'set -g Q_SHELL' in the output");
649+
assert!(response.contains("function fig_osc"), "Expected 'function fig_osc' in the output");
650+
assert!(response.contains("function fig_copy_fn"), "Expected 'function fig_copy_fn' in the output");
651+
assert!(response.contains("function fig_wrap_prompt"), "Expected 'function fig_wrap_prompt' in the output");
652+
assert!(response.contains("function fig_preexec"), "Expected 'function fig_preexec' in the output");
653+
assert!(response.contains("function fig_precmd"), "Expected 'function fig_precmd' in the output");
654+
assert!(response.contains("--on-event fish_preexec"), "Expected '--on-event fish_preexec' in the output");
655+
assert!(response.contains("--on-event fish_prompt"), "Expected '--on-event fish_prompt' in the output");
656+
assert!(response.contains("QTERM_SESSION_ID"), "Expected 'QTERM_SESSION_ID' in the output");
657+
assert!(!response.contains("SHOULD_QTERM_LAUNCH"), "fish post should not contain terminal launch logic");
658+
659+
println!("✅ Kiro Cli init -v fish post subcommand executed successfully!");
660+
547661
Ok(())
548662
}

e2etests/tests/setup_subcommands/test_kiro_cli_setup_subcommand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ fn test_kiro_cli_setup_input_method_subommand() -> Result<(), Box<dyn std::error
7373
let session = q_chat_helper::get_chat_session();
7474
let mut chat = session.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
7575

76-
println!("\n🔍 Executing 'kiro-cli setup --dotfiles' subcommand in chat session...");
77-
let response = chat.execute_command_with_timeout("!kiro-cli setup --input-method", Some(500))?;
76+
println!("\n🔍 Executing 'kiro-cli setup --input-method' subcommand in chat session...");
77+
let response = chat.execute_command_with_timeout("!kiro-cli setup --input-method", Some(1000))?;
7878

7979
println!("📝 FULL OUTPUT:");
8080
println!("{}", response);

0 commit comments

Comments
 (0)