Skip to content

Commit 1ffca35

Browse files
QCLI Automation for Tools,Issue,Promt tests
1 parent 4e79a1a commit 1ffca35

17 files changed

+686
-0
lines changed

e2etests/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ session_mgmt = []
1919
integration = []
2020
mcp = []
2121
ai_prompts = []
22+
issue_reporting = []
23+
tools=[]
2224

2325
[[test]]
2426
name = "test_help_command"

e2etests/run_simple_categorized.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ RUN_SESSION_MGMT=true
1515
RUN_INTEGRATION=true
1616
RUN_MCP=true
1717
RUN_AI_PROMPTS=true
18+
RUN_ISSUE_REPORTING=true
19+
RUN_TOOLS=true
1820
# ============================================================================
1921

2022
Q_BINARY="q"
@@ -197,6 +199,22 @@ if [ "$RUN_AI_PROMPTS" = true ]; then
197199
fi
198200
fi
199201

202+
if [ "$RUN_ISSUE_REPORTING" = true ]; then
203+
if run_category "issue_reporting" "ISSUE REPORTING"; then
204+
((total_passed++))
205+
else
206+
((total_failed++))
207+
fi
208+
fi
209+
210+
if [ "$RUN_TOOLS" = true ]; then
211+
if run_category "tools" "TOOLS"; then
212+
((total_passed++))
213+
else
214+
((total_failed++))
215+
fi
216+
fi
217+
200218
# Final summary
201219
echo ""
202220
echo "🎯 FINAL SUMMARY"

e2etests/tests/test_hooks_command.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
use q_cli_e2e_tests::q_chat_helper::QChatSession;
2+
3+
#[test]
4+
#[cfg(feature = "integration")]
5+
fn test_hooks_command() -> Result<(), Box<dyn std::error::Error>> {
6+
println!("🔍 Testing /hooks command...");
7+
8+
let mut chat = QChatSession::new()?;
9+
println!("✅ Q Chat session started");
10+
11+
let response = chat.execute_command("/hooks")?;
12+
13+
println!("📝 Hooks command response: {} bytes", response.len());
14+
println!("📝 FULL OUTPUT:");
15+
println!("{}", response);
16+
println!("📝 END OUTPUT");
17+
18+
// Verify no hooks configured message
19+
assert!(response.contains("No hooks are configured."), "Missing no hooks configured message");
20+
println!("✅ Found no hooks configured message");
21+
22+
// Verify documentation reference
23+
assert!(response.contains("Refer to the documentation"), "Missing documentation reference");
24+
assert!(response.contains("https://github.com/aws/amazon-q-developer-cli/blob/main/docs/agent-format.md#hooks-field"), "Missing documentation URL");
25+
println!("✅ Found documentation reference and URL");
26+
27+
// Verify hooks field reference
28+
assert!(response.contains("hooks-field"), "Missing hooks field reference");
29+
println!("✅ Found hooks field reference");
30+
31+
println!("✅ All hooks command functionality verified!");
32+
33+
chat.quit()?;
34+
println!("✅ Test completed successfully");
35+
36+
Ok(())
37+
}

