fix(评论): 表情保留(UTF-8 提示 + 剪贴板输入 + 严格回读)
- 导入报告新增 emoji_rows/含表情数量;页面提示 CSV 必须 UTF-8 - input_text 评论来源优先设备端剪贴板粘贴,send_keys 兜底 - 评论回读改为整段文字校验(原前缀校验会放过被丢掉的表情) - 测试覆盖表情解析/入库/计数
This commit is contained in:
@@ -73,6 +73,9 @@ rows = cm.parse_rows("https://v.douyin.com/a/,号甲,\"你好, 世界\"")
|
||||
check("逗号 CSV + 引号", rows[0]["comment"], "你好, 世界")
|
||||
rows = cm.parse_rows("https://v.douyin.com/a/\t号甲\t")
|
||||
check("空评论报错", bool(rows[0]["error"]), True)
|
||||
rows = cm.parse_rows("https://v.douyin.com/emoji/\t号甲\t你好😀👍")
|
||||
check("表情保留", rows[0]["comment"], "你好😀👍")
|
||||
check("表情标记", rows[0]["emoji"], True)
|
||||
|
||||
print("=== 2. 导入 / 去重 / 状态 ===")
|
||||
txt = "视频链接\t账号\t评论内容\nhttps://v.douyin.com/a/\t号甲\t第一条"
|
||||
@@ -97,6 +100,11 @@ r = cm.import_comments("https://v.douyin.com/dry/\t号乙\t预演", dry_run=True
|
||||
check("dry_run 计数", (r["added"], r["dry_run"]), (1, True))
|
||||
with app.app_context():
|
||||
check("dry_run 不写库", CommentItem.query.filter_by(account_name="号乙").count(), 0)
|
||||
r = cm.import_comments("https://v.douyin.com/emoji/\t号甲\t你好😀👍")
|
||||
check("导入报告含表情数", r.get("emoji_rows"), 1)
|
||||
with app.app_context():
|
||||
_er = CommentItem.query.filter_by(video_url="https://v.douyin.com/emoji").first()
|
||||
check("DB 保留表情", _er.comment_text if _er else None, "你好😀👍")
|
||||
|
||||
print("=== 3. 原子领取 / 标记 / 重试 / 僵尸 ===")
|
||||
reset_db()
|
||||
@@ -188,7 +196,7 @@ class _D:
|
||||
|
||||
w5 = gt.GenericStepsWorker("S1", {"steps": []})
|
||||
w5._vars["comment"] = {"comment_text": "输入框评论"}
|
||||
w5._verify_input = lambda d, text, clear: True
|
||||
w5._verify_input = lambda d, text, clear, strict=False: True
|
||||
w5._exec_input_text(_D(), {"text_source": "comment", "clear_first": True})
|
||||
check("input_text 取评论内容", sent.get("text"), "输入框评论")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user