统一服务默认端口为 59188,完善 Windows 服务权限与 macOS LaunchAgent 管理。 实现 Windows 与 macOS 托盘状态机、服务启停等待、单实例保护、日志目录入口和退出前清理后台服务。 统一 Linux、Windows、macOS 与 Docker 的 Playwright Chromium runtime 构建流程,增加缓存、架构校验和 Linux 原生 runner,避免 QEMU。 完善 Windows、macOS、Linux 安装包及签名打包脚本,修正 Chromium 嵌入、服务注册和安装卸载流程。 同步 README、AGENTS、官网首页、Wiki 与前端开发文档,统一端口、初始化、服务、日志、托盘和安装说明。
67 lines
4.1 KiB
Bash
Executable File
67 lines
4.1 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
test_instance() {
|
|
name="$1"
|
|
base_url="$2"
|
|
cookie_file="/tmp/${name}.cookies"
|
|
|
|
curl -fsS "${base_url}/health" | grep -q '"database":"ok"'
|
|
curl -fsS "${base_url}/verify" | grep -q '"initialized":true'
|
|
curl -fsS -c "$cookie_file" -H 'Content-Type: application/json' \
|
|
-d '{"username":"docker_fixture","password":"docker_fixture_password"}' \
|
|
"${base_url}/login" | grep -q '"success":true'
|
|
curl -fsS -b "$cookie_file" "${base_url}/dashboard/stats" | grep -q '"total_cookies":1'
|
|
curl -fsS -b "$cookie_file" "${base_url}/analytics/orders?timezone_offset_minutes=480" | grep -q '"revenue_stats"'
|
|
curl -fsS -b "$cookie_file" "${base_url}/cards" | grep -q '\[Docker测试\]'
|
|
curl -fsS -b "$cookie_file" "${base_url}/api/orders?search=docker&page=1&page_size=5" | grep -q '"success":true'
|
|
curl -fsS -b "$cookie_file" "${base_url}/items/publish-batches?limit=10" | grep -q '"batches"'
|
|
curl -fsS -b "$cookie_file" "${base_url}/automation-issues" | grep -q '"runs"'
|
|
|
|
invalid_amount_status="$(curl -sS -o /tmp/${name}-invalid-amount.json -w '%{http_code}' -b "$cookie_file" \
|
|
-H 'Content-Type: application/json' -X PUT -d '{"amount":"abc"}' \
|
|
"${base_url}/api/orders/docker-invalid-amount")"
|
|
test "$invalid_amount_status" = "400"
|
|
curl -fsS -b "$cookie_file" -H 'Content-Type: application/json' -X PUT \
|
|
-d '{"pause_duration":1}' "${base_url}/cookies/docker-fixture-account/pause-duration" | grep -q '"paused":true'
|
|
curl -fsS -b "$cookie_file" "${base_url}/cookies/docker-fixture-account/pause-duration" | grep -q '"paused":true'
|
|
|
|
keyword_response="$(curl -fsS -b "$cookie_file" -H 'Content-Type: application/json' \
|
|
-d '{"keyword":"docker-keyword-'"$name"'","reply":"before","item_id":"","type":"text","image_url":""}' \
|
|
"${base_url}/keywords-with-item-id/docker-fixture-account")"
|
|
keyword_id="$(printf '%s' "$keyword_response" | sed -n 's/.*"id":\([0-9][0-9]*\).*/\1/p')"
|
|
test -n "$keyword_id"
|
|
curl -fsS -b "$cookie_file" -H 'Content-Type: application/json' -X PUT \
|
|
-d '{"keyword":"docker-keyword-'"$name"'","reply":"after","item_id":"","type":"text","image_url":""}' \
|
|
"${base_url}/keywords-with-type/docker-fixture-account/${keyword_id}" | grep -q '"success":true'
|
|
# 完全相同的更新在 MySQL 也必须成功;用于覆盖 clientFoundRows 的匹配行语义。
|
|
curl -fsS -b "$cookie_file" -H 'Content-Type: application/json' -X PUT \
|
|
-d '{"keyword":"docker-keyword-'"$name"'","reply":"after","item_id":"","type":"text","image_url":""}' \
|
|
"${base_url}/keywords-with-type/docker-fixture-account/${keyword_id}" | grep -q '"success":true'
|
|
curl -fsS -b "$cookie_file" "${base_url}/keywords-with-type/docker-fixture-account" | grep -q '"reply":"after"'
|
|
curl -fsS -b "$cookie_file" -X DELETE \
|
|
"${base_url}/keywords-with-type/docker-fixture-account/${keyword_id}" | grep -q '"success":true'
|
|
|
|
admin_status="$(curl -sS -o /tmp/${name}-admin.json -w '%{http_code}' -b "$cookie_file" "${base_url}/admin/stats")"
|
|
test "$admin_status" = "403"
|
|
|
|
admin_cookie_file="/tmp/${name}.admin.cookies"
|
|
curl -fsS -c "$admin_cookie_file" -H 'Content-Type: application/json' \
|
|
-d '{"username":"docker_admin","password":"docker_admin_password"}' \
|
|
"${base_url}/login" | grep -q '"success":true'
|
|
curl -fsS -b "$admin_cookie_file" -H 'Content-Type: application/json' -X PUT \
|
|
-d '{"theme_color":"docker-blue","renewal_log_retention_days":15}' \
|
|
"${base_url}/system-settings" | grep -q '"success":true'
|
|
curl -fsS -b "$admin_cookie_file" "${base_url}/system-settings" | grep -q '"theme_color":"docker-blue"'
|
|
invalid_bulk_status="$(curl -sS -o /tmp/${name}-invalid-settings.json -w '%{http_code}' -b "$admin_cookie_file" \
|
|
-H 'Content-Type: application/json' -X PUT -d '{"theme_color":"must-not-save","log_level":"verbose"}' \
|
|
"${base_url}/system-settings")"
|
|
test "$invalid_bulk_status" = "400"
|
|
curl -fsS -b "$admin_cookie_file" "${base_url}/system-settings" | grep -q '"theme_color":"docker-blue"'
|
|
printf '%s functional test passed\n' "$name"
|
|
}
|
|
|
|
test_instance sqlite http://app-sqlite:59188
|
|
test_instance mysql http://app-mysql:59188
|
|
test_instance postgres http://app-postgres:59188
|