lantern-harness 0.1.43 → 0.1.45
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 +36 -0
- package/README.md +1 -1
- package/builtin/session/lh-nav-groups.mjs +18 -4
- package/dist/500.html +61 -5
- package/dist/_astro/Base.Bkt1lrgu.css +1 -0
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.Chv7r8_9.js → Base.astro_astro_type_script_index_0_lang.UKTVQqk7.js} +1 -1
- package/dist/_astro/{CaseExecBoard.DUMjSunb.js → CaseExecBoard.DICluCbK.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.DtuOyQuv.js → CaseGenerateApp.Be3h5XPG.js} +1 -1
- package/dist/_astro/{CasesLibrary.B9o_jvXb.js → CasesLibrary.Buys7Cy-.js} +3 -3
- package/dist/_astro/ChatApp.D3BheKci.js +227 -0
- package/dist/_astro/ConfirmDialog.DrrPf1MB.js +1 -0
- package/dist/_astro/{DashboardBoard.DEvgMoqo.js → DashboardBoard.Qvf8o4v1.js} +1 -1
- package/dist/_astro/{DocsFileBrowser.D66pN9rp.js → DocsFileBrowser.DwKBffbM.js} +1 -1
- package/dist/_astro/{DocsPager.ceBEecmd.js → DocsPager.Duf4I68E.js} +1 -1
- package/dist/_astro/{DrawerField.CWpOf3L_.js → DrawerField.BH3p4Q4D.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.DYqE2mRi.js → KnowledgeLibrary.MDpMqeOd.js} +1 -1
- package/dist/_astro/{LifeKrTasksBoard.B7UiEutA.js → LifeKrTasksBoard.DsvW_S66.js} +1 -1
- package/dist/_astro/{LifeKrTodosBoard.VL7HdhNY.js → LifeKrTodosBoard.D2KTqvg1.js} +1 -1
- package/dist/_astro/{LifeObjectivesBoard.lLBPOHEZ.js → LifeObjectivesBoard.B0cDK934.js} +1 -1
- package/dist/_astro/{LifePlanTypeSelect.CdKQmlEK.js → LifePlanTypeSelect.BELDvMWU.js} +1 -1
- package/dist/_astro/{LifeReviewsBoard.AjO4SbsR.js → LifeReviewsBoard.BPXeVpg1.js} +1 -1
- package/dist/_astro/{LifeShared.CtdsQI43.js → LifeShared.tnT7aQON.js} +1 -1
- package/dist/_astro/{LifeStagesBoard.Dl-kTZ6K.js → LifeStagesBoard.CZftLR9K.js} +1 -1
- package/dist/_astro/{LifeYearCycleSelect.BILJOKXK.js → LifeYearCycleSelect.Bw2eRbSm.js} +1 -1
- package/dist/_astro/{LifeYearPlansBoard.BzJmi7Hw.js → LifeYearPlansBoard.DB-RJFEl.js} +1 -1
- package/dist/_astro/{MultiSelectDropdown.y8JMbCxO.js → MultiSelectDropdown.CBC7aNOv.js} +1 -1
- package/dist/_astro/NavLibraries.DdQYsZbe.js +1 -0
- package/dist/_astro/OverflowHint.CHZeFfUj.js +1 -0
- package/dist/_astro/{PluginsPage.D2OrUGY3.js → PluginsPage.C1JnInH4.js} +1 -1
- package/dist/_astro/PluginsPage.C3eEwy3K.js +1 -0
- package/dist/_astro/{PmBugsBoard.BynUocbE.js → PmBugsBoard.CGpXUTPu.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.CvFblvfX.js → PmIterationsBoard.BaKiFIam.js} +1 -1
- package/dist/_astro/{PmProjectDetail.Dlm6flwk.js → PmProjectDetail.DneFVBpy.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.B5vaWuax.js → PmProjectsBoard.BxoMF9gK.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.-SI8VZXI.js +1 -0
- package/dist/_astro/{PmRequirementsBoard.piRWjiYA.js → PmRequirementsBoard.DsK6RF7Q.js} +1 -1
- package/dist/_astro/PmShared.BK8kWRSV.js +1 -0
- package/dist/_astro/{PromptMountDialog.DYojFMok.js → PromptMountDialog.mrTx3U5T.js} +1 -1
- package/dist/_astro/PromptsLibrary.B_SUf47p.js +1 -0
- package/dist/_astro/{ReportsPage.B-xhGVEU.js → ReportsPage.B9lGg1_s.js} +1 -1
- package/dist/_astro/{ReqAnalysisBoard.B3sAOuAq.js → ReqAnalysisBoard.CIZKnCQH.js} +1 -1
- package/dist/_astro/{RequirementsLibrary.BGys7DeN.js → RequirementsLibrary.cJc-bnGQ.js} +1 -1
- package/dist/_astro/{SearchableSelect.DFZBUFIs.js → SearchableSelect.SyLRS-Jj.js} +1 -1
- package/dist/_astro/SelectDropdown.T3CKHaLt.js +1 -0
- package/dist/_astro/{SettingsDialog.CEyjZuxq.js → SettingsDialog.DYdtCvLc.js} +1 -1
- package/dist/_astro/{SpaceSwitcher.DJqvw5Lw.js → SpaceSwitcher.C47_S1g9.js} +1 -1
- package/dist/_astro/{TableFieldConfig.D0v9S2g3.js → TableFieldConfig.C7O-mL-p.js} +1 -1
- package/dist/_astro/{TasksBoard.DZ9LLl_c.js → TasksBoard.BUEg2BYk.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.iyj_kFMO.js → TemplatesLibrary.BLVIphXO.js} +1 -1
- package/dist/_astro/{TestReportsLibrary.B6pf0d7W.js → TestReportsLibrary.DVq30Jae.js} +1 -1
- package/dist/_astro/{TestStatsBoard.DS_2bqWI.js → TestStatsBoard.-5BWQ6bI.js} +1 -1
- package/dist/_astro/{TodosBoard.CYAVDD1W.js → TodosBoard.DI_lTp2e.js} +1 -1
- package/dist/_astro/UiAutoBoard.ChFdgv7s.js +2 -0
- package/dist/_astro/UiAutoEnvPanel.B50q4kYb.js +19 -0
- package/dist/_astro/UiAutoGenerationDialog.CLkFAHrm.js +1 -0
- package/dist/_astro/UiAutoProjectsPage.DCsDeN5d.js +3 -0
- package/dist/_astro/app-config.DkyjuL-S.js +1 -0
- package/dist/_astro/app-version.Cy-5oZO2.js +1 -0
- package/dist/_astro/{bash-tools.CfNj2sh0.js → bash-tools.D9HCzC_7.js} +1 -1
- package/dist/_astro/{case-gen-run.nrr97yK3.js → case-gen-run.BklG1H8k.js} +1 -1
- package/dist/_astro/{case-types.B51yDRdf.js → case-types.DlFkbZJN.js} +1 -1
- package/dist/_astro/composer-draft.llpvz3MW.js +1 -0
- package/dist/_astro/composer-task.DRi5tAJs.js +5 -0
- package/dist/_astro/{hydrate-cache.CoD1FB3T.js → hydrate-cache.B15Nrpq0.js} +1 -1
- package/dist/_astro/i18n.D_aOCHSN.js +7 -0
- package/dist/_astro/{open-docs-in-session.DJtuI1C4.js → open-docs-in-session.CRiZT022.js} +1 -1
- package/dist/_astro/plugins.BRvXWHLe.js +1 -0
- package/dist/_astro/prompts-meta.BUGutlsk.js +2 -0
- package/dist/_astro/{req-analysis.qmyv5cBw.js → req-analysis.B12_MGMQ.js} +1 -1
- package/dist/_astro/{settings.CYERib3l.js → settings.38J2uD5M.js} +2 -2
- package/dist/_astro/{spaces-client.DvIgFink.js → spaces-client.DV04tRyD.js} +1 -1
- package/dist/_astro/{story-review.2UUlN3p-.js → story-review.D2W5tEOY.js} +1 -1
- package/dist/_astro/{test-reports.DPQ-FMsQ.js → test-reports.CuIjlEyK.js} +1 -1
- package/dist/_astro/ui-auto-prompt.H9_yhau9.js +9 -0
- package/dist/_astro/ui-auto.DMv940x4.js +1 -0
- package/dist/_astro/{view-prefs.GnvelRDj.js → view-prefs.DhdLZjGh.js} +1 -1
- package/dist/case-exec/index.html +62 -6
- package/dist/cases/generate/index.html +62 -6
- package/dist/cases/library/index.html +62 -6
- package/dist/dashboard/index.html +62 -6
- package/dist/docs/changelog/index.html +138 -50
- package/dist/docs/install/index.html +61 -5
- package/dist/docs/manual/index.html +129 -21
- package/dist/knowledge/index.html +62 -6
- package/dist/life/kr-tasks/index.html +62 -6
- package/dist/life/kr-todos/index.html +62 -6
- package/dist/life/objectives/index.html +62 -6
- package/dist/life/reviews/index.html +62 -6
- package/dist/life/stages/index.html +62 -6
- package/dist/life/year-plans/index.html +62 -6
- package/dist/plugins/index.html +62 -6
- package/dist/pm/bugs/index.html +62 -6
- package/dist/pm/iterations/index.html +62 -6
- package/dist/pm/projects/detail/index.html +62 -6
- package/dist/pm/projects/index.html +62 -6
- package/dist/pm/requirements/index.html +62 -6
- package/dist/prompts/index.html +62 -6
- package/dist/reports/index.html +62 -6
- package/dist/requirement-analysis/index.html +62 -6
- package/dist/requirements/index.html +62 -6
- package/dist/tasks/index.html +62 -6
- package/dist/templates/index.html +62 -6
- package/dist/test-automation/index.html +63 -7
- package/dist/test-automation/projects/index.html +980 -0
- package/dist/test-reports/index.html +62 -6
- package/dist/test-stats/index.html +62 -6
- package/dist/todos/index.html +62 -6
- package/dist/workbench/index.html +62 -6
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +1 -1
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +107 -63
- package/lh-plugins/lh-uiauto.mjs +2502 -51
- package/lh-plugins/plugin-prompts.mjs +62 -2
- package/lh-plugins/storage-domain.mjs +17 -4
- package/lh-plugins/uiauto-adapters/playwright.mjs +29 -14
- package/lh-plugins/uiauto-adapters/tasks.mjs +8 -2
- package/lh-plugins/uiauto-env.mjs +669 -0
- package/lh-plugins/uiauto-explorer/apps.mjs +4 -5
- package/lh-plugins/uiauto-explorer/emit-files.mjs +32 -9
- package/lh-plugins/uiauto-explorer/emit-ts.mjs +13 -2
- package/lh-plugins/uiauto-explorer/ir.mjs +20 -0
- package/lh-plugins/uiauto-explorer/sessions.mjs +36 -0
- package/lh-plugins/uiauto-node.mjs +327 -0
- package/lh-plugins/uiauto-pm.mjs +178 -0
- package/lh-plugins/uiauto-prompt.mjs +228 -18
- package/lh-plugins/uiauto-report.mjs +16 -0
- package/lh-plugins/uiauto-scaffold/audit.mjs +356 -0
- package/lh-plugins/uiauto-scaffold/index.mjs +25 -0
- package/lh-plugins/uiauto-scaffold/library.mjs +508 -0
- package/lh-plugins/uiauto-scaffold/manifest.mjs +83 -0
- package/lh-plugins/uiauto-scaffold/render.mjs +133 -0
- package/lh-plugins/uiauto-scaffold/templates/playwright-ts.json +225 -0
- package/lh-plugins/uiauto-scaffold/templates/playwright-ts.mjs +46 -0
- package/package.json +1 -1
- package/dist/_astro/Base.BnVp5Mf8.css +0 -1
- package/dist/_astro/ChatApp.CKPGFibd.js +0 -227
- package/dist/_astro/ConfirmDialog.D5qXeML0.js +0 -1
- package/dist/_astro/NavLibraries.BnaL-km5.js +0 -1
- package/dist/_astro/OverflowHint.pvo2Xc8R.js +0 -1
- package/dist/_astro/PluginsPage.CMW4hEFr.js +0 -1
- package/dist/_astro/PmRequirementsBoard.B8KTeso8.js +0 -1
- package/dist/_astro/PmShared.86HEsdd_.js +0 -1
- package/dist/_astro/PromptsLibrary.GpNbBTj1.js +0 -1
- package/dist/_astro/SelectDropdown.Dmk5n225.js +0 -1
- package/dist/_astro/SlideOverDrawer.C1IVOc_8.js +0 -1
- package/dist/_astro/UiAutoBoard.DSsiMfx2.js +0 -9
- package/dist/_astro/app-config.DwpFFa5D.js +0 -1
- package/dist/_astro/app-version.Dabxyva-.js +0 -1
- package/dist/_astro/composer-task.DJmluzPT.js +0 -5
- package/dist/_astro/i18n.vo2aElR9.js +0 -7
- package/dist/_astro/plugins.BmKRnp4a.js +0 -1
- package/dist/_astro/prompts-meta.bF2q5SUy.js +0 -2
- package/dist/_astro/ui-auto-prompt.COBTt5Gd.js +0 -4
- package/dist/_astro/ui-auto.BmC9JJ_X.js +0 -1
|
@@ -55,7 +55,8 @@ function writeSeedState(spaceDir, state) {
|
|
|
55
55
|
/** 提示词文件名 → 所属插件 id */
|
|
56
56
|
export const PLUGIN_PROMPT_FILES = Object.freeze({
|
|
57
57
|
'工作汇报提示词.md': 'reports',
|
|
58
|
-
'
|
|
58
|
+
'自动化执行提示词.md': 'uiAuto',
|
|
59
|
+
'自动化项目提示词.md': 'uiAuto',
|
|
59
60
|
'需求分析提示词.md': 'reqAnalysis',
|
|
60
61
|
'原文结构提示词.md': 'reqAnalysis',
|
|
61
62
|
'用户故事审查提示词.md': 'storyReview',
|
|
@@ -67,7 +68,29 @@ export const PLUGIN_PROMPT_FILES = Object.freeze({
|
|
|
67
68
|
'性能测试报告提示词.md': 'testReports',
|
|
68
69
|
});
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
/**
|
|
72
|
+
* 提示词用途:决定它能被挂到哪个入口。
|
|
73
|
+
* - `generate`:「自动化执行」里生成用例(规划 / 探索 / 出码)读它;
|
|
74
|
+
* - `scaffold`:「自动化项目」新建时体检 / 补全骨架读它。
|
|
75
|
+
*/
|
|
76
|
+
export const PROMPT_USAGE = Object.freeze({
|
|
77
|
+
'自动化执行提示词.md': 'generate',
|
|
78
|
+
'自动化项目提示词.md': 'scaffold',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/** 「关联插件」列按侧栏菜单名显示,跟入口对得上(不再统一写「自动化测试」) */
|
|
82
|
+
export const PROMPT_MENU_LABEL = Object.freeze({
|
|
83
|
+
'自动化执行提示词.md': '自动化执行',
|
|
84
|
+
'自动化项目提示词.md': '自动化项目',
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
/** 旧文件名 → 新文件名:只改名,正文一个字不动(用户改过的也照搬) */
|
|
88
|
+
export const PROMPT_RENAMES = Object.freeze({
|
|
89
|
+
'Playwright提示词.md': '自动化执行提示词.md',
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const UI_AUTO_PROMPT_FILE = '自动化执行提示词.md';
|
|
93
|
+
export const UI_AUTO_PROJECT_PROMPT_FILE = '自动化项目提示词.md';
|
|
71
94
|
export const REQ_ANALYSIS_PROMPT_FILE = '需求分析提示词.md';
|
|
72
95
|
export const SOURCE_STRUCTURE_PROMPT_FILE = '原文结构提示词.md';
|
|
73
96
|
export const STORY_REVIEW_PROMPT_FILE = '用户故事审查提示词.md';
|
|
@@ -94,6 +117,43 @@ export function readPluginPrompt(name, spaceDir = getDataRoot()) {
|
|
|
94
117
|
}
|
|
95
118
|
}
|
|
96
119
|
|
|
120
|
+
/** 这份提示词属于哪个入口(generate / scaffold);没登记返回空串 */
|
|
121
|
+
export function promptUsage(name) {
|
|
122
|
+
const base = String(name ?? '')
|
|
123
|
+
.split('/')
|
|
124
|
+
.pop();
|
|
125
|
+
return PROMPT_USAGE[base] ?? '';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 旧版文件名就地改名(只改文件名,内容与指纹一起搬过去)。
|
|
130
|
+
* 目标文件已经存在时不动:两份都在的话,旧的那份降成普通提示词,交给用户处理。
|
|
131
|
+
*
|
|
132
|
+
* @returns {Array<{ from: string, to: string }>} 本次实际改名的记录
|
|
133
|
+
*/
|
|
134
|
+
export function migrateLegacyPluginPrompts(spaceDir = getDataRoot()) {
|
|
135
|
+
const moved = [];
|
|
136
|
+
for (const [from, to] of Object.entries(PROMPT_RENAMES)) {
|
|
137
|
+
const src = pluginPromptPath(from, spaceDir);
|
|
138
|
+
const dest = pluginPromptPath(to, spaceDir);
|
|
139
|
+
if (!fs.existsSync(src) || fs.existsSync(dest)) continue;
|
|
140
|
+
try {
|
|
141
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
142
|
+
fs.renameSync(src, dest);
|
|
143
|
+
const state = readSeedState(spaceDir);
|
|
144
|
+
if (state[from]) {
|
|
145
|
+
const next = { ...state, [to]: state[from] };
|
|
146
|
+
delete next[from];
|
|
147
|
+
writeSeedState(spaceDir, next);
|
|
148
|
+
}
|
|
149
|
+
moved.push({ from, to });
|
|
150
|
+
} catch {
|
|
151
|
+
// 改名失败就当没迁移:下次打开插件再试
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return moved;
|
|
155
|
+
}
|
|
156
|
+
|
|
97
157
|
/**
|
|
98
158
|
* 缺就补种子;已存在时:
|
|
99
159
|
* - 内容仍与上次插件写入的一致(没人改过)→ 跟内置模板对齐,自动升级到新版本;
|
|
@@ -16,7 +16,12 @@ import {
|
|
|
16
16
|
TEST_STATS_DIR_NAME,
|
|
17
17
|
TEST_STATS_STORE_FILE,
|
|
18
18
|
} from './lh-stats.mjs';
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
UIAUTO_PROJECTS_DIR_NAME,
|
|
21
|
+
UIAUTO_PROJECTS_FILE,
|
|
22
|
+
UIAUTO_RUNS_DIR_NAME,
|
|
23
|
+
UIAUTO_RUNS_FILE,
|
|
24
|
+
} from './lh-uiauto.mjs';
|
|
20
25
|
|
|
21
26
|
/** @type {Array<{ id: string, rel: string, kind: 'file' | 'dir', roleZh: string }>} */
|
|
22
27
|
export const KNOWN_STORAGE_DOMAINS = [
|
|
@@ -58,10 +63,16 @@ export const KNOWN_STORAGE_DOMAINS = [
|
|
|
58
63
|
roleZh: '用例执行统计',
|
|
59
64
|
},
|
|
60
65
|
{
|
|
61
|
-
id: '
|
|
62
|
-
rel: `${
|
|
66
|
+
id: 'uiAutoProjects',
|
|
67
|
+
rel: `${UIAUTO_PROJECTS_DIR_NAME}/${UIAUTO_PROJECTS_FILE}`,
|
|
68
|
+
kind: 'file',
|
|
69
|
+
roleZh: '自动化项目挂载记录',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'uiAutoRuns',
|
|
73
|
+
rel: `${UIAUTO_RUNS_DIR_NAME}/${UIAUTO_RUNS_FILE}`,
|
|
63
74
|
kind: 'file',
|
|
64
|
-
roleZh: '
|
|
75
|
+
roleZh: '自动化执行运行记录',
|
|
65
76
|
},
|
|
66
77
|
{
|
|
67
78
|
id: 'uiAutoCache',
|
|
@@ -95,6 +106,8 @@ const RELOCATABLE = {
|
|
|
95
106
|
tasks: { dir: TASK_DIR_NAME, file: TASK_STORE_FILE },
|
|
96
107
|
testStats: { dir: TEST_STATS_DIR_NAME, file: TEST_STATS_STORE_FILE },
|
|
97
108
|
caseExec: { dir: CASE_EXEC_DIR_NAME, file: CASE_EXEC_STORE_FILE },
|
|
109
|
+
uiAutoProjects: { dir: UIAUTO_PROJECTS_DIR_NAME, file: UIAUTO_PROJECTS_FILE },
|
|
110
|
+
uiAutoRuns: { dir: UIAUTO_RUNS_DIR_NAME, file: UIAUTO_RUNS_FILE },
|
|
98
111
|
};
|
|
99
112
|
|
|
100
113
|
function domainRel(base, d) {
|
|
@@ -9,6 +9,7 @@ import fs from 'node:fs';
|
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
|
|
11
11
|
import { emptySummary, intOr, parseJUnitXml, readSmall, text } from './shared.mjs';
|
|
12
|
+
import { resolvePackageManager } from '../uiauto-pm.mjs';
|
|
12
13
|
|
|
13
14
|
export const id = 'playwright';
|
|
14
15
|
export const label = 'Playwright';
|
|
@@ -51,19 +52,12 @@ export function ready(probe) {
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
export function readyHint(probe) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const browsers =
|
|
61
|
-
probe.packageManager === 'pnpm'
|
|
62
|
-
? 'pnpm exec playwright install'
|
|
63
|
-
: probe.packageManager === 'yarn'
|
|
64
|
-
? 'yarn playwright install'
|
|
65
|
-
: 'npx playwright install';
|
|
66
|
-
return `未找到 Playwright:请先在 ${probe.dir} 运行「${runner}」,首次使用再运行「${browsers}」。`;
|
|
55
|
+
// 包管理器按项目里声明的 + 本机是否装了 pnpm 判断:没装 pnpm 时提示里给 npm 命令
|
|
56
|
+
const { commands } = resolvePackageManager({
|
|
57
|
+
dir: probe.dir,
|
|
58
|
+
declared: probe.packageManager,
|
|
59
|
+
});
|
|
60
|
+
return `未找到 Playwright:请先在 ${probe.dir} 运行「${commands.install}」,首次使用再运行「${commands.browserInstall}」。`;
|
|
67
61
|
}
|
|
68
62
|
|
|
69
63
|
/** 拼 Playwright 运行参数(纯函数,便于单测) */
|
|
@@ -179,6 +173,27 @@ export function reportDirs(probe) {
|
|
|
179
173
|
return [...dirs];
|
|
180
174
|
}
|
|
181
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Allure 的两类目录(项目相对路径):
|
|
178
|
+
* - `report`:`allure generate` 产出的静态 HTML(有 index.html 才能直接看)
|
|
179
|
+
* - `results`:allure-playwright 写出的原始结果(还没 generate 时用来自动补生成)
|
|
180
|
+
* 默认位置是骨架的 `reports/allure-*`,也认 `allure-results` / `allure-report` 这两种常见写法。
|
|
181
|
+
*/
|
|
182
|
+
export function allureDirs(probe) {
|
|
183
|
+
const report = new Set(['reports/allure-report', 'allure-report']);
|
|
184
|
+
const results = new Set(['reports/allure-results', 'allure-results']);
|
|
185
|
+
const config = configFiles.map((name) => probe.readRel(name)).find(Boolean) ?? '';
|
|
186
|
+
// 骨架用 resultsDir,少数项目写成 outputFolder / outputDir
|
|
187
|
+
const re = /(?:resultsDir|outputFolder|outputDir)\s*:\s*['"]([^'"]+)['"]/g;
|
|
188
|
+
let match;
|
|
189
|
+
while ((match = re.exec(config))) {
|
|
190
|
+
const rel = match[1].replace(/\\/g, '/').replace(/^\.\//, '');
|
|
191
|
+
if (!rel || rel.includes('..') || path.isAbsolute(rel)) continue;
|
|
192
|
+
if (/allure-results/.test(rel)) results.add(rel);
|
|
193
|
+
}
|
|
194
|
+
return { report: [...report], results: [...results] };
|
|
195
|
+
}
|
|
196
|
+
|
|
182
197
|
export function parse(ctx) {
|
|
183
198
|
const raw = readSmall(ctx.resultAbs, 32 * 1024 * 1024);
|
|
184
199
|
if (!raw) return emptySummary();
|
|
@@ -194,7 +209,7 @@ export function hintFromLog(log) {
|
|
|
194
209
|
if (
|
|
195
210
|
/Executable doesn't exist|Please run the following command to download new browsers/i.test(log)
|
|
196
211
|
) {
|
|
197
|
-
return '
|
|
212
|
+
return '缺少浏览器内核:请到「项目配置 → 运行环境」点「一键安装依赖」(失败会自动切国内镜像),或在项目目录运行 playwright install(国内网络可加 PLAYWRIGHT_DOWNLOAD_HOST=https://cdn.npmmirror.com/binaries/playwright)后重试。';
|
|
198
213
|
}
|
|
199
214
|
if (/Cannot find module ['"]@playwright\/test['"]/i.test(log)) {
|
|
200
215
|
return '项目里没有安装 @playwright/test:先在项目目录安装依赖再运行。';
|
|
@@ -14,13 +14,14 @@ import fs from 'node:fs';
|
|
|
14
14
|
import path from 'node:path';
|
|
15
15
|
|
|
16
16
|
import { text } from './shared.mjs';
|
|
17
|
+
import { resolvePackageManager } from '../uiauto-pm.mjs';
|
|
17
18
|
|
|
18
19
|
export const MAX_RUN_TASKS = 20;
|
|
19
20
|
export const CUSTOM_TASK_LIMIT = 20;
|
|
20
21
|
|
|
21
22
|
/** 要跑哪些 script:名字像测试的;排除 lint / format / 打开报告这类 */
|
|
22
23
|
const NODE_SCRIPT_ALLOW =
|
|
23
|
-
/^(test|tests|e2e|ui|api|smoke|regression|edge|sanity|spec|allure|report)([:._-].*)?$/i;
|
|
24
|
+
/^(test|tests|e2e|ui|api|smoke|regression|edge|sanity|spec|allure|report|check)([:._-].*)?$/i;
|
|
24
25
|
const NODE_SCRIPT_DENY =
|
|
25
26
|
/(lint|format|prepare|husky|install|build|serve|start|dev|watch|debug|open|show|clean|postinstall|pretest)/i;
|
|
26
27
|
/** 交互式命令挂后台会一直不退出,直接跳过 */
|
|
@@ -66,7 +67,9 @@ export function pickRunScripts(scripts) {
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
export function discoverNodeScripts(probe) {
|
|
69
|
-
|
|
70
|
+
// 没声明包管理器的项目按「装了 pnpm 用 pnpm,否则 npm」展示,和安装步骤保持一致
|
|
71
|
+
const { manager } = resolvePackageManager({ dir: probe.dir, declared: probe.packageManager });
|
|
72
|
+
const runner = packageManagerRunner(manager);
|
|
70
73
|
return pickRunScripts(probe.pkg?.scripts).map(({ name, body }) => {
|
|
71
74
|
const isPlaywright = /playwright/i.test(body);
|
|
72
75
|
const label = `${runner.command} run ${name}`;
|
|
@@ -350,6 +353,9 @@ export function taskCommandLine(task, flags = {}) {
|
|
|
350
353
|
if (flags.lastFailed) parts.push(task.kind === 'pytest' ? '--lf' : '--last-failed');
|
|
351
354
|
if (flags.bail) parts.push(task.kind === 'pytest' ? '-x' : '--max-failures=1');
|
|
352
355
|
}
|
|
356
|
+
// 有头只对 Playwright 脚本有意义:args 里的 `--` 已经把所有参数透传给脚本,
|
|
357
|
+
// 追加在最后 Playwright 会当成自己的开关(任务是 make / 自定义命令时不掺和)。
|
|
358
|
+
if (flags.headed && task.kind === 'script' && task.failureFlags) parts.push('--headed');
|
|
353
359
|
return parts.filter(Boolean).join(' ');
|
|
354
360
|
}
|
|
355
361
|
|