@ihyeon/flow-qa 0.9.12 → 0.10.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.
Files changed (57) hide show
  1. package/README.ko.md +2 -0
  2. package/README.md +2 -0
  3. package/THIRD_PARTY_NOTICES.md +2 -2
  4. package/dist/src/compiler.js +27 -9
  5. package/dist/src/engine.js +12 -8
  6. package/dist/src/report.js +44 -9
  7. package/dist/src/run-comparison.js +32 -2
  8. package/dist/src/step-comparison.js +107 -0
  9. package/dist/src/ui/design-system/components.css +787 -0
  10. package/{node_modules/@hyeonse/design-system/dist → dist/src/ui/design-system}/preferences.js +20 -12
  11. package/{node_modules/@hyeonse/design-system/src → dist/src/ui/design-system}/tokens.css +56 -0
  12. package/dist/src/ui/public/app.js +31 -0
  13. package/dist/src/ui/public/i18n.js +18 -0
  14. package/dist/src/ui/public/style.css +3 -0
  15. package/dist/src/ui/server.js +22 -7
  16. package/docs/releases.md +12 -0
  17. package/docs/ui.md +4 -2
  18. package/package.json +4 -6
  19. package/node_modules/@hyeonse/design-system/.github/workflows/ci.yml +0 -21
  20. package/node_modules/@hyeonse/design-system/.npmignore +0 -5
  21. package/node_modules/@hyeonse/design-system/AGENTS.md +0 -10
  22. package/node_modules/@hyeonse/design-system/README.md +0 -67
  23. package/node_modules/@hyeonse/design-system/THIRD_PARTY_NOTICES.md +0 -5
  24. package/node_modules/@hyeonse/design-system/dist/components.css +0 -105
  25. package/node_modules/@hyeonse/design-system/dist/preferences.d.ts +0 -21
  26. package/node_modules/@hyeonse/design-system/dist/react.d.ts +0 -21
  27. package/node_modules/@hyeonse/design-system/dist/react.js +0 -100
  28. package/node_modules/@hyeonse/design-system/dist/tokens.css +0 -75
  29. package/node_modules/@hyeonse/design-system/docs/api.md +0 -33
  30. package/node_modules/@hyeonse/design-system/docs/assets/fonts/dm-sans.woff2 +0 -0
  31. package/node_modules/@hyeonse/design-system/docs/assets/fonts/noto-kr-subset.woff2 +0 -0
  32. package/node_modules/@hyeonse/design-system/docs/audit.md +0 -29
  33. package/node_modules/@hyeonse/design-system/docs/foundations.md +0 -30
  34. package/node_modules/@hyeonse/design-system/docs/verification.md +0 -13
  35. package/node_modules/@hyeonse/design-system/index.html +0 -51
  36. package/node_modules/@hyeonse/design-system/licenses/DM-Sans-LICENSE.txt +0 -93
  37. package/node_modules/@hyeonse/design-system/licenses/Noto-Sans-KR-LICENSE.txt +0 -93
  38. package/node_modules/@hyeonse/design-system/licenses/arla6ka-MIT.txt +0 -21
  39. package/node_modules/@hyeonse/design-system/package.json +0 -35
  40. package/node_modules/@hyeonse/design-system/scripts/audit-tokens.mjs +0 -48
  41. package/node_modules/@hyeonse/design-system/scripts/build.mjs +0 -12
  42. package/node_modules/@hyeonse/design-system/showcase.css +0 -75
  43. package/node_modules/@hyeonse/design-system/showcase.mjs +0 -63
  44. package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/SKILL.md +0 -18
  45. package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/api.md +0 -7
  46. package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/build.md +0 -7
  47. package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/foundations.md +0 -7
  48. package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/mapping.md +0 -7
  49. package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/migration.md +0 -5
  50. package/node_modules/@hyeonse/design-system/skills/hyeonse-design-system/references/review-docs.md +0 -5
  51. package/node_modules/@hyeonse/design-system/src/components.css +0 -105
  52. package/node_modules/@hyeonse/design-system/src/preferences.ts +0 -87
  53. package/node_modules/@hyeonse/design-system/src/react.tsx +0 -161
  54. package/node_modules/@hyeonse/design-system/tests/audit.test.mjs +0 -30
  55. package/node_modules/@hyeonse/design-system/tests/preferences.test.mjs +0 -86
  56. package/node_modules/@hyeonse/design-system/tsconfig.json +0 -16
  57. /package/{node_modules/@hyeonse → dist/src/ui}/design-system/LICENSE +0 -0
package/README.ko.md CHANGED
@@ -82,6 +82,8 @@ CLI에서는 `flow-qa run cases/task-flow.json --target demo --case TC-001 --cas
82
82
 
83
83
  **실행 기록 → 실행 2건 비교**에서 같은 스위트와 대상의 두 기록을 선택하면 통과→실패, 실패→통과, 그 외 상태 변경, 동일 상태, 추가·누락 케이스를 확인할 수 있습니다. 분류별로 보거나 전체 비교를 Markdown·JSON으로 내려받으세요. 테스트 내용 변경과 불완전한 실행은 별도로 표시하며, 상태 변화만으로 제품 버그의 발생·해결을 확정하지 않습니다. 자세한 동작은 [UI 가이드](docs/ui.md#compare-two-runs)를 참고하세요.
84
84
 
85
+ `0.10.0`부터 같은 정의의 두 실행은 마지막 시도끼리 원본 단계의 **마지막 공통 성공**과 **첫 결과 차이**를 표시합니다. 이후 실행되지 않은 단계는 `미실행`으로 나타납니다. 예전 보고서처럼 원본 단계 연결 근거가 없으면 이유를 표시하고 케이스 상태 비교를 계속 볼 수 있습니다.
86
+
85
87
  ## 모바일 대상
86
88
 
87
89
  `0.2.0`부터 사용자가 직접 설정하는 iOS·Android 대상을 지원합니다. 시나리오 화면에서 **모바일**을 선택하면 앱을 정하기 전에도 케이스를 준비할 수 있습니다. 이후 **연결 설정**에서 플랫폼·설치된 앱의 번들/패키지 ID·기기를 등록하고 실행할 때 선택합니다. 설정 저장은 앱 설치나 테스트 실행을 시작하지 않습니다.
package/README.md CHANGED
@@ -78,6 +78,8 @@ From `0.8.0`, **Detailed report** supports case/error-text search, status filter
78
78
 
79
79
  ## Compare recorded runs
80
80
 
81
+ From `0.10.0`, runs with the same suite definition show the last commonly passed authored step and the first differing observed step for each case. The comparison selects each case's last attempt and identifies later steps that did not run. Earlier reports without verified authored-step links show an explanation alongside the existing case status comparison.
82
+
81
83
  From `0.6.0`, **Run history** searches all valid saved reports by suite ID, run ID, or target name, combined with the run-status filter. Results load 50 at a time; use **Load more** for older results and **Refresh history** to update the list while keeping your filters. Older reports support the same downloads and failed-case preparation. From `0.7.0`, choose **Use as baseline** and **Use as current** on any history rows to compare older runs, retaining the pair through searches and refreshes. See [history search and paging](docs/ui.md#search-run-history).
82
84
 
83
85
  In **Run history → Compare two runs**, select two reports from the same suite and target to see passed-to-failed, failed-to-passed, other status changes, unchanged, added, and missing cases. Filter the comparison or download all results as Markdown/JSON. Changed test definitions and incomplete runs carry explicit warnings; observed status changes do not prove a product defect was introduced or fixed. See the [UI guide](docs/ui.md#compare-two-runs).
@@ -2,8 +2,8 @@
2
2
 
3
3
  Flow QA uses [tester-army/e2e](https://github.com/tester-army/e2e), `@e2e-dev/web` for browser tests, and `@e2e-dev/mobile` for native iOS and Android tests. Those packages are licensed under Apache-2.0 and retain their upstream LICENSE and NOTICE files in their installed distributions. The mobile engine uses [agent-device](https://github.com/callstack/agent-device), licensed under MIT. Flow QA adds the flow specification, schema validation, orchestration, report interpretation, and local UI; it does not claim authorship of the execution engines.
4
4
 
5
- Flow QA uses `@hyeonse/design-system` from [Hyeonse Design System](https://github.com/hyeonse-swing/hyeonse-design-system), pinned to commit `38978c6a86f422fc0e63e919f600bc2dd3451e5c`. The npm tarball bundles this dependency so consumers do not need Git or GitHub credentials. Its MIT license and notices are preserved in the bundled package. Source checkout installation fetches the pinned public source archive over HTTPS.
5
+ Flow QA uses `@hyeonse/design-system` version 0.4.8 from the [Hyeonse Design System release archive](https://design-system.hyeonse.dev/releases/hyeonse-design-system-0.4.8.tgz) during development and packaging. The Flow QA npm tarball includes copies of its `tokens.css`, `components.css`, and `preferences.js` files alongside its MIT `LICENSE`; it does not include the design-system package or its other dependencies. Installed consumers do not need Git or the design-system source archive. Source checkout installation fetches the versioned public archive over HTTPS.
6
6
 
7
- The local DM Sans and Noto Sans KR font files were copied from that repository's `docs/assets/fonts/` at the same commit. Their licenses are preserved in [DM Sans license](licenses/DM-Sans-LICENSE.txt) and [Noto Sans KR license](licenses/Noto-Sans-KR-LICENSE.txt).
7
+ The local DM Sans and Noto Sans KR font files were copied from that repository's `docs/assets/fonts/` at commit `38978c6a86f422fc0e63e919f600bc2dd3451e5c`. Their licenses are preserved in [DM Sans license](licenses/DM-Sans-LICENSE.txt) and [Noto Sans KR license](licenses/Noto-Sans-KR-LICENSE.txt).
8
8
 
9
9
  The Korean font is a subset and does not cover every Korean character. The UI falls back to installed Korean/system fonts for missing glyphs. No external font service is contacted.
@@ -38,7 +38,8 @@ export function expectedChecks(testCase) {
38
38
  export function needsAgent(suite) {
39
39
  return suite.cases.some((testCase) => !testCase.questions.length && testCase.steps.some((step) => step.type === 'act' || step.type === 'assertAgent'));
40
40
  }
41
- export function compileSuite(suite, target) {
41
+ /** Generated source lines are the only bridge from engine calls to authored steps. */
42
+ export function compileSuiteWithStepMap(suite, target) {
42
43
  const parsed = suiteSchema.parse(suite);
43
44
  const mobile = parsed.platform === 'mobile';
44
45
  // Android Settings may keep a system process alive after force-stop. The
@@ -48,11 +49,25 @@ export function compileSuite(suite, target) {
48
49
  const launchApp = settings
49
50
  ? 'await device.home();\n await device.openApp("com.android.settings");\n if ((await device.foregroundApp()).bundleId !== "com.android.settings") throw new Error("Android Settings did not reach the foreground.");'
50
51
  : 'await app.open();';
51
- const lines = [`import { test } from '${mobile ? '@e2e-dev/mobile' : '@e2e-dev/web'}';`, "import { expect } from 'e2e';", ''];
52
+ const lines = [];
53
+ const cases = Object.create(null);
54
+ let nextLine = 1;
55
+ const append = (code) => {
56
+ const first = nextLine;
57
+ const count = code.split('\n').length;
58
+ lines.push(code);
59
+ nextLine += count;
60
+ return Array.from({ length: count }, (_, index) => first + index);
61
+ };
62
+ append(`import { test } from '${mobile ? '@e2e-dev/mobile' : '@e2e-dev/web'}';`);
63
+ append("import { expect } from 'e2e';");
64
+ append('');
52
65
  for (const testCase of parsed.cases) {
53
66
  const title = literal(`[${testCase.id}] ${testCase.title}`);
67
+ const locations = { setupLines: [], stepLines: [] };
68
+ cases[testCase.id] = locations;
54
69
  if (testCase.questions.length) {
55
- lines.push(`test.skip(${title}, async () => {});`);
70
+ append(`test.skip(${title}, async () => {});`);
56
71
  continue;
57
72
  }
58
73
  const fixtures = ['app'];
@@ -64,16 +79,19 @@ export function compileSuite(suite, target) {
64
79
  fixtures.push('browser');
65
80
  if (testCase.steps.some((step) => step.type === 'act' || step.type === 'assertAgent'))
66
81
  fixtures.push('agent');
67
- lines.push(`test(${title}, async ({ ${fixtures.join(', ')} }) => {`);
82
+ append(`test(${title}, async ({ ${fixtures.join(', ')} }) => {`);
68
83
  if (mobile) {
69
84
  if (testCase.steps[0]?.type !== 'launchApp')
70
- lines.push(` ${launchApp}`);
85
+ locations.setupLines.push(...append(` ${launchApp}`));
71
86
  }
72
87
  else if (testCase.steps[0]?.type !== 'open')
73
- lines.push(" await app.open('/');");
88
+ locations.setupLines.push(...append(" await app.open('/');"));
74
89
  for (const step of testCase.steps)
75
- lines.push(` ${stepCode(step, launchApp)}`);
76
- lines.push('});');
90
+ locations.stepLines.push(append(` ${stepCode(step, launchApp)}`));
91
+ append('});');
77
92
  }
78
- return `${lines.join('\n')}\n`;
93
+ return { source: `${lines.join('\n')}\n`, stepMap: { schemaVersion: 'flow-qa/step-map-1', cases } };
94
+ }
95
+ export function compileSuite(suite, target) {
96
+ return compileSuiteWithStepMap(suite, target).source;
79
97
  }
@@ -5,7 +5,7 @@ import { lstat, mkdir, readFile, realpath, stat, writeFile } from 'node:fs/promi
5
5
  import path from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { selectCases } from "./case-selection.js";
8
- import { compileSuite } from "./compiler.js";
8
+ import { compileSuiteWithStepMap } from "./compiler.js";
9
9
  import { acquireMobileDevice, checkMobileApp, mobileReadiness } from "./mobile-runtime.js";
10
10
  import { failureReport, normalizeReport1, renderMarkdown, stoppedReport } from "./report.js";
11
11
  import { configSchema, suiteSchema } from "./schema.js";
@@ -22,11 +22,11 @@ function packageModule(specifier) {
22
22
  return import.meta.resolve(specifier);
23
23
  }
24
24
  function compiledTest(suite, target) {
25
- const source = compileSuite(suite, target);
26
- return source
27
- .replace("from '@e2e-dev/web'", `from ${JSON.stringify(packageModule('@e2e-dev/web'))}`)
28
- .replace("from '@e2e-dev/mobile'", `from ${JSON.stringify(packageModule('@e2e-dev/mobile'))}`)
29
- .replace("from 'e2e'", `from ${JSON.stringify(packageModule('e2e'))}`);
25
+ const compiled = compileSuiteWithStepMap(suite, target);
26
+ return { ...compiled, source: compiled.source
27
+ .replace("from '@e2e-dev/web'", `from ${JSON.stringify(packageModule('@e2e-dev/web'))}`)
28
+ .replace("from '@e2e-dev/mobile'", `from ${JSON.stringify(packageModule('@e2e-dev/mobile'))}`)
29
+ .replace("from 'e2e'", `from ${JSON.stringify(packageModule('e2e'))}`) };
30
30
  }
31
31
  function generatedConfig(suite, config, targetName, agentAvailable, runId, sdkDevice) {
32
32
  const target = config.targets[targetName];
@@ -188,6 +188,7 @@ export async function runSuite(options) {
188
188
  let blocked = new Map();
189
189
  let target = { name: options.targetName, url: '' };
190
190
  let releaseMobileDevice;
191
+ let stepMap;
191
192
  const context = () => ({ suite: executionSuite, selection, runId, suiteHash, target, startedAt, finishedAt: new Date().toISOString(), blockedReasons: blocked });
192
193
  const blockAll = (suite, reason) => {
193
194
  for (const testCase of suite.cases)
@@ -238,7 +239,10 @@ export async function runSuite(options) {
238
239
  const testFile = path.join(runDir, TEST_FILE);
239
240
  const configFile = path.join(runDir, CONFIG_FILE);
240
241
  const agentAvailable = runnable.some(agentCase);
241
- await writeFile(testFile, compiledTest(executable, selectedTarget), { mode: 0o600 });
242
+ const compiled = compiledTest(executable, selectedTarget);
243
+ stepMap = compiled.stepMap;
244
+ await writeFile(testFile, compiled.source, { mode: 0o600 });
245
+ await writeFile(path.join(runDir, 'step-map.json'), `${JSON.stringify({ ...stepMap, suiteHash }, null, 2)}\n`, { mode: 0o600 });
242
246
  await writeFile(configFile, generatedConfig(suite, config, options.targetName, agentAvailable, runId, sdkDevice), { mode: 0o600 });
243
247
  if (options.signal?.aborted) {
244
248
  report = failureReport(context(), 'interrupted', 'An interrupt signal arrived before the run started.');
@@ -265,7 +269,7 @@ export async function runSuite(options) {
265
269
  }
266
270
  if (raw !== undefined) {
267
271
  try {
268
- const reportContext = { ...context(), rawDir: path.join(runDir, 'raw'), testFile };
272
+ const reportContext = { ...context(), rawDir: path.join(runDir, 'raw'), testFile, stepMap };
269
273
  report = reason === undefined ? normalizeReport1(raw, reportContext)
270
274
  : stoppedReport(raw, reportContext, child.interrupted ? 'interrupted' : 'error', reason);
271
275
  }
@@ -15,7 +15,8 @@ const archiveEnvelopeSchema = z.object({
15
15
  ]),
16
16
  startedAt: z.string(), finishedAt: z.string(), status: z.enum(['passed', 'failed', 'blocked', 'error', 'interrupted']),
17
17
  cases: z.array(z.object({ id: z.string(), title: z.string(), status: z.enum(['passed', 'failed', 'flaky', 'blocked', 'skipped', 'error']),
18
- expected: z.array(z.string()), attempts: z.array(z.unknown()), reason: z.string().optional() }).passthrough()),
18
+ expected: z.array(z.string()), definedSteps: z.array(z.object({ type: z.string() })).optional(),
19
+ attempts: z.array(z.unknown()), reason: z.string().optional() }).passthrough()),
19
20
  errors: z.array(z.string()), usage: z.object({ modelTokens: z.number(), modelCachedTokens: z.number().optional(), estimatedCostUsd: z.number().optional() }).optional(),
20
21
  selection: z.unknown().optional(),
21
22
  }).passthrough();
@@ -29,7 +30,8 @@ const savedAttemptSchema = z.object({
29
30
  index: z.number().int().nonnegative(), status: z.enum(['passed', 'failed', 'timed-out', 'interrupted', 'skipped']),
30
31
  startedAt: z.string(), durationMs: z.number().finite().nonnegative(),
31
32
  error: savedErrorSchema.optional(), secondaryErrors: z.array(savedErrorSchema),
32
- steps: z.array(z.object({ api: z.string(), label: z.string(), status: z.string() })),
33
+ steps: z.array(z.object({ api: z.string(), label: z.string(), status: z.string(),
34
+ sourceStepIndex: z.number().int().nonnegative().optional(), sourceSetup: z.literal(true).optional() })),
33
35
  artifacts: z.array(z.object({ kind: z.string(), redaction: z.enum(['complete', 'not-required', 'incomplete']), path: z.string().optional() })),
34
36
  });
35
37
  const savedReportSchema = z.object({
@@ -37,7 +39,7 @@ const savedReportSchema = z.object({
37
39
  suiteHash: z.string().regex(/^[a-f0-9]{64}$/),
38
40
  cases: z.array(z.object({
39
41
  id: idSchema, title: z.string(), status: z.enum(['passed', 'failed', 'flaky', 'blocked', 'skipped', 'error']),
40
- expected: z.array(z.string()), reason: z.string().optional(),
42
+ expected: z.array(z.string()), definedSteps: z.array(z.object({ type: z.string() })).optional(), reason: z.string().optional(),
41
43
  attempts: z.array(savedAttemptSchema),
42
44
  })),
43
45
  usage: z.object({ modelTokens: z.number().finite().nonnegative(), modelCachedTokens: z.number().finite().nonnegative().optional(), estimatedCostUsd: z.number().finite().nonnegative().optional() }).optional(),
@@ -50,6 +52,18 @@ export function isSavedReport(raw) {
50
52
  if (!isReportSelectionValid(report.cases, report.selection))
51
53
  return false;
52
54
  for (const item of report.cases) {
55
+ if (item.definedSteps && (item.definedSteps.length === 0 || item.definedSteps.length > 100))
56
+ return false;
57
+ for (const attempt of item.attempts) {
58
+ const seen = new Set();
59
+ for (const step of attempt.steps) {
60
+ if (step.sourceStepIndex === undefined)
61
+ continue;
62
+ if (!item.definedSteps || step.sourceStepIndex >= item.definedSteps.length || step.sourceSetup || seen.has(step.sourceStepIndex))
63
+ return false;
64
+ seen.add(step.sourceStepIndex);
65
+ }
66
+ }
53
67
  if (item.status === 'passed' && (item.attempts.length !== 1 || item.attempts[0]?.index !== 0 || item.attempts[0]?.status !== 'passed'))
54
68
  return false;
55
69
  if (item.status === 'flaky' && (item.attempts.length < 2 || item.attempts.at(-1)?.status !== 'passed'
@@ -162,15 +176,23 @@ function localArtifactPath(rawPath, rawDir) {
162
176
  }
163
177
  return `raw/artifacts/${parts.join('/')}`;
164
178
  }
165
- function normalizeAttempt(value, rawDir) {
179
+ function normalizeAttempt(value, rawDir, location, sourceFile) {
166
180
  const item = object(value, 'attempt');
167
181
  const steps = array(item.steps, 'attempt.steps').map((value) => {
168
182
  const step = object(value, 'step');
169
183
  const model = step.model === undefined ? undefined : object(step.model, 'step.model');
184
+ const source = step.source && typeof step.source === 'object' && !Array.isArray(step.source)
185
+ ? step.source : undefined;
186
+ const line = source && source.file === sourceFile && Number.isSafeInteger(source.line) && Number.isSafeInteger(source.column)
187
+ && source.column > 0 ? source.line : undefined;
188
+ const stepIndex = line === undefined ? -1 : location?.stepLines.findIndex((lines) => lines.includes(line)) ?? -1;
189
+ const sourceSetup = line !== undefined && location?.setupLines.includes(line);
170
190
  return {
171
191
  api: string(step.api, 'step.api'),
172
192
  label: string(step.label, 'step.label'),
173
193
  status: oneOf(step.status, ['passed', 'failed', 'blocked', 'timed-out', 'cancelled'], 'step.status'),
194
+ ...(stepIndex >= 0 ? { sourceStepIndex: stepIndex } : {}),
195
+ ...(sourceSetup ? { sourceSetup: true } : {}),
174
196
  ...(step.error === undefined ? {} : { error: rawError(step.error) }),
175
197
  ...(model === undefined ? {} : { model: {
176
198
  provider: string(model.provider, 'step.model.provider'),
@@ -181,6 +203,18 @@ function normalizeAttempt(value, rawDir) {
181
203
  } }),
182
204
  };
183
205
  });
206
+ const seen = new Set();
207
+ const repeated = new Set();
208
+ for (const step of steps) {
209
+ if (step.sourceStepIndex === undefined)
210
+ continue;
211
+ if (seen.has(step.sourceStepIndex))
212
+ repeated.add(step.sourceStepIndex);
213
+ seen.add(step.sourceStepIndex);
214
+ }
215
+ for (const step of steps)
216
+ if (step.sourceStepIndex !== undefined && repeated.has(step.sourceStepIndex))
217
+ delete step.sourceStepIndex;
184
218
  const artifacts = array(item.artifacts, 'attempt.artifacts').map((value) => {
185
219
  const artifact = object(value, 'artifact');
186
220
  const redaction = oneOf(artifact.redaction, redactionStatuses, 'artifact.redaction');
@@ -243,7 +277,7 @@ export function normalizeReport1(raw, context) {
243
277
  if (mapped.has(id))
244
278
  throw new Error(`Duplicate test result in the raw report: ${id}`);
245
279
  const status = oneOf(result.status, resultStatuses, 'result.status');
246
- const attempts = array(result.attempts, 'result.attempts').map((attempt) => normalizeAttempt(attempt, context.rawDir));
280
+ const attempts = array(result.attempts, 'result.attempts').map((attempt) => normalizeAttempt(attempt, context.rawDir, context.stepMap?.cases[id], sourceName));
247
281
  if (status !== 'skipped' && attempts.length === 0)
248
282
  throw new Error(`Test result has no attempts: ${id}`);
249
283
  const finalAttemptStatus = attempts.at(-1)?.status;
@@ -268,13 +302,14 @@ export function normalizeReport1(raw, context) {
268
302
  const expected = expectedChecks(testCase);
269
303
  const result = mapped.get(testCase.id);
270
304
  const blockedReason = context.blockedReasons.get(testCase.id);
305
+ const definedSteps = testCase.steps.map((step) => ({ type: step.type }));
271
306
  if (blockedReason !== undefined)
272
- return { id: testCase.id, title: testCase.title, status: 'blocked', expected, attempts: result?.attempts ?? [], reason: blockedReason };
307
+ return { id: testCase.id, title: testCase.title, status: 'blocked', expected, definedSteps, attempts: result?.attempts ?? [], reason: blockedReason };
273
308
  if (result === undefined)
274
- return { id: testCase.id, title: testCase.title, status: 'error', expected, attempts: [], reason: 'The raw report has no result for this case.' };
309
+ return { id: testCase.id, title: testCase.title, status: 'error', expected, definedSteps, attempts: [], reason: 'The raw report has no result for this case.' };
275
310
  const status = resultCaseStatus(result.status, result.attempts);
276
311
  const reason = status === 'blocked' ? result.attempts.at(-1)?.error?.message ?? result.reason : result.reason;
277
- return { id: testCase.id, title: testCase.title, status, expected, attempts: result.attempts, ...(reason === undefined ? {} : { reason }) };
312
+ return { id: testCase.id, title: testCase.title, status, expected, definedSteps, attempts: result.attempts, ...(reason === undefined ? {} : { reason }) };
278
313
  });
279
314
  if (cases.some((item) => item.status === 'error' && !context.blockedReasons.has(item.id)))
280
315
  errors.push('One or more cases ended without a result or were interrupted.');
@@ -318,7 +353,7 @@ export function failureReport(context, status, error) {
318
353
  cases: scopedCases(context).map((testCase) => ({
319
354
  id: testCase.id, title: testCase.title,
320
355
  status: context.blockedReasons.has(testCase.id) ? 'blocked' : 'error',
321
- expected: expectedChecks(testCase), attempts: [],
356
+ expected: expectedChecks(testCase), definedSteps: testCase.steps.map((step) => ({ type: step.type })), attempts: [],
322
357
  reason: context.blockedReasons.get(testCase.id) ?? error,
323
358
  })),
324
359
  errors: [error], ...reportSelection(context),
@@ -1,5 +1,6 @@
1
1
  import { localized } from "./i18n.js";
2
2
  import { isReportSelectionValid } from "./case-selection.js";
3
+ import { compareCaseSteps } from "./step-comparison.js";
3
4
  import { sameReportTarget, targetLabel } from "./targets.js";
4
5
  export const comparisonCategories = ['newly-failed', 'now-passed', 'changed', 'unchanged', 'added', 'missing'];
5
6
  export class ComparisonError extends Error {
@@ -45,7 +46,7 @@ function category(baseline, current) {
45
46
  return 'now-passed';
46
47
  return 'changed';
47
48
  }
48
- /** Compare only recorded final case statuses and report metadata. Never inspect attempts or artifacts. */
49
+ /** Keep final-status categories stable and add conservative authored-step evidence. */
49
50
  export function compareReports(baseline, current) {
50
51
  if (baseline.runId === current.runId)
51
52
  throw new ComparisonError(400, 'A comparison needs two different runs.');
@@ -83,7 +84,8 @@ export function compareReports(baseline, current) {
83
84
  const currentCase = after.get(id);
84
85
  const transition = category(baselineCase, currentCase);
85
86
  counts[transition]++;
86
- return { id, category: transition, baseline: caseSnapshot(baselineCase), current: caseSnapshot(currentCase) };
87
+ return { id, category: transition, baseline: caseSnapshot(baselineCase), current: caseSnapshot(currentCase),
88
+ stepComparison: compareCaseSteps(baselineCase, currentCase, baseline.suiteHash === current.suiteHash) };
87
89
  });
88
90
  return { schemaVersion: 'flow-qa/comparison-1', baseline: runSummary(baseline), current: runSummary(current), warnings, counts, cases };
89
91
  }
@@ -127,6 +129,17 @@ export function renderComparisonMarkdown(comparison, locale = 'en') {
127
129
  'incomplete-run': label('At least one run ended with error or interruption; case results may be incomplete.', '하나 이상의 실행이 오류 또는 중단으로 끝나 케이스 결과가 불완전할 수 있습니다.'),
128
130
  'mobile-identity-unverified': label('The recorded app and device settings match, but these reports do not verify that both runs used the same physical device.', '기록된 앱과 기기 설정은 같지만, 두 실행이 같은 실제 기기에서 진행됐는지는 이 리포트로 확인할 수 없습니다.'),
129
131
  };
132
+ const stepReasons = {
133
+ 'suite-changed': label('Suite definitions differ.', '케이스 모음 정의가 다릅니다.'),
134
+ 'case-absent': label('The case is absent from one run.', '한쪽 실행에 케이스 기록이 없습니다.'),
135
+ 'definition-unavailable': label('Authored step definitions are unavailable.', '원본 단계 정의 기록이 없습니다.'),
136
+ 'definition-changed': label('Recorded step definitions differ.', '기록된 단계 정의가 다릅니다.'),
137
+ 'attempt-unavailable': label('An execution attempt is missing.', '실행 시도 기록이 없습니다.'),
138
+ 'step-unlinked': label('An engine step has no verified authored-step link.', '원본 단계와 연결할 수 없는 엔진 기록이 있습니다.'),
139
+ 'step-ambiguous': label('The step links are duplicated or out of order.', '단계 연결이 중복되거나 순서가 맞지 않습니다.'),
140
+ 'record-incomplete': label('The attempt lacks enough ordered step evidence.', '시도 기록에 순서대로 연결된 단계 근거가 부족합니다.'),
141
+ 'setup-failed': label('The generated setup step failed.', '생성된 준비 단계가 실패했습니다.'),
142
+ };
130
143
  const lines = [
131
144
  `# ${label('QA run comparison', 'QA 실행 비교')}`,
132
145
  '',
@@ -159,6 +172,23 @@ export function renderComparisonMarkdown(comparison, locale = 'en') {
159
172
  if (entry.reason !== undefined)
160
173
  lines.push(` - ${label('Reason', '실행 상태 근거')}: ${safe(entry.reason)}`);
161
174
  }
175
+ const steps = item.stepComparison;
176
+ for (const [name, attempt] of [[label('Baseline attempt', '기준 시도'), steps.baselineAttempt],
177
+ [label('Current attempt', '현재 시도'), steps.currentAttempt]]) {
178
+ if (attempt)
179
+ lines.push(`- ${name}: ${attempt.index}/${attempt.total} · ${safe(attempt.status)}`);
180
+ }
181
+ if (steps.availability === 'unavailable') {
182
+ lines.push(`- ${label('Step comparison unavailable', '단계 비교 불가')}: ${stepReasons[steps.reason ?? 'record-incomplete']}`);
183
+ }
184
+ else {
185
+ lines.push(`- ${label('Generated setup calls', '생성된 준비 호출')}: ${steps.baselineSetupSteps ?? 0} → ${steps.currentSetupSteps ?? 0}`);
186
+ lines.push(`- ${label('Last common passed step', '마지막 공통 성공 단계')}: ${steps.lastCommonPassedStepIndex === undefined ? label('None', '없음') : steps.lastCommonPassedStepIndex + 1}`);
187
+ lines.push(`- ${label('First differing step', '첫 결과 차이 단계')}: ${steps.firstDifferenceStepIndex === undefined ? label('None', '없음') : steps.firstDifferenceStepIndex + 1}`);
188
+ for (const step of steps.steps ?? []) {
189
+ lines.push(` - ${step.index + 1}. ${safe(step.type)}: ${safe(step.baseline)} → ${safe(step.current)}`);
190
+ }
191
+ }
162
192
  lines.push('');
163
193
  }
164
194
  return lines.join('\n');
@@ -0,0 +1,107 @@
1
+ const authoredTypes = new Set([
2
+ 'open', 'launchApp', 'back', 'swipe', 'act', 'click', 'fill',
3
+ 'assertVisible', 'assertText', 'assertUrl', 'assertAgent',
4
+ ]);
5
+ const observedStatuses = new Set(['passed', 'failed', 'blocked', 'timed-out', 'cancelled']);
6
+ const attemptStatuses = new Set(['passed', 'failed', 'timed-out', 'interrupted', 'skipped']);
7
+ function finalAttempt(testCase) {
8
+ if (!testCase || !Array.isArray(testCase.attempts) || !testCase.attempts.length)
9
+ return undefined;
10
+ const index = testCase.attempts.length - 1;
11
+ const attempt = testCase.attempts[index];
12
+ if (!attempt || attempt.index !== index || !attemptStatuses.has(attempt.status))
13
+ return undefined;
14
+ return { index: index + 1, total: testCase.attempts.length, status: attempt.status };
15
+ }
16
+ function observed(testCase, count) {
17
+ const attempt = testCase.attempts.at(-1);
18
+ if (!attempt || !Array.isArray(attempt.steps))
19
+ return 'attempt-unavailable';
20
+ const steps = Array(count).fill(undefined);
21
+ let setup = 0;
22
+ let previousIndex = -1;
23
+ let failedSetup = false;
24
+ for (const record of attempt.steps) {
25
+ if (!record || typeof record !== 'object' || !observedStatuses.has(record.status))
26
+ return 'record-incomplete';
27
+ if (record.sourceSetup === true && record.sourceStepIndex === undefined) {
28
+ setup++;
29
+ failedSetup ||= record.status !== 'passed';
30
+ continue;
31
+ }
32
+ const index = record.sourceStepIndex;
33
+ if (index === undefined)
34
+ return 'step-unlinked';
35
+ if (!Number.isSafeInteger(index) || index < 0 || index >= count || index <= previousIndex || steps[index] !== undefined)
36
+ return 'step-ambiguous';
37
+ steps[index] = record.status;
38
+ previousIndex = index;
39
+ }
40
+ if (failedSetup)
41
+ return 'setup-failed';
42
+ if (previousIndex < 0)
43
+ return 'record-incomplete';
44
+ if (steps.slice(0, previousIndex + 1).some((status) => status === undefined))
45
+ return 'record-incomplete';
46
+ if (steps.slice(previousIndex + 1).some((status) => status !== undefined))
47
+ return 'record-incomplete';
48
+ if (previousIndex < count - 1) {
49
+ const last = steps[previousIndex];
50
+ if (!['failed', 'blocked', 'timed-out', 'cancelled'].includes(last ?? '') ||
51
+ !['failed', 'timed-out'].includes(attempt.status))
52
+ return 'record-incomplete';
53
+ steps.fill('not-run', previousIndex + 1);
54
+ }
55
+ if (attempt.status === 'passed' && steps.some((status) => status !== 'passed'))
56
+ return 'record-incomplete';
57
+ return { steps: steps, setup };
58
+ }
59
+ export function compareCaseSteps(baseline, current, sameSuite) {
60
+ const baselineAttempt = finalAttempt(baseline);
61
+ const currentAttempt = finalAttempt(current);
62
+ const attempts = {
63
+ ...(baselineAttempt ? { baselineAttempt } : {}),
64
+ ...(currentAttempt ? { currentAttempt } : {}),
65
+ };
66
+ const unavailable = (reason) => ({ availability: 'unavailable', reason, ...attempts });
67
+ if (!baseline || !current)
68
+ return unavailable('case-absent');
69
+ if (!sameSuite)
70
+ return unavailable('suite-changed');
71
+ if (!Array.isArray(baseline.definedSteps) || !Array.isArray(current.definedSteps) ||
72
+ baseline.definedSteps.length === 0 || baseline.definedSteps.length > 100 ||
73
+ baseline.definedSteps.some((step) => !authoredTypes.has(step?.type)) ||
74
+ current.definedSteps.some((step) => !authoredTypes.has(step?.type)))
75
+ return unavailable('definition-unavailable');
76
+ if (baseline.definedSteps.length !== current.definedSteps.length ||
77
+ baseline.definedSteps.some((step, index) => step.type !== current.definedSteps?.[index]?.type))
78
+ return unavailable('definition-changed');
79
+ if (!baselineAttempt || !currentAttempt)
80
+ return unavailable('attempt-unavailable');
81
+ const left = observed(baseline, baseline.definedSteps.length);
82
+ const right = observed(current, baseline.definedSteps.length);
83
+ if (typeof left === 'string')
84
+ return unavailable(left);
85
+ if (typeof right === 'string')
86
+ return unavailable(right);
87
+ const steps = baseline.definedSteps.map((step, index) => ({
88
+ index, type: step.type, baseline: left.steps[index], current: right.steps[index],
89
+ }));
90
+ let lastCommonPassedStepIndex;
91
+ let firstDifferenceStepIndex;
92
+ for (const step of steps) {
93
+ if (firstDifferenceStepIndex === undefined && step.baseline !== step.current)
94
+ firstDifferenceStepIndex = step.index;
95
+ if (lastCommonPassedStepIndex === step.index - 1 || (lastCommonPassedStepIndex === undefined && step.index === 0)) {
96
+ if (step.baseline === 'passed' && step.current === 'passed')
97
+ lastCommonPassedStepIndex = step.index;
98
+ }
99
+ }
100
+ return {
101
+ availability: 'compared', ...attempts,
102
+ baselineSetupSteps: left.setup, currentSetupSteps: right.setup,
103
+ ...(lastCommonPassedStepIndex === undefined ? {} : { lastCommonPassedStepIndex }),
104
+ ...(firstDifferenceStepIndex === undefined ? {} : { firstDifferenceStepIndex }),
105
+ steps,
106
+ };
107
+ }