@ihyeon/flow-qa 0.10.2 → 0.10.5
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/README.ko.md +2 -0
- package/README.md +2 -0
- package/dist/src/engine.js +4 -1
- package/dist/src/report.js +7 -3
- package/dist/src/ui/public/app.js +45 -5
- package/dist/src/ui/public/i18n.js +5 -0
- package/dist/src/ui/server.js +79 -51
- package/docs/ui.md +3 -1
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -74,6 +74,8 @@ CLI에서는 `flow-qa run cases/task-flow.json --target demo --case TC-001 --cas
|
|
|
74
74
|
|
|
75
75
|
`0.5.0`부터 상세 보고서에서 **실패·오류 케이스 준비**를 누르면 실행 당시와 같은 저장된 케이스를 불러와 `실패`와 `실행 오류`만 선택합니다. 준비 후 케이스와 대상을 다시 검토하고 직접 실행하세요. 케이스·원본 파일이 없거나 바뀌었으면 준비를 중단하며, 실행 대상이 없거나 바뀌었으면 다시 선택해야 합니다. 자세한 동작은 [실패 케이스 준비](docs/ui.md#prepare-failed-cases)를 참고하세요.
|
|
76
76
|
|
|
77
|
+
준비한 케이스 정의·대상·선택 케이스 그대로 실행하면 새 보고서에 원본 실행 ID가 남습니다. 상세 보고서에서 원본을 열거나 두 결과를 바로 비교할 수 있습니다. 이 조건을 변경해 실행하면 독립 실행으로 저장합니다. 원본 보고서가 삭제돼도 새 보고서는 읽을 수 있으며 원본이 없다는 상태를 표시합니다.
|
|
78
|
+
|
|
77
79
|
`0.8.0`부터 **상세 보고서**에서 케이스·오류 내용을 검색하고 상태별로 좁히거나 **실패·오류만** 볼 수 있습니다. **시도 2회 이상만 보기**(0.8.7)를 켜면 여러 번 시도한 케이스만 표시합니다. 표시 건수와 보고서 전체 케이스 수를 구분하며, Markdown·JSON 다운로드와 실패·오류 재실행 준비는 보고서 전체 범위를 유지합니다. 필터에 맞는 ID만 화면 순서대로 저장하려면 **표시된 케이스 ID 다운로드**(0.8.6)를 선택하세요. 자세한 동작은 [보고서 케이스 탐색](docs/ui.md#explore-cases-in-a-report)을 참고하세요.
|
|
78
80
|
|
|
79
81
|
## 실행 결과 비교
|
package/README.md
CHANGED
|
@@ -74,6 +74,8 @@ The CLI supports repeated IDs: `flow-qa run cases/task-flow.json --target demo -
|
|
|
74
74
|
|
|
75
75
|
From `0.5.0`, open a detailed report and choose **Prepare failed/error cases** to load its unchanged saved suite with only `failed` and `error` cases selected. Preparation never starts a run: review the cases and target, then run explicitly. Changed or missing case/source files block preparation; a changed or missing target must be selected again. See [preparing failed cases](docs/ui.md#prepare-failed-cases).
|
|
76
76
|
|
|
77
|
+
When the saved suite, target, and selected cases still match that preparation, the new report records the original run ID. Open or compare the original from the detailed report. If you change those inputs, the new result is saved as an independent run. An unavailable original is identified without hiding the new report.
|
|
78
|
+
|
|
77
79
|
From `0.8.0`, **Detailed report** supports case/error-text search, status filters, and **Failed/error only**. Use **At least 2 attempts** (0.8.7) to see only cases with multiple recorded attempts. Counts distinguish displayed matches from all recorded cases. Markdown/JSON downloads and failed/error preparation retain the full report scope. To save just the filtered IDs in the displayed order, choose **Download visible case IDs** (0.8.6). See [report case exploration](docs/ui.md#explore-cases-in-a-report).
|
|
78
80
|
|
|
79
81
|
## Compare recorded runs
|
package/dist/src/engine.js
CHANGED
|
@@ -161,6 +161,9 @@ function runnableSuite(suite, blocked) {
|
|
|
161
161
|
export async function runSuite(options) {
|
|
162
162
|
// A malformed selection must not leave a run directory behind.
|
|
163
163
|
const selected = selectCases(options.suite, options.caseIds);
|
|
164
|
+
if (options.parentRunId && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(options.parentRunId)) {
|
|
165
|
+
throw new Error('Invalid parent run ID.');
|
|
166
|
+
}
|
|
164
167
|
let executionSuite = selected.suite;
|
|
165
168
|
let selection = selected.selection;
|
|
166
169
|
const workspace = await realpath(options.workspace);
|
|
@@ -189,7 +192,7 @@ export async function runSuite(options) {
|
|
|
189
192
|
let target = { name: options.targetName, url: '' };
|
|
190
193
|
let releaseMobileDevice;
|
|
191
194
|
let stepMap;
|
|
192
|
-
const context = () => ({ suite: executionSuite, selection, runId, suiteHash, target, startedAt, finishedAt: new Date().toISOString(), blockedReasons: blocked });
|
|
195
|
+
const context = () => ({ suite: executionSuite, selection, runId, parentRunId: options.parentRunId, suiteHash, target, startedAt, finishedAt: new Date().toISOString(), blockedReasons: blocked });
|
|
193
196
|
const blockAll = (suite, reason) => {
|
|
194
197
|
for (const testCase of suite.cases)
|
|
195
198
|
if (!blocked.has(testCase.id))
|
package/dist/src/report.js
CHANGED
|
@@ -9,6 +9,7 @@ import { targetLabel } from "./targets.js";
|
|
|
9
9
|
const RUN_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
10
10
|
const archiveEnvelopeSchema = z.object({
|
|
11
11
|
schemaVersion: z.literal('flow-qa/report-1'), runId: z.string().regex(RUN_ID), suiteId: idSchema,
|
|
12
|
+
parentRunId: z.string().regex(RUN_ID).optional(),
|
|
12
13
|
suiteHash: z.string(), target: z.union([
|
|
13
14
|
z.object({ name: z.string(), url: z.string() }),
|
|
14
15
|
z.object({ name: z.string(), kind: z.literal('mobile'), platform: z.enum(['ios', 'android']), bundleId: z.string(), device: z.string() }),
|
|
@@ -23,7 +24,7 @@ const archiveEnvelopeSchema = z.object({
|
|
|
23
24
|
/** The original UI metadata contract accepts older reports with incomplete attempt details. */
|
|
24
25
|
export function parseArchivedReportEnvelope(raw) {
|
|
25
26
|
const parsed = archiveEnvelopeSchema.safeParse(raw);
|
|
26
|
-
return parsed.success && isReportSelectionValid(parsed.data.cases, parsed.data.selection) ? parsed.data : undefined;
|
|
27
|
+
return parsed.success && parsed.data.parentRunId !== parsed.data.runId && isReportSelectionValid(parsed.data.cases, parsed.data.selection) ? parsed.data : undefined;
|
|
27
28
|
}
|
|
28
29
|
const savedErrorSchema = z.object({ code: z.string(), message: z.string(), category: z.enum(['test', 'configuration', 'infrastructure', 'internal', 'interrupted']).optional() });
|
|
29
30
|
const savedAttemptSchema = z.object({
|
|
@@ -49,6 +50,8 @@ export function isSavedReport(raw) {
|
|
|
49
50
|
if (!savedReportSchema.safeParse(raw).success)
|
|
50
51
|
return false;
|
|
51
52
|
const report = raw;
|
|
53
|
+
if (report.parentRunId === report.runId)
|
|
54
|
+
return false;
|
|
52
55
|
if (!isReportSelectionValid(report.cases, report.selection))
|
|
53
56
|
return false;
|
|
54
57
|
for (const item of report.cases) {
|
|
@@ -332,7 +335,7 @@ export function normalizeReport1(raw, context) {
|
|
|
332
335
|
: rawStatus === 'failed' ? 'failed'
|
|
333
336
|
: 'passed';
|
|
334
337
|
return {
|
|
335
|
-
schemaVersion: 'flow-qa/report-1', runId: context.runId, suiteId: context.suite.id,
|
|
338
|
+
schemaVersion: 'flow-qa/report-1', runId: context.runId, ...(context.parentRunId ? { parentRunId: context.parentRunId } : {}), suiteId: context.suite.id,
|
|
336
339
|
suiteHash: context.suiteHash, target: context.target, startedAt: context.startedAt,
|
|
337
340
|
finishedAt: context.finishedAt, status, cases, errors, usage: reportUsage, ...reportSelection(context),
|
|
338
341
|
};
|
|
@@ -347,7 +350,7 @@ export function stoppedReport(raw, context, status, reason) {
|
|
|
347
350
|
/** An explicit failure report still enumerates every expected case. */
|
|
348
351
|
export function failureReport(context, status, error) {
|
|
349
352
|
return {
|
|
350
|
-
schemaVersion: 'flow-qa/report-1', runId: context.runId, suiteId: context.suite.id,
|
|
353
|
+
schemaVersion: 'flow-qa/report-1', runId: context.runId, ...(context.parentRunId ? { parentRunId: context.parentRunId } : {}), suiteId: context.suite.id,
|
|
351
354
|
suiteHash: context.suiteHash, target: context.target, startedAt: context.startedAt,
|
|
352
355
|
finishedAt: context.finishedAt, status,
|
|
353
356
|
cases: scopedCases(context).map((testCase) => ({
|
|
@@ -387,6 +390,7 @@ export function renderMarkdown(report, locale = 'en') {
|
|
|
387
390
|
`# ${label('QA results', 'QA 결과')}: ${safe(report.suiteId)}`,
|
|
388
391
|
'',
|
|
389
392
|
`- ${label('Run ID', '실행 ID')}: ${safe(report.runId)}`,
|
|
393
|
+
...(report.parentRunId ? [`- ${label('Prepared from run', '재실행 원본')}: ${safe(report.parentRunId)}`] : []),
|
|
390
394
|
`- ${label('Target', '대상')}: ${safe(report.target.name)} ${report.target.kind === 'mobile'
|
|
391
395
|
? safe(targetLabel(report.target))
|
|
392
396
|
: label('(URL available in the local JSON report)', '(주소는 로컬 JSON 보고서에서 확인)')}`,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const t = i18n.t;
|
|
6
6
|
const names = { scenario: 'nav.scenario', library: 'nav.library', history: 'nav.history', settings: 'nav.settings' };
|
|
7
7
|
const defaultReportFilter = () => ({ search: '', status: 'all', sort: 'recorded', repeatedOnly: false });
|
|
8
|
-
const app = { state: null, connected: false, displayTargets: [], draft: null, selectedCaseIds: new Set(), script: '', neutralScript: '', scriptRevision: 0, savedFile: '', savedHash: '', origin: 'none', sourceFlow: '', boundSource: null, stale: false, dirty: false, busy: false, planning: false, planRequest: 0, stopping: false, report: null, reportMarkdown: '', selectedRun: '', reportFilter: defaultReportFilter(), rerunOrigin: null, rerunTargetMismatch: false, navigationVersion: 0, comparison: null, comparisonRequest: 0, comparisonBusy: false, comparisonStatus: 'comparison.selectBoth', comparisonPins: { baseline: null, current: null }, comparisonSelectionGeneration: 0, comparisonValidation: null, history: { runs: [], nextCursor: null, pagesLoaded: 0, loaded: false, loading: false, request: 0, debounce: null, kind: null, error: null, updatesAvailable: false, pendingRecentUpdate: false }, view: 'scenario' };
|
|
8
|
+
const app = { state: null, connected: false, displayTargets: [], draft: null, selectedCaseIds: new Set(), script: '', neutralScript: '', scriptRevision: 0, savedFile: '', savedHash: '', origin: 'none', sourceFlow: '', boundSource: null, stale: false, dirty: false, busy: false, planning: false, planRequest: 0, stopping: false, report: null, reportParent: null, reportMarkdown: '', selectedRun: '', reportFilter: defaultReportFilter(), rerunOrigin: null, rerunTargetMismatch: false, navigationVersion: 0, comparison: null, comparisonRequest: 0, comparisonBusy: false, comparisonStatus: 'comparison.selectBoth', comparisonPins: { baseline: null, current: null }, comparisonSelectionGeneration: 0, comparisonValidation: null, history: { runs: [], nextCursor: null, pagesLoaded: 0, loaded: false, loading: false, request: 0, debounce: null, kind: null, error: null, updatesAvailable: false, pendingRecentUpdate: false }, view: 'scenario' };
|
|
9
9
|
|
|
10
10
|
function el(tag, className, value) {
|
|
11
11
|
const node = document.createElement(tag);
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
const ready = !!app.draft && !!app.script && !app.stale && !app.dirty;
|
|
110
110
|
$('run-btn').disabled = !app.connected || !ready || !app.savedFile || !app.savedHash || !selectedCases().length || !$('review-checkbox').checked || !compatibleTarget() || !!active || app.busy;
|
|
111
111
|
updateCaseSelection();
|
|
112
|
+
renderRerunHints();
|
|
112
113
|
$('save-btn').disabled = !ready || app.busy;
|
|
113
114
|
$('suite-download').disabled = !canDownloadSavedCases();
|
|
114
115
|
$('flow-download').disabled = !canDownloadSourceMarkdown();
|
|
@@ -253,10 +254,19 @@
|
|
|
253
254
|
}
|
|
254
255
|
function renderRerunHints() {
|
|
255
256
|
$('rerun-origin-hint').hidden = !app.rerunOrigin;
|
|
256
|
-
if (app.rerunOrigin) $('rerun-origin-hint').textContent = t('app.rerunPrepared', app.rerunOrigin);
|
|
257
|
+
if (app.rerunOrigin) $('rerun-origin-hint').textContent = t(canLinkRerun() ? 'app.rerunPrepared' : 'app.rerunChanged', app.rerunOrigin);
|
|
257
258
|
$('rerun-target-hint').hidden = !app.rerunTargetMismatch;
|
|
258
259
|
if (app.rerunTargetMismatch) $('rerun-target-hint').textContent = t('app.rerunTargetMismatch');
|
|
259
260
|
}
|
|
261
|
+
function canLinkRerun() {
|
|
262
|
+
const origin = app.rerunOrigin;
|
|
263
|
+
const target = selectedTarget();
|
|
264
|
+
const caseIds = selectedCases().map((item) => item.id);
|
|
265
|
+
return !!origin && !app.dirty && !app.stale && app.savedFile === origin.file &&
|
|
266
|
+
app.savedHash === origin.suiteHash && target?.name === origin.targetName &&
|
|
267
|
+
target.targetFingerprint === origin.targetFingerprint &&
|
|
268
|
+
caseIds.length === origin.caseIds.length && caseIds.every((id, index) => id === origin.caseIds[index]);
|
|
269
|
+
}
|
|
260
270
|
function modelDescription(role) {
|
|
261
271
|
const model = app.state?.models?.[role] || {};
|
|
262
272
|
const explanation = t(role === 'planner' ? 'app.modelPlannerHelp' : 'app.modelAgentHelp');
|
|
@@ -679,7 +689,22 @@
|
|
|
679
689
|
noticeKey('app.compileComplete');
|
|
680
690
|
}); }
|
|
681
691
|
async function save() { await work(async () => { if (!app.draft || app.dirty || app.stale) throw localizedError('app.needValidated'); const body = { suite: app.draft }; if (!app.boundSource && app.sourceFlow && (app.origin === 'imported' ? editableFlow(app.sourceFlow) === $('flow-input').value : app.sourceFlow === $('flow-input').value.trim())) body.flow = app.sourceFlow; const result = await api('/api/save', body); const saved = await api(`/api/suite?file=${encodeURIComponent(result.file)}`); $('flow-input').value = saved.flow || ''; setDraft(saved.suite, saved.script, 'library', saved.flow || '', result.file, saved.suiteHash || ''); noticeKey('app.savedSuite', { file: result.file }); await refresh(false); }); }
|
|
682
|
-
async function run() {
|
|
692
|
+
async function run() {
|
|
693
|
+
await work(async () => {
|
|
694
|
+
if (!app.draft || !app.script || !app.savedFile || !app.savedHash || app.dirty || app.stale ||
|
|
695
|
+
!selectedCases().length || !$('review-checkbox').checked || !compatibleTarget()) {
|
|
696
|
+
throw localizedError('app.runNotReady');
|
|
697
|
+
}
|
|
698
|
+
const target = selectedTarget();
|
|
699
|
+
const body = { suite: app.savedFile, suiteHash: app.savedHash,
|
|
700
|
+
targetName: target.name, targetFingerprint: target.targetFingerprint };
|
|
701
|
+
if (selectedCases().length < app.draft.cases.length) body.caseIds = selectedCases().map((item) => item.id);
|
|
702
|
+
if (canLinkRerun()) body.parentRunId = app.rerunOrigin.runId;
|
|
703
|
+
const result = await api('/api/run', body);
|
|
704
|
+
noticeKey('app.runStarted', { id: result.operationId });
|
|
705
|
+
await refresh(false);
|
|
706
|
+
});
|
|
707
|
+
}
|
|
683
708
|
async function stop() {
|
|
684
709
|
if (app.stopping || !app.state?.active) return;
|
|
685
710
|
if (app.state.active.kind === 'plan' && app.planning) app.planRequest += 1;
|
|
@@ -688,7 +713,7 @@
|
|
|
688
713
|
catch (error) { showError(error); }
|
|
689
714
|
finally { app.stopping = false; readiness(); }
|
|
690
715
|
}
|
|
691
|
-
async function loadReport(runId) { await work(async () => { const result = await api(`/api/report?runId=${encodeURIComponent(runId)}`); if (app.selectedRun !== runId) app.reportFilter = defaultReportFilter(); app.report = result.report; app.reportMarkdown = result.markdown; app.selectedRun = runId; renderReport(); readiness(); $('report-panel').hidden = false; $('report-panel').scrollIntoView({ behavior: 'smooth', block: 'start' }); }); }
|
|
716
|
+
async function loadReport(runId) { await work(async () => { const result = await api(`/api/report?runId=${encodeURIComponent(runId)}`); if (app.selectedRun !== runId) app.reportFilter = defaultReportFilter(); app.report = result.report; app.reportParent = result.parentRun || null; app.reportMarkdown = result.markdown; app.selectedRun = runId; renderReport(); readiness(); $('report-panel').hidden = false; $('report-panel').scrollIntoView({ behavior: 'smooth', block: 'start' }); }); }
|
|
692
717
|
async function prepareFailedCases() { await work(async () => {
|
|
693
718
|
const runId = app.selectedRun;
|
|
694
719
|
const report = app.report;
|
|
@@ -709,7 +734,8 @@
|
|
|
709
734
|
$('target-select').value = sameTarget ? target.name : '';
|
|
710
735
|
await syncScriptForTarget();
|
|
711
736
|
app.rerunTargetMismatch = !sameTarget;
|
|
712
|
-
app.rerunOrigin = { runId: result.originRunId, count: result.caseIds.length
|
|
737
|
+
app.rerunOrigin = { runId: result.originRunId, count: result.caseIds.length, caseIds: result.caseIds,
|
|
738
|
+
file: result.file, suiteHash: result.suiteHash, targetName: result.targetName, targetFingerprint: result.targetFingerprint };
|
|
713
739
|
renderRerunHints(); targetDescription();
|
|
714
740
|
noticeKey(sameTarget ? 'app.rerunPrepared' : 'app.rerunPreparedTarget', app.rerunOrigin);
|
|
715
741
|
view('scenario');
|
|
@@ -875,6 +901,20 @@
|
|
|
875
901
|
$('report-heading').textContent = `${report.runId} · ${i18n.status(report.status)} · ${targetDisplay(report.target)}`;
|
|
876
902
|
const host = $('report-content'); replace(host);
|
|
877
903
|
const meta = el('div', 'report-meta'); for (const value of [t('app.reportStatus', { status: i18n.status(report.status) }), t('app.reportTarget', { target: targetDisplay(report.target) }), t('app.reportStarted', { date: formatDate(report.startedAt) }), t('app.reportFinished', { date: formatDate(report.finishedAt) })]) meta.append(el('span', '', value)); const scope = selectionScope(report.selection); if (scope) meta.append(el('span', 'selection-scope', scope)); host.append(meta);
|
|
904
|
+
if (report.parentRunId) {
|
|
905
|
+
const parent = el('section', 'report-parent'); parent.append(el('p', 'hint', t(app.reportParent ? 'history.parentRun' : 'history.parentMissing', { runId: report.parentRunId })));
|
|
906
|
+
if (app.reportParent) {
|
|
907
|
+
const actions = el('div', 'actions');
|
|
908
|
+
const open = el('button', 'button quiet', t('history.openParent')); open.type = 'button'; open.dataset.action = 'open-parent'; open.addEventListener('click', () => loadReport(report.parentRunId));
|
|
909
|
+
const compare = el('button', 'button quiet', t('history.compareParent')); compare.type = 'button'; compare.dataset.action = 'compare-parent'; compare.addEventListener('click', () => {
|
|
910
|
+
selectComparisonRun('baseline', app.reportParent);
|
|
911
|
+
selectComparisonRun('current', { runId: report.runId, suiteId: report.suiteId, status: report.status, startedAt: report.startedAt, target: report.target, selection: report.selection });
|
|
912
|
+
void compareRuns();
|
|
913
|
+
});
|
|
914
|
+
actions.append(open, compare); parent.append(actions);
|
|
915
|
+
}
|
|
916
|
+
host.append(parent);
|
|
917
|
+
}
|
|
878
918
|
if (report.usage) host.append(el('p', 'hint', t('app.usage', { tokens: report.usage.modelTokens ?? t('app.unavailable'), cost: typeof report.usage.estimatedCostUsd === 'number' ? `$${report.usage.estimatedCostUsd.toFixed(4)}` : t('app.unavailable') })));
|
|
879
919
|
if (report.errors?.length) host.append(el('p', 'report-errors', report.errors.join('\n')));
|
|
880
920
|
const caseList = el('div'); caseList.id = 'report-case-list'; host.append(caseList);
|
|
@@ -161,6 +161,10 @@
|
|
|
161
161
|
'comparison.error': ['Comparison failed: {message}', '비교 실패: {message}'],
|
|
162
162
|
'comparison.runLabel': ['{date} · {suite} · {shortId} · {target} · {status} · {id}', '{date} · {suite} · {shortId} · {target} · {status} · {id}'],
|
|
163
163
|
'history.report': ['Detailed report', '상세 보고서'],
|
|
164
|
+
'history.parentRun': ['Prepared from run {runId}', '실행 {runId}에서 재실행 준비'],
|
|
165
|
+
'history.parentMissing': ['Original run {runId} is unavailable. This report is still readable.', '원본 실행 {runId}을(를) 찾을 수 없습니다. 현재 보고서는 계속 볼 수 있습니다.'],
|
|
166
|
+
'history.openParent': ['View original report', '원본 보고서 보기'],
|
|
167
|
+
'history.compareParent': ['Compare with original', '원본과 비교'],
|
|
164
168
|
'report.searchLabel': ['Search cases', '케이스 검색'],
|
|
165
169
|
'report.searchPlaceholder': ['Search ID, title, expected result, or errors', 'ID, 제목, 기대 결과 또는 오류 검색'],
|
|
166
170
|
'report.statusLabel': ['Case status', '케이스 상태'],
|
|
@@ -365,6 +369,7 @@
|
|
|
365
369
|
'app.runStarted': ['Run started. Task ID: {id}', '실행을 시작했습니다. 작업 ID: {id}'],
|
|
366
370
|
'app.rerunPrepared': ['Prepared {count} failed/error cases from run {runId}. Review the cases and target before starting a new run.', '실행 {runId}의 실패·오류 케이스 {count}개를 준비했습니다. 새 실행 전 케이스와 대상을 검토하세요.'],
|
|
367
371
|
'app.rerunPreparedTarget': ['Prepared {count} failed/error cases from run {runId}. The target changed or is unavailable. Select and review a target before starting a new run.', '실행 {runId}의 실패·오류 케이스 {count}개를 준비했습니다. 대상이 변경되었거나 없습니다. 새 실행 전 대상을 선택하고 검토하세요.'],
|
|
372
|
+
'app.rerunChanged': ['Run {runId} prepared {count} cases. The definition, target, or case selection changed, so the next result will be independent.', '실행 {runId}에서 케이스 {count}개를 준비했습니다. 정의·대상·선택 케이스가 달라져 다음 결과는 독립 실행으로 저장됩니다.'],
|
|
368
373
|
'app.rerunTargetMismatch': ['The report target changed or is unavailable. Select a current target and review it before running.', '보고서의 대상이 변경되었거나 없습니다. 현재 대상을 선택하고 검토한 뒤 실행하세요.'],
|
|
369
374
|
'app.stopRequested': ['Stop request sent. Checking the final state.', '중지 요청을 보냈습니다. 실제 종료 상태를 확인 중입니다.'],
|
|
370
375
|
'app.reportStatus': ['Status {status}', '상태 {status}'],
|
package/dist/src/ui/server.js
CHANGED
|
@@ -419,6 +419,55 @@ export async function startUIServer(options) {
|
|
|
419
419
|
markdown = renderSavedMarkdown(raw, markdown, locale);
|
|
420
420
|
return { report: raw, ...(markdown === undefined ? {} : { markdown }) };
|
|
421
421
|
}
|
|
422
|
+
async function preparedRerun(runId) {
|
|
423
|
+
const { report: previous } = await report(runId, false);
|
|
424
|
+
const matches = (await suites()).filter((item) => item.id === previous.suiteId);
|
|
425
|
+
if (matches.length === 0)
|
|
426
|
+
throw new HTTPError(409, 'No saved case file matches this report.');
|
|
427
|
+
if (matches.length > 1)
|
|
428
|
+
throw new HTTPError(409, 'Multiple saved case files match this report.');
|
|
429
|
+
const file = matches[0].file;
|
|
430
|
+
let selected;
|
|
431
|
+
try {
|
|
432
|
+
selected = await getSuite(file, true);
|
|
433
|
+
}
|
|
434
|
+
catch (error) {
|
|
435
|
+
if (error instanceof HTTPError && error.status === 404) {
|
|
436
|
+
throw new HTTPError(409, 'The saved case file or source flow was not found.');
|
|
437
|
+
}
|
|
438
|
+
if (error instanceof HTTPError && error.status === 400) {
|
|
439
|
+
throw new HTTPError(409, 'The saved case file or source flow is invalid.');
|
|
440
|
+
}
|
|
441
|
+
throw error;
|
|
442
|
+
}
|
|
443
|
+
const { suite } = selected;
|
|
444
|
+
if (sha256(`${JSON.stringify(suite, null, 2)}\n`) !== previous.suiteHash) {
|
|
445
|
+
throw new HTTPError(409, 'The saved case file changed since this run. Review it before rerunning.');
|
|
446
|
+
}
|
|
447
|
+
const available = new Set(suite.cases.map((item) => item.id));
|
|
448
|
+
if (previous.cases.some((item) => !item.id.trim() || !available.has(item.id)) ||
|
|
449
|
+
new Set(previous.cases.map((item) => item.id)).size !== previous.cases.length ||
|
|
450
|
+
(!previous.selection && previous.cases.length !== suite.cases.length)) {
|
|
451
|
+
throw new HTTPError(409, 'The report cases do not match the saved case file.');
|
|
452
|
+
}
|
|
453
|
+
if (previous.selection && (previous.selection.totalCases !== suite.cases.length ||
|
|
454
|
+
!isReportSelectionValid(previous.cases, previous.selection))) {
|
|
455
|
+
throw new HTTPError(409, 'The report selection does not match the saved case file.');
|
|
456
|
+
}
|
|
457
|
+
const failing = new Set(previous.cases.filter((item) => item.status === 'failed' || item.status === 'error').map((item) => item.id));
|
|
458
|
+
const caseIds = suite.cases.filter((item) => failing.has(item.id)).map((item) => item.id);
|
|
459
|
+
if (caseIds.length === 0)
|
|
460
|
+
throw new HTTPError(409, 'No failed or errored cases are available to rerun.');
|
|
461
|
+
const settings = await config();
|
|
462
|
+
const targetName = previous.target.name;
|
|
463
|
+
const expectedFingerprint = targetFingerprint(previous.target);
|
|
464
|
+
const currentTarget = Object.hasOwn(settings.targets, targetName) ? settings.targets[targetName] : undefined;
|
|
465
|
+
return { originRunId: runId, file, ...selected, caseIds, targetName,
|
|
466
|
+
targetFingerprint: expectedFingerprint,
|
|
467
|
+
targetMatches: Boolean(currentTarget &&
|
|
468
|
+
(suite.platform ?? 'web') === (currentTarget.kind === 'mobile' ? 'mobile' : 'web') &&
|
|
469
|
+
targetFingerprint(currentTarget) === expectedFingerprint) };
|
|
470
|
+
}
|
|
422
471
|
async function runCandidates() {
|
|
423
472
|
const root = await directory(['.flowqa', 'runs']);
|
|
424
473
|
if (!root)
|
|
@@ -496,14 +545,16 @@ export async function startUIServer(options) {
|
|
|
496
545
|
throw new HTTPError(403, 'Invalid request origin.');
|
|
497
546
|
if (request.method === 'GET') {
|
|
498
547
|
if (url.pathname === '/api/state') {
|
|
548
|
+
const observedActive = active;
|
|
499
549
|
const settings = await config();
|
|
500
550
|
const history = (await runSummaries(RUN_HISTORY_LIMIT)).map(({ summary }) => summary);
|
|
551
|
+
const stateActive = observedActive ?? active;
|
|
501
552
|
sendJSON(response, 200, { csrfToken: token,
|
|
502
553
|
targets: Object.entries(settings.targets).map(([name, target]) => ({ name, ...target, targetFingerprint: targetFingerprint(target) })),
|
|
503
554
|
models: { planner: modelState(settings.planner), agent: modelState(settings.agent) },
|
|
504
555
|
runtime: { browserInstalled: await browserInstalled(), browserInstallCommand: BROWSER_INSTALL_COMMAND },
|
|
505
556
|
suites: await suites(), runs: history,
|
|
506
|
-
active:
|
|
557
|
+
active: stateActive?.kind === 'plan' ? { ...stateActive, title: localizeProductMessage(stateActive.title, locale) } : stateActive,
|
|
507
558
|
...(history[0] ? { lastRunId: history[0].runId } : {}),
|
|
508
559
|
...(lastError ? { lastError: localizeProductMessage(lastError, locale) } : {}) });
|
|
509
560
|
return;
|
|
@@ -562,60 +613,25 @@ export async function startUIServer(options) {
|
|
|
562
613
|
const runId = url.searchParams.get('runId');
|
|
563
614
|
if (!runId)
|
|
564
615
|
invalid('A run ID is required.');
|
|
565
|
-
|
|
616
|
+
const saved = await report(runId, true, locale);
|
|
617
|
+
let parentRun = null;
|
|
618
|
+
if (saved.report.parentRunId) {
|
|
619
|
+
try {
|
|
620
|
+
parentRun = runSummary((await report(saved.report.parentRunId, false)).report);
|
|
621
|
+
}
|
|
622
|
+
catch (error) {
|
|
623
|
+
if (!(error instanceof HTTPError && (error.status === 404 || error.status === 400)))
|
|
624
|
+
throw error;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
sendJSON(response, 200, { ...saved, ...(saved.report.parentRunId ? { parentRun } : {}) });
|
|
566
628
|
return;
|
|
567
629
|
}
|
|
568
630
|
if (url.pathname === '/api/rerun') {
|
|
569
631
|
const runId = url.searchParams.get('runId');
|
|
570
632
|
if (!runId)
|
|
571
633
|
invalid('A run ID is required.');
|
|
572
|
-
|
|
573
|
-
const matches = (await suites()).filter((item) => item.id === previous.suiteId);
|
|
574
|
-
if (matches.length === 0)
|
|
575
|
-
throw new HTTPError(409, 'No saved case file matches this report.');
|
|
576
|
-
if (matches.length > 1)
|
|
577
|
-
throw new HTTPError(409, 'Multiple saved case files match this report.');
|
|
578
|
-
const file = matches[0].file;
|
|
579
|
-
let selected;
|
|
580
|
-
try {
|
|
581
|
-
selected = await getSuite(file, true);
|
|
582
|
-
}
|
|
583
|
-
catch (error) {
|
|
584
|
-
if (error instanceof HTTPError && error.status === 404) {
|
|
585
|
-
throw new HTTPError(409, 'The saved case file or source flow was not found.');
|
|
586
|
-
}
|
|
587
|
-
if (error instanceof HTTPError && error.status === 400) {
|
|
588
|
-
throw new HTTPError(409, 'The saved case file or source flow is invalid.');
|
|
589
|
-
}
|
|
590
|
-
throw error;
|
|
591
|
-
}
|
|
592
|
-
const { suite } = selected;
|
|
593
|
-
if (sha256(`${JSON.stringify(suite, null, 2)}\n`) !== previous.suiteHash) {
|
|
594
|
-
throw new HTTPError(409, 'The saved case file changed since this run. Review it before rerunning.');
|
|
595
|
-
}
|
|
596
|
-
const available = new Set(suite.cases.map((item) => item.id));
|
|
597
|
-
if (previous.cases.some((item) => !item.id.trim() || !available.has(item.id)) ||
|
|
598
|
-
new Set(previous.cases.map((item) => item.id)).size !== previous.cases.length ||
|
|
599
|
-
(!previous.selection && previous.cases.length !== suite.cases.length)) {
|
|
600
|
-
throw new HTTPError(409, 'The report cases do not match the saved case file.');
|
|
601
|
-
}
|
|
602
|
-
if (previous.selection && (previous.selection.totalCases !== suite.cases.length ||
|
|
603
|
-
!isReportSelectionValid(previous.cases, previous.selection))) {
|
|
604
|
-
throw new HTTPError(409, 'The report selection does not match the saved case file.');
|
|
605
|
-
}
|
|
606
|
-
const failing = new Set(previous.cases.filter((item) => item.status === 'failed' || item.status === 'error').map((item) => item.id));
|
|
607
|
-
const caseIds = suite.cases.filter((item) => failing.has(item.id)).map((item) => item.id);
|
|
608
|
-
if (caseIds.length === 0)
|
|
609
|
-
throw new HTTPError(409, 'No failed or errored cases are available to rerun.');
|
|
610
|
-
const settings = await config();
|
|
611
|
-
const targetName = previous.target.name;
|
|
612
|
-
const expectedFingerprint = targetFingerprint(previous.target);
|
|
613
|
-
const currentTarget = Object.hasOwn(settings.targets, targetName) ? settings.targets[targetName] : undefined;
|
|
614
|
-
sendJSON(response, 200, { originRunId: runId, file, ...selected, caseIds, targetName,
|
|
615
|
-
targetFingerprint: expectedFingerprint,
|
|
616
|
-
targetMatches: Boolean(currentTarget &&
|
|
617
|
-
(suite.platform ?? 'web') === (currentTarget.kind === 'mobile' ? 'mobile' : 'web') &&
|
|
618
|
-
targetFingerprint(currentTarget) === expectedFingerprint) });
|
|
634
|
+
sendJSON(response, 200, await preparedRerun(runId));
|
|
619
635
|
return;
|
|
620
636
|
}
|
|
621
637
|
if (url.pathname === '/api/comparison') {
|
|
@@ -857,10 +873,11 @@ export async function startUIServer(options) {
|
|
|
857
873
|
if (url.pathname === '/api/run') {
|
|
858
874
|
enterMutation();
|
|
859
875
|
try {
|
|
860
|
-
const { suite: file, suiteHash, targetName, targetURL, targetFingerprint: reviewedFingerprint, caseIds } = parse(z.object({
|
|
876
|
+
const { suite: file, suiteHash, targetName, targetURL, targetFingerprint: reviewedFingerprint, caseIds, parentRunId } = parse(z.object({
|
|
861
877
|
suite: z.string(), suiteHash: z.string().regex(/^[a-f0-9]{64}$/), targetName: idSchema,
|
|
862
878
|
targetURL: z.string().optional(), targetFingerprint: z.string().regex(/^[a-f0-9]{64}$/).optional(),
|
|
863
879
|
caseIds: z.array(idSchema).min(1).max(100).optional(),
|
|
880
|
+
parentRunId: z.string().regex(RUN_ID).optional(),
|
|
864
881
|
}).strict(), body);
|
|
865
882
|
const selected = await getSuite(file, true);
|
|
866
883
|
if (selected.suiteHash !== suiteHash)
|
|
@@ -889,6 +906,17 @@ export async function startUIServer(options) {
|
|
|
889
906
|
else if (target.kind === 'mobile' || !targetURL || target.url !== targetURL) {
|
|
890
907
|
throw new HTTPError(409, 'The selected target changed. Review it again.');
|
|
891
908
|
}
|
|
909
|
+
if (parentRunId) {
|
|
910
|
+
const prepared = await preparedRerun(parentRunId);
|
|
911
|
+
const actualIds = selectedIds ?? suite.cases.map((item) => item.id);
|
|
912
|
+
if (prepared.file !== file || prepared.suiteHash !== suiteHash ||
|
|
913
|
+
prepared.targetName !== targetName || !prepared.targetMatches ||
|
|
914
|
+
prepared.targetFingerprint !== targetFingerprint(target) ||
|
|
915
|
+
actualIds.length !== prepared.caseIds.length ||
|
|
916
|
+
actualIds.some((id, index) => id !== prepared.caseIds[index])) {
|
|
917
|
+
throw new HTTPError(409, 'The prepared rerun changed. Review it again or start an independent run.');
|
|
918
|
+
}
|
|
919
|
+
}
|
|
892
920
|
const operationId = randomUUID();
|
|
893
921
|
const abort = new AbortController();
|
|
894
922
|
controller = abort;
|
|
@@ -899,7 +927,7 @@ export async function startUIServer(options) {
|
|
|
899
927
|
const suiteSnapshot = structuredClone(suite);
|
|
900
928
|
const configSnapshot = structuredClone(settings);
|
|
901
929
|
runTask = Promise.resolve().then(() => run({ workspace, suite: suiteSnapshot, config: configSnapshot, targetName, signal: abort.signal,
|
|
902
|
-
...(selectedIds ? { caseIds: [...selectedIds] } : {}) }))
|
|
930
|
+
...(selectedIds ? { caseIds: [...selectedIds] } : {}), ...(parentRunId ? { parentRunId } : {}) }))
|
|
903
931
|
.then(() => undefined)
|
|
904
932
|
.catch(() => { lastError = 'Could not complete the run. Check the local records.'; })
|
|
905
933
|
.finally(() => { active = null; controller = undefined; busy = false; runTask = undefined; });
|
package/docs/ui.md
CHANGED
|
@@ -108,7 +108,9 @@ The UI finds exactly one saved case file with the report's suite ID, verifies it
|
|
|
108
108
|
|
|
109
109
|
Successful preparation opens Scenario with the original source and failed/error selection. The prior target is selected only when its current name and settings still match the recorded target. Otherwise the target is cleared for explicit selection. Review confirmation is always cleared; inspect the selected cases and target before pressing **Run QA**. The normal execution-time file, source, and target checks still apply. Each selected case must establish its own starting state. Mobile target matching compares configured selectors, not physical device identity.
|
|
110
110
|
|
|
111
|
-
The preparation notice identifies the original run.
|
|
111
|
+
The preparation notice identifies the original run. If the saved suite, target settings, and selected case IDs still match that preparation when you press **Run QA**, the new report records the original run ID. Its detailed report can open the original or compare the two runs directly. The comparison marks cases excluded from the rerun as missing from the current report; it does not count them as passes. A failed, blocked, or interrupted rerun keeps the same original run ID. If the original report is deleted later, the new report remains readable and shows that the original is unavailable.
|
|
112
|
+
|
|
113
|
+
Changing the suite, target, or case selection starts an independent run without the original link. The UI explains this before execution. The server rechecks the saved inputs and original run at submission time. Selection stays through navigation, language changes, and polling, but resets on page reload. Reports saved by older versions remain readable without an original run ID.
|
|
112
114
|
|
|
113
115
|
### Compare two runs
|
|
114
116
|
|