Skip to content

Commit 27131f1

Browse files
QCLI Automation for core_session,integration,mcp,model,session_mgmt tests
1 parent a192763 commit 27131f1

File tree

11 files changed

+583
-164
lines changed

11 files changed

+583
-164
lines changed

e2etests/run_simple_categorized.sh

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ 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
20-
RUN_COMPACT=true
21-
RUN_HOOKS=true
22-
RUN_USAGE=true
23-
RUN_EDITOR=true
24-
RUN_SUBSCRIBE=true
18+
#TODO: check and remove not required features from below
19+
#RUN_ISSUE_REPORTING=true
20+
#RUN_TOOLS=true
21+
#RUN_COMPACT=true
22+
#RUN_HOOKS=true
23+
#RUN_USAGE=true
24+
#RUN_EDITOR=true
25+
#RUN_SUBSCRIBE=true
2526
# ============================================================================
2627

2728
Q_BINARY="q"
@@ -220,45 +221,46 @@ if [ "$RUN_TOOLS" = true ]; then
220221
fi
221222
fi
222223

223-
if [ "$RUN_COMPACT" = true ]; then
224-
if run_category "compact" "COMPACT"; then
225-
((total_passed++))
226-
else
227-
((total_failed++))
228-
fi
229-
fi
230-
231-
if [ "$RUN_HOOKS" = true ]; then
232-
if run_category "hooks" "HOOKS"; then
233-
((total_passed++))
234-
else
235-
((total_failed++))
236-
fi
237-
fi
238-
239-
if [ "$RUN_USAGE" = true ]; then
240-
if run_category "usage" "USAGE"; then
241-
((total_passed++))
242-
else
243-
((total_failed++))
244-
fi
245-
fi
246-
247-
if [ "$RUN_EDITOR" = true ]; then
248-
if run_category "editor" "EDITOR"; then
249-
((total_passed++))
250-
else
251-
((total_failed++))
252-
fi
253-
fi
254-
255-
if [ "$RUN_SUBSCRIBE" = true ]; then
256-
if run_category "subscribe" "SUBSCRIBE"; then
257-
((total_passed++))
258-
else
259-
((total_failed++))
260-
fi
261-
fi
224+
#TODO: check and remove not required features from below
225+
# if [ "$RUN_COMPACT" = true ]; then
226+
# if run_category "compact" "COMPACT"; then
227+
# ((total_passed++))
228+
# else
229+
# ((total_failed++))
230+
# fi
231+
# fi
232+
#
233+
# if [ "$RUN_HOOKS" = true ]; then
234+
# if run_category "hooks" "HOOKS"; then
235+
# ((total_passed++))
236+
# else
237+
# ((total_failed++))
238+
# fi
239+
# fi
240+
#
241+
# if [ "$RUN_USAGE" = true ]; then
242+
# if run_category "usage" "USAGE"; then
243+
# ((total_passed++))
244+
# else
245+
# ((total_failed++))
246+
# fi
247+
# fi
248+
#
249+
# if [ "$RUN_EDITOR" = true ]; then
250+
# if run_category "editor" "EDITOR"; then
251+
# ((total_passed++))
252+
# else
253+
# ((total_failed++))
254+
# fi
255+
# fi
256+
#
257+
# if [ "$RUN_SUBSCRIBE" = true ]; then
258+
# if run_category "subscribe" "SUBSCRIBE"; then
259+
# ((total_passed++))
260+
# else
261+
# ((total_failed++))
262+
# fi
263+
# fi
262264

263265
# Final summary
264266
echo ""

e2etests/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ pub mod q_chat_helper {
138138
},
139139
Ok(_) => {
140140
// No more data, but wait a bit more in case there's more coming
141-
std::thread::sleep(Duration::from_millis(2500));
141+
std::thread::sleep(Duration::from_millis(20000));
142142
if total_content.len() > 0 { break; }
143143
},
144144
Err(_) => break,
145145
}
146-
std::thread::sleep(Duration::from_millis(2500));
146+
std::thread::sleep(Duration::from_millis(20000));
147147
}
148148

149149
Ok(total_content)

