Skip to main content

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 驱动。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_ui_testing-0.2.2.tar.gz (48.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_ui_testing-0.2.2-py3-none-any.whl (55.1 kB view details)

Uploaded Python 3

File details

Details for the file ai_ui_testing-0.2.2.tar.gz.

File metadata

  • Download URL: ai_ui_testing-0.2.2.tar.gz
  • Upload date:
  • Size: 48.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for ai_ui_testing-0.2.2.tar.gz
Algorithm Hash digest
SHA256 2512bc6459e05cd0cb4033677a3ae60d31142545513498f79b8c7355a77099cf
MD5 321220099943302ee94ef57e3124ba24
BLAKE2b-256 1f28172f15296d56e194cc7a547e3ef4a5f609c3db0fc03528568ca306d04c28

See more details on using hashes here.

File details

Details for the file ai_ui_testing-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ai_ui_testing-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 55.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for ai_ui_testing-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b3f16c234a2e1221dd0b42ae9ad30e10d969106bde3063964b15fe7a1999adfe
MD5 cd3519e53eae94527b342332793b1826
BLAKE2b-256 2d42f892ee9828ad876cf60fcf2b720e2beeadbd664330ed1238584ccf8037de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page