fix(rpa): 计划报表行按规范化名称匹配修复收料轮询not found

This commit is contained in:
hugo committed 2026-09-19 10:15:03 +08:00
1 parent c3eef5cf20
commit e08f314047
2 files changed
+50 -3

No files matched your search

+31
View File
@@ -596,3 +596,34 @@ def test_wait_and_click_scheduled_download_skips_fallback_on_click_failure(tmp_p
download_dir=str(tmp_path),
)
assert fallback_called["value"] is False
def test_row_matches_scheduled_report_normalizes_name_form(monkeypatch):
"""行名 InboundDetails.xlsx 与期望名 Inbound Details 应规范化后相等(收料轮询 not found 根因)。"""
module = _load_export()
texts = ["InboundDetails.xlsx", "2026/9/18 22:02:53", "accf9483fabe", "Download"]
class _Cell:
def __init__(self, text):
self._text = text
def inner_text(self, timeout=None):
return self._text
cells = MagicMock()
cells.count.return_value = len(texts)
cells.nth.side_effect = lambda i: _Cell(texts[i])
row = MagicMock()
row.locator.return_value = cells
row.is_visible.return_value = True
assert module._row_matches_scheduled_report(
row, description="accf9483fabe", expected_report_name="Inbound Details"
) is True
# [断言意图] 描述不一致时不得匹配(唯一性由 UUID 保证)
assert module._row_matches_scheduled_report(
row, description="other", expected_report_name="Inbound Details"
) is False
assert module._row_matches_scheduled_report(
row, description="accf9483fabe", expected_report_name="OnHandDetails.xlsx"
) is False