51 行
1.7 KiB
Bash
可执行文件
51 行
1.7 KiB
Bash
可执行文件
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
CLIENT_DIR="$ROOT_DIR/client"
|
|
PUBLIC_BASE_URL="${LIVE_SMOKE_BASE_URL:-https://oa.hyinda.com}"
|
|
REPORT_DIR="${ASSET1D_REPORT_DIR:-$ROOT_DIR/artifacts/qa-flow/asset1d-public-trial-$(date +%Y%m%d-%H%M%S)}"
|
|
ENV_FILE="${ASSET1D_ENV_FILE:-$HOME/.hyb-oa/live-smoke.env}"
|
|
|
|
mkdir -p "$REPORT_DIR"
|
|
|
|
if [[ "${ASSET1D_SKIP_ENV_FILE:-0}" != "1" && -f "$ENV_FILE" ]]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "$ENV_FILE"
|
|
set +a
|
|
PUBLIC_BASE_URL="${LIVE_SMOKE_BASE_URL:-$PUBLIC_BASE_URL}"
|
|
echo "[asset1d] loaded masked live smoke env file"
|
|
fi
|
|
|
|
if [[ -z "${LIVE_SMOKE_ADMIN_IDENTIFIER:-}" || -z "${LIVE_SMOKE_ADMIN_PASSWORD:-}" ]]; then
|
|
echo "[asset1d][ERROR] missing LIVE_SMOKE_ADMIN_IDENTIFIER/PASSWORD" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "[asset1d] base=$PUBLIC_BASE_URL"
|
|
echo "[asset1d] report=$REPORT_DIR"
|
|
|
|
(
|
|
cd "$CLIENT_DIR"
|
|
PLAYWRIGHT_MANUAL=1 \
|
|
ASSET1D_PUBLIC_TRIAL=1 \
|
|
ASSET1D_REPORT_DIR="$REPORT_DIR" \
|
|
E2E_BASE_URL="$PUBLIC_BASE_URL" \
|
|
npx playwright test tests/e2e/manual/asset1d-public-trial.spec.ts --workers=1 --reporter=list
|
|
)
|
|
|
|
node - "$REPORT_DIR" <<'NODE'
|
|
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
const reportDir = process.argv[2];
|
|
const summaryPath = path.join(reportDir, "summary.json");
|
|
if (!fs.existsSync(summaryPath)) {
|
|
console.error(`[asset1d][ERROR] missing summary: ${summaryPath}`);
|
|
process.exit(1);
|
|
}
|
|
const summary = JSON.parse(fs.readFileSync(summaryPath, "utf8"));
|
|
console.log(`[asset1d] status=${summary.status} created=${summary.createdAssets?.length ?? 0}`);
|
|
if (summary.status !== "PASS_ASSET_UI_TRIAL_READY") process.exit(1);
|
|
NODE
|