Add comprehensive testing plan and quick test script
- TEST-PLAN.md: 38 detailed tests covering all features - quick-test.sh: Automated quick test for basic functionality - Tests include IMAP, SMTP, attachments, SSL/TLS, error handling
This commit is contained in:
1025
TEST-PLAN.md
Normal file
1025
TEST-PLAN.md
Normal file
File diff suppressed because it is too large
Load Diff
106
quick-test.sh
Executable file
106
quick-test.sh
Executable file
@@ -0,0 +1,106 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Quick Test Script for nextcloud-mail
|
||||||
|
# Usage: ./quick-test.sh <username>
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
USERNAME="${1:-wltbagent@shortcutsolutions.net}"
|
||||||
|
TEST_DIR="/tmp/mail-tests"
|
||||||
|
|
||||||
|
echo "========================================="
|
||||||
|
echo "nextcloud-mail Quick Test Suite"
|
||||||
|
echo "========================================="
|
||||||
|
echo ""
|
||||||
|
echo "Username: $USERNAME"
|
||||||
|
echo "Test Directory: $TEST_DIR"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Create test directory
|
||||||
|
mkdir -p "$TEST_DIR"
|
||||||
|
echo "✓ Test directory created: $TEST_DIR"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Test 1: List folders
|
||||||
|
echo "Test 1: List folders"
|
||||||
|
echo "Running: ~/bin/nextcloud-mail --op list-folders"
|
||||||
|
~/bin/nextcloud-mail --op list-folders
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Test 2: List messages
|
||||||
|
echo "Test 2: List messages in INBOX"
|
||||||
|
echo "Running: ~/bin/nextcloud-mail --op list-messages --folder INBOX --page 1 --page-size 5"
|
||||||
|
~/bin/nextcloud-mail --op list-messages --folder INBOX --page 1 --page-size 5
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Test 3: Send test email
|
||||||
|
echo "Test 3: Send test email to self"
|
||||||
|
TEST_SUBJECT="nextcloud-mail Test - $(date +%s)"
|
||||||
|
echo "Running: ~/bin/nextcloud-mail --op send-email --from $USERNAME --to $USERNAME --subject '$TEST_SUBJECT'"
|
||||||
|
~/bin/nextcloud-mail --op send-email \
|
||||||
|
--from "$USERNAME" \
|
||||||
|
--to "$USERNAME" \
|
||||||
|
--subject "$TEST_SUBJECT" \
|
||||||
|
--body "This is an automated test from nextcloud-mail tool."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Wait for email to arrive
|
||||||
|
echo "Waiting 5 seconds for email to arrive..."
|
||||||
|
sleep 5
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Test 4: Search for test email
|
||||||
|
echo "Test 4: Search for test email"
|
||||||
|
echo "Running: ~/bin/nextcloud-mail --op search --folder INBOX --query '$TEST_SUBJECT'"
|
||||||
|
~/bin/nextcloud-mail --op search --folder INBOX --query "$TEST_SUBJECT"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Test 5: Send email with attachment
|
||||||
|
echo "Test 5: Send email with attachment"
|
||||||
|
echo "Creating test attachment..."
|
||||||
|
echo "This is a test attachment from nextcloud-mail." > "$TEST_DIR/attachment.txt"
|
||||||
|
echo "Running: ~/bin/nextcloud-mail --op send-email --from $USERNAME --to $USERNAME --subject 'Test with attachment' --attachments $TEST_DIR/attachment.txt"
|
||||||
|
~/bin/nextcloud-mail --op send-email \
|
||||||
|
--from "$USERNAME" \
|
||||||
|
--to "$USERNAME" \
|
||||||
|
--subject "Test with attachment - $(date +%s)" \
|
||||||
|
--body "Email with one attachment." \
|
||||||
|
--attachments "$TEST_DIR/attachment.txt"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Wait for attachment email
|
||||||
|
echo "Waiting 5 seconds for attachment email to arrive..."
|
||||||
|
sleep 5
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Test 6: Get message with attachment
|
||||||
|
echo "Test 6: Get message and list attachments"
|
||||||
|
echo "Finding recent message..."
|
||||||
|
UID=$(~/bin/nextcloud-mail --op list-messages --folder INBOX --page 1 --page-size 1 | grep "UID:" | awk '{print $2}')
|
||||||
|
if [ -n "$UID" ]; then
|
||||||
|
echo "Found UID: $UID"
|
||||||
|
echo "Running: ~/bin/nextcloud-mail --op get-message --folder INBOX --uids $UID --list-attachments"
|
||||||
|
~/bin/nextcloud-mail --op get-message --folder INBOX --uids "$UID" --list-attachments
|
||||||
|
|
||||||
|
# Test 7: Save attachments
|
||||||
|
echo ""
|
||||||
|
echo "Test 7: Save attachments"
|
||||||
|
mkdir -p "$TEST_DIR/downloads"
|
||||||
|
echo "Running: ~/bin/nextcloud-mail --op get-message --folder INBOX --uids $UID --save-attachments --save-dir $TEST_DIR/downloads"
|
||||||
|
~/bin/nextcloud-mail --op get-message --folder INBOX --uids "$UID" \
|
||||||
|
--save-attachments --save-dir "$TEST_DIR/downloads"
|
||||||
|
|
||||||
|
# Verify files were saved
|
||||||
|
echo ""
|
||||||
|
echo "Downloaded files:"
|
||||||
|
ls -lh "$TEST_DIR/downloads"
|
||||||
|
else
|
||||||
|
echo "⚠ Could not find message UID for attachment test"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "========================================="
|
||||||
|
echo "Quick Test Suite Complete!"
|
||||||
|
echo "========================================="
|
||||||
|
echo ""
|
||||||
|
echo "Test artifacts in: $TEST_DIR"
|
||||||
|
echo "For full testing, see: TEST-PLAN.md"
|
||||||
Reference in New Issue
Block a user