Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

test(web): 浏览器冒烟跑完全部批次再汇总失败

longmeidaoa3817e49e277
diff --git a/docs/TESTING.md b/docs/TESTING.md
index 29a616bc1..e4a0f2b92 100644
--- a/docs/TESTING.md
+++ b/docs/TESTING.md
@@ -164,7 +164,9 @@ ffmpeg 起不来是事实,但它不该挡住一次只改文档的 `checks`。
## 定向调试与局部记录
-Windows 的 `-Focus` 接受 Python 模块、类、方法或仓库相对路径,可传数组;macOS/Linux 对每个选择器重复传 `--focus`。入口准备隔离依赖并核对源码。选择器不存在、浏览器路径超出 `frontend/e2e` 或与分片混用时拒绝执行。
+Windows 的 `-Focus` 接受 Python 模块、类、方法或仓库相对路径,可传数组;macOS/Linux 对每个选择器重复传 `--focus`。入口准备隔离依赖并核对源码。选择器不存在、浏览器路径超出 `frontend/e2e` 或与分片混用时拒绝执行。浏览器用例只收单个 `frontend/e2e/*.test.ts` 文件,不收目录;要跑全部 e2e 时把文件逐个列进数组。
+
+浏览器冒烟把 e2e 文件分成若干批,一批失败仍跑完其余批次,最后把各失败批次的输出与日志路径一起报出;一轮全量就能看到所有 e2e 失败,修完再起下一轮。
定向调试 Python 回归:
diff --git a/tests/test_web_e2e.py b/tests/test_web_e2e.py
index 4d7209dfc..d8bc16ac6 100644
--- a/tests/test_web_e2e.py
+++ b/tests/test_web_e2e.py
@@ -19,6 +19,7 @@ from __future__ import annotations
import importlib.util
import json
import os
+import re
import shutil
import socket
import sqlite3
@@ -327,6 +328,9 @@ class WebE2ESmokeTests(unittest.TestCase):
concurrency = e2e_concurrency(os.environ.get("PEACH_E2E_CONCURRENCY", "").strip())
selected = tuple(json.loads(os.environ.get("PEACH_E2E_FILES", "[]")))
batches = e2e_batches(FRONTEND, concurrency, selected)
+ # 一批红了也接着跑完后面的批次,最后一起报:停在第一批的话,一轮全量只露出一处失败,
+ # 修一处、再等一轮全量才看见下一处。
+ failures = []
for index, (batch, lanes) in enumerate(batches, 1):
print(f"浏览器批次 {index}/{len(batches)}:{', '.join(batch)}", flush=True)
log_path = BROWSER_LOGS / f"batch-{index}.tap"
@@ -340,12 +344,15 @@ class WebE2ESmokeTests(unittest.TestCase):
if isinstance(partial, bytes):
partial = partial.decode("utf-8", errors="replace")
log_path.write_text(partial, encoding="utf-8")
- self.fail(f"本批 {E2E_SECONDS} 秒内没跑完,完整日志:{log_path}\n{partial[-4000:]}")
+ failures.append(f"批次 {index} 在 {E2E_SECONDS} 秒内没跑完,完整日志:{log_path}\n{partial[-4000:]}")
+ continue
output = f"{completed.stdout}\n{completed.stderr}"
log_path.write_text(output, encoding="utf-8")
- self.assertEqual(completed.returncode, 0, f"{output}\n--- serve.log ---\n{self._server_log()}")
- self.assertRegex(output, r"# pass [1-9]\d*", output)
- self.assertRegex(output, r"# fail 0\b", output)
+ if (completed.returncode != 0 or not re.search(r"# pass [1-9]\d*", output)
+ or not re.search(r"# fail 0\b", output)):
+ failures.append(f"批次 {index}({', '.join(batch)})退出码 {completed.returncode},日志:{log_path}\n{output}")
+ if failures:
+ self.fail("\n\n".join(failures) + f"\n--- serve.log ---\n{self._server_log()}")
class SetupE2ETests(unittest.TestCase):