- Add tests/ directory with 12 bash/curl/jq test stages covering all API endpoints - Add tests/lib/common.sh shared library with assertions and helpers - Add tests/run-all.sh orchestrator script - Update CLAUDE.md with test data reference and DevTools MCP docs - Increase dev rate limit to 5000 for test suite runs - Configure Chrome DevTools MCP in project settings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
67 lines
2.6 KiB
Bash
Executable File
67 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -uo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
source "$SCRIPT_DIR/lib/common.sh"
|
|
|
|
FAILED_STAGES=()
|
|
PASSED_STAGES=()
|
|
TOTAL_STAGES=0
|
|
|
|
run_stage() {
|
|
local script="$1" name="$2"
|
|
((TOTAL_STAGES++))
|
|
sleep 1 # Brief pause between stages to avoid overwhelming the server
|
|
if bash "$SCRIPT_DIR/$script"; then
|
|
PASSED_STAGES+=("$name")
|
|
else
|
|
FAILED_STAGES+=("$name")
|
|
fi
|
|
}
|
|
|
|
echo ""
|
|
printf "${BOLD}╔══════════════════════════════════════════╗${NC}\n"
|
|
printf "${BOLD}║ Marketplace QA Test Suite ║${NC}\n"
|
|
printf "${BOLD}╚══════════════════════════════════════════╝${NC}\n"
|
|
echo " API: ${BASE_URL:-http://localhost:3000}"
|
|
echo " Client: ${CLIENT_URL:-http://localhost:5173}"
|
|
echo ""
|
|
|
|
run_stage "stage-01-infrastructure.sh" "Infrastructure"
|
|
run_stage "stage-02-auth.sh" "Authentication"
|
|
run_stage "stage-03-public.sh" "Public Endpoints"
|
|
run_stage "stage-04-user-crud.sh" "User CRUD"
|
|
run_stage "stage-05-listings.sh" "Listings Workflow"
|
|
run_stage "stage-06-offers.sh" "Offers Workflow"
|
|
run_stage "stage-07-rentals.sh" "Rental Workflow"
|
|
run_stage "stage-08-subscriptions.sh" "Subscriptions"
|
|
run_stage "stage-09-chat-notifications.sh" "Chat & Notifications"
|
|
run_stage "stage-10-admin.sh" "Admin Operations"
|
|
run_stage "stage-11-edge-cases.sh" "Edge Cases"
|
|
|
|
# Stage 12 only if client running
|
|
CLIENT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "${CLIENT_URL:-http://localhost:5173}" 2>/dev/null)
|
|
if [[ "$CLIENT_STATUS" == "200" ]]; then
|
|
run_stage "stage-12-client-pages.sh" "Client Pages"
|
|
else
|
|
printf "\n${YELLOW}SKIP: Client not running — Stage 12 skipped${NC}\n"
|
|
fi
|
|
|
|
# Final report
|
|
echo ""
|
|
printf "${BOLD}╔══════════════════════════════════════════╗${NC}\n"
|
|
printf "${BOLD}║ FINAL RESULTS ║${NC}\n"
|
|
printf "${BOLD}╚══════════════════════════════════════════╝${NC}\n"
|
|
printf " Stages passed: ${GREEN}%d${NC} / %d\n" "${#PASSED_STAGES[@]}" "$TOTAL_STAGES"
|
|
|
|
if [[ ${#FAILED_STAGES[@]} -gt 0 ]]; then
|
|
printf " ${RED}Failed stages:${NC}\n"
|
|
for s in "${FAILED_STAGES[@]}"; do
|
|
printf " ${RED}✗ %s${NC}\n" "$s"
|
|
done
|
|
exit 1
|
|
else
|
|
printf " ${GREEN}ALL STAGES PASSED${NC}\n"
|
|
exit 0
|
|
fi
|