android-midscene-automation 0.1.15 → 0.1.17

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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,18 @@
1
1
  # 更新记录
2
2
 
3
+ ## v0.1.17
4
+
5
+ - README 中的使用说明与更新记录链接改为 HTML 文档查看器,点击后直接显示渲染后的 Markdown 内容。
6
+
7
+ ## v0.1.16
8
+
9
+ - 参数配置页调整卡片顺序,将“预设 App 参数”移动到“运行配置”下方。
10
+
3
11
  ## v0.1.15
4
12
 
5
13
  - README 新增 Midscene 与 Appium 两种测试方式对比,明确 Midscene 必须配置模型,Appium 不依赖模型。
6
14
  - README 环境要求补充 Appium 3.x、UiAutomator2 Driver 的安装与启动说明。
15
+ - README 明确 Android 测试不需要 Playwright Chromium,仅源码中的 Web E2E 示例需要单独安装。
7
16
 
8
17
  ## v0.1.14
9
18
 
package/README.md CHANGED
@@ -19,7 +19,6 @@ Appium 方案完全不依赖大模型,不需要填写 Base URL、API Key、Mod
19
19
  - npm
20
20
  - Android SDK / ADB,移动端自动化测试需要
21
21
  - Appium 3.x 和 UiAutomator2 Driver,仅 Appium 录制回放方式需要
22
- - Playwright Chromium,Web 示例脚本需要
23
22
 
24
23
  安装 Appium 相关依赖:
25
24
 
@@ -52,8 +51,8 @@ npx android-midscene-automation --port 5174
52
51
 
53
52
  ## 功能文档
54
53
 
