csspilot 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,12 +45,23 @@ npx csspilot validate # validate cases against the DSL
45
45
  npx csspilot list # list cases (--tag smoke)
46
46
  npx csspilot run # run cases (file paths / --tag)
47
47
  npx csspilot report # generate JSON + HTML report
48
- npx csspilot doctor # check environment
48
+ npx csspilot doctor # health check (config / cases / adapters / env / server)
49
+ npx csspilot ci init # generate TestPilot CI workflow template
50
+ npx csspilot sync-metadata # sync case metadata to TestPilot Server (CI, after git push)
49
51
  ```
50
52
 
53
+ ## Project context
54
+
55
+ Read `references/` first (generated by `csspilot init` for this project):
56
+
57
+ - `references/project.md` — project name / type / test dirs / available adapters
58
+ - `references/test-conventions.md` — the testing rules this project enforces
59
+ - `references/adapters.md` — detected adapter status
60
+
61
+
51
62
  ## Directory map (business project)
52
63
 
53
- - `.ai/skills/testpilot/` — this skill (AI usage spec)
64
+ - `.agents/skills/testpilot/` — this skill (AI usage spec)
54
65
  - `.testpilot/` — TestPilot runtime state and artifacts
55
66
  - `tests/e2e/cases/` — business cases
56
67
  - `testpilot.yaml` — project-level TestPilot config
@@ -1,8 +1,8 @@
1
1
  # TestPilot Skill 清单(源文件)
2
- # `npx csspilot init` 会把整个 skills/testpilot/ 安装到业务项目 .ai/skills/testpilot/
2
+ # `npx csspilot init` 会把整个 skills/testpilot/ 安装到业务项目 .agents/skills/testpilot/
3
3
  id: testpilot
4
4
  name: TestPilot
5
- version: 0.1.1
5
+ version: 0.2.0
6
6
 
7
7
  description: >
8
8
  AI Native cross-platform testing skill.
@@ -13,6 +13,9 @@ capabilities:
13
13
  - run
14
14
  - list
15
15
  - report
16
+ - sync-metadata
17
+ - doctor
18
+ - ci-init
16
19
 
17
20
  runtime:
18
21
  cli: csspilot
@@ -5,8 +5,9 @@ Case 是 YAML 文件,V0.1 顶层结构:
5
5
  ```yaml
6
6
  id: order-create # kebab-case,与文件名一致
7
7
  name: 用户创建订单 # 人类可读名称
8
+ accountRef: test-user # 可选:引用环境凭据,用 ${account.username} 等变量,禁止明文密码
8
9
  steps: # 有序步骤列表
9
- - target: miniapp # 执行端:miniapp | web
10
+ - target: miniapp # 执行端:miniapp | web | api
10
11
  action: click # 见下方 Action 表
11
12
  locator: # 定位器(见 rules/locator.md)
12
13
  text: 提交订单
@@ -14,20 +15,57 @@ steps: # 有序步骤列表
14
15
 
15
16
  ## V0.1 稳定 Action
16
17
 
17
- | action | 用途 | 关键字段 |
18
- | --- | --- | --- |
19
- | `launch` | 启动应用(miniapp) | — |
20
- | `navigate` | 打开页面(web) | `url` |
21
- | `click` | 点击 | `locator` |
22
- | `input` | 输入 | `locator`, `value` |
23
- | `select` | 选择 | `locator`, `value` |
24
- | `wait` | 等待 | 条件(以 @testpilot/dsl schema 为准) |
25
- | `assert` | 断言 | `locator`, `expected` |
26
- | `extract` | 提取内容为变量 | `locator`, 变量名(以 schema 为准) |
27
- | `screenshot` | 截图取证 | — |
18
+ | action | 用途 | 支持端 | 关键字段 |
19
+ | --- | --- | --- | --- |
20
+ | `launch` | 启动应用(miniapp) | miniapp | — |
21
+ | `navigate` | 打开页面(web) | web, miniapp | `url` |
22
+ | `click` | 点击 | web, miniapp | `locator` |
23
+ | `input` | 输入 | web, miniapp | `locator`, `value` |
24
+ | `select` | 选择 | web | `locator`, `value` |
25
+ | `wait` | 等待 | web, miniapp | 条件(以 @testpilot/dsl schema 为准) |
26
+ | `assert` | 断言 | web, miniapp, api | `locator`+`expected`(UI)/`expected`(api 响应体包含) |
27
+ | `extract` | 提取内容为变量 | web, miniapp, api | `locator`+变量名(UI)/`value`(JSON path)+变量名(api) |
28
+ | `screenshot` | 截图取证 | web, miniapp | — |
29
+ | `request` | HTTP 请求 | api | `url`, `method`, `headers`, `body`, `expected`(状态码) |
28
30
 
29
31
  字段定义最终以 `packages/dsl` 的 zod schema 为准;不要使用表中之外的字段。
30
32
 
33
+ ## api 端(HTTP 接口测试与造数)
34
+
35
+ `target: api` 走 HTTP 执行端:相对 `url` 按 `testpilot.yaml` 的 `api.baseUrl` 解析。典型用法:API 造数 → UI 操作 → API/JSON 断言的混合编排。
36
+
37
+ ```yaml
38
+ id: api-checkout
39
+ name: API 下单校验
40
+ accountRef: test-user
41
+ steps:
42
+ - target: api
43
+ action: request
44
+ url: /api/login
45
+ method: POST
46
+ headers:
47
+ authorization: 'Bearer ${account.token}'
48
+ body:
49
+ username: '${account.username}'
50
+ expected: '200' # 断言 HTTP 状态码
51
+ - target: api
52
+ action: extract
53
+ value: data.orderId # 点号 JSON path(数组用下标,如 items.0.id)
54
+ variable: orderId
55
+ - target: api
56
+ action: request
57
+ url: '/api/orders/${orderId}'
58
+ - target: api
59
+ action: assert
60
+ expected: '"status":"PAID"' # 响应体文本包含
61
+ ```
62
+
63
+ ## 账号与凭据(accountRef)
64
+
65
+ - Case 顶层 `accountRef: test-user` 引用凭据,值由运行方注入(Server 环境凭据 / CLI 环境变量),Case 里永远不写明文
66
+ - 注入后在 headers/body/url/expected 中用 `${account.username}`、`${account.password}` 等引用(凭据值推荐 JSON 对象)
67
+ - 取证与报告对 authorization/cookie 等敏感头自动脱敏,凭据原文不落 Run 结果
68
+
31
69
  ## 原则:Action 是通用测试原语,不是业务能力
32
70
 
33
71
  ```text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "csspilot",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "TestPilot — AI Native 跨端业务测试基础设施 CLI",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,14 +28,8 @@
28
28
  "playwright": "^1.53.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@testpilot/adapter-core": "workspace:^",
32
- "@testpilot/adapter-playwright": "workspace:^",
33
- "@testpilot/adapter-wechatide": "workspace:^",
34
31
  "@testpilot/core": "workspace:^",
35
- "@testpilot/dsl": "workspace:^",
36
- "@testpilot/evidence": "workspace:^",
37
- "@testpilot/execution-engine": "workspace:^",
38
- "@testpilot/reporter": "workspace:^",
32
+ "@testpilot/sdk": "workspace:^",
39
33
  "@types/node": "^22.0.0",
40
34
  "commander": "^12.0.0",
41
35
  "esbuild": "^0.25.0",