Files
Media-download-telegram-bot/web/miniapp/e2e/run.sh
T
MichilisandClaude Opus 5.5 3c153af97f Phase 8: widgets and polish
- Live job card widget (progress bar, in-widget cancel via widget_query)
  and live invoice widget (QR drawn from a bitmap, countdown, paid state),
  Bot API 10.4 sendWidget, private chats only
- Automatic fallback to the ordinary message when sendWidget fails, with
  a breaker that pauses widgets after repeated failures or on servers
  without the method; TELEGRAM_WIDGETS
- Prometheus metrics on the core (/metrics) and on every worker: queue
  depth and wait, slots, heartbeats, job outcomes, errors per site,
  deliveries, cache, invoices, Lightning, ledger check, widgets
- Example Prometheus config and alert rules, Caddyfile, dashboard notes
- Load test: cmd/loadtest and deploy/loadtest (make loadtest)
- Browser check of the widgets' HTML, including decoding a drawn QR
- docs/DEPLOY.md (production in under an hour) and docs/MONITORING.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:24:36 +00:00

43 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Runs the browser test of the Mini App: a complete core in test mode
# (fake Telegram, fake LNbits, scripted yt-dlp) and headless Chromium
# clicking through the built app.
#
# web/miniapp/e2e/run.sh [screenshot dir]
#
# Needs Node.js with "npm ci" done in web/miniapp, and a Chromium that
# Playwright can start: "npx playwright-core install chromium", or
# CHROMIUM_PATH pointing at a Chrome or Chromium binary.
set -euo pipefail
root="$(cd "$(dirname "$0")/../../.." && pwd)"
stage="$(mktemp -d)"
shots="${1:-}"
log="$stage/core.log"
cleanup() {
touch "$stage/stop"
wait "$core" 2>/dev/null || true
rm -rf "$stage"
}
cd "$root"
(cd web/miniapp && npm run build >/dev/null)
DLBOT_STAGE_DIR="$stage" go test ./internal/app/ -run '^TestMiniAppStage$' -count=1 -timeout 20m >"$log" 2>&1 &
core=$!
trap cleanup EXIT
for _ in $(seq 1 600); do
[ -f "$stage/stage.json" ] && break
if ! kill -0 "$core" 2>/dev/null; then
echo "the core did not start:" >&2
cat "$log" >&2
exit 1
fi
sleep 0.2
done
[ -f "$stage/stage.json" ] || { echo "timed out waiting for the core" >&2; cat "$log" >&2; exit 1; }
(cd web/miniapp && node e2e/smoke.mjs "$stage" "$shots" && node e2e/widgets.mjs "$shots")