B1-B8 建立项目级流程与QA门禁
这个提交包含在:
+180
@@ -0,0 +1,180 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
CLIENT_DIR="$ROOT_DIR/client"
|
||||
MODE="${1:-local}"
|
||||
REPORT_DIR="${BUSINESS_FLOW_REPORT_DIR:-$ROOT_DIR/artifacts/qa-flow/business-flow-$(date +%Y%m%d-%H%M%S)}"
|
||||
|
||||
mkdir -p "$REPORT_DIR"
|
||||
|
||||
usage() {
|
||||
cat <<USAGE
|
||||
Usage: bash scripts/qa/run-business-flow-gates.sh <local|attached|list>
|
||||
|
||||
说明:
|
||||
local 通过 scripts/qa/run-web-gates.sh business-flow-local 准备临时库和服务后运行
|
||||
attached 复用当前 E2E_BASE_URL 直接按业务域执行 Playwright
|
||||
list 仅输出业务域与用例清单
|
||||
|
||||
可选环境变量:
|
||||
BUSINESS_FLOW_GROUPS=auth,reimbursement 仅运行部分业务域
|
||||
E2E_BASE_URL attached 模式下必填或沿用 Playwright 默认
|
||||
USAGE
|
||||
}
|
||||
|
||||
declare -a GROUP_ORDER=(
|
||||
auth
|
||||
reimbursement
|
||||
approval
|
||||
leave
|
||||
collaboration
|
||||
hr
|
||||
project
|
||||
procurement
|
||||
asset
|
||||
travel
|
||||
governance
|
||||
)
|
||||
|
||||
specs_for_group() {
|
||||
case "$1" in
|
||||
auth)
|
||||
printf '%s\n' \
|
||||
tests/e2e/login-portal-ux.spec.ts \
|
||||
tests/e2e/wecom-entry.spec.ts \
|
||||
tests/e2e/wecom-first-bind.spec.ts \
|
||||
tests/e2e/r89-mobile-login-navigation.spec.ts
|
||||
;;
|
||||
reimbursement)
|
||||
printf '%s\n' \
|
||||
tests/e2e/reimbursement-workflow-progress.spec.ts \
|
||||
tests/e2e/invoice-ocr-flow.spec.ts \
|
||||
tests/e2e/reimbursement-payment-batch-flow.spec.ts \
|
||||
tests/e2e/r102-reimbursement-main-flow.spec.ts \
|
||||
tests/e2e/r111-invoice-reimbursement-guard.spec.ts \
|
||||
tests/e2e/r125-invoice-reupload-after-delete.spec.ts
|
||||
;;
|
||||
approval)
|
||||
printf '%s\n' \
|
||||
tests/e2e/workflow-quick-approve.spec.ts \
|
||||
tests/e2e/mobile-approvals-offline.spec.ts
|
||||
;;
|
||||
leave)
|
||||
printf '%s\n' \
|
||||
tests/e2e/leave-flow.spec.ts \
|
||||
tests/e2e/leave-team-calendar.spec.ts
|
||||
;;
|
||||
collaboration)
|
||||
printf '%s\n' \
|
||||
tests/e2e/weekly-todo-flow.spec.ts \
|
||||
tests/e2e/announcements-presence.spec.ts \
|
||||
tests/e2e/global-search.spec.ts
|
||||
;;
|
||||
hr)
|
||||
printf '%s\n' \
|
||||
tests/e2e/user-onboarding.spec.ts \
|
||||
tests/e2e/r75-automation-gap-fill.spec.ts
|
||||
;;
|
||||
project)
|
||||
printf '%s\n' \
|
||||
tests/e2e/project-workbench.spec.ts \
|
||||
tests/e2e/confidential-boundary.spec.ts
|
||||
;;
|
||||
procurement)
|
||||
printf '%s\n' \
|
||||
tests/e2e/procurement-flow.spec.ts
|
||||
;;
|
||||
asset)
|
||||
printf '%s\n' \
|
||||
tests/e2e/assets-flow.spec.ts
|
||||
;;
|
||||
travel)
|
||||
printf '%s\n' \
|
||||
tests/e2e/travel-payment-flow.spec.ts \
|
||||
tests/e2e/travel-reconciliation-flow.spec.ts
|
||||
;;
|
||||
governance)
|
||||
printf '%s\n' \
|
||||
tests/e2e/settings-governance.spec.ts
|
||||
;;
|
||||
*)
|
||||
echo "[business-flow][ERROR] 未知业务域:$1" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
selected_groups() {
|
||||
if [[ -n "${BUSINESS_FLOW_GROUPS:-}" ]]; then
|
||||
tr ',' '\n' <<<"$BUSINESS_FLOW_GROUPS" | sed '/^$/d'
|
||||
return
|
||||
fi
|
||||
|
||||
printf '%s\n' "${GROUP_ORDER[@]}"
|
||||
}
|
||||
|
||||
existing_specs_for_group() {
|
||||
local group="$1"
|
||||
local spec
|
||||
while IFS= read -r spec; do
|
||||
[[ -f "$CLIENT_DIR/$spec" ]] && printf '%s\n' "$spec"
|
||||
done < <(specs_for_group "$group")
|
||||
}
|
||||
|
||||
list_groups() {
|
||||
local group
|
||||
for group in "${GROUP_ORDER[@]}"; do
|
||||
echo "[$group]"
|
||||
existing_specs_for_group "$group" | sed 's/^/ - /'
|
||||
done
|
||||
}
|
||||
|
||||
run_attached() {
|
||||
local group
|
||||
local status=0
|
||||
local summary="$REPORT_DIR/summary.txt"
|
||||
: >"$summary"
|
||||
|
||||
for group in $(selected_groups); do
|
||||
mapfile -t specs < <(existing_specs_for_group "$group")
|
||||
if [[ "${#specs[@]}" -eq 0 ]]; then
|
||||
echo "[business-flow][SKIP] $group:无可执行 spec" | tee -a "$summary"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo ">>> [business-flow] $group" | tee -a "$summary"
|
||||
if (
|
||||
cd "$CLIENT_DIR"
|
||||
E2E_MODE=local npx playwright test "${specs[@]}" --workers=1 --reporter=list
|
||||
); then
|
||||
echo "[business-flow][PASS] $group" | tee -a "$summary"
|
||||
else
|
||||
echo "[business-flow][FAIL] $group" | tee -a "$summary"
|
||||
status=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "[business-flow] report=$summary"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
case "$MODE" in
|
||||
help|-h|--help)
|
||||
usage
|
||||
;;
|
||||
list)
|
||||
list_groups
|
||||
;;
|
||||
attached)
|
||||
run_attached
|
||||
;;
|
||||
local)
|
||||
BUSINESS_FLOW_REPORT_DIR="$REPORT_DIR" bash "$ROOT_DIR/scripts/qa/run-web-gates.sh" business-flow-local
|
||||
;;
|
||||
*)
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
在新工单中引用
屏蔽一个用户