e2etests/tests/test_issue_command.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use q_cli_e2e_tests::q_chat_helper::QChatSession;
2+
3+
#[test]
4+
#[cfg(feature = "issue_reporting")]
5+
fn test_issue_command() -> Result<(), Box<dyn std::error::Error>> {
6+
println!("🔍 Testing /issue command with bug report...");
7+
8+
let mut chat = QChatSession::new()?;
9+
println!("✅ Q Chat session started");
10+
11+
let response = chat.execute_command("/issue \"Bug: Q CLI crashes when using large files\"")?;
12+
13+
println!("📝 Issue command response: {} bytes", response.len());
14+
println!("📝 FULL OUTPUT:");
15+
println!("{}", response);
16+
println!("📝 END OUTPUT");
17+
18+
// Verify command executed successfully (GitHub opens automatically)
19+
assert!(response.contains("Heading over to GitHub..."), "Missing browser opening confirmation");
20+
println!("✅ Found browser opening confirmation");
21+
22+
println!("✅ All issue command functionality verified!");
23+
24+
chat.quit()?;
25+
println!("✅ Test completed successfully");
26+
27+
Ok(())
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use q_cli_e2e_tests::q_chat_helper::QChatSession;
2+
3+
#[test]
4+
#[cfg(feature = "issue_reporting")]
5+
fn test_issue_force_command() -> Result<(), Box<dyn std::error::Error>> {
6+
println!("🔍 Testing /issue --force command with critical bug...");
7+
8+
let mut chat = QChatSession::new()?;
9+
println!("✅ Q Chat session started");
10+
11+
let response = chat.execute_command("/issue --force \"Critical bug in file handling\"")?;
12+
13+
println!("📝 Issue force command response: {} bytes", response.len());
14+
println!("📝 FULL OUTPUT:");
15+
println!("{}", response);
16+
println!("📝 END OUTPUT");
17+
18+
// Verify command executed successfully (GitHub opens automatically)
19+
assert!(response.contains("Heading over to GitHub..."), "Missing browser opening confirmation");
20+
println!("✅ Found browser opening confirmation");
21+
22+
println!("✅ All issue --force command functionality verified!");
23+
24+
chat.quit()?;
25+
println!("✅ Test completed successfully");
26+
27+
Ok(())
28+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
use q_cli_e2e_tests::q_chat_helper::QChatSession;
2+
3+
#[test]
4+
#[cfg(feature = "integration")]
5+
fn test_issue_help_command() -> Result<(), Box<dyn std::error::Error>> {
6+
println!("🔍 Testing /issue --help command...");
7+
8+
let mut chat = QChatSession::new()?;
9+
println!("✅ Q Chat session started");
10+
11+
let response = chat.execute_command("/issue --help")?;
12+
13+
println!("📝 Issue help response: {} bytes", response.len());
14+
println!("📝 FULL OUTPUT:");
15+
println!("{}", response);
16+
println!("📝 END OUTPUT");
17+
18+
// Verify description
19+
assert!(response.contains("Create a new Github issue or make a feature request"), "Missing issue description");
20+
println!("✅ Found issue description");
21+
22+
// Verify Usage section
23+
//assert!(response.contains("Usage: /issue [OPTIONS] [DESCRIPTION]..."), "Missing usage format");
24+
assert!(response.contains("Usage:") && response.contains("/issue") && response.contains("[DESCRIPTION]") && response.contains("[OPTIONS]"), "Missing Usage section");
25+
println!("✅ Found usage format");
26+
27+
// Verify Arguments section
28+
assert!(response.contains("Arguments:"), "Missing Arguments section");
29+
assert!(response.contains("[DESCRIPTION]..."), "Missing DESCRIPTION argument");
30+
assert!(response.contains("Issue description"), "Missing issue description text");
31+
println!("✅ Found Arguments section");
32+
33+
// Verify Options section
34+
assert!(response.contains("Options:"), "Missing Options section");
35+
assert!(response.contains("-f") && response.contains("--force"), "Missing force option");
36+
assert!(response.contains("Force issue creation"), "Missing force description");
37+
assert!(response.contains("-h") && response.contains("--help"), "Missing -h, --help flags");
38+
assert!(response.contains("Print help"), "Missing help description");
39+
println!("✅ Found Options section with force and help flags");
40+
41+
println!("✅ All issue help content verified!");
42+
43+
chat.quit()?;
44+
println!("✅ Test completed successfully");
45+
46+
Ok(())
47+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
use q_cli_e2e_tests::q_chat_helper::QChatSession;
2+
3+
#[test]
4+
#[cfg(feature = "ai_prompts")]
5+
fn test_prompts_command() -> Result<(), Box<dyn std::error::Error>> {
6+
println!("🔍 Testing /prompts command...");
7+
8+
let mut chat = QChatSession::new()?;
9+
println!("✅ Q Chat session started");
10+
11+
let response = chat.execute_command("/prompts")?;
12+
13+
println!("📝 Prompts command response: {} bytes", response.len());
14+
println!("📝 FULL OUTPUT:");
15+
println!("{}", response);
16+
println!("📝 END OUTPUT");
17+
18+
// Verify usage instruction
19+
assert!(response.contains("Usage:") && response.contains("@") && response.contains("<prompt name>") && response.contains("[...args]"), "Missing usage instruction");
20+
println!("✅ Found usage instruction");
21+
22+
// Verify table headers
23+
assert!(response.contains("Prompt"), "Missing Prompt header");
24+
assert!(response.contains("Arguments") && response.contains("*") && response.contains("required"), "Missing Arguments header");
25+
println!("✅ Found table headers with required notation");
26+
27+
// Verify command executed successfully
28+
assert!(!response.is_empty(), "Empty response from prompts command");
29+
println!("✅ Command executed with response");
30+
31+
println!("✅ All prompts command functionality verified!");
32+
33+
chat.quit()?;
34+
println!("✅ Test completed successfully");
35+
36+
Ok(())
37+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
use q_cli_e2e_tests::q_chat_helper::QChatSession;
2+
3+
#[test]
4+
#[cfg(feature = "ai_prompts")]
5+
fn test_prompts_help_command() -> Result<(), Box<dyn std::error::Error>> {
6+
println!("🔍 Testing /prompts --help command...");
7+
8+
let mut chat = QChatSession::new()?;
9+
println!("✅ Q Chat session started");
10+
11+
let response = chat.execute_command("/prompts --help")?;
12+
13+
println!("📝 Prompts help response: {} bytes", response.len());
14+
println!("📝 FULL OUTPUT:");
15+
println!("{}", response);
16+
println!("📝 END OUTPUT");
17+
18+
// Verify description
19+
assert!(response.contains("Prompts are reusable templates that help you quickly access common workflows and tasks"), "Missing prompts description");
20+
assert!(response.contains("These templates are provided by the mcp servers you have installed and configured"), "Missing MCP servers description");
21+
println!("✅ Found prompts description");
22+
23+
// Verify usage examples
24+
assert!(response.contains("@") && response.contains("<prompt name> [arg]") && response.contains("[arg]"), "Missing @ syntax example");
25+
assert!(response.contains("Retrieve prompt specified"), "Missing retrieve description");
26+
assert!(response.contains("/prompts") && response.contains("get") && response.contains("<prompt name>") && response.contains("[arg]"), "Missing long form example");
27+
println!("✅ Found usage examples with @ syntax and long form");
28+
29+
// Verify main description
30+
assert!(response.contains("View and retrieve prompts"), "Missing main description");
31+
println!("✅ Found main description");
32+
33+
// Verify Usage section
34+
assert!(response.contains("Usage:") && response.contains("/prompts") && response.contains("[COMMAND]"), "Missing usage format");
35+
println!("✅ Found usage format");
36+
37+
// Verify Commands section
38+
assert!(response.contains("Commands:"), "Missing Commands section");
39+
assert!(response.contains("list"), "Missing list command");
40+
assert!(response.contains("get"), "Missing get command");
41+
assert!(response.contains("help"), "Missing help command");
42+
println!("✅ Found all commands: list, get, help");
43+
44+
// Verify command descriptions
45+
assert!(response.contains("List available prompts from a tool or show all available prompt"), "Missing list description");
46+
println!("✅ Found command descriptions");
47+
48+
// Verify Options section
49+
assert!(response.contains("Options:"), "Missing Options section");
50+
assert!(response.contains("-h") && response.contains("--help"), "Missing help flags");
51+
println!("✅ Found Options section with help flags");
52+
53+
println!("✅ All prompts help content verified!");
54+
55+
chat.quit()?;
56+
println!("✅ Test completed successfully");
57+
58+
Ok(())
59+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
use q_cli_e2e_tests::q_chat_helper::QChatSession;
2+
3+
#[test]
4+
#[cfg(feature = "tools")]
5+
fn test_tools_help_command() -> Result<(), Box<dyn std::error::Error>> {
6+
println!("🔍 Testing /tools --help command...");
7+
8+
let mut chat = QChatSession::new()?;
9+
println!("✅ Q Chat session started");
10+
11+
let response = chat.execute_command("/tools --help")?;
12+
13+
println!("📝 Tools help response: {} bytes", response.len());
14+
println!("📝 FULL OUTPUT:");
15+
println!("{}", response);
16+
println!("📝 END OUTPUT");
17+
18+
// Verify description
19+
assert!(response.contains("By default, Amazon Q will ask for your permission to use certain tools."), "Missing permission description");
20+
println!("✅ Found tools permission description");
21+
22+
// Verify documentation reference
23+
assert!(response.contains("Refer to the documentation for how to configure tools with your agent"), "Missing documentation reference");
24+
assert!(response.contains("https://github.com/aws/amazon-q-developer-cli/blob/main/docs/agent-format.md#tools-field"), "Missing documentation URL");
25+
println!("✅ Found documentation reference and URL");
26+
27+
// Verify main description
28+
assert!(response.contains("View tools and permissions"), "Missing main description");
29+
println!("✅ Found main description");
30+
31+
// Verify Usage section
32+
//assert!(response.contains("Usage: /tools [COMMAND]"), "Missing usage format");
33+
assert!(response.contains("Usage:") && response.contains("/tools") && response.contains("[COMMAND]"), "Missing Usage section");
34+
println!("✅ Found usage format");
35+
println!("✅ Found usage format");
36+
37+
// Verify Commands section
38+
assert!(response.contains("Commands:"), "Missing Commands section");
39+
assert!(response.contains("schema"), "Missing schema command");
40+
assert!(response.contains("trust"), "Missing trust command");
41+
assert!(response.contains("untrust"), "Missing untrust command");
42+
assert!(response.contains("trust-all"), "Missing trust-all command");
43+
assert!(response.contains("reset"), "Missing reset command");
44+
assert!(response.contains("help"), "Missing help command");
45+
println!("✅ Found all commands: schema, trust, untrust, trust-all, reset, help");
46+
47+
// Verify command descriptions
48+
assert!(response.contains("Show the input schema for all available tools"), "Missing schema description");
49+
assert!(response.contains("Trust a specific tool or tools for the session"), "Missing trust description");
50+
assert!(response.contains("Revert a tool or tools to per-request confirmation"), "Missing untrust description");
51+
assert!(response.contains("Trust all tools (equivalent to deprecated /acceptall)"), "Missing trust-all description");
52+
assert!(response.contains("Reset all tools to default permission levels"), "Missing reset description");
53+
println!("✅ Found all command descriptions");
54+
55+
// Verify Options section
56+
assert!(response.contains("Options:"), "Missing Options section");
57+
assert!(response.contains("-h") && response.contains("--help"), "Missing -h, --help flags");
58+
println!("✅ Found Options section with help flags");
59+
60+
println!("✅ All tools help content verified!");
61+
62+
chat.quit()?;
63+
println!("✅ Test completed successfully");
64+
65+
Ok(())
66+
}

0 commit comments

Comments
 (0)