SPB Git

Repository Public

test-live.sh 1.8 KB 27 lines shellscript

1#!/usr/bin/env bash2# SP Chat iOS3# File: Scripts/test-live.sh4# Description: Runs the unit tests plus the end-to-end suites against the backend DEVELOPMENT server (never production):5#              opens the tunnel, renews the dev test session, passes both to the test runner.6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9set -euo pipefail10cd "$(dirname "$0")/.."11SLOT="$(printf %s "${SPCHAT_DEV_SLOT:-}" | tr -cd 'a-z0-9')"; TOKEN_FILE="$HOME/.config/spchat-dev/session-token${SLOT:+-$SLOT}"12NODE="${SPCHAT_DEV_NODE:-M4M64c}"13lsof -nP -iTCP:8510 -sTCP:LISTEN >/dev/null 2>&1 || ssh -f -N -o ExitOnForwardFailure=yes -L 8510:localhost:8510 "$NODE"14Scripts/dev-session.sh >/dev/null15export TEST_RUNNER_SPCHAT_BASE_URL="http://localhost:8510"16export TEST_RUNNER_SPCHAT_DEBUG_SESSION="$(cat "$TOKEN_FILE")"17# start from a clean composer: no draft left by an earlier run18curl -s -m 10 -o /dev/null -X PUT -H "Origin: http://localhost:8510" -H "Content-Type: application/json" -H "Cookie: csa_session=$TEST_RUNNER_SPCHAT_DEBUG_SESSION" -d '{"scope":"new","text":"","attachmentIds":[]}' http://localhost:8510/api/drafts || true19# a stored conversation answered by an OpenRouter model (sources, follow-ups) for the UI tests that only read20export TEST_RUNNER_SPCHAT_DEMO_CONVERSATION="$(curl -s -m 15 -H "Cookie: csa_session=$TEST_RUNNER_SPCHAT_DEBUG_SESSION" "http://localhost:8510/api/conversations?limit=100" | python3 -c "21import json,sys22try: c=[x for x in json.load(sys.stdin)['conversations'] if str(x.get('model_id') or '').startswith('or:') and x.get('message_count',0)>=2 and 'uitest' not in x.get('title','').lower()]23except Exception: c=[]24print(c[0]['id'] if c else '')" 2>/dev/null || true)"25[ -n "${SPCHAT_UI_THEME:-}" ] && export TEST_RUNNER_SPCHAT_UI_THEME="$SPCHAT_UI_THEME"26exec Scripts/build.sh "${1:-test}" "${@:2}"27
Files main
Menu

Theme