Add Anneng actual-data (scan) download and wire into automation test

安能站点第二阶段:实到数据下载 + 接入自动化测试。

- site_anneng.py:新增 anneng_actual_download()。网点到件扫描查询页是 Ant Design
  且无导出功能——综合查询→扫描查询→网点到件扫描查询(新)→ 设扫描时间(直接输入
  +回车)→ 选「子单」→ 每页 500(size-changer 用 mousedown 展开)→ 查询 → 直接
  从表格 DOM 抽数、逐页翻页取完 → 存 安能-实到货物数据.xlsx → 关 tab。复用应到的
  CDP/菜单/tab 辅助;扫描专有逻辑单独成段。main() 支持 `actual` 参数独立跑实到。
  修掉复用 tab 时首查读到旧总数的问题(查询后等总数变化再读)。
- main_router.py:菜单加 [11] 实到货物数据下载;run_automation_test 的 flow_table
  加入安能(expected/actual),执行循环对应用类站点(APP_SITES)走无 page 分支。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-06-21 22:12:23 +08:00
parent 9d3d3cbb78
commit dea9ad6e07
2 changed files with 302 additions and 4 deletions

View File

@@ -166,6 +166,10 @@ def run_automation_test(pages_map):
"expected": ("应到", site_yunda.yunda_expected_download),
"actual": ("实到", site_yunda.yunda_actual_download),
},
"安能": {
"expected": ("应到", site_anneng.anneng_expected_download),
"actual": ("实到", site_anneng.anneng_actual_download),
},
}
# 构建测试计划:[(站点, 流程中文名, 流程函数), ...]
@@ -195,13 +199,17 @@ def run_automation_test(pages_map):
print("\n----------------------------------------------------")
print(f"[步骤 {idx}/{total}] 站点【{site_name}】流程【{label}")
print("----------------------------------------------------")
page = pages_map[site_name]
start = time.time()
status = "PASS"
err = ""
try:
page.bring_to_front()
ret = func(page)
if site_name in APP_SITES:
# 安能Electron 应用,无 Playwright page函数不收 page 参数
ret = func()
else:
page = pages_map[site_name]
page.bring_to_front()
ret = func(page)
if ret is False:
status = "FAIL"
err = "流程返回失败状态"
@@ -443,6 +451,7 @@ def run_multi_site_daemon():
print("-" * 52)
print(" 模块五【安能】数据处理流Electron 应用)")
print(" [10] 执行 - 应到货物数据下载(运单信息)")
print(" [11] 执行 - 实到货物数据下载(网点到件扫描)")
print("-" * 52)
print(" 自动化测试")
print(" [8] 执行 - 全站点下载流程自动化测试 (交叉跑通校验)")
@@ -479,6 +488,8 @@ def run_multi_site_daemon():
site_yunda.yunda_actual_download(pages_map["韵达"])
elif choice == "10" and is_site_ready("安能"):
site_anneng.anneng_expected_download()
elif choice == "11" and is_site_ready("安能"):
site_anneng.anneng_actual_download()
elif choice == "8":
run_automation_test(pages_map)
elif choice == "9":
@@ -503,6 +514,7 @@ def run_multi_site_daemon():
"8",
"9",
"10",
"11",
"0",
]:
print("\n⚠️ 无效输入,请查证后回车。")