- CLI + Web 双平台,基于 LLM 的 TDD+DDD 自动化测试生成 - 集成 unified-test-platform 903 个 D-Cloud 用例 + 13 个 Robogo 场景 - Agent 5 步流水线: 扫描 -> DDD -> LLM 生成测试 - 精确回归 + UI 变更检查 - 可视化 HTML 测试报告 - 暗色/亮色主题切换 - 19 个 API 端点 + 6 个 SPA 页面 - 15/15 项 TDD+DDD 合规
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
"""搜索操作 Mixin"""
|
|
|
|
|
|
class SearchMixin:
|
|
"""搜索操作相关
|
|
|
|
提供搜索、清除搜索等操作。
|
|
"""
|
|
|
|
def search(self, keyword: str, placeholder: str = "搜索") -> bool:
|
|
"""通用搜索方法
|
|
|
|
Args:
|
|
keyword: 搜索关键词
|
|
placeholder: 搜索框占位符文本(用于定位搜索框)
|
|
|
|
Returns:
|
|
bool: 是否成功执行搜索
|
|
"""
|
|
search_input = self.page.locator(f"input[placeholder*='{placeholder}']")
|
|
if search_input.is_visible():
|
|
search_input.fill(keyword)
|
|
self.page.keyboard.press("Enter")
|
|
self.wait_for_page_ready()
|
|
return True
|
|
return False
|
|
|
|
def clear_search(self, placeholder: str = "搜索") -> bool:
|
|
"""清除搜索条件
|
|
|
|
Args:
|
|
placeholder: 搜索框占位符文本
|
|
|
|
Returns:
|
|
bool: 是否成功清除
|
|
"""
|
|
search_input = self.page.locator(f"input[placeholder*='{placeholder}']")
|
|
if search_input.is_visible():
|
|
search_input.clear()
|
|
self.page.keyboard.press("Enter")
|
|
self.wait_for_page_ready()
|
|
return True
|
|
return False
|