e2etests/tests/core_session/test_tools_command.rs

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,6 @@ fn test_tools_help_command() -> Result<(), Box<dyn std::error::Error>> {
9191
println!("{}", response);
9292
println!("📝 END OUTPUT");
9393

94-
/* Verify description
95-
assert!(response.contains("permission"), "Missing permission description");
96-
println!("✅ Found tools permission description");*/
97-
98-
// Verify documentation reference
99-
//assert!(response.contains("documentation"), "Missing documentation reference");
100-
assert!(response.contains("https://github.com/aws/amazon-q-developer-cli/blob/main/docs/agent-format.md#tools-field"), "Missing documentation URL");
101-
println!("✅ Found documentation reference and URL");
102-
10394
// Verify Usage section
10495
assert!(response.contains("Usage:") && response.contains("/tools") && response.contains("[COMMAND]"), "Missing Usage section");
10596
println!("✅ Found usage format");
@@ -147,11 +138,9 @@ fn test_tools_trust_all_command() -> Result<(), Box<dyn std::error::Error>> {
147138
println!("{}", trust_all_response);
148139
println!("📝 END TRUST-ALL OUTPUT");
149140

150-
/* Verify trust-all confirmation message
151-
assert!(trust_all_response.contains("confirmation"), "Missing trust-all confirmation message");
152-
assert!(trust_all_response.contains("risk"), "Missing risk warning message");*/
153-
assert!(trust_all_response.contains("https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-chat-security.html#command-line-chat-trustall-safety"), "Missing documentation link");
154-
println!("✅ Found documentation link");
141+
// Verify that all tools now show "trusted" permission
142+
assert!(trust_all_response.contains("All tools") && trust_all_response.contains("trusted"), "Missing trusted tools after trust-all");
143+
println!("✅ trust-all confirmation message!!");
155144

156145
// Now check tools list to verify all tools are trusted
157146
let tools_response = chat.execute_command("/tools")?;
@@ -228,17 +217,14 @@ fn test_tools_trust_all_help_command() -> Result<(), Box<dyn std::error::Error>>
228217
println!("{}", response);
229218
println!("📝 END OUTPUT");
230219

231-
/* Verify command description
232-
assert!(response.contains("Trust"), "Missing command description");
233-
println!("✅ Found command description");*/
234220

235221
// Verify usage format
236222
assert!(response.contains("Usage:") && response.contains("/tools trust-all"), "Missing usage format");
237223
println!("✅ Found usage format");
238224

239225
// Verify options section
240226
assert!(response.contains("Options:"), "Missing Options section");
241-
assert!(response.contains("-h") && response.contains("--help") && response.contains("Print help"), "Missing help option");
227+
assert!(response.contains("-h") && response.contains("--help"), "Missing help option");
242228
println!("✅ Found options section with help flag");
243229

244230
println!("✅ All tools trust-all help functionality verified!");
@@ -267,17 +253,13 @@ fn test_tools_reset_help_command() -> Result<(), Box<dyn std::error::Error>> {
267253
println!("{}", response);
268254
println!("📝 END OUTPUT");
269255

270-
/* Verify command description
271-
assert!(response.contains("Reset"), "Missing command description");
272-
println!("✅ Found command description");*/
273-
274256
// Verify usage format
275257
assert!(response.contains("Usage:") && response.contains("/tools reset"), "Missing usage format");
276258
println!("✅ Found usage format");
277259

278260
// Verify options section
279261
assert!(response.contains("Options:"), "Missing Options section");
280-
assert!(response.contains("-h") && response.contains("--help") && response.contains("Print help"), "Missing help option");
262+
assert!(response.contains("-h") && response.contains("--help"), "Missing help option");
281263
println!("✅ Found options section with help flag");
282264

283265
println!("✅ All tools reset help functionality verified!");
@@ -384,10 +366,6 @@ fn test_tools_trust_help_command() -> Result<(), Box<dyn std::error::Error>> {
384366
println!("{}", response);
385367
println!("📝 END OUTPUT");
386368

387-
/* Verify command description
388-
assert!(response.contains("Trust"), "Missing command description");
389-
println!("✅ Found command description");*/
390-
391369
// Verify usage format
392370
assert!(response.contains("Usage:") && response.contains("/tools trust") && response.contains("<TOOL_NAMES>"), "Missing usage format");
393371
println!("✅ Found usage format");
@@ -427,10 +405,6 @@ fn test_tools_untrust_help_command() -> Result<(), Box<dyn std::error::Error>> {
427405
println!("{}", response);
428406
println!("📝 END OUTPUT");
429407

430-
/* Verify command description
431-
assert!(response.contains("Revert"), "Missing command description");
432-
println!("✅ Found command description");*/
433-
434408
// Verify usage format
435409
assert!(response.contains("Usage:") && response.contains("/tools untrust") && response.contains("<TOOL_NAMES>"), "Missing usage format");
436410
println!("✅ Found usage format");
@@ -469,11 +443,7 @@ fn test_tools_schema_help_command() -> Result<(), Box<dyn std::error::Error>> {
469443
println!("📝 FULL OUTPUT:");
470444
println!("{}", response);
471445
println!("📝 END OUTPUT");
472-
473-
/* Verify command description
474-
assert!(response.contains("Show the input schema for all available tools"), "Missing command description");
475-
println!("✅ Found command description");*/
476-
446+
477447
// Verify usage format
478448
assert!(response.contains("Usage:") && response.contains("/tools schema"), "Missing usage format");
479449
println!("✅ Found usage format");
@@ -493,7 +463,7 @@ fn test_tools_schema_help_command() -> Result<(), Box<dyn std::error::Error>> {
493463

494464
Ok(())
495465
}
496-
466+
//TODO: As response not giving full content , need to check this.
497467
/*#[test]
498468
#[cfg(feature = "tools")]
499469
fn test_tools_schema_command() -> Result<(), Box<dyn std::error::Error>> {

e2etests/tests/integration/test_editor_help_command.rs

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ static TEST_COUNT: AtomicUsize = AtomicUsize::new(0);
1010
const TEST_NAMES: &[&str] = &[
1111
"test_editor_help_command",
1212
"test_help_editor_command",
13+
"test_editor_h_command",
1314
];
1415
#[allow(dead_code)]
1516
const TOTAL_TESTS: usize = TEST_NAMES.len();
@@ -20,7 +21,7 @@ fn test_editor_help_command() -> Result<(), Box<dyn std::error::Error>> {
2021
println!("🔍 Testing /editor --help command...");
2122

2223
let session = get_chat_session();
23-
let mut chat = session.lock().unwrap();
24+
let mut chat = session.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
2425

2526
let response = chat.execute_command("/editor --help")?;
2627

@@ -29,10 +30,6 @@ fn test_editor_help_command() -> Result<(), Box<dyn std::error::Error>> {
2930
println!("{}", response);
3031
println!("📝 END OUTPUT");
3132

32-
/* Verify description
33-
assert!(response.contains("Open $EDITOR"), "Missing editor description");
34-
println!("✅ Found editor description");*/
35-
3633
// Verify Usage section
3734
assert!(response.contains("Usage:") && response.contains("/editor") && response.contains("[INITIAL_TEXT]"), "Missing Usage section");
3835
println!("✅ Found Usage section with /editor command");
@@ -67,7 +64,7 @@ fn test_help_editor_command() -> Result<(), Box<dyn std::error::Error>> {
6764
println!("🔍 Testing /help editor command...");
6865

6966
let session = get_chat_session();
70-
let mut chat = session.lock().unwrap();
67+
let mut chat = session.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
7168

7269
let response = chat.execute_command("/help editor")?;
7370

@@ -102,4 +99,47 @@ fn test_help_editor_command() -> Result<(), Box<dyn std::error::Error>> {
10299
cleanup_if_last_test(&TEST_COUNT, TOTAL_TESTS)?;
103100

104101
Ok(())
105-
}
102+
}
103+
104+
#[test]
105+
#[cfg(all(any(feature = "editor", feature = "integration"), feature = "regression"))]
106+
fn test_editor_h_command() -> Result<(), Box<dyn std::error::Error>> {
107+
println!("🔍 Testing /editor -h command...");
108+
109+
let session = get_chat_session();
110+
let mut chat = session.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
111+
112+
let response = chat.execute_command("/editor -h")?;
113+
114+
println!("📝 Editor help response: {} bytes", response.len());
115+
println!("📝 FULL OUTPUT:");
116+
println!("{}", response);
117+
println!("📝 END OUTPUT");
118+
119+
// Verify Usage section
120+
assert!(response.contains("Usage:") && response.contains("/editor") && response.contains("[INITIAL_TEXT]"), "Missing Usage section");
121+
println!("✅ Found Usage section with /editor command");
122+
123+
// Verify Arguments section
124+
assert!(response.contains("Arguments:"), "Missing Arguments section");
125+
assert!(response.contains("[INITIAL_TEXT]"), "Missing INITIAL_TEXT argument");
126+
println!("✅ Found Arguments section");
127+
128+
// Verify Options section
129+
assert!(response.contains("Options:"), "Missing Options section");
130+
println!("✅ Found Options section");
131+
132+
// Verify help flags
133+
assert!(response.contains("-h") && response.contains("--help"), "Missing -h, --help flags");
134+
println!("✅ Found help flags: -h, --help with Print help description");
135+
136+
println!("✅ All editor help content verified!");
137+
138+
// Release the lock before cleanup
139+
drop(chat);
140+
141+
// Cleanup only if this is the last test
142+
cleanup_if_last_test(&TEST_COUNT, TOTAL_TESTS)?;
143+
144+
Ok(())
145+
}

0 commit comments

Comments
 (0)