55
- - [Appium 录制器使用说明](https://cdn.jsdelivr.net/npm/android-midscene-automation@latest/USAGE.md)
56
- - [项目更新记录](https://cdn.jsdelivr.net/npm/android-midscene-automation@latest/CHANGELOG.md)
54
+ - [Appium 录制器使用说明](https://cdn.jsdelivr.net/npm/android-midscene-automation@latest/docs.html?document=USAGE.md)
55
+ - [项目更新记录](https://cdn.jsdelivr.net/npm/android-midscene-automation@latest/docs.html?document=CHANGELOG.md)
57
56
 
58
57
  ## 源码开发
59
58
 
@@ -62,7 +61,13 @@ npm install
62
61
  npm run dev
63
62
  ```
64
63
 
65
- `Playwright` 浏览器下载不走 npm registry。单独安装浏览器时,可临时指定镜像:
64
+ Midscene Android 测试和 Appium 测试都不需要 Playwright Chromium。只有运行源码中的 Web E2E 示例时才需要单独安装:
65
+
66
+ ```sh
67
+ npx playwright install chromium
68
+ ```
69
+
70
+ Playwright 浏览器下载不走 npm registry。下载较慢时,可临时指定镜像:
66
71
 
67
72
  ```sh
68
73
  PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright/ npx playwright install chromium
package/docs.html ADDED
@@ -0,0 +1,147 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>android-midscene-automation 文档</title>
7
+ <style>
8
+ :root {
9
+ color: #24292f;
10
+ background: #f6f8fa;
11
+ font-family:
12
+ -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
13
+ sans-serif;
14
+ }
15
+
16
+ body {
17
+ margin: 0;
18
+ padding: 32px 20px;
19
+ }
20
+
21
+ main {
22
+ box-sizing: border-box;
23
+ width: min(100%, 980px);
24
+ min-height: calc(100vh - 64px);
25
+ margin: 0 auto;
26
+ padding: 40px 48px;
27
+ border: 1px solid #d8dee4;
28
+ border-radius: 8px;
29
+ background: #fff;
30
+ }
31
+
32
+ h1,
33
+ h2 {
34
+ padding-bottom: 0.3em;
35
+ border-bottom: 1px solid #d8dee4;
36
+ }
37
+
38
+ h1,
39
+ h2,
40
+ h3 {
41
+ margin-top: 1.5em;
42
+ line-height: 1.25;
43
+ }
44
+
45
+ h1:first-child {
46
+ margin-top: 0;
47
+ }
48
+
49
+ p,
50
+ li {
51
+ line-height: 1.7;
52
+ }
53
+
54
+ a {
55
+ color: #0969da;
56
+ }
57
+
58
+ code {
59
+ padding: 0.2em 0.4em;
60
+ border-radius: 4px;
61
+ background: #eff1f3;
62
+ font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
63
+ }
64
+
65
+ pre {
66
+ overflow: auto;
67
+ padding: 16px;
68
+ border-radius: 6px;
69
+ background: #f6f8fa;
70
+ }
71
+
72
+ pre code {
73
+ padding: 0;
74
+ background: transparent;
75
+ }
76
+
77
+ table {
78
+ display: block;
79
+ width: max-content;
80
+ max-width: 100%;
81
+ overflow: auto;
82
+ border-collapse: collapse;
83
+ }
84
+
85
+ th,
86
+ td {
87
+ padding: 8px 12px;
88
+ border: 1px solid #d8dee4;
89
+ }
90
+
91
+ blockquote {
92
+ margin-left: 0;
93
+ padding-left: 16px;
94
+ border-left: 4px solid #d8dee4;
95
+ color: #57606a;
96
+ }
97
+
98
+ #status {
99
+ color: #57606a;
100
+ }
101
+
102
+ @media (max-width: 640px) {
103
+ body {
104
+ padding: 0;
105
+ }
106
+
107
+ main {
108
+ min-height: 100vh;
109
+ padding: 24px 18px;
110
+ border: 0;
111
+ border-radius: 0;
112
+ }
113
+ }
114
+ </style>
115
+ </head>
116
+ <body>
117
+ <main id="content"><p id="status">正在加载文档...</p></main>
118
+ <script type="module">
119
+ const documents = {
120
+ "USAGE.md": "Appium 录制器使用说明",
121
+ "CHANGELOG.md": "项目更新记录",
122
+ };
123
+ const requestedDocument = new URLSearchParams(location.search).get(
124
+ "document",
125
+ );
126
+ const documentName = documents[requestedDocument]
127
+ ? requestedDocument
128
+ : "USAGE.md";
129
+ const content = document.querySelector("#content");
130
+
131
+ try {
132
+ const [{ marked }, response] = await Promise.all([
133
+ import("https://cdn.jsdelivr.net/npm/marked@18.0.3/lib/marked.esm.js"),
134
+ fetch(new URL(documentName, location.href)),
135
+ ]);
136
+ if (!response.ok) {
137
+ throw new Error(`HTTP ${response.status}`);
138
+ }
139
+ const markdown = await response.text();
140
+ document.title = `${documents[documentName]} - android-midscene-automation`;
141
+ content.innerHTML = marked.parse(markdown, { gfm: true });
142
+ } catch (error) {
143
+ content.innerHTML = `<h1>文档加载失败</h1><p>${String(error)}</p>`;
144
+ }
145
+ </script>
146
+ </body>
147
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "android-midscene-automation",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "android-midscene-automation": "./bin/android-midscene-automation.js"
@@ -8,6 +8,7 @@
8
8
  "files": [
9
9
  "bin",
10
10
  "index.html",
11
+ "docs.html",
11
12
  "remote-agent",
12
13
  "server",
13
14
  "src",
@@ -112,6 +112,45 @@ const updateMidsceneProvider = (value: string) => {
112
112
  </el-form>
113
113
  </el-card>
114
114
 
115
+ <el-card shadow="never" class="config-module-card">
116
+ <template #header>
117
+ <div class="panel-header">
118
+ <div class="panel-header__title">
119
+ <span>预设 App 参数</span>
120
+ <el-tag v-if="appPresetForm.id" size="small" type="warning">编辑中</el-tag>
121
+ </div>
122
+ <div class="panel-header__actions">
123
+ <el-button type="primary" :loading="isSavingAppPreset" @click="$emit('saveAppPreset')">
124
+ {{ appPresetForm.id ? '保存修改' : '保存 App' }}
125
+ </el-button>
126
+ </div>
127
+ </div>
128
+ </template>
129
+
130
+ <el-form label-position="top">
131
+ <el-form-item label="App 名称">
132
+ <el-input v-model="appPresetForm.name" placeholder="例如:示例 App" />
133
+ </el-form-item>
134
+ <el-form-item label="App 包名">
135
+ <el-input v-model="appPresetForm.packageName" placeholder="例如:com.example.app" />
136
+ </el-form-item>
137
+ </el-form>
138
+
139
+ <div class="app-preset-list">
140
+ <div v-for="app in appPresets" :key="app.id" class="app-preset-row">
141
+ <div class="app-preset-row__main">
142
+ <strong>{{ app.name }}</strong>
143
+ <span>{{ app.packageName }}</span>
144
+ </div>
145
+ <div class="script-row__actions">
146
+ <el-button text size="small" :icon="Edit" @click="$emit('editAppPreset', app)" />
147
+ <el-button text size="small" :icon="Delete" @click="$emit('deleteAppPreset', app.id)" />
148
+ </div>
149
+ </div>
150
+ <el-empty v-if="!appPresets.length" description="暂无预设 App" />
151
+ </div>
152
+ </el-card>
153
+
115
154
  <el-card shadow="never" class="config-module-card">
116
155
  <template #header>
117
156
  <div class="panel-header">
@@ -258,44 +297,6 @@ const updateMidsceneProvider = (value: string) => {
258
297
  />
259
298
  </el-card>
260
299
 
261
- <el-card shadow="never" class="config-module-card">
262
- <template #header>
263
- <div class="panel-header">
264
- <div class="panel-header__title">
265
- <span>预设 App 参数</span>
266
- <el-tag v-if="appPresetForm.id" size="small" type="warning">编辑中</el-tag>
267
- </div>
268
- <div class="panel-header__actions">
269
- <el-button type="primary" :loading="isSavingAppPreset" @click="$emit('saveAppPreset')">
270
- {{ appPresetForm.id ? '保存修改' : '保存 App' }}
271
- </el-button>
272
- </div>
273
- </div>
274
- </template>
275
-
276
- <el-form label-position="top">
277
- <el-form-item label="App 名称">
278
- <el-input v-model="appPresetForm.name" placeholder="例如:示例 App" />
279
- </el-form-item>
280
- <el-form-item label="App 包名">
281
- <el-input v-model="appPresetForm.packageName" placeholder="例如:com.example.app" />
282
- </el-form-item>
283
- </el-form>
284
-
285
- <div class="app-preset-list">
286
- <div v-for="app in appPresets" :key="app.id" class="app-preset-row">
287
- <div class="app-preset-row__main">
288
- <strong>{{ app.name }}</strong>
289
- <span>{{ app.packageName }}</span>
290
- </div>
291
- <div class="script-row__actions">
292
- <el-button text size="small" :icon="Edit" @click="$emit('editAppPreset', app)" />
293
- <el-button text size="small" :icon="Delete" @click="$emit('deleteAppPreset', app.id)" />
294
- </div>
295
- </div>
296
- <el-empty v-if="!appPresets.length" description="暂无预设 App" />
297
- </div>
298
- </el-card>
299
300
  </section>
300
301
  </div>
301
302
  </template>