ai-ui-testing
AI 驱动的 Web UI 自动化测试框架(基于 Playwright + pytest 封装)
特性
- AI 定位器与自动修复:自然语言描述元素("登录按钮"),页面快照驱动生成并校验定位器;失效自动修复并写入学习缓存
- AI 失败分析:失败自动采集截图 + DOM 快照 + traceback,给出根因与修复建议
- 自然语言用例生成:YAML 描述用例意图 → 生成 pytest 代码,按模块保存(描述 + 代码配对)
- 登录态复用:登录一次保存 cookies/localStorage,用例间自动复用(session 隔离,绕开 SSO/扫码/验证码)
- 外部 AI 可编排:inspect / act / login 能力命令(输出 JSON),配合 init 生成的 AGENTS.md,AI agent 自动按规范开发用例
- Mock 降级:无 API Key 完整可用、可演示、可写用例
- 开箱即用:
ai-ui -h / init / run / gen / index / analyze一条龙
安装
pip install ai-ui-testing
playwright install chromium
快速开始
ai-ui init # 生成项目骨架(含 AGENTS.md / CLAUDE.md,供 AI agent 自动读取)
ai-ui run # 运行示例用例(mock 模式,无需 API Key)
写用例
from ai_ui_testing.base_page import BasePage
class LoginPage(BasePage):
locators = {"username": "#username", "login": "button:has-text('登录')"}
descriptions = {"login": "登录按钮"} # 供 AI 定位/修复
def login(self, user, pwd):
self.el("username").fill(user)
self.el("login").click()
return self
或用 AI 对话式开发:AI agent 读取项目根的 AGENTS.md,按规范完成「探查页面 → 登录 → 生成用例 → 运行验证」。
文档
完整文档随 ai-ui init 生成(docs/ 目录 + AGENTS.md),覆盖:POM 编写、AI 能力、登录态复用、CI 集成、外部 AI 驱动。
Metadata
Release files for ai-ui-testing 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ai_ui_testing-0.2.2.tar.gz | 48.5 kB | Without provenance | Details for ai_ui_testing-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_ui_testing-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for ai_ui_testing-0.2.2-py3-none-any.whl |
Total release size: 103.6 kB
Release files / ai_ui_testing-0.2.2.tar.gz
| Download URL | ai_ui_testing-0.2.2.tar.gz |
|---|---|
| Size | 48.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2512bc6459e05cd0cb4033677a3ae60d31142545513498f79b8c7355a77099cf
|
|
BLAKE2b-256 checksum How to use checksums |
1f28172f15296d56e194cc7a547e3ef4a5f609c3db0fc03528568ca306d04c28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / ai_ui_testing-0.2.2-py3-none-any.whl
| Download URL | ai_ui_testing-0.2.2-py3-none-any.whl |
|---|---|
| Size | 55.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3f16c234a2e1221dd0b42ae9ad30e10d969106bde3063964b15fe7a1999adfe
|
|
BLAKE2b-256 checksum How to use checksums |
2d42f892ee9828ad876cf60fcf2b720e2beeadbd664330ed1238584ccf8037de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Security for ai-ui-testing 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.