Files
AOS/aos-verify9.sh
T

89 lines
3.9 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Verify Reporting + Setup Wizard
set -u
cd /home/z/my-project
BASE=http://127.0.0.1:3000
SHOTS=/home/z/my-project/aos-shots
mkdir -p "$SHOTS"
echo "=== Start server ==="
pkill -f "next dev" 2>/dev/null; pkill -f "tee dev.log" 2>/dev/null; sleep 2
bun run dev > dev.log 2>&1 &
SRV=$!
for i in $(seq 1 90); do curl -s -o /dev/null "$BASE/" 2>/dev/null && break; sleep 1; done
echo " ready after ${i}s"; sleep 2
echo "=== API tests ==="
echo -n " /api/aos/reporting -> "; curl -s -o /dev/null -w "HTTP %{http_code}\n" "$BASE/api/aos/reporting"
curl -s "$BASE/api/aos/reporting" | python3 -c "
import sys,json
d=json.load(sys.stdin)
p=d['pipeline']
print(f' pipeline: {p[\"conversionRate\"]}% conversion, €{p[\"pipelineValue\"]/100:.0f} open, €{p[\"wonValue\"]/100:.0f} won')
r=d['recurring']
print(f' MRR: €{r[\"mrr\"]/100:.0f}, ARR: €{r[\"arr\"]/100:.0f}, renewals: {len(r[\"renewalsDue\"])}')
print(f' utilization: {len(d[\"utilization\"][\"byProject\"])} projects, {len(d[\"utilization\"][\"weekly\"])} weeks')
print(f' activity: {len(d[\"activity\"])} groups, estimateWinRate: {d[\"estimateWinRate\"]}%')
" 2>/dev/null
echo ""
echo "=== Browser: Reporting view ==="
agent-browser open "$BASE/" >/dev/null 2>&1
agent-browser wait --load networkidle >/dev/null 2>&1 || true
agent-browser wait 3000 >/dev/null 2>&1
agent-browser set viewport 1440 900 >/dev/null 2>&1
agent-browser find text "Reporting" click >/dev/null 2>&1
agent-browser wait 3000 >/dev/null 2>&1
H1=$(agent-browser get text h1 2>/dev/null | head -1)
echo " Reporting H1: $H1"
agent-browser screenshot --full "$SHOTS/v11-reporting.png" >/dev/null 2>&1 && echo " shot OK"
echo "=== Switch to MRR tab ==="
agent-browser find role tab click --name "MRR & Erneuerungen" >/dev/null 2>&1 || agent-browser find text "MRR" click >/dev/null 2>&1
agent-browser wait 2000 >/dev/null 2>&1
agent-browser screenshot --full "$SHOTS/v11-reporting-mrr.png" >/dev/null 2>&1 && echo " mrr shot OK"
echo "=== Switch to Auslastung tab ==="
agent-browser find role tab click --name "Auslastung" >/dev/null 2>&1 || agent-browser find text "Auslastung" click >/dev/null 2>&1
agent-browser wait 2000 >/dev/null 2>&1
agent-browser screenshot --full "$SHOTS/v11-reporting-utilization.png" >/dev/null 2>&1 && echo " utilization shot OK"
echo ""
echo "=== Browser: Setup Wizard ==="
agent-browser find text "Setup-Wizard" click >/dev/null 2>&1
agent-browser wait 3000 >/dev/null 2>&1
H1=$(agent-browser get text h1 2>/dev/null | head -1)
echo " Wizard H1: $H1"
agent-browser screenshot --full "$SHOTS/v11-wizard-step1.png" >/dev/null 2>&1 && echo " step1 shot OK"
echo "=== Click Weiter to step 3 (Modules) ==="
agent-browser find text "Weiter & Speichern" click >/dev/null 2>&1
agent-browser wait 1500 >/dev/null 2>&1
agent-browser find text "Weiter & Speichern" click >/dev/null 2>&1
agent-browser wait 1500 >/dev/null 2>&1
# now at step 3
agent-browser screenshot --full "$SHOTS/v11-wizard-step3-modules.png" >/dev/null 2>&1 && echo " step3 shot OK"
echo "=== Go to step 4 (Mail) and test ==="
agent-browser find text "E-Mail" click >/dev/null 2>&1
agent-browser wait 1500 >/dev/null 2>&1
agent-browser find text "Test ausführen" click >/dev/null 2>&1
agent-browser wait 3000 >/dev/null 2>&1
agent-browser screenshot --full "$SHOTS/v11-wizard-step4-mail.png" >/dev/null 2>&1 && echo " step4 mail shot OK"
MAIL_RES=$(agent-browser eval "document.body.innerText.includes('Verbindung erfolgreich') || document.body.innerText.includes('SMTP')" 2>/dev/null | tail -1)
echo " mail test result visible: $MAIL_RES"
echo ""
echo "=== Errors ==="
agent-browser errors 2>&1 | head -8
echo "--- console last 5 ---"
agent-browser console 2>&1 | tail -5
echo ""
agent-browser close >/dev/null 2>&1
kill $SRV 2>/dev/null
echo "=== dev.log errors ==="
grep -iE "error|⨯|500" dev.log | grep -v SIGTERM | tail -8
echo "=== DONE ==="
ls -la "$SHOTS"/v11-* 2>/dev/null | tail -8