spana-test 0.1.0 → 0.2.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 (120) hide show
  1. package/.agents/skills/spana-testing/SKILL.md +4 -1
  2. package/README.md +277 -86
  3. package/dist/agent/index.d.ts +34 -5
  4. package/dist/agent/index.js +14 -10
  5. package/dist/{chunk-RK4Z6C7M.js → chunk-3YR4GUGE.js} +3 -2
  6. package/dist/chunk-3YR4GUGE.js.map +1 -0
  7. package/dist/{chunk-WIJYK22K.js → chunk-AEKDFFPJ.js} +2 -2
  8. package/dist/chunk-BF37W5EG.js +125 -0
  9. package/dist/chunk-BF37W5EG.js.map +1 -0
  10. package/dist/chunk-EXLUY7KT.js +21 -0
  11. package/dist/chunk-EXLUY7KT.js.map +1 -0
  12. package/dist/chunk-FNDOEMOL.js +62 -0
  13. package/dist/chunk-FNDOEMOL.js.map +1 -0
  14. package/dist/chunk-HWFDXIXR.js +183 -0
  15. package/dist/chunk-HWFDXIXR.js.map +1 -0
  16. package/dist/chunk-IJIASIX5.js +314 -0
  17. package/dist/chunk-IJIASIX5.js.map +1 -0
  18. package/dist/chunk-KJPHH2TW.js +168 -0
  19. package/dist/chunk-KJPHH2TW.js.map +1 -0
  20. package/dist/{chunk-RJ5VPHVX.js → chunk-L7MFJF46.js} +16 -6
  21. package/dist/chunk-L7MFJF46.js.map +1 -0
  22. package/dist/{chunk-5XO6S7AI.js → chunk-MRH7SK52.js} +4 -4
  23. package/dist/chunk-MRH7SK52.js.map +1 -0
  24. package/dist/{chunk-53MUJUJY.js → chunk-P7JQRLP4.js} +5 -4
  25. package/dist/{chunk-53MUJUJY.js.map → chunk-P7JQRLP4.js.map} +1 -1
  26. package/dist/chunk-S2XNAKSO.js +1087 -0
  27. package/dist/chunk-S2XNAKSO.js.map +1 -0
  28. package/dist/{chunk-VDWWIVM6.js → chunk-S4R4OR7T.js} +108 -53
  29. package/dist/chunk-S4R4OR7T.js.map +1 -0
  30. package/dist/{chunk-V62HFH6E.js → chunk-SFBRFB2N.js} +14 -6
  31. package/dist/chunk-SFBRFB2N.js.map +1 -0
  32. package/dist/{chunk-PWEOJKUF.js → chunk-VNYF5BHX.js} +28 -7
  33. package/dist/chunk-VNYF5BHX.js.map +1 -0
  34. package/dist/chunk-WBU34APM.js +38 -0
  35. package/dist/chunk-WBU34APM.js.map +1 -0
  36. package/dist/{chunk-CKJQX73M.js → chunk-WQ4GXUUE.js} +921 -352
  37. package/dist/chunk-WQ4GXUUE.js.map +1 -0
  38. package/dist/chunk-YBZCOQXJ.js +311 -0
  39. package/dist/chunk-YBZCOQXJ.js.map +1 -0
  40. package/dist/cli.js +316 -40
  41. package/dist/cli.js.map +1 -1
  42. package/dist/{compiler-G75RIIYS.js → compiler-74VGKZO6.js} +2 -2
  43. package/dist/{compiler-G75RIIYS.js.map → compiler-74VGKZO6.js.map} +1 -1
  44. package/dist/config-loader-BJJ3IJJ7.js +9 -0
  45. package/dist/{console-FV4RJPO4.js → console-XWKUTP3D.js} +39 -7
  46. package/dist/console-XWKUTP3D.js.map +1 -0
  47. package/dist/{config-Dg9O0rcQ.d.ts → coordinator-BbUjvvnX.d.ts} +165 -1
  48. package/dist/{discover-RWBKI5IB.js → discover-KZKXHZZA.js} +3 -3
  49. package/dist/doctor-command-T2UX5RV5.js +732 -0
  50. package/dist/doctor-command-T2UX5RV5.js.map +1 -0
  51. package/dist/{element-CGteXiXB.d.ts → element-DZ0HyJ3C.d.ts} +2 -0
  52. package/dist/{flow-D-_tlLpp.d.ts → flow-BUC9Mf8W.d.ts} +38 -9
  53. package/dist/gherkin/steps.d.ts +2 -2
  54. package/dist/{html-JP2HBIJQ.js → html-GE6Q4DCG.js} +23 -3
  55. package/dist/html-GE6Q4DCG.js.map +1 -0
  56. package/dist/index.d.ts +171 -3
  57. package/dist/index.js +6 -3
  58. package/dist/index.js.map +1 -1
  59. package/dist/{init-command-CELKL2CX.js → init-command-GVMRXIMY.js} +37 -21
  60. package/dist/init-command-GVMRXIMY.js.map +1 -0
  61. package/dist/init-flow-command-R76AXF4Z.js +34 -0
  62. package/dist/init-flow-command-R76AXF4Z.js.map +1 -0
  63. package/dist/{installer-R6NX7BYQ.js → installer-YZJ4DV3F.js} +4 -2
  64. package/dist/{ios-ZZU6DHH7.js → ios-ZW6XVNLG.js} +4 -2
  65. package/dist/json-KS67BZYU.js +39 -0
  66. package/dist/json-KS67BZYU.js.map +1 -0
  67. package/dist/{junit-UDY5JG22.js → junit-HLC62MK6.js} +2 -2
  68. package/dist/junit-HLC62MK6.js.map +1 -0
  69. package/dist/provider-A57C3MU6.js +12 -0
  70. package/dist/{redact-IDA3C4UH.js → redact-U72BUBBR.js} +2 -2
  71. package/dist/{redact-IDA3C4UH.js.map → redact-U72BUBBR.js.map} +1 -1
  72. package/dist/{runner-QEF6PJOE.js → runner-UXNHVVGG.js} +2 -2
  73. package/dist/{server-MMK7PZIH.js → server-W7OA3DDN.js} +49 -24
  74. package/dist/server-W7OA3DDN.js.map +1 -0
  75. package/dist/session-TMNOKYLG.js +17 -0
  76. package/dist/{studio-command-CDVPREMG.js → studio-command-6VHTHDUK.js} +2 -2
  77. package/dist/{test-command-SB5KYPQI.js → test-command-AHMOZLV4.js} +1280 -357
  78. package/dist/test-command-AHMOZLV4.js.map +1 -0
  79. package/dist/validator-35624P7S.js +20 -0
  80. package/package.json +1 -1
  81. package/studio-dist/assets/index-DC6DIXfl.js +188 -0
  82. package/studio-dist/assets/index-DDKsnBwD.css +1 -0
  83. package/studio-dist/index.html +2 -2
  84. package/dist/chunk-5XO6S7AI.js.map +0 -1
  85. package/dist/chunk-BZRLA4Z3.js +0 -82
  86. package/dist/chunk-BZRLA4Z3.js.map +0 -1
  87. package/dist/chunk-CKJQX73M.js.map +0 -1
  88. package/dist/chunk-PANFRTIU.js +0 -310
  89. package/dist/chunk-PANFRTIU.js.map +0 -1
  90. package/dist/chunk-PWEOJKUF.js.map +0 -1
  91. package/dist/chunk-RJ5VPHVX.js.map +0 -1
  92. package/dist/chunk-RK4Z6C7M.js.map +0 -1
  93. package/dist/chunk-U564GCO2.js +0 -259
  94. package/dist/chunk-U564GCO2.js.map +0 -1
  95. package/dist/chunk-V62HFH6E.js.map +0 -1
  96. package/dist/chunk-VDWWIVM6.js.map +0 -1
  97. package/dist/config-loader-JJ5RPP53.js +0 -9
  98. package/dist/console-FV4RJPO4.js.map +0 -1
  99. package/dist/html-JP2HBIJQ.js.map +0 -1
  100. package/dist/init-command-CELKL2CX.js.map +0 -1
  101. package/dist/json-JMRPUVY2.js +0 -20
  102. package/dist/json-JMRPUVY2.js.map +0 -1
  103. package/dist/junit-UDY5JG22.js.map +0 -1
  104. package/dist/provider-CUWPULGC.js +0 -10
  105. package/dist/server-MMK7PZIH.js.map +0 -1
  106. package/dist/session-FBJABNXL.js +0 -16
  107. package/dist/test-command-SB5KYPQI.js.map +0 -1
  108. package/dist/validator-CFQ55NUQ.js +0 -13
  109. package/studio-dist/assets/index-CPdpC9i-.css +0 -1
  110. package/studio-dist/assets/index-L1Wd0vop.js +0 -183
  111. /package/dist/{chunk-WIJYK22K.js.map → chunk-AEKDFFPJ.js.map} +0 -0
  112. /package/dist/{config-loader-JJ5RPP53.js.map → config-loader-BJJ3IJJ7.js.map} +0 -0
  113. /package/dist/{discover-RWBKI5IB.js.map → discover-KZKXHZZA.js.map} +0 -0
  114. /package/dist/{installer-R6NX7BYQ.js.map → installer-YZJ4DV3F.js.map} +0 -0
  115. /package/dist/{ios-ZZU6DHH7.js.map → ios-ZW6XVNLG.js.map} +0 -0
  116. /package/dist/{provider-CUWPULGC.js.map → provider-A57C3MU6.js.map} +0 -0
  117. /package/dist/{runner-QEF6PJOE.js.map → runner-UXNHVVGG.js.map} +0 -0
  118. /package/dist/{session-FBJABNXL.js.map → session-TMNOKYLG.js.map} +0 -0
  119. /package/dist/{studio-command-CDVPREMG.js.map → studio-command-6VHTHDUK.js.map} +0 -0
  120. /package/dist/{validator-CFQ55NUQ.js.map → validator-35624P7S.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/gherkin/compiler.ts","../src/gherkin/matcher.ts"],"sourcesContent":["import { Parser, AstBuilder, GherkinClassicTokenMatcher } from \"@cucumber/gherkin\";\nimport { IdGenerator } from \"@cucumber/messages\";\nimport type { FlowDefinition, FlowConfig } from \"../api/flow.js\";\nimport type { Platform } from \"../schemas/selector.js\";\nimport type { ScenarioStepResult, ScenarioStepKeyword } from \"../report/types.js\";\nimport { createStepMatcher, type MatchResult } from \"./matcher.js\";\nimport { globalRegistry, type StepContext } from \"./registry.js\";\nimport { getWorldFactory } from \"./world.js\";\n\nconst PLATFORM_TAGS: Record<string, Platform> = {\n \"@web\": \"web\",\n \"@android\": \"android\",\n \"@ios\": \"ios\",\n};\n\ninterface GherkinStep {\n keyword: string;\n text: string;\n dataTable?: { rows: readonly { cells: readonly { value: string }[] }[] };\n docString?: { content: string; mediaType?: string };\n}\n\ninterface GherkinScenario {\n name: string;\n tags: readonly { name: string }[];\n steps: readonly GherkinStep[];\n examples: readonly {\n tags: readonly { name: string }[];\n tableHeader?: { cells: readonly { value: string }[] };\n tableBody?: readonly { cells: readonly { value: string }[] }[];\n }[];\n}\n\nexport function compileFeature(source: string, filePath?: string): FlowDefinition[] {\n const parser = new Parser(new AstBuilder(IdGenerator.uuid()), new GherkinClassicTokenMatcher());\n\n const document = parser.parse(source);\n const feature = document.feature;\n if (!feature) return [];\n\n const featureTags = feature.tags.map((t: { name: string }) => t.name);\n const flows: FlowDefinition[] = [];\n\n // Find background steps if any\n let backgroundSteps: readonly GherkinStep[] = [];\n for (const child of feature.children) {\n if (child.background) {\n backgroundSteps = child.background.steps as readonly GherkinStep[];\n }\n }\n\n for (const child of feature.children) {\n if (!child.scenario) continue;\n const scenario = child.scenario as unknown as GherkinScenario;\n\n if (scenario.examples.length > 0) {\n // Scenario Outline — expand each example row\n for (const example of scenario.examples) {\n if (!example.tableHeader || !example.tableBody) continue;\n const headers = example.tableHeader.cells.map((c) => c.value);\n const exampleTags = example.tags.map((t) => t.name);\n\n for (const row of example.tableBody) {\n const values = row.cells.map((c) => c.value);\n const replacements: Record<string, string> = {};\n for (let i = 0; i < headers.length; i++) {\n replacements[headers[i]!] = values[i] ?? \"\";\n }\n\n const expandedName = replaceOutlinePlaceholders(scenario.name, replacements);\n const expandedSteps = scenario.steps.map((s) => ({\n ...s,\n text: replaceOutlinePlaceholders(s.text, replacements),\n }));\n\n const allTags = [...featureTags, ...scenario.tags.map((t) => t.name), ...exampleTags];\n flows.push(\n buildFlowDefinition(\n `${feature.name} — ${expandedName}`,\n allTags,\n backgroundSteps,\n expandedSteps,\n filePath,\n ),\n );\n }\n }\n } else {\n // Regular Scenario\n const allTags = [...featureTags, ...scenario.tags.map((t) => t.name)];\n flows.push(\n buildFlowDefinition(\n `${feature.name} — ${scenario.name}`,\n allTags,\n backgroundSteps,\n scenario.steps,\n filePath,\n ),\n );\n }\n }\n\n return flows;\n}\n\nfunction buildFlowDefinition(\n name: string,\n tags: string[],\n backgroundSteps: readonly GherkinStep[],\n scenarioSteps: readonly GherkinStep[],\n filePath?: string,\n): FlowDefinition {\n const { platforms, filteredTags } = extractPlatformTags(tags);\n\n const config: FlowConfig = {\n tags: filteredTags.length > 0 ? filteredTags : undefined,\n platforms: platforms.length > 0 ? platforms : undefined,\n autoLaunch: false, // Gherkin flows use Background/Given steps to navigate\n };\n\n const allSteps = [...backgroundSteps, ...scenarioSteps];\n\n return {\n name,\n config,\n fn: async (flowCtx) => {\n const matcher = createStepMatcher(globalRegistry.getSteps());\n const state = new Map<string, unknown>();\n const worldFactory = getWorldFactory();\n const world = worldFactory?.instantiate(flowCtx, state);\n\n const scenarioStepResults: ScenarioStepResult[] = [];\n const beforeHooks = globalRegistry.getHooks(\"Before\");\n const afterHooks = globalRegistry.getHooks(\"After\");\n\n const stepCtx: StepContext = {\n ...flowCtx,\n state,\n ...world,\n };\n\n // Run Before hooks\n for (const hook of beforeHooks) {\n if (hook.tagExpression && !tagsMatch(tags, hook.tagExpression)) continue;\n const hookStart = Date.now();\n try {\n await hook.fn(stepCtx);\n scenarioStepResults.push({\n keyword: \"Before\",\n text: hook.tagExpression ?? \"hook\",\n status: \"passed\",\n durationMs: Date.now() - hookStart,\n });\n } catch (error) {\n scenarioStepResults.push({\n keyword: \"Before\",\n text: hook.tagExpression ?? \"hook\",\n status: \"failed\",\n durationMs: Date.now() - hookStart,\n error: error instanceof Error ? error.message : String(error),\n });\n // Still run After hooks, then rethrow\n await runAfterHooks(afterHooks, stepCtx, tags, scenarioStepResults);\n attachScenarioSteps(flowCtx, scenarioStepResults);\n throw error;\n }\n }\n\n // Run steps — fail fast, skip remaining\n let failed = false;\n let failError: unknown;\n\n for (const step of allSteps) {\n const keyword = normalizeKeyword(step.keyword);\n const stepStart = Date.now();\n\n if (failed) {\n scenarioStepResults.push({\n keyword,\n text: step.text,\n status: \"skipped\",\n durationMs: 0,\n });\n continue;\n }\n\n const match = matcher.match(step.text);\n if (!match) {\n const error = `Undefined step: \"${step.keyword.trim()} ${step.text}\"${filePath ? ` in ${filePath}` : \"\"}`;\n scenarioStepResults.push({\n keyword,\n text: step.text,\n status: \"failed\",\n durationMs: Date.now() - stepStart,\n error,\n });\n failed = true;\n failError = new Error(error);\n continue;\n }\n\n try {\n const args = buildStepArgs(match, step);\n await match.handler.fn(stepCtx, ...args);\n scenarioStepResults.push({\n keyword,\n text: step.text,\n status: \"passed\",\n durationMs: Date.now() - stepStart,\n });\n } catch (error) {\n scenarioStepResults.push({\n keyword,\n text: step.text,\n status: \"failed\",\n durationMs: Date.now() - stepStart,\n error: error instanceof Error ? error.message : String(error),\n });\n failed = true;\n failError = error;\n }\n }\n\n // Always run After hooks\n await runAfterHooks(afterHooks, stepCtx, tags, scenarioStepResults);\n attachScenarioSteps(flowCtx, scenarioStepResults);\n\n if (failError) throw failError;\n },\n };\n}\n\nasync function runAfterHooks(\n hooks: readonly { tagExpression?: string; fn: (ctx: StepContext) => Promise<void> }[],\n stepCtx: StepContext,\n tags: string[],\n results: ScenarioStepResult[],\n): Promise<void> {\n for (const hook of hooks) {\n if (hook.tagExpression && !tagsMatch(tags, hook.tagExpression)) continue;\n const hookStart = Date.now();\n try {\n await hook.fn(stepCtx);\n results.push({\n keyword: \"After\",\n text: hook.tagExpression ?? \"hook\",\n status: \"passed\",\n durationMs: Date.now() - hookStart,\n });\n } catch (error) {\n results.push({\n keyword: \"After\",\n text: hook.tagExpression ?? \"hook\",\n status: \"failed\",\n durationMs: Date.now() - hookStart,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n}\n\nfunction attachScenarioSteps(flowCtx: any, scenarioSteps: ScenarioStepResult[]): void {\n // The engine collects steps from the step recorder on flowCtx.\n // We attach scenarioSteps to a well-known property so the engine can pick them up.\n flowCtx.__scenarioSteps = scenarioSteps;\n}\n\nfunction extractPlatformTags(tags: string[]): { platforms: Platform[]; filteredTags: string[] } {\n const platforms: Platform[] = [];\n const filteredTags: string[] = [];\n\n for (const tag of tags) {\n const platform = PLATFORM_TAGS[tag.toLowerCase()];\n if (platform) {\n platforms.push(platform);\n } else {\n filteredTags.push(tag);\n }\n }\n\n return { platforms, filteredTags };\n}\n\nfunction normalizeKeyword(keyword: string): ScenarioStepKeyword {\n const trimmed = keyword.trim();\n switch (trimmed) {\n case \"Given\":\n return \"Given\";\n case \"When\":\n return \"When\";\n case \"Then\":\n return \"Then\";\n case \"And\":\n return \"And\";\n case \"But\":\n return \"But\";\n case \"*\":\n return \"And\";\n default:\n return \"Given\";\n }\n}\n\nfunction replaceOutlinePlaceholders(text: string, replacements: Record<string, string>): string {\n return text.replace(/<([^>]+)>/g, (_, key) => replacements[key] ?? `<${key}>`);\n}\n\nfunction buildStepArgs(match: MatchResult, step: GherkinStep): unknown[] {\n const args = [...match.args];\n\n if (step.dataTable) {\n const rows = step.dataTable.rows.map((r) => r.cells.map((c) => c.value));\n args.push(rows);\n }\n\n if (step.docString) {\n args.push(step.docString.content);\n }\n\n return args;\n}\n\n/** Simple tag expression matching — supports single tags and \"and\"/\"not\" */\nfunction tagsMatch(scenarioTags: string[], expression: string): boolean {\n const parts = expression.split(/\\s+/);\n let result = true;\n let negate = false;\n\n for (const part of parts) {\n if (part === \"and\") continue;\n if (part === \"not\") {\n negate = true;\n continue;\n }\n if (part === \"or\") {\n // Simple OR: if we already matched, we're done\n if (result) return true;\n result = true;\n continue;\n }\n\n const hasTag = scenarioTags.includes(part);\n const matches = negate ? !hasTag : hasTag;\n result = result && matches;\n negate = false;\n }\n\n return result;\n}\n","import {\n CucumberExpression,\n RegularExpression,\n ParameterTypeRegistry,\n} from \"@cucumber/cucumber-expressions\";\nimport type { StepHandler } from \"./registry.js\";\n\nexport interface MatchResult {\n handler: StepHandler;\n args: unknown[];\n}\n\nexport function createStepMatcher(steps: readonly StepHandler[]) {\n const parameterTypeRegistry = new ParameterTypeRegistry();\n\n const compiled = steps.map((handler) => {\n const expression =\n handler.pattern instanceof RegExp\n ? new RegularExpression(handler.pattern, parameterTypeRegistry)\n : new CucumberExpression(handler.pattern, parameterTypeRegistry);\n return { handler, expression };\n });\n\n return {\n match(text: string): MatchResult | undefined {\n const matches: { handler: StepHandler; args: unknown[] }[] = [];\n\n for (const { handler, expression } of compiled) {\n const result = expression.match(text);\n if (result) {\n matches.push({\n handler,\n args: result.map((arg) => arg.getValue(null)),\n });\n }\n }\n\n if (matches.length === 0) return undefined;\n\n if (matches.length > 1) {\n const patterns = matches.map((m) => ` \"${m.handler.pattern}\"`).join(\"\\n\");\n throw new Error(`Ambiguous step definition for \"${text}\". Matches:\\n${patterns}`);\n }\n\n return matches[0];\n },\n };\n}\n"],"mappings":";;;;;;;AAAA,SAAS,QAAQ,YAAY,kCAAkC;AAC/D,SAAS,mBAAmB;;;ACD5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQA,SAAS,kBAAkB,OAA+B;AAC/D,QAAM,wBAAwB,IAAI,sBAAsB;AAExD,QAAM,WAAW,MAAM,IAAI,CAAC,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Q,KAAK;AAC7B,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,2BAA2B,MAAc,cAA8C;AAC9F,SAAO,KAAK,QAAQ,cAAc,CAAC,GAAG,QAAQ,aAAa,GAAG,KAAK,IAAI,GAAG,GAAG;AAC/E;AAEA,SAAS,cAAc,OAAoB,MAA8B;AACvE,QAAM,OAAO,CAAC,GAAG,MAAM,IAAI;AAE3B,MAAI,KAAK,WAAW;AAClB,UAAM,OAAO,KAAK,UAAU,KAAK,IAAI,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC;AACvE,SAAK,KAAK,IAAI;AAAA,EAChB;AAEA,MAAI,KAAK,WAAW;AAClB,SAAK,KAAK,KAAK,UAAU,OAAO;AAAA,EAClC;AAEA,SAAO;AACT;AAGA,SAAS,UAAU,cAAwB,YAA6B;AACtE,QAAM,QAAQ,WAAW,MAAM,KAAK;AACpC,MAAI,SAAS;AACb,MAAI,SAAS;AAEb,aAAW,QAAQ,OAAO;AACxB,QAAI,SAAS,MAAO;AACpB,QAAI,SAAS,OAAO;AAClB,eAAS;AACT;AAAA,IACF;AACA,QAAI,SAAS,MAAM;AAEjB,UAAI,OAAQ,QAAO;AACnB,eAAS;AACT;AAAA,IACF;AAEA,UAAM,SAAS,aAAa,SAAS,IAAI;AACzC,UAAM,UAAU,SAAS,CAAC,SAAS;AACnC,aAAS,UAAU;AACnB,aAAS;AAAA,EACX;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/gherkin/compiler.ts","../src/gherkin/matcher.ts"],"sourcesContent":["import { Parser, AstBuilder, GherkinClassicTokenMatcher } from \"@cucumber/gherkin\";\nimport { IdGenerator } from \"@cucumber/messages\";\nimport type { FlowDefinition, FlowConfig } from \"../api/flow.js\";\nimport type { Platform } from \"../schemas/selector.js\";\nimport type { ScenarioStepResult, ScenarioStepKeyword } from \"../report/types.js\";\nimport { createStepMatcher, type MatchResult } from \"./matcher.js\";\nimport { globalRegistry, type StepContext } from \"./registry.js\";\nimport { getWorldFactory } from \"./world.js\";\n\nconst PLATFORM_TAGS: Record<string, Platform> = {\n \"@web\": \"web\",\n \"@android\": \"android\",\n \"@ios\": \"ios\",\n};\n\ninterface GherkinStep {\n keyword: string;\n text: string;\n dataTable?: { rows: readonly { cells: readonly { value: string }[] }[] };\n docString?: { content: string; mediaType?: string };\n}\n\ninterface GherkinScenario {\n name: string;\n tags: readonly { name: string }[];\n steps: readonly GherkinStep[];\n examples: readonly {\n tags: readonly { name: string }[];\n tableHeader?: { cells: readonly { value: string }[] };\n tableBody?: readonly { cells: readonly { value: string }[] }[];\n }[];\n}\n\nexport function compileFeature(source: string, filePath?: string): FlowDefinition[] {\n const parser = new Parser(new AstBuilder(IdGenerator.uuid()), new GherkinClassicTokenMatcher());\n\n const document = parser.parse(source);\n const feature = document.feature;\n if (!feature) return [];\n\n const featureTags = feature.tags.map((t: { name: string }) => t.name);\n const flows: FlowDefinition[] = [];\n\n // Find background steps if any\n let backgroundSteps: readonly GherkinStep[] = [];\n for (const child of feature.children) {\n if (child.background) {\n backgroundSteps = child.background.steps as readonly GherkinStep[];\n }\n }\n\n for (const child of feature.children) {\n if (!child.scenario) continue;\n const scenario = child.scenario as unknown as GherkinScenario;\n\n if (scenario.examples.length > 0) {\n // Scenario Outline — expand each example row\n for (const example of scenario.examples) {\n if (!example.tableHeader || !example.tableBody) continue;\n const headers = example.tableHeader.cells.map((c) => c.value);\n const exampleTags = example.tags.map((t) => t.name);\n\n for (const row of example.tableBody) {\n const values = row.cells.map((c) => c.value);\n const replacements: Record<string, string> = {};\n for (let i = 0; i < headers.length; i++) {\n replacements[headers[i]!] = values[i] ?? \"\";\n }\n\n const expandedName = replaceOutlinePlaceholders(scenario.name, replacements);\n const expandedSteps = scenario.steps.map((s) => ({\n ...s,\n text: replaceOutlinePlaceholders(s.text, replacements),\n }));\n\n const allTags = [...featureTags, ...scenario.tags.map((t) => t.name), ...exampleTags];\n flows.push(\n buildFlowDefinition(\n `${feature.name} — ${expandedName}`,\n allTags,\n backgroundSteps,\n expandedSteps,\n filePath,\n ),\n );\n }\n }\n } else {\n // Regular Scenario\n const allTags = [...featureTags, ...scenario.tags.map((t) => t.name)];\n flows.push(\n buildFlowDefinition(\n `${feature.name} — ${scenario.name}`,\n allTags,\n backgroundSteps,\n scenario.steps,\n filePath,\n ),\n );\n }\n }\n\n return flows;\n}\n\nfunction buildFlowDefinition(\n name: string,\n tags: string[],\n backgroundSteps: readonly GherkinStep[],\n scenarioSteps: readonly GherkinStep[],\n filePath?: string,\n): FlowDefinition {\n const { platforms, filteredTags } = extractPlatformTags(tags);\n\n const config: FlowConfig = {\n tags: filteredTags.length > 0 ? filteredTags : undefined,\n platforms: platforms.length > 0 ? platforms : undefined,\n autoLaunch: false, // Gherkin flows use Background/Given steps to navigate\n };\n\n const allSteps = [...backgroundSteps, ...scenarioSteps];\n\n return {\n name,\n config,\n fn: async (flowCtx) => {\n const matcher = createStepMatcher(globalRegistry.getSteps());\n const state = new Map<string, unknown>();\n const worldFactory = getWorldFactory();\n const world = worldFactory?.instantiate(flowCtx, state);\n\n const scenarioStepResults: ScenarioStepResult[] = [];\n const beforeHooks = globalRegistry.getHooks(\"Before\");\n const afterHooks = globalRegistry.getHooks(\"After\");\n\n const stepCtx: StepContext = {\n ...flowCtx,\n state,\n ...world,\n };\n\n // Run Before hooks\n for (const hook of beforeHooks) {\n if (hook.tagExpression && !tagsMatch(tags, hook.tagExpression)) continue;\n const hookStart = Date.now();\n try {\n await hook.fn(stepCtx);\n scenarioStepResults.push({\n keyword: \"Before\",\n text: hook.tagExpression ?? \"hook\",\n status: \"passed\",\n durationMs: Date.now() - hookStart,\n });\n } catch (error) {\n scenarioStepResults.push({\n keyword: \"Before\",\n text: hook.tagExpression ?? \"hook\",\n status: \"failed\",\n durationMs: Date.now() - hookStart,\n error: error instanceof Error ? error.message : String(error),\n });\n // Still run After hooks, then rethrow\n await runAfterHooks(afterHooks, stepCtx, tags, scenarioStepResults);\n attachScenarioSteps(flowCtx, scenarioStepResults);\n throw error;\n }\n }\n\n // Run steps — fail fast, skip remaining\n let failed = false;\n let failError: unknown;\n\n for (const step of allSteps) {\n const keyword = normalizeKeyword(step.keyword);\n const stepStart = Date.now();\n\n if (failed) {\n scenarioStepResults.push({\n keyword,\n text: step.text,\n status: \"skipped\",\n durationMs: 0,\n });\n continue;\n }\n\n const match = matcher.match(step.text);\n if (!match) {\n const error = `Undefined step: \"${step.keyword.trim()} ${step.text}\"${filePath ? ` in ${filePath}` : \"\"}`;\n scenarioStepResults.push({\n keyword,\n text: step.text,\n status: \"failed\",\n durationMs: Date.now() - stepStart,\n error,\n });\n failed = true;\n failError = new Error(error);\n continue;\n }\n\n try {\n const args = buildStepArgs(match, step);\n await match.handler.fn(stepCtx, ...args);\n scenarioStepResults.push({\n keyword,\n text: step.text,\n status: \"passed\",\n durationMs: Date.now() - stepStart,\n });\n } catch (error) {\n scenarioStepResults.push({\n keyword,\n text: step.text,\n status: \"failed\",\n durationMs: Date.now() - stepStart,\n error: error instanceof Error ? error.message : String(error),\n });\n failed = true;\n failError = error;\n }\n }\n\n // Always run After hooks\n await runAfterHooks(afterHooks, stepCtx, tags, scenarioStepResults);\n attachScenarioSteps(flowCtx, scenarioStepResults);\n\n if (failError) throw failError;\n },\n };\n}\n\nasync function runAfterHooks(\n hooks: readonly { tagExpression?: string; fn: (ctx: StepContext) => Promise<void> }[],\n stepCtx: StepContext,\n tags: string[],\n results: ScenarioStepResult[],\n): Promise<void> {\n for (const hook of hooks) {\n if (hook.tagExpression && !tagsMatch(tags, hook.tagExpression)) continue;\n const hookStart = Date.now();\n try {\n await hook.fn(stepCtx);\n results.push({\n keyword: \"After\",\n text: hook.tagExpression ?? \"hook\",\n status: \"passed\",\n durationMs: Date.now() - hookStart,\n });\n } catch (error) {\n results.push({\n keyword: \"After\",\n text: hook.tagExpression ?? \"hook\",\n status: \"failed\",\n durationMs: Date.now() - hookStart,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n}\n\nfunction attachScenarioSteps(flowCtx: any, scenarioSteps: ScenarioStepResult[]): void {\n // The engine collects steps from the step recorder on flowCtx.\n // We attach scenarioSteps to a well-known property so the engine can pick them up.\n flowCtx.__scenarioSteps = scenarioSteps;\n}\n\nfunction extractPlatformTags(tags: string[]): { platforms: Platform[]; filteredTags: string[] } {\n const platforms: Platform[] = [];\n const filteredTags: string[] = [];\n\n for (const tag of tags) {\n const platform = PLATFORM_TAGS[tag.toLowerCase()];\n if (platform) {\n platforms.push(platform);\n } else {\n filteredTags.push(tag);\n }\n }\n\n return { platforms, filteredTags };\n}\n\nfunction normalizeKeyword(keyword: string): ScenarioStepKeyword {\n const trimmed = keyword.trim();\n switch (trimmed) {\n case \"Given\":\n return \"Given\";\n case \"When\":\n return \"When\";\n case \"Then\":\n return \"Then\";\n case \"And\":\n return \"And\";\n case \"But\":\n return \"But\";\n case \"*\":\n return \"And\";\n default:\n return \"Given\";\n }\n}\n\nfunction replaceOutlinePlaceholders(text: string, replacements: Record<string, string>): string {\n return text.replaceAll(/<([^>]+)>/g, (_, key) => replacements[key] ?? `<${key}>`);\n}\n\nfunction buildStepArgs(match: MatchResult, step: GherkinStep): unknown[] {\n const args = [...match.args];\n\n if (step.dataTable) {\n const rows = step.dataTable.rows.map((r) => r.cells.map((c) => c.value));\n args.push(rows);\n }\n\n if (step.docString) {\n args.push(step.docString.content);\n }\n\n return args;\n}\n\n/** Simple tag expression matching — supports single tags and \"and\"/\"not\" */\nfunction tagsMatch(scenarioTags: string[], expression: string): boolean {\n const parts = expression.split(/\\s+/);\n let result = true;\n let negate = false;\n\n for (const part of parts) {\n if (part === \"and\") continue;\n if (part === \"not\") {\n negate = true;\n continue;\n }\n if (part === \"or\") {\n // Simple OR: if we already matched, we're done\n if (result) return true;\n result = true;\n continue;\n }\n\n const hasTag = scenarioTags.includes(part);\n const matches = negate ? !hasTag : hasTag;\n result = result && matches;\n negate = false;\n }\n\n return result;\n}\n","import {\n CucumberExpression,\n RegularExpression,\n ParameterTypeRegistry,\n} from \"@cucumber/cucumber-expressions\";\nimport type { StepHandler } from \"./registry.js\";\n\nexport interface MatchResult {\n handler: StepHandler;\n args: unknown[];\n}\n\nexport function createStepMatcher(steps: readonly StepHandler[]) {\n const parameterTypeRegistry = new ParameterTypeRegistry();\n\n const compiled = steps.map((handler) => {\n const expression =\n handler.pattern instanceof RegExp\n ? new RegularExpression(handler.pattern, parameterTypeRegistry)\n : new CucumberExpression(handler.pattern, parameterTypeRegistry);\n return { handler, expression };\n });\n\n return {\n match(text: string): MatchResult | undefined {\n const matches: { handler: StepHandler; args: unknown[] }[] = [];\n\n for (const { handler, expression } of compiled) {\n const result = expression.match(text);\n if (result) {\n matches.push({\n handler,\n args: result.map((arg) => arg.getValue(null)),\n });\n }\n }\n\n if (matches.length === 0) return undefined;\n\n if (matches.length > 1) {\n const patterns = matches.map((m) => ` \"${m.handler.pattern}\"`).join(\"\\n\");\n throw new Error(`Ambiguous step definition for \"${text}\". Matches:\\n${patterns}`);\n }\n\n return matches[0];\n },\n };\n}\n"],"mappings":";;;;;;;AAAA,SAAS,QAAQ,YAAY,kCAAkC;AAC/D,SAAS,mBAAmB;;;ACD5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQA,SAAS,kBAAkB,OAA+B;AAC/D,QAAM,wBAAwB,IAAI,sBAAsB;AAExD,QAAM,WAAW,MAAM,IAAI,CAAC,YAAY;AACtC,UAAM,aACJ,QAAQ,mBAAmB,SACvB,IAAI,kBAAkB,QAAQ,SAAS,qBAAqB,IAC5D,IAAI,mBAAmB,QAAQ,SAAS,qBAAqB;AACnE,WAAO,EAAE,SAAS,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T,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,2BAA2B,MAAc,cAA8C;AAC9F,SAAO,KAAK,WAAW,cAAc,CAAC,GAAG,QAAQ,aAAa,GAAG,KAAK,IAAI,GAAG,GAAG;AAClF;AAEA,SAAS,cAAc,OAAoB,MAA8B;AACvE,QAAM,OAAO,CAAC,GAAG,MAAM,IAAI;AAE3B,MAAI,KAAK,WAAW;AAClB,UAAM,OAAO,KAAK,UAAU,KAAK,IAAI,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC;AACvE,SAAK,KAAK,IAAI;AAAA,EAChB;AAEA,MAAI,KAAK,WAAW;AAClB,SAAK,KAAK,KAAK,UAAU,OAAO;AAAA,EAClC;AAEA,SAAO;AACT;AAGA,SAAS,UAAU,cAAwB,YAA6B;AACtE,QAAM,QAAQ,WAAW,MAAM,KAAK;AACpC,MAAI,SAAS;AACb,MAAI,SAAS;AAEb,aAAW,QAAQ,OAAO;AACxB,QAAI,SAAS,MAAO;AACpB,QAAI,SAAS,OAAO;AAClB,eAAS;AACT;AAAA,IACF;AACA,QAAI,SAAS,MAAM;AAEjB,UAAI,OAAQ,QAAO;AACnB,eAAS;AACT;AAAA,IACF;AAEA,UAAM,SAAS,aAAa,SAAS,IAAI;AACzC,UAAM,UAAU,SAAS,CAAC,SAAS;AACnC,aAAS,UAAU;AACnB,aAAS;AAAA,EACX;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,9 @@
