feat(shipping-notice): 完成货代发货通知全门禁恢复MVP收口
完成全门禁恢复MVP版本交付:调整自动上传与重试配置,重构正式执行链路;修复多处代码bug,新增测试与审计工具;更新全流程文档与契约规范。
This commit is contained in:
1 parent
8e0bbf7a81
commit
c94d173f92
181 files changed
+12947
-1724
No files matched your search
@@ -181,6 +181,14 @@ def _dsv_dropdown_text_visible(page: Any, text: str, *, timeout_ms: int = 1_000)
|
||||
return True
|
||||
except Exception:
|
||||
pass
|
||||
# DSV 的部分 Program(例如 Salt Lake City/AWSSL)由自定义 div/span 渲染,
|
||||
# 不一定带 dropdown-item、a 或 role=menuitem;精确文本定位可命中其嵌套节点。
|
||||
try:
|
||||
for container in ("#report-mega-legacy", ".mega-dropdown-menu", ".dropdown-menu"):
|
||||
if page.locator(container).get_by_text(text, exact=True).first.is_visible(timeout=timeout_ms):
|
||||
return True
|
||||
except Exception:
|
||||
pass
|
||||
probe = _collect_dsv_menu_probe(page, text)
|
||||
for item in probe.get("matchedItems") or []:
|
||||
item_text = str((item or {}).get("text") or "").strip().lower()
|
||||
@@ -219,7 +227,9 @@ def _click_dsv_menu_item(page: Any, text: str, *, next_text: str = "") -> None:
|
||||
deadline = time.monotonic() + 30
|
||||
started_at = time.monotonic()
|
||||
while time.monotonic() < deadline:
|
||||
for selector in (
|
||||
locator_candidates = [
|
||||
(page.locator(selector).first, selector)
|
||||
for selector in (
|
||||
f"#report-mega-legacy a.dropdown-item:has-text({text_literal})",
|
||||
f".mega-dropdown-menu a.dropdown-item:has-text({text_literal})",
|
||||
f".dropdown-menu a.dropdown-item:has-text({text_literal})",
|
||||
@@ -229,12 +239,25 @@ def _click_dsv_menu_item(page: Any, text: str, *, next_text: str = "") -> None:
|
||||
f"#report-mega-legacy a:has-text({text_literal})",
|
||||
f".mega-dropdown-menu a:has-text({text_literal})",
|
||||
f".dropdown-menu a:has-text({text_literal})",
|
||||
):
|
||||
)
|
||||
]
|
||||
# 兼容自定义菜单节点及嵌套 span 文本(AWSSL 使用该类结构)。
|
||||
for container in ("#report-mega-legacy", ".mega-dropdown-menu", ".dropdown-menu"):
|
||||
try:
|
||||
locator_candidates.append(
|
||||
(page.locator(container).get_by_text(text, exact=True).first, f"{container} >> text={text!r}")
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
for locator, selector in locator_candidates:
|
||||
try:
|
||||
locator = page.locator(selector).first
|
||||
locator.wait_for(state="visible", timeout=2_000)
|
||||
for action in ("hover", "click", "force-click", "evaluate", "enter", "space"):
|
||||
try:
|
||||
try:
|
||||
locator.scroll_into_view_if_needed(timeout=1_000)
|
||||
except Exception:
|
||||
pass
|
||||
if action == "hover":
|
||||
locator.hover(timeout=1_500)
|
||||
time.sleep(0.2)
|
||||
|
||||
Reference in new issue
Block a user