1
+ import {
2
+ loadConfig
3
+ } from "./chunk-P7JQRLP4.js";
4
+ import "./chunk-L7MFJF46.js";
5
+ import "./chunk-DGUM43GV.js";
6
+ export {
7
+ loadConfig
8
+ };
9
+ //# sourceMappingURL=config-loader-BJJ3IJJ7.js.map
@@ -21,6 +21,9 @@ function printScenarioSteps(steps) {
21
21
  }
22
22
  }
23
23
  }
24
+ function workerPrefix(workerName) {
25
+ return workerName ? `[${workerName}] ` : "";
26
+ }
24
27
  var driverNames = {
25
28
  web: "Playwright",
26
29
  android: "UiAutomator2",
@@ -31,11 +34,21 @@ function createConsoleReporter(options) {
31
34
  let completed = 0;
32
35
  let total = 0;
33
36
  let currentPlatform;
34
- function progressPrefix() {
37
+ const platformDone = /* @__PURE__ */ new Map();
38
+ let platformTotals;
39
+ function progressPrefix(platform) {
40
+ if (platformTotals && platform) {
41
+ const done = platformDone.get(platform) ?? 0;
42
+ const ptotal = platformTotals[platform] ?? 0;
43
+ if (ptotal > 0) {
44
+ const pct = Math.round(done / ptotal * 100);
45
+ return `${platform} [${done}/${ptotal} ${pct}%]`;
46
+ }
47
+ }
35
48
  return total > 0 ? `[${completed}/${total}]` : "";
36
49
  }
37
50
  return {
38
- onFlowStart(name, platform) {
51
+ onFlowStart(name, platform, workerName) {
39
52
  if (quiet) return;
40
53
  if (platform !== currentPlatform) {
41
54
  currentPlatform = platform;
@@ -43,28 +56,36 @@ function createConsoleReporter(options) {
43
56
  ${platform} (${driverNames[platform]})`);
44
57
  }
45
58
  if (process.stderr.isTTY) {
46
- process.stderr.write(` \u25B8 ${progressPrefix()} ${name}...\r`);
59
+ process.stderr.write(
60
+ ` \u25B8 ${workerPrefix(workerName)}${progressPrefix(platform)} ${name}...\r`
61
+ );
47
62
  }
48
63
  },
49
64
  onFlowPass(result) {
50
65
  completed++;
66
+ platformDone.set(result.platform, (platformDone.get(result.platform) ?? 0) + 1);
51
67
  if (quiet) return;
52
68
  if (process.stderr.isTTY) {
53
69
  process.stderr.write("\x1B[2K");
54
70
  }
55
71
  const duration = `(${result.durationMs}ms)`;
56
72
  const flakyTag = result.flaky ? ` [flaky, passed on attempt ${result.attempts}]` : "";
57
- console.log(` \u2713 ${progressPrefix()} ${result.name} ${duration}${flakyTag}`);
73
+ console.log(
74
+ ` \u2713 ${workerPrefix(result.workerName)}${progressPrefix(result.platform)} ${result.name} ${duration}${flakyTag}`
75
+ );
58
76
  if (result.scenarioSteps) printScenarioSteps(result.scenarioSteps);
59
77
  printResultAttachments(result);
60
78
  },
61
79
  onFlowFail(result) {
62
80
  completed++;
81
+ platformDone.set(result.platform, (platformDone.get(result.platform) ?? 0) + 1);
63
82
  if (process.stderr.isTTY) {
64
83
  process.stderr.write("\x1B[2K");
65
84
  }
66
85
  const duration = `(${result.durationMs}ms)`;
67
- console.log(` \u2717 ${progressPrefix()} [${result.platform}] ${result.name} ${duration}`);
86
+ console.log(
87
+ ` \u2717 ${workerPrefix(result.workerName)}${progressPrefix(result.platform)} [${result.platform}] ${result.name} ${duration}`
88
+ );
68
89
  if (result.scenarioSteps) printScenarioSteps(result.scenarioSteps);
69
90
  printResultAttachments(result);
70
91
  },
@@ -90,8 +111,10 @@ function createConsoleReporter(options) {
90
111
  if (failures.length > 0) {
91
112
  console.log("\n--- Failures ---");
92
113
  for (const f of failures) {
93
- console.log(`\u2717 [${f.platform}] ${f.name}`);
114
+ const deviceLabel = f.workerName ? `${f.platform} on ${f.workerName}` : f.platform;
115
+ console.log(`\u2717 [${deviceLabel}] ${f.name}`);
94
116
  if (f.error) {
117
+ console.log(` Category: ${f.error.category}`);
95
118
  console.log(` ${f.error.message}`);
96
119
  if (f.error.suggestion) {
97
120
  for (const line of f.error.suggestion.split("\n")) {
@@ -108,6 +131,12 @@ function createConsoleReporter(options) {
108
131
  console.log(`~ [${f.platform}] ${f.name} (passed on attempt ${f.attempts})`);
109
132
  }
110
133
  }
134
+ if (summary.workerStats && summary.workerStats.size > 0) {
135
+ console.log("\nWorker Stats:");
136
+ for (const [id, stats] of summary.workerStats) {
137
+ console.log(` [${id}] ${stats.flowCount} flows ${(stats.totalMs / 1e3).toFixed(1)}s`);
138
+ }
139
+ }
111
140
  if (summary.bailedOut) {
112
141
  console.log(
113
142
  `
@@ -123,10 +152,13 @@ ${summary.passed}/${summary.total} passed, ${summary.failed} failed${flakyStr} (
123
152
  // Allow callers to set total for progress tracking
124
153
  set flowCount(n) {
125
154
  total = n;
155
+ },
156
+ set platformFlowCounts(counts) {
157
+ platformTotals = counts;
126
158
  }
127
159
  };
128
160
  }
129
161
  export {
130
162
  createConsoleReporter
131
163
  };
132
- //# sourceMappingURL=console-FV4RJPO4.js.map
164
+ //# sourceMappingURL=console-XWKUTP3D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/report/console.ts"],"sourcesContent":["import type { Platform } from \"../schemas/selector.js\";\nimport type { FlowResult, Reporter, ScenarioStepResult } from \"./types.js\";\n\nexport interface ConsoleReporterOptions {\n /** Only show failures and the final summary. */\n quiet?: boolean;\n}\n\nfunction printResultAttachments(result: FlowResult): void {\n for (const attachment of result.attachments ?? []) {\n console.log(` ↳ ${attachment.name}: ${attachment.path}`);\n }\n\n for (const [index, step] of (result.steps ?? []).entries()) {\n for (const attachment of step.attachments ?? []) {\n console.log(` ↳ step ${index + 1} ${step.command}: ${attachment.path}`);\n }\n }\n}\n\nfunction printScenarioSteps(steps: ScenarioStepResult[]): void {\n for (const step of steps) {\n const icon = step.status === \"passed\" ? \"✓\" : step.status === \"failed\" ? \"✗\" : \"○\";\n const duration = step.durationMs > 0 ? ` (${step.durationMs}ms)` : \"\";\n console.log(` ${icon} ${step.keyword} ${step.text}${duration}`);\n if (step.error) {\n console.log(` ${step.error}`);\n }\n }\n}\n\nfunction workerPrefix(workerName?: string): string {\n return workerName ? `[${workerName}] ` : \"\";\n}\n\nconst driverNames: Record<Platform, string> = {\n web: \"Playwright\",\n android: \"UiAutomator2\",\n ios: \"WebDriverAgent\",\n};\n\nexport function createConsoleReporter(options?: ConsoleReporterOptions): Reporter {\n const quiet = options?.quiet ?? false;\n let completed = 0;\n let total = 0;\n let currentPlatform: Platform | undefined;\n const platformDone = new Map<Platform, number>();\n let platformTotals: Partial<Record<Platform, number>> | undefined;\n\n function progressPrefix(platform?: Platform): string {\n if (platformTotals && platform) {\n const done = platformDone.get(platform) ?? 0;\n const ptotal = platformTotals[platform] ?? 0;\n if (ptotal > 0) {\n const pct = Math.round((done / ptotal) * 100);\n return `${platform} [${done}/${ptotal} ${pct}%]`;\n }\n }\n return total > 0 ? `[${completed}/${total}]` : \"\";\n }\n\n return {\n onFlowStart(name, platform, workerName) {\n if (quiet) return;\n\n // Print platform header when switching to a new platform\n if (platform !== currentPlatform) {\n currentPlatform = platform;\n console.log(`\\n ${platform} (${driverNames[platform]})`);\n }\n\n if (process.stderr.isTTY) {\n process.stderr.write(\n ` ▸ ${workerPrefix(workerName)}${progressPrefix(platform)} ${name}...\\r`,\n );\n }\n },\n\n onFlowPass(result) {\n completed++;\n platformDone.set(result.platform, (platformDone.get(result.platform) ?? 0) + 1);\n if (quiet) return;\n\n // Clear progress line\n if (process.stderr.isTTY) {\n process.stderr.write(\"\\x1b[2K\");\n }\n\n const duration = `(${result.durationMs}ms)`;\n const flakyTag = result.flaky ? ` [flaky, passed on attempt ${result.attempts}]` : \"\";\n console.log(\n ` ✓ ${workerPrefix(result.workerName)}${progressPrefix(result.platform)} ${result.name} ${duration}${flakyTag}`,\n );\n if (result.scenarioSteps) printScenarioSteps(result.scenarioSteps);\n printResultAttachments(result);\n },\n\n onFlowFail(result) {\n completed++;\n platformDone.set(result.platform, (platformDone.get(result.platform) ?? 0) + 1);\n\n // Clear progress line\n if (process.stderr.isTTY) {\n process.stderr.write(\"\\x1b[2K\");\n }\n\n // Always show failures, even in quiet mode\n const duration = `(${result.durationMs}ms)`;\n console.log(\n ` ✗ ${workerPrefix(result.workerName)}${progressPrefix(result.platform)} [${result.platform}] ${result.name} ${duration}`,\n );\n if (result.scenarioSteps) printScenarioSteps(result.scenarioSteps);\n printResultAttachments(result);\n },\n\n onRunComplete(summary) {\n console.log(\"\");\n\n // Group results by platform\n const byPlatform = new Map<Platform, FlowResult[]>();\n for (const r of summary.results) {\n const list = byPlatform.get(r.platform) ?? [];\n list.push(r);\n byPlatform.set(r.platform, list);\n }\n\n for (const [platform, results] of byPlatform) {\n const passed = results.filter((r) => r.status === \"passed\").length;\n const totalCount = results.length;\n const symbols = results\n .map((r) => (r.flaky ? \"~\" : r.status === \"passed\" ? \"✓\" : \"✗\"))\n .join(\"\");\n const label = `${platform} (${driverNames[platform]})`;\n const duration = Math.max(...results.map((r) => r.durationMs));\n console.log(\n `${label.padEnd(25)} ${symbols} ${passed}/${totalCount} passed (${(duration / 1000).toFixed(1)}s)`,\n );\n }\n\n // Failures detail with suggestions\n const failures = summary.results.filter((r) => r.status === \"failed\");\n if (failures.length > 0) {\n console.log(\"\\n--- Failures ---\");\n for (const f of failures) {\n const deviceLabel = f.workerName ? `${f.platform} on ${f.workerName}` : f.platform;\n console.log(`✗ [${deviceLabel}] ${f.name}`);\n if (f.error) {\n console.log(` Category: ${f.error.category}`);\n console.log(` ${f.error.message}`);\n if (f.error.suggestion) {\n for (const line of f.error.suggestion.split(\"\\n\")) {\n console.log(` 💡 ${line}`);\n }\n }\n }\n }\n }\n\n // Flaky detail\n const flakyResults = summary.results.filter((r) => r.flaky);\n if (flakyResults.length > 0) {\n console.log(\"\\n--- Flaky ---\");\n for (const f of flakyResults) {\n console.log(`~ [${f.platform}] ${f.name} (passed on attempt ${f.attempts})`);\n }\n }\n\n // Worker stats\n if (summary.workerStats && summary.workerStats.size > 0) {\n console.log(\"\\nWorker Stats:\");\n for (const [id, stats] of summary.workerStats) {\n console.log(` [${id}] ${stats.flowCount} flows ${(stats.totalMs / 1000).toFixed(1)}s`);\n }\n }\n\n if (summary.bailedOut) {\n console.log(\n `\\nBailed out after ${summary.failed} failure(s)${\n summary.bailLimit ? ` (limit: ${summary.bailLimit})` : \"\"\n }.`,\n );\n }\n\n // Final summary\n const flakyStr = summary.flaky > 0 ? `, ${summary.flaky} flaky` : \"\";\n console.log(\n `\\n${summary.passed}/${summary.total} passed, ${summary.failed} failed${flakyStr} (${(summary.durationMs / 1000).toFixed(1)}s)`,\n );\n },\n\n // Allow callers to set total for progress tracking\n set flowCount(n: number) {\n total = n;\n },\n\n set platformFlowCounts(counts: Partial<Record<Platform, number>>) {\n platformTotals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AQ,MAAM,UAAU,QAAQ,MAAM,QAAQ,aAAa,KAAM,QAAQ,CAAC,CAAC;AAAA,MAC7H;AAAA,IACF;AAAA;AAAA,IAGA,IAAI,UAAU,GAAW;AACvB,cAAQ;AAAA,IACV;AAAA,IAEA,IAAI,mBAAmB,QAA2C;AAChE,uBAAiB;AAAA,IACnB;AAAA,EACF;AACF;","names":[]}
@@ -70,12 +70,120 @@ interface BrowserNetworkConditions {
70
70
  downloadThroughputKbps?: number;
71
71
  uploadThroughputKbps?: number;
72
72
  }
73
+ interface BrowserConsoleLogLocation {
74
+ url?: string;
75
+ lineNumber?: number;
76
+ columnNumber?: number;
77
+ }
78
+ interface BrowserConsoleLog {
79
+ type: string;
80
+ text: string;
81
+ location?: BrowserConsoleLogLocation;
82
+ }
83
+ interface BrowserJSError {
84
+ name?: string;
85
+ message: string;
86
+ stack?: string;
87
+ }
88
+ interface BrowserHARHeader {
89
+ name: string;
90
+ value: string;
91
+ }
92
+ interface BrowserHAREntry {
93
+ pageref: string;
94
+ startedDateTime: string;
95
+ time: number;
96
+ request: {
97
+ method: string;
98
+ url: string;
99
+ httpVersion: string;
100
+ headers: BrowserHARHeader[];
101
+ queryString: BrowserHARHeader[];
102
+ headersSize: number;
103
+ bodySize: number;
104
+ postData?: {
105
+ mimeType: string;
106
+ text?: string;
107
+ };
108
+ };
109
+ response: {
110
+ status: number;
111
+ statusText: string;
112
+ httpVersion: string;
113
+ headers: BrowserHARHeader[];
114
+ redirectURL: string;
115
+ headersSize: number;
116
+ bodySize: number;
117
+ content: {
118
+ size: number;
119
+ mimeType: string;
120
+ };
121
+ };
122
+ cache: Record<string, never>;
123
+ timings: {
124
+ blocked: number;
125
+ dns: number;
126
+ connect: number;
127
+ ssl: number;
128
+ send: number;
129
+ wait: number;
130
+ receive: number;
131
+ };
132
+ serverIPAddress?: string;
133
+ _resourceType?: string;
134
+ _failureText?: string;
135
+ }
136
+ interface BrowserHARPage {
137
+ id: string;
138
+ title: string;
139
+ startedDateTime: string;
140
+ pageTimings: {
141
+ onContentLoad: number;
142
+ onLoad: number;
143
+ };
144
+ }
145
+ interface BrowserHAR {
146
+ log: {
147
+ version: "1.2";
148
+ creator: {
149
+ name: "spana";
150
+ version: string;
151
+ };
152
+ browser: {
153
+ name: string;
154
+ };
155
+ pages: BrowserHARPage[];
156
+ entries: BrowserHAREntry[];
157
+ };
158
+ }
159
+ type TouchAction = {
160
+ type: "move";
161
+ x: number;
162
+ y: number;
163
+ duration?: number;
164
+ } | {
165
+ type: "down";
166
+ } | {
167
+ type: "up";
168
+ } | {
169
+ type: "pause";
170
+ duration: number;
171
+ };
172
+ interface TouchSequence {
173
+ id: number;
174
+ actions: TouchAction[];
175
+ }
73
176
  interface RawDriverService {
177
+ readonly beginFlow?: (flowName: string) => Effect.Effect<void, DriverError>;
178
+ readonly getDriverLogs?: () => Effect.Effect<string[], DriverError>;
74
179
  readonly dumpHierarchy: () => Effect.Effect<RawHierarchy, DriverError>;
75
180
  readonly tapAtCoordinate: (x: number, y: number) => Effect.Effect<void, DriverError>;
76
181
  readonly doubleTapAtCoordinate: (x: number, y: number) => Effect.Effect<void, DriverError>;
77
182
  readonly longPressAtCoordinate: (x: number, y: number, duration: number) => Effect.Effect<void, DriverError>;
78
183
  readonly swipe: (startX: number, startY: number, endX: number, endY: number, duration: number) => Effect.Effect<void, DriverError>;
184
+ readonly pinch?: (cx: number, cy: number, scale: number, duration: number) => Effect.Effect<void, DriverError>;
185
+ readonly zoom?: (cx: number, cy: number, scale: number, duration: number) => Effect.Effect<void, DriverError>;
186
+ readonly multiTouch?: (sequences: TouchSequence[]) => Effect.Effect<void, DriverError>;
79
187
  readonly inputText: (text: string) => Effect.Effect<void, DriverError>;
80
188
  readonly pressKey: (key: string) => Effect.Effect<void, DriverError>;
81
189
  readonly hideKeyboard: () => Effect.Effect<void, DriverError>;
@@ -99,6 +207,15 @@ interface RawDriverService {
99
207
  readonly loadCookies?: (path: string) => Effect.Effect<void, DriverError>;
100
208
  readonly saveAuthState?: (path: string) => Effect.Effect<void, DriverError>;
101
209
  readonly loadAuthState?: (path: string) => Effect.Effect<void, DriverError>;
210
+ readonly downloadFile?: (path: string) => Effect.Effect<void, DriverError>;
211
+ readonly uploadFile?: (selector: Selector, path: string) => Effect.Effect<void, DriverError>;
212
+ readonly newTab?: (url?: string) => Effect.Effect<string, DriverError>;
213
+ readonly switchToTab?: (index: number) => Effect.Effect<void, DriverError>;
214
+ readonly closeTab?: () => Effect.Effect<void, DriverError>;
215
+ readonly getTabIds?: () => Effect.Effect<string[], DriverError>;
216
+ readonly getConsoleLogs?: () => Effect.Effect<BrowserConsoleLog[], DriverError>;
217
+ readonly getJSErrors?: () => Effect.Effect<BrowserJSError[], DriverError>;
218
+ readonly getHAR?: () => Effect.Effect<BrowserHAR, DriverError>;
102
219
  }
103
220
 
104
221
  interface IOSSigningConfig {
@@ -122,6 +239,8 @@ interface WebExecutionConfig {
122
239
  headless?: boolean;
123
240
  /** Optional Playwright storage state JSON file to preload for web runs */
124
241
  storageState?: string;
242
+ /** Print verbose Playwright runtime events to stdout for local web debugging */
243
+ verboseLogging?: boolean;
125
244
  }
126
245
  interface CloudAppReferenceConfig {
127
246
  /** Existing remote app reference, e.g. bs://... or storage:... */
@@ -164,6 +283,8 @@ interface AppiumExecutionConfig {
164
283
  reportToProvider?: boolean;
165
284
  browserstack?: BrowserStackHelperConfig;
166
285
  saucelabs?: SauceLabsHelperConfig;
286
+ /** Path to a custom cloud provider module (default export must conform to CloudProvider interface). */
287
+ cloudProvider?: string;
167
288
  }
168
289
  interface ExecutionConfig {
169
290
  mode?: "local" | "appium";
@@ -177,6 +298,9 @@ interface ArtifactConfig {
177
298
  captureSteps?: boolean;
178
299
  screenshot?: boolean;
179
300
  uiHierarchy?: boolean;
301
+ consoleLogs?: boolean;
302
+ jsErrors?: boolean;
303
+ har?: boolean;
180
304
  }
181
305
  interface HookContext {
182
306
  app: unknown;
@@ -200,10 +324,25 @@ interface ProvConfig {
200
324
  waitForIdleTimeout?: number;
201
325
  /** Delay between each character when typing. Default: 0 (instant). */
202
326
  typingDelay?: number;
327
+ /** Starting poll interval for adaptive backoff. Default: 50ms. Set equal to pollInterval to disable adaptive backoff. */
328
+ initialPollInterval?: number;
329
+ /** Max age in ms before cached hierarchy is stale. Default: 100. Set to 0 to disable. */
330
+ hierarchyCacheTtl?: number;
331
+ /** Delay in ms between retry attempts of a failed flow. Default: 0 (immediate). */
332
+ retryDelay?: number;
333
+ /** Max workers per platform when using --parallel. */
334
+ workers?: number;
203
335
  };
204
336
  platforms?: Platform[];
337
+ /** Run platforms concurrently when they use independent resources. Default: false (serial). */
338
+ parallelPlatforms?: boolean;
205
339
  flowDir?: string;
206
340
  launchOptions?: LaunchOptions;
341
+ /**
342
+ * Reporter names or module paths. Built-in: "console", "json", "junit", "html", "allure".
343
+ * Custom reporters: provide a relative path (e.g., "./reporters/slack.ts") that default-exports
344
+ * a Reporter object or a `(options: { outputDir: string }) => Reporter` factory function.
345
+ */
207
346
  reporters?: string[];
208
347
  hooks?: {
209
348
  beforeAll?: (ctx: HookContext) => Promise<void>;
@@ -216,4 +355,29 @@ interface ProvConfig {
216
355
  }
217
356
  declare function defineConfig(config: ProvConfig): ProvConfig;
218
357
 
219
- export { type AppConfig as A, type BrowserMockResponse as B, DeviceInfo as D, type ExtendedSelector as E, type LaunchOptions as L, type Platform as P, type RelativeSelector as R, Selector as S, type WebExecutionConfig as W, type ArtifactConfig as a, type BrowserName as b, type BrowserNetworkConditions as c, type BrowserRouteMatcher as d, type ProvConfig as e, defineConfig as f, type RawDriverService as g };
358
+ interface WaitOptions {
359
+ timeout?: number;
360
+ pollInterval?: number;
361
+ settleTimeout?: number;
362
+ /** Starting poll interval for adaptive polling. Default: 50ms. Set equal to pollInterval to disable adaptive backoff. */
363
+ initialPollInterval?: number;
364
+ }
365
+
366
+ type Direction = "up" | "down" | "left" | "right";
367
+ interface ScrollUntilVisibleOptions extends WaitOptions {
368
+ /** Where the target is relative to the current viewport. Default: "down". */
369
+ direction?: Direction;
370
+ /** Max number of scroll gestures to attempt before failing. Default: 5. */
371
+ maxScrolls?: number;
372
+ }
373
+ type KeyboardDismissStrategy = "auto" | "driver" | "back";
374
+ interface DismissKeyboardOptions {
375
+ /** Default: "auto" (driver hideKeyboard, then Android back fallback). */
376
+ strategy?: KeyboardDismissStrategy;
377
+ }
378
+ interface BackUntilVisibleOptions extends WaitOptions {
379
+ /** Max number of back actions to attempt before failing. Default: 3. */
380
+ maxBacks?: number;
381
+ }
382
+
383
+ export { type AppiumExecutionConfig as A, type BackUntilVisibleOptions as B, DeviceInfo as D, type ExtendedSelector as E, type LaunchOptions as L, type Platform as P, type RelativeSelector as R, type ScrollUntilVisibleOptions as S, type TouchAction as T, type WebExecutionConfig as W, type AppConfig as a, type ArtifactConfig as b, type BrowserConsoleLog as c, type BrowserHAR as d, type BrowserJSError as e, type BrowserMockResponse as f, type BrowserName as g, type BrowserNetworkConditions as h, type BrowserRouteMatcher as i, type DismissKeyboardOptions as j, type ProvConfig as k, Selector as l, type TouchSequence as m, defineConfig as n, type WaitOptions as o, type Direction as p, type RawDriverService as q };
@@ -2,13 +2,13 @@ import {
2
2
  discoverDevices,
3
3
  findDeviceById,
4
4
  firstDeviceForPlatform
5
- } from "./chunk-WIJYK22K.js";
5
+ } from "./chunk-AEKDFFPJ.js";
6
6
  import "./chunk-GZK22EIE.js";
7
- import "./chunk-V62HFH6E.js";
7
+ import "./chunk-SFBRFB2N.js";
8
8
  import "./chunk-DGUM43GV.js";
9
9
  export {
10
10
  discoverDevices,
11
11
  findDeviceById,
12
12
  firstDeviceForPlatform
13
13
  };
14
- //# sourceMappingURL=discover-RWBKI5IB.js.map
14
+ //# sourceMappingURL=discover-KZKXHZZA.js.map