@solidxai/core 0.1.22-beta.4 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +808 -0
- package/dist/controllers/admin-embed.controller.d.ts +5 -0
- package/dist/controllers/admin-embed.controller.d.ts.map +1 -0
- package/dist/controllers/admin-embed.controller.js +58 -0
- package/dist/controllers/admin-embed.controller.js.map +1 -0
- package/dist/controllers/agent-registry.controller.d.ts +1 -7
- package/dist/controllers/agent-registry.controller.d.ts.map +1 -1
- package/dist/controllers/agent-registry.controller.js +1 -1
- package/dist/controllers/agent-session.controller.d.ts +1 -1
- package/dist/controllers/agent-session.controller.d.ts.map +1 -1
- package/dist/controllers/agent-session.controller.js +25 -3
- package/dist/controllers/agent-session.controller.js.map +1 -1
- package/dist/controllers/authentication.controller.d.ts +12 -1
- package/dist/controllers/authentication.controller.d.ts.map +1 -1
- package/dist/controllers/authentication.controller.js +26 -2
- package/dist/controllers/authentication.controller.js.map +1 -1
- package/dist/guards/access-token.guard.d.ts +3 -1
- package/dist/guards/access-token.guard.d.ts.map +1 -1
- package/dist/guards/access-token.guard.js +11 -2
- package/dist/guards/access-token.guard.js.map +1 -1
- package/dist/interfaces/active-user-data.interface.d.ts +1 -0
- package/dist/interfaces/active-user-data.interface.d.ts.map +1 -1
- package/dist/interfaces/active-user-data.interface.js.map +1 -1
- package/dist/resources/admin-embed/solid-admin-embed.js +133 -0
- package/dist/seeders/seed-data/solid-core-metadata.json +99 -2
- package/dist/services/agent-hub-process-manager.service.d.ts +13 -1
- package/dist/services/agent-hub-process-manager.service.d.ts.map +1 -1
- package/dist/services/agent-hub-process-manager.service.js +10 -2
- package/dist/services/agent-hub-process-manager.service.js.map +1 -1
- package/dist/services/agent-registry.service.d.ts +1 -7
- package/dist/services/agent-registry.service.d.ts.map +1 -1
- package/dist/services/agent-registry.service.js +5 -1
- package/dist/services/agent-registry.service.js.map +1 -1
- package/dist/services/api-key-portal-session.spec.d.ts +2 -0
- package/dist/services/api-key-portal-session.spec.d.ts.map +1 -0
- package/dist/services/api-key-portal-session.spec.js +71 -0
- package/dist/services/api-key-portal-session.spec.js.map +1 -0
- package/dist/services/api-key.service.d.ts +12 -0
- package/dist/services/api-key.service.d.ts.map +1 -1
- package/dist/services/api-key.service.js +58 -0
- package/dist/services/api-key.service.js.map +1 -1
- package/dist/services/authentication.service.d.ts +1 -0
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +14 -1
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/settings/default-settings-provider.service.d.ts +4 -4
- package/dist/services/settings/default-settings-provider.service.js +2 -2
- package/dist/services/settings/default-settings-provider.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +2 -0
- package/dist/solid-core.module.js.map +1 -1
- package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -1
- package/dist/testing/adapters/ui/playwright-adapter.js +3 -1
- package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -1
- package/dist/testing/contracts/runtime-context.types.d.ts +7 -0
- package/dist/testing/contracts/runtime-context.types.d.ts.map +1 -1
- package/dist/testing/contracts/runtime-context.types.js.map +1 -1
- package/dist/testing/core/interpolation.d.ts.map +1 -1
- package/dist/testing/core/interpolation.js +14 -2
- package/dist/testing/core/interpolation.js.map +1 -1
- package/dist/testing/core/step-data.d.ts +5 -0
- package/dist/testing/core/step-data.d.ts.map +1 -0
- package/dist/testing/core/step-data.js +14 -0
- package/dist/testing/core/step-data.js.map +1 -0
- package/dist/testing/core/step-data.spec.d.ts +2 -0
- package/dist/testing/core/step-data.spec.d.ts.map +1 -0
- package/dist/testing/core/step-data.spec.js +48 -0
- package/dist/testing/core/step-data.spec.js.map +1 -0
- package/dist/testing/core/testing-engine.d.ts.map +1 -1
- package/dist/testing/core/testing-engine.js +13 -8
- package/dist/testing/core/testing-engine.js.map +1 -1
- package/dist/testing/reporter/lifecycle-events.types.d.ts +2 -1
- package/dist/testing/reporter/lifecycle-events.types.d.ts.map +1 -1
- package/dist/testing/reporter/lifecycle-events.types.js.map +1 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.d.ts +2 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.d.ts.map +1 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.js +1 -0
- package/dist/testing/reporter/lifecycle-webhook-reporter.js.map +1 -1
- package/dist/testing/reporter/reporter.types.d.ts +2 -1
- package/dist/testing/reporter/reporter.types.d.ts.map +1 -1
- package/dist/testing/reporter/reporter.types.js.map +1 -1
- package/dist/testing/runner/run-from-metadata.d.ts.map +1 -1
- package/dist/testing/runner/run-from-metadata.js +39 -9
- package/dist/testing/runner/run-from-metadata.js.map +1 -1
- package/dist/testing/runner/run-from-metadata.spec.js +29 -0
- package/dist/testing/runner/run-from-metadata.spec.js.map +1 -1
- package/dist/testing/runner/scenario-graph.d.ts +9 -0
- package/dist/testing/runner/scenario-graph.d.ts.map +1 -1
- package/dist/testing/runner/scenario-graph.js +47 -13
- package/dist/testing/runner/scenario-graph.js.map +1 -1
- package/dist/testing/steps/ui/navigation.step.d.ts.map +1 -1
- package/dist/testing/steps/ui/navigation.step.js +4 -1
- package/dist/testing/steps/ui/navigation.step.js.map +1 -1
- package/dist/testing/steps/util/random.step.d.ts.map +1 -1
- package/dist/testing/steps/util/random.step.js +4 -1
- package/dist/testing/steps/util/random.step.js.map +1 -1
- package/package.json +1 -1
- package/resources/admin-embed/solid-admin-embed.js +133 -0
- package/src/controllers/admin-embed.controller.ts +34 -0
- package/src/controllers/agent-session.controller.ts +19 -3
- package/src/controllers/authentication.controller.ts +20 -1
- package/src/guards/access-token.guard.ts +11 -1
- package/src/interfaces/active-user-data.interface.ts +3 -0
- package/src/seeders/seed-data/solid-core-metadata.json +100 -3
- package/src/services/agent-hub-process-manager.service.ts +12 -2
- package/src/services/agent-registry.service.ts +4 -1
- package/src/services/api-key-portal-session.spec.ts +75 -0
- package/src/services/api-key.service.ts +61 -0
- package/src/services/authentication.service.ts +16 -2
- package/src/services/settings/default-settings-provider.service.ts +2 -2
- package/src/solid-core.module.ts +2 -0
- package/src/testing/adapters/ui/playwright-adapter.ts +5 -1
- package/src/testing/contracts/runtime-context.types.ts +16 -0
- package/src/testing/core/interpolation.ts +11 -2
- package/src/testing/core/step-data.spec.ts +59 -0
- package/src/testing/core/step-data.ts +14 -0
- package/src/testing/core/testing-engine.ts +6 -1
- package/src/testing/reporter/lifecycle-events.types.ts +3 -1
- package/src/testing/reporter/lifecycle-webhook-reporter.ts +3 -1
- package/src/testing/reporter/reporter.types.ts +3 -1
- package/src/testing/runner/run-from-metadata.spec.ts +33 -0
- package/src/testing/runner/run-from-metadata.ts +53 -16
- package/src/testing/runner/scenario-graph.ts +55 -12
- package/src/testing/steps/ui/navigation.step.ts +4 -1
- package/src/testing/steps/util/random.step.ts +4 -1
- package/src/entities/media-migration-plan.md +0 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-from-metadata.js","sourceRoot":"","sources":["../../../src/testing/runner/run-from-metadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,gDAWC;AAmFD,0CAiPC;AA3YD,6DAAyD;AACzD,sEAAkE;AAClE,kEAAwE;AACxE,2DAA6D;AAC7D,qDAAyD;AACzD,yDAAqD;AACrD,2DAA2E;AAC3E,uDAAoD;AACpD,yDAA0D;AAC1D,qDAAgG;AAChG,2CASqB;AACrB,4EAA6E;AAC7E,yDAAsD;AACtD,mEAA+D;AAE/D,qDAO0B;AAM1B,KAAK,UAAU,cAAc,CAC3B,EAAa,EACb,QAAsB,EACtB,IAA+B,EAC/B,KAAgC,EAChC,WAAoB;IAEpB,IAAI,QAAQ,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,WAAW;YAAE,MAAM,EAAE,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO;IACT,CAA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E,IAAI,EAAE,mBAAmB,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBAC7H,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,MAAM,IAAI,aAAa,CAAC,KAAK,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAE3D,MAAM,SAAS,GAAG,CAAC,CAAC,QAAQ,CAAC;YAC7B,MAAM,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;YACjC,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;gBACnC,IAAI,KAAK,IAAI,QAAQ,CAAC,iBAAiB,EAAE,CAAC;oBACxC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;gBACrG,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { Reporter } from \"../reporter/reporter.types\";\nimport type { TestingMetadata, TestingDataRecord, ScenarioSpec } from \"../contracts/testing-metadata.types\";\nimport type { ApiAdapterOptions } from \"../adapters/api/api.types\";\nimport type { PlaywrightAdapterOptions } from \"../adapters/ui/ui.types\";\nimport type { MobileAdapterOptions } from \"../adapters/mobile/mobile.types\";\nimport { ApiAdapter } from \"../adapters/api/api-adapter\";\nimport { MobileAdapter } from \"../adapters/mobile/mobile-adapter\";\nimport { createDefaultStepRegistry } from \"../runtime/default-registry\";\nimport { SimpleResourceStore } from \"../core/resource-store\";\nimport { RandomDataRegistry } from \"../core/random-data\";\nimport { SpecRegistry } from \"../core/spec-registry\";\nimport { TestingEngine, type ScenarioSetup } from \"../core/testing-engine\";\nimport { filterScenarios } from \"./scenario-filter\";\nimport { collectSecretKeys } from \"../core/interpolation\";\nimport { planMobileSetup, splitResetScenario, type MobileSessionState } from \"./mobile-session\";\nimport {\n cleanStartProblem,\n ensureMobileStarted,\n ensureUiStarted,\n mobileScenarioProblem,\n scenarioNeedsMobile,\n scenarioNeedsUi,\n startsWithCleanApp,\n withoutLeadingClear,\n} from \"./lifecycle\";\nimport { ensureChromiumInstalled } from \"../adapters/ui/browser-provisioner\";\nimport { RunCanceledError } from \"./run-cancellation\";\nimport { ConsoleReporter } from \"../reporter/console-reporter\";\nimport type { PlaywrightAdapter as UiAdapter, StorageState } from \"../adapters/ui/playwright-adapter\";\nimport {\n expandWithDependencies,\n orderByDependencies,\n expandRestoreFrom,\n sessionSourceFor,\n usesDependencies,\n validateSessions,\n} from \"./scenario-graph\";\n\n/**\n * Give a scenario the browser context its `session` asks for. `justStarted` skips a\n * redundant context swap when the browser was opened for this very scenario.\n */\nasync function prepareSession(\n ui: UiAdapter,\n scenario: ScenarioSpec,\n byId: Map<string, ScenarioSpec>,\n saved: Map<string, StorageState>,\n justStarted: boolean,\n): Promise<void> {\n if (scenario.session === \"fresh\") {\n if (!justStarted) await ui.newContext();\n return;\n }\n if (scenario.session === \"restore\") {\n const source = sessionSourceFor(scenario, byId);\n const storageState = source ? saved.get(source) : undefined;\n if (!storageState) {\n // The source passed (or this scenario would have been skipped) but never opened a page.\n throw new Error(`Scenario \"${scenario.id}\" restores the session of \"${source}\", which saved no browser state`);\n }\n await ui.newContext({ storageState });\n }\n}\n\n\nexport function buildTestDataIndex(data?: TestingDataRecord[]): Record<string, Record<string, any>> {\n const index: Record<string, Record<string, any>> = {};\n if (!Array.isArray(data)) return index;\n for (const record of data) {\n if (!record?.modelUserKey || !record?.recUserKeyValue) continue;\n if (!index[record.modelUserKey]) {\n index[record.modelUserKey] = {};\n }\n index[record.modelUserKey][record.recUserKeyValue] = record.data ?? {};\n }\n return index;\n}\n\nexport type RunnerOptions = {\n metadata?: TestingMetadata;\n scenarios?: ScenarioSpec[];\n data?: TestingDataRecord[];\n externalRunId?: string;\n env?: Record<string, string>;\n scenarioIds?: string[];\n includeTags?: string[];\n skipScenarioIds?: string[];\n reporter?: Reporter;\n api?: ApiAdapterOptions;\n ui?: PlaywrightAdapterOptions;\n /** Device and app for mobile scenarios. Required when any scenario is a mobile scenario. */\n mobile?: MobileAdapterOptions;\n defaults?: { timeoutMs?: number; retries?: number };\n options?: { printApiLogs?: boolean };\n /**\n * Stop the run at the first failed scenario (default `true`), also in a run with dependencies\n * (dependsOn / restoreFrom / session). When `false`, every scenario runs — a failed one's dependents\n * are skipped — and the run still throws after the last one if any failed.\n */\n failFast?: boolean;\n specs?: (registry: SpecRegistry) => void;\n /**\n * Resolves `${secret:...}` references against the secret store. Injected by the\n * caller so this runner stays free of database and DI coupling. Required only if a\n * scenario actually references a secret.\n */\n resolveSecrets?: (keys: string[]) => Promise<Record<string, any>>;\n /**\n * Aborting this stops the run: the browser (or device session) is closed at once, so a step in flight fails\n * and the window disappears, and no further scenario starts. The caller gets a RunCanceledError.\n */\n signal?: AbortSignal;\n};\n\n/**\n * Resolves every secret referenced by the scenarios about to run, in one call, and\n * returns a per-scenario view of the result.\n *\n * Partitioned deliberately: ctxBase is shared across scenarios, so handing every\n * scenario the whole map would let each read secrets belonging to the others.\n */\nasync function resolveSecretsByScenario(\n scenarios: ScenarioSpec[],\n resolveSecrets?: RunnerOptions[\"resolveSecrets\"],\n): Promise<Map<string, Record<string, any>>> {\n const keysByScenario = new Map<string, string[]>();\n const allKeys = new Set<string>();\n\n for (const scenario of scenarios) {\n const keys = collectSecretKeys(scenario);\n if (keys.length === 0) continue;\n keysByScenario.set(scenario.id, keys);\n keys.forEach((key) => allKeys.add(key));\n }\n\n if (allKeys.size === 0) return new Map();\n\n if (!resolveSecrets) {\n throw new Error(\n `Scenarios reference secrets (${[...allKeys].join(\", \")}) but no secret resolver was provided to the runner.`,\n );\n }\n\n // Resolved up front so a missing secret fails the run before any scenario executes.\n const resolved = await resolveSecrets([...allKeys]);\n\n const byScenario = new Map<string, Record<string, any>>();\n for (const [scenarioId, keys] of keysByScenario) {\n byScenario.set(\n scenarioId,\n keys.reduce((acc, key) => {\n acc[key] = resolved[key];\n return acc;\n }, {} as Record<string, any>),\n );\n }\n return byScenario;\n}\n\nexport async function runFromMetadata(opts: RunnerOptions): Promise<void> {\n const startedAt = Date.now();\n const registry = createDefaultStepRegistry();\n\n const engine = new TestingEngine(registry, opts.defaults);\n // The reset scenario is setup, not a scenario: it is never selected, run on its own, or counted.\n const { reset: resetScenario, rest: unexpandedScenarios } = splitResetScenario(\n opts.scenarios ?? opts.metadata?.testing?.scenarios ?? [],\n );\n // restoreFrom becomes dependsOn + session: restore + saveSession on its source, so the rest of the run sees only those.\n const allScenarios = expandRestoreFrom(unexpandedScenarios, resetScenario?.id);\n const selected = expandWithDependencies(\n allScenarios,\n filterScenarios(allScenarios, {\n scenarioIds: opts.scenarioIds,\n includeTags: opts.includeTags,\n skipScenarioIds: opts.skipScenarioIds,\n }),\n );\n // Without dependsOn/session settings a run keeps its original contract: file order,\n // one shared browser context, stop at the first failure.\n const dependencyMode = usesDependencies(selected);\n const scenarios = dependencyMode ? orderByDependencies(selected) : selected;\n if (dependencyMode) validateSessions(scenarios);\n const scenarioById = new Map(scenarios.map((s) => [s.id, s]));\n\n const specRegistry = new SpecRegistry();\n const testData = buildTestDataIndex(opts.data ?? opts.metadata?.testing?.data);\n if (opts.specs) {\n opts.specs(specRegistry);\n }\n\n // Fetch the browser before the reporter starts drawing its footer, so the download\n // gets a clean terminal and a missing browser fails before any scenario runs.\n if (scenarios.some(scenarioNeedsUi)) {\n await ensureChromiumInstalled();\n }\n\n const resources = new SimpleResourceStore();\n const reporter: Reporter = opts.reporter ?? new ConsoleReporter();\n const api = new ApiAdapter(opts.api);\n const { PlaywrightAdapter } = await import(\"../adapters/ui/playwright-adapter\");\n const ui = new PlaywrightAdapter(opts.ui);\n const mobile = opts.mobile ? new MobileAdapter(opts.mobile) : undefined;\n const randomData = new RandomDataRegistry();\n const ctxBase = { resources, randomData, reporter, api, ui, mobile, specRegistry, testData, env: opts.env, options: opts.options };\n const uiStarted = { value: false };\n const mobileStarted = { value: false };\n let passed = 0;\n let failed = 0;\n let skipped = 0;\n let runError: unknown;\n const outcomes = new Map<string, \"passed\" | \"failed\" | \"skipped\">();\n const savedSessions = new Map<string, StorageState>();\n const mobileState: MobileSessionState = {};\n // When the run is canceled, close what it opened right away rather than waiting for the step in flight, so a\n // headed browser window goes away. The `finally` below skips closing them a second time.\n let uiClosedOnCancel = false;\n let mobileClosedOnCancel = false;\n const closeOnCancel = () => {\n if (uiStarted.value) {\n uiClosedOnCancel = true;\n void ui.stop({ keepVideo: false }).catch(() => undefined);\n }\n if (mobile && mobileStarted.value) {\n mobileClosedOnCancel = true;\n void mobile.stop({ keepVideo: false }).catch(() => undefined);\n }\n };\n opts.signal?.addEventListener(\"abort\", closeOnCancel, { once: true });\n const throwIfCanceled = () => {\n if (opts.signal?.aborted) throw new RunCanceledError();\n };\n\n reporter.onRunStart?.({\n total: scenarios.length,\n startedAt: new Date(startedAt).toISOString(),\n scenarioIds: scenarios.map((s) => s.id),\n scenarios: scenarios.map((s) => ({ id: s.id, name: s.name, type: s.type })),\n });\n\n try {\n // Checked inside the try so a bad mobile setup still reports run.end.\n for (const scenario of scenarios) {\n const problem = mobileScenarioProblem(scenario);\n if (problem) throw new Error(problem);\n if (scenarioNeedsMobile(scenario) && !opts.mobile) {\n throw new Error(\n `Scenario \"${scenario.id}\" is a mobile scenario but the run has no mobile options (device and app). Start it from Test Hub, or pass RunnerOptions.mobile.`,\n );\n }\n }\n // An iOS device with no build cannot clear an app's data: say so now, naming the scenarios, not at their first step.\n const noReinstall = !!mobile && !mobile.canReinstall;\n const cleanProblem = cleanStartProblem(scenarios, { noReinstall }, resetScenario);\n if (cleanProblem) throw new Error(cleanProblem);\n\n // One query for the whole run, after onRunStart so a failure here still reports\n // run.end. Keys that do not resolve are not fatal — they surface at the step that\n // references them, where the reporter can name the token and locate the failure.\n const secretsByScenario = await resolveSecretsByScenario(\n resetScenario ? [...scenarios, resetScenario] : scenarios,\n opts.resolveSecrets,\n );\n\n for (const scenario of scenarios) {\n throwIfCanceled();\n if (dependencyMode) {\n const blocked = (scenario.dependsOn ?? []).find((dep) => outcomes.get(String(dep)) !== \"passed\");\n if (blocked !== undefined) {\n skipped += 1;\n outcomes.set(scenario.id, \"skipped\");\n reporter.onScenarioSkipped?.(scenario, { reason: \"dependency_failed\", dependency: String(blocked) });\n continue;\n }\n }\n if (scenarioNeedsUi(scenario)) {\n const wasStarted = uiStarted.value;\n await ensureUiStarted(ctxBase, uiStarted);\n if (dependencyMode) {\n try {\n await prepareSession(ui, scenario, scenarioById, savedSessions, !wasStarted);\n } catch (error) {\n reporter.onScenarioStart(scenario);\n reporter.onScenarioEnd(scenario, { ok: false, error, durationMs: 0 });\n failed += 1;\n runError = error;\n outcomes.set(scenario.id, \"failed\");\n if (opts.failFast !== false) throw error;\n continue;\n }\n }\n }\n let setup: ScenarioSetup[] = [];\n // On an iOS device that cannot clear data, a scenario that starts clean is started by the reset scenario instead, and its\n // own first step only relaunches the app.\n const cleanFirst = !!mobile && !mobile.canReinstall && scenarioNeedsMobile(scenario) && startsWithCleanApp(scenario);\n if (scenarioNeedsMobile(scenario)) {\n await ensureMobileStarted(ctxBase, mobileStarted);\n if ((dependencyMode || cleanFirst) && mobile) {\n try {\n setup = planMobileSetup({\n scenario: cleanFirst && (scenario.session ?? \"shared\") === \"shared\" ? { ...scenario, session: \"fresh\" } : scenario,\n noReinstall: !mobile.canReinstall,\n byId: scenarioById,\n reset: resetScenario,\n state: mobileState,\n secretsOf: (id) => secretsByScenario.get(id),\n });\n } catch (error) {\n reporter.onScenarioStart(scenario);\n reporter.onScenarioEnd(scenario, { ok: false, error, durationMs: 0 });\n failed += 1;\n runError = error;\n outcomes.set(scenario.id, \"failed\");\n if (opts.failFast !== false) throw error;\n continue;\n }\n }\n // What the app is left in is only known for a producer that passes; anything else may have changed it.\n mobileState.loggedInBy = undefined;\n }\n try {\n await engine.runScenario(\n cleanFirst ? withoutLeadingClear(scenario) : scenario,\n {\n ...ctxBase,\n secrets: secretsByScenario.get(scenario.id),\n },\n setup,\n );\n passed += 1;\n outcomes.set(scenario.id, \"passed\");\n if (scenario.saveSession && uiStarted.value) {\n savedSessions.set(scenario.id, await ui.storageState());\n }\n if (scenario.saveSession && scenarioNeedsMobile(scenario)) {\n mobileState.loggedInBy = scenario.id;\n }\n if (scenarioNeedsMobile(scenario)) {\n // Where the app was last brought to a restore source's state. A scenario that sets no session leaves this as it was:\n // the next restore checks the device before it trusts it.\n if (scenario.saveSession) mobileState.mayBeIn = scenario.id;\n else if (scenario.session === \"restore\") mobileState.mayBeIn = sessionSourceFor(scenario, scenarioById);\n else if (scenario.session === \"fresh\") mobileState.mayBeIn = undefined;\n }\n } catch (error) {\n failed += 1;\n outcomes.set(scenario.id, \"failed\");\n // failFast (the default) stops the run here, with or without dependencies. Otherwise keep going: the\n // first failure is rethrown once every scenario has run, and a dependsOn run skips the failed one's dependents.\n runError ??= error;\n throwIfCanceled();\n if (opts.failFast !== false) throw error;\n }\n }\n if (runError) throw runError;\n } catch (error) {\n // Also catches a setup failure before the loop (unreachable database, absent\n // encryption key), which would otherwise leave runError unset and report ok: true.\n runError = error;\n throw error;\n } finally {\n reporter.onRunEnd?.({\n ok: !runError,\n total: scenarios.length,\n passed,\n failed,\n ...(dependencyMode ? { skipped } : {}),\n durationMs: Date.now() - startedAt,\n });\n opts.signal?.removeEventListener(\"abort\", closeOnCancel);\n if (uiStarted.value && !uiClosedOnCancel) {\n // Only KEEP the whole-run video when the run FAILED — passing runs discard it unread.\n const keepVideo = !!runError;\n await ui.stop({ keepVideo });\n // Video bytes are only finalized after ui.stop(); attach it as a run-level artifact so\n // the reporter uploads it and references it on run.end (queued before flushPending runs).\n if (keepVideo && reporter.attachRunArtifact) {\n for (const video of ui.getRunVideos()) {\n reporter.attachRunArtifact({ name: video.name, contentType: video.contentType, data: video.data });\n }\n // Where each scenario is in the video, for the run page to jump to.\n const timeline = ui.getRunVideoTimeline();\n if (timeline) {\n reporter.attachRunArtifact({ name: \"run-timeline.json\", contentType: \"application/json\", data: JSON.stringify(timeline) });\n }\n }\n }\n if (mobile && mobileStarted.value && !mobileClosedOnCancel) {\n // Same policy as the browser video: only keep the recording when the run failed.\n const keepVideo = !!runError;\n await mobile.stop({ keepVideo });\n if (keepVideo) {\n const video = mobile.getRunVideo();\n if (video && reporter.attachRunArtifact) {\n reporter.attachRunArtifact({ name: video.name, contentType: video.contentType, data: video.data });\n }\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"run-from-metadata.js","sourceRoot":"","sources":["../../../src/testing/runner/run-from-metadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,gDAWC;AAmFD,0CAoQC;AAhbD,6DAAyD;AACzD,sEAAkE;AAClE,kEAAwE;AACxE,2DAA6D;AAC7D,qDAAyD;AACzD,yDAAqD;AACrD,2DAA2E;AAC3E,uDAAoD;AACpD,yDAA0D;AAC1D,qDAAgG;AAChG,2CASqB;AACrB,4EAA6E;AAC7E,yDAAsD;AACtD,mEAA+D;AAE/D,qDAS0B;AAU1B,SAAS,kBAAkB,CAAC,UAAgC,EAAE,QAA+B;IAC3F,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,EAAE,EAAE,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC9B,KAAK,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CA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ACH,CAAC;QACH,CAAC;QACD,IAAI,MAAM,IAAI,aAAa,CAAC,KAAK,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAE3D,MAAM,SAAS,GAAG,CAAC,CAAC,QAAQ,CAAC;YAC7B,MAAM,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;YACjC,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;gBACnC,IAAI,KAAK,IAAI,QAAQ,CAAC,iBAAiB,EAAE,CAAC;oBACxC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;gBACrG,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { Reporter } from \"../reporter/reporter.types\";\nimport type { TestingMetadata, TestingDataRecord, ScenarioSpec } from \"../contracts/testing-metadata.types\";\nimport type { ApiAdapterOptions } from \"../adapters/api/api.types\";\nimport type { PlaywrightAdapterOptions } from \"../adapters/ui/ui.types\";\nimport type { MobileAdapterOptions } from \"../adapters/mobile/mobile.types\";\nimport { ApiAdapter } from \"../adapters/api/api-adapter\";\nimport { MobileAdapter } from \"../adapters/mobile/mobile-adapter\";\nimport { createDefaultStepRegistry } from \"../runtime/default-registry\";\nimport { SimpleResourceStore } from \"../core/resource-store\";\nimport { RandomDataRegistry } from \"../core/random-data\";\nimport { SpecRegistry } from \"../core/spec-registry\";\nimport { TestingEngine, type ScenarioSetup } from \"../core/testing-engine\";\nimport { filterScenarios } from \"./scenario-filter\";\nimport { collectSecretKeys } from \"../core/interpolation\";\nimport { planMobileSetup, splitResetScenario, type MobileSessionState } from \"./mobile-session\";\nimport {\n cleanStartProblem,\n ensureMobileStarted,\n ensureUiStarted,\n mobileScenarioProblem,\n scenarioNeedsMobile,\n scenarioNeedsUi,\n startsWithCleanApp,\n withoutLeadingClear,\n} from \"./lifecycle\";\nimport { ensureChromiumInstalled } from \"../adapters/ui/browser-provisioner\";\nimport { RunCanceledError } from \"./run-cancellation\";\nimport { ConsoleReporter } from \"../reporter/console-reporter\";\nimport type { PlaywrightAdapter as UiAdapter, StorageState } from \"../adapters/ui/playwright-adapter\";\nimport {\n expandWithDependencies,\n orderByDependencies,\n expandRestoreFrom,\n sessionSourceFor,\n splitUnrunnable,\n usesDependencies,\n validateSessions,\n type UnrunnableScenario,\n} from \"./scenario-graph\";\n\n/**\n * Give a scenario the browser context its `session` asks for. `justStarted` skips a\n * redundant context swap when the browser was opened for this very scenario.\n */\n/**\n * The scenarios set aside as unrunnable that this run reports: the ones it selected, plus the broken ones they wait on\n * (so a skip names a failure the run shows). Broken ones first, so each skip follows the failure that caused it.\n */\nfunction selectedUnrunnable(unrunnable: UnrunnableScenario[], selected: Array<{ id: string }>): UnrunnableScenario[] {\n const byId = new Map(unrunnable.map((u) => [u.scenario.id, u]));\n const keep = new Set<string>();\n for (const { id } of selected) {\n for (let at = byId.get(id); at && !keep.has(at.scenario.id); at = at.blockedBy ? byId.get(at.blockedBy) : undefined) {\n keep.add(at.scenario.id);\n }\n }\n const kept = unrunnable.filter((u) => keep.has(u.scenario.id));\n return [...kept.filter((u) => u.error), ...kept.filter((u) => !u.error)];\n}\n\nasync function prepareSession(\n ui: UiAdapter,\n scenario: ScenarioSpec,\n byId: Map<string, ScenarioSpec>,\n saved: Map<string, StorageState>,\n justStarted: boolean,\n): Promise<void> {\n if (scenario.session === \"fresh\") {\n if (!justStarted) await ui.newContext();\n return;\n }\n if (scenario.session === \"restore\") {\n const source = sessionSourceFor(scenario, byId);\n const storageState = source ? saved.get(source) : undefined;\n if (!storageState) {\n // The source passed (or this scenario would have been skipped) but never opened a page.\n throw new Error(`Scenario \"${scenario.id}\" restores the session of \"${source}\", which saved no browser state`);\n }\n await ui.newContext({ storageState });\n }\n}\n\n\nexport function buildTestDataIndex(data?: TestingDataRecord[]): Record<string, Record<string, any>> {\n const index: Record<string, Record<string, any>> = {};\n if (!Array.isArray(data)) return index;\n for (const record of data) {\n if (!record?.modelUserKey || !record?.recUserKeyValue) continue;\n if (!index[record.modelUserKey]) {\n index[record.modelUserKey] = {};\n }\n index[record.modelUserKey][record.recUserKeyValue] = record.data ?? {};\n }\n return index;\n}\n\nexport type RunnerOptions = {\n metadata?: TestingMetadata;\n scenarios?: ScenarioSpec[];\n data?: TestingDataRecord[];\n externalRunId?: string;\n env?: Record<string, string>;\n scenarioIds?: string[];\n includeTags?: string[];\n skipScenarioIds?: string[];\n reporter?: Reporter;\n api?: ApiAdapterOptions;\n ui?: PlaywrightAdapterOptions;\n /** Device and app for mobile scenarios. Required when any scenario is a mobile scenario. */\n mobile?: MobileAdapterOptions;\n defaults?: { timeoutMs?: number; retries?: number };\n options?: { printApiLogs?: boolean };\n /**\n * Stop the run at the first failed scenario (default `true`), also in a run with dependencies\n * (dependsOn / restoreFrom / session). When `false`, every scenario runs — a failed one's dependents\n * are skipped — and the run still throws after the last one if any failed.\n */\n failFast?: boolean;\n specs?: (registry: SpecRegistry) => void;\n /**\n * Resolves `${secret:...}` references against the secret store. Injected by the\n * caller so this runner stays free of database and DI coupling. Required only if a\n * scenario actually references a secret.\n */\n resolveSecrets?: (keys: string[]) => Promise<Record<string, any>>;\n /**\n * Aborting this stops the run: the browser (or device session) is closed at once, so a step in flight fails\n * and the window disappears, and no further scenario starts. The caller gets a RunCanceledError.\n */\n signal?: AbortSignal;\n};\n\n/**\n * Resolves every secret referenced by the scenarios about to run, in one call, and\n * returns a per-scenario view of the result.\n *\n * Partitioned deliberately: ctxBase is shared across scenarios, so handing every\n * scenario the whole map would let each read secrets belonging to the others.\n */\nasync function resolveSecretsByScenario(\n scenarios: ScenarioSpec[],\n resolveSecrets?: RunnerOptions[\"resolveSecrets\"],\n): Promise<Map<string, Record<string, any>>> {\n const keysByScenario = new Map<string, string[]>();\n const allKeys = new Set<string>();\n\n for (const scenario of scenarios) {\n const keys = collectSecretKeys(scenario);\n if (keys.length === 0) continue;\n keysByScenario.set(scenario.id, keys);\n keys.forEach((key) => allKeys.add(key));\n }\n\n if (allKeys.size === 0) return new Map();\n\n if (!resolveSecrets) {\n throw new Error(\n `Scenarios reference secrets (${[...allKeys].join(\", \")}) but no secret resolver was provided to the runner.`,\n );\n }\n\n // Resolved up front so a missing secret fails the run before any scenario executes.\n const resolved = await resolveSecrets([...allKeys]);\n\n const byScenario = new Map<string, Record<string, any>>();\n for (const [scenarioId, keys] of keysByScenario) {\n byScenario.set(\n scenarioId,\n keys.reduce((acc, key) => {\n acc[key] = resolved[key];\n return acc;\n }, {} as Record<string, any>),\n );\n }\n return byScenario;\n}\n\nexport async function runFromMetadata(opts: RunnerOptions): Promise<void> {\n const startedAt = Date.now();\n const registry = createDefaultStepRegistry();\n\n const engine = new TestingEngine(registry, opts.defaults);\n // The reset scenario is setup, not a scenario: it is never selected, run on its own, or counted.\n const { reset: resetScenario, rest: unexpandedScenarios } = splitResetScenario(\n opts.scenarios ?? opts.metadata?.testing?.scenarios ?? [],\n );\n // A scenario whose restoreFrom or dependsOn names a scenario that is not there cannot run, nor can what needs it. They\n // are reported as failed / skipped below instead of stopping the run before the others start.\n const { runnable, unrunnable } = splitUnrunnable(unexpandedScenarios, resetScenario?.id);\n // restoreFrom becomes dependsOn + session: restore + saveSession on its source, so the rest of the run sees only those.\n const allScenarios = expandRestoreFrom(runnable, resetScenario?.id);\n const filterOptions = {\n scenarioIds: opts.scenarioIds,\n includeTags: opts.includeTags,\n skipScenarioIds: opts.skipScenarioIds,\n };\n const selected = expandWithDependencies(allScenarios, filterScenarios(allScenarios, filterOptions));\n const notRunnable = selectedUnrunnable(unrunnable, filterScenarios(unrunnable.map((u) => u.scenario), filterOptions));\n // Without dependsOn/session settings a run keeps its original contract: file order,\n // one shared browser context, stop at the first failure.\n const dependencyMode = usesDependencies(selected);\n const scenarios = dependencyMode ? orderByDependencies(selected) : selected;\n if (dependencyMode) validateSessions(scenarios);\n const scenarioById = new Map(scenarios.map((s) => [s.id, s]));\n\n const specRegistry = new SpecRegistry();\n const testData = buildTestDataIndex(opts.data ?? opts.metadata?.testing?.data);\n if (opts.specs) {\n opts.specs(specRegistry);\n }\n\n // Fetch the browser before the reporter starts drawing its footer, so the download\n // gets a clean terminal and a missing browser fails before any scenario runs.\n if (scenarios.some(scenarioNeedsUi)) {\n await ensureChromiumInstalled();\n }\n\n const resources = new SimpleResourceStore();\n const reporter: Reporter = opts.reporter ?? new ConsoleReporter();\n const api = new ApiAdapter(opts.api);\n const { PlaywrightAdapter } = await import(\"../adapters/ui/playwright-adapter\");\n const ui = new PlaywrightAdapter(opts.ui);\n const mobile = opts.mobile ? new MobileAdapter(opts.mobile) : undefined;\n const randomData = new RandomDataRegistry();\n const ctxBase = { resources, randomData, reporter, api, ui, mobile, specRegistry, testData, env: opts.env, options: opts.options };\n const uiStarted = { value: false };\n const mobileStarted = { value: false };\n let passed = 0;\n let failed = 0;\n let skipped = 0;\n let runError: unknown;\n const outcomes = new Map<string, \"passed\" | \"failed\" | \"skipped\">();\n const savedSessions = new Map<string, StorageState>();\n const mobileState: MobileSessionState = {};\n // When the run is canceled, close what it opened right away rather than waiting for the step in flight, so a\n // headed browser window goes away. The `finally` below skips closing them a second time.\n let uiClosedOnCancel = false;\n let mobileClosedOnCancel = false;\n const closeOnCancel = () => {\n if (uiStarted.value) {\n uiClosedOnCancel = true;\n void ui.stop({ keepVideo: false }).catch(() => undefined);\n }\n if (mobile && mobileStarted.value) {\n mobileClosedOnCancel = true;\n void mobile.stop({ keepVideo: false }).catch(() => undefined);\n }\n };\n opts.signal?.addEventListener(\"abort\", closeOnCancel, { once: true });\n const throwIfCanceled = () => {\n if (opts.signal?.aborted) throw new RunCanceledError();\n };\n\n const reported = [...notRunnable.map((u) => u.scenario), ...scenarios];\n reporter.onRunStart?.({\n total: reported.length,\n startedAt: new Date(startedAt).toISOString(),\n scenarioIds: reported.map((s) => s.id),\n scenarios: reported.map((s) => ({ id: s.id, name: s.name, type: s.type })),\n });\n\n try {\n // Scenarios that cannot run fail (a broken reference) or are skipped (they need one that cannot run), and the run goes on.\n for (const { scenario, error, blockedBy } of notRunnable) {\n if (error) {\n const failure = new Error(error);\n reporter.onScenarioStart(scenario);\n reporter.onScenarioEnd(scenario, { ok: false, error: failure, durationMs: 0 });\n failed += 1;\n runError = failure;\n outcomes.set(scenario.id, \"failed\");\n } else {\n skipped += 1;\n outcomes.set(scenario.id, \"skipped\");\n reporter.onScenarioSkipped?.(scenario, { reason: \"dependency_failed\", dependency: String(blockedBy) });\n }\n }\n // Checked inside the try so a bad mobile setup still reports run.end.\n for (const scenario of scenarios) {\n const problem = mobileScenarioProblem(scenario);\n if (problem) throw new Error(problem);\n if (scenarioNeedsMobile(scenario) && !opts.mobile) {\n throw new Error(\n `Scenario \"${scenario.id}\" is a mobile scenario but the run has no mobile options (device and app). Start it from Test Hub, or pass RunnerOptions.mobile.`,\n );\n }\n }\n // An iOS device with no build cannot clear an app's data: say so now, naming the scenarios, not at their first step.\n const noReinstall = !!mobile && !mobile.canReinstall;\n const cleanProblem = cleanStartProblem(scenarios, { noReinstall }, resetScenario);\n if (cleanProblem) throw new Error(cleanProblem);\n\n // One query for the whole run, after onRunStart so a failure here still reports\n // run.end. Keys that do not resolve are not fatal — they surface at the step that\n // references them, where the reporter can name the token and locate the failure.\n const secretsByScenario = await resolveSecretsByScenario(\n resetScenario ? [...scenarios, resetScenario] : scenarios,\n opts.resolveSecrets,\n );\n\n for (const scenario of scenarios) {\n throwIfCanceled();\n if (dependencyMode) {\n const blocked = (scenario.dependsOn ?? []).find((dep) => outcomes.get(String(dep)) !== \"passed\");\n if (blocked !== undefined) {\n skipped += 1;\n outcomes.set(scenario.id, \"skipped\");\n reporter.onScenarioSkipped?.(scenario, { reason: \"dependency_failed\", dependency: String(blocked) });\n continue;\n }\n }\n if (scenarioNeedsUi(scenario)) {\n const wasStarted = uiStarted.value;\n await ensureUiStarted(ctxBase, uiStarted);\n if (dependencyMode) {\n try {\n await prepareSession(ui, scenario, scenarioById, savedSessions, !wasStarted);\n } catch (error) {\n reporter.onScenarioStart(scenario);\n reporter.onScenarioEnd(scenario, { ok: false, error, durationMs: 0 });\n failed += 1;\n runError = error;\n outcomes.set(scenario.id, \"failed\");\n if (opts.failFast !== false) throw error;\n continue;\n }\n }\n }\n let setup: ScenarioSetup[] = [];\n // On an iOS device that cannot clear data, a scenario that starts clean is started by the reset scenario instead, and its\n // own first step only relaunches the app.\n const cleanFirst = !!mobile && !mobile.canReinstall && scenarioNeedsMobile(scenario) && startsWithCleanApp(scenario);\n if (scenarioNeedsMobile(scenario)) {\n await ensureMobileStarted(ctxBase, mobileStarted);\n if ((dependencyMode || cleanFirst) && mobile) {\n try {\n setup = planMobileSetup({\n scenario: cleanFirst && (scenario.session ?? \"shared\") === \"shared\" ? { ...scenario, session: \"fresh\" } : scenario,\n noReinstall: !mobile.canReinstall,\n byId: scenarioById,\n reset: resetScenario,\n state: mobileState,\n secretsOf: (id) => secretsByScenario.get(id),\n });\n } catch (error) {\n reporter.onScenarioStart(scenario);\n reporter.onScenarioEnd(scenario, { ok: false, error, durationMs: 0 });\n failed += 1;\n runError = error;\n outcomes.set(scenario.id, \"failed\");\n if (opts.failFast !== false) throw error;\n continue;\n }\n }\n // What the app is left in is only known for a producer that passes; anything else may have changed it.\n mobileState.loggedInBy = undefined;\n }\n try {\n await engine.runScenario(\n cleanFirst ? withoutLeadingClear(scenario) : scenario,\n {\n ...ctxBase,\n secrets: secretsByScenario.get(scenario.id),\n },\n setup,\n );\n passed += 1;\n outcomes.set(scenario.id, \"passed\");\n if (scenario.saveSession && uiStarted.value) {\n savedSessions.set(scenario.id, await ui.storageState());\n }\n if (scenario.saveSession && scenarioNeedsMobile(scenario)) {\n mobileState.loggedInBy = scenario.id;\n }\n if (scenarioNeedsMobile(scenario)) {\n // Where the app was last brought to a restore source's state. A scenario that sets no session leaves this as it was:\n // the next restore checks the device before it trusts it.\n if (scenario.saveSession) mobileState.mayBeIn = scenario.id;\n else if (scenario.session === \"restore\") mobileState.mayBeIn = sessionSourceFor(scenario, scenarioById);\n else if (scenario.session === \"fresh\") mobileState.mayBeIn = undefined;\n }\n } catch (error) {\n failed += 1;\n outcomes.set(scenario.id, \"failed\");\n // failFast (the default) stops the run here, with or without dependencies. Otherwise keep going: the\n // first failure is rethrown once every scenario has run, and a dependsOn run skips the failed one's dependents.\n runError ??= error;\n throwIfCanceled();\n if (opts.failFast !== false) throw error;\n }\n }\n if (runError) throw runError;\n } catch (error) {\n // Also catches a setup failure before the loop (unreachable database, absent\n // encryption key), which would otherwise leave runError unset and report ok: true.\n runError = error;\n throw error;\n } finally {\n reporter.onRunEnd?.({\n ok: !runError,\n total: reported.length,\n passed,\n failed,\n ...(dependencyMode || skipped > 0 ? { skipped } : {}),\n durationMs: Date.now() - startedAt,\n });\n opts.signal?.removeEventListener(\"abort\", closeOnCancel);\n if (uiStarted.value && !uiClosedOnCancel) {\n // Only KEEP the whole-run video when the run FAILED in the browser — passing runs, and runs where only API\n // scenarios failed (nothing of theirs is on screen), discard it unread.\n const keepVideo = !!runError && scenarios.some((s) => scenarioNeedsUi(s) && outcomes.get(s.id) === \"failed\");\n await ui.stop({ keepVideo });\n // Video bytes are only finalized after ui.stop(); attach it as a run-level artifact so\n // the reporter uploads it and references it on run.end (queued before flushPending runs).\n if (keepVideo && reporter.attachRunArtifact) {\n for (const video of ui.getRunVideos()) {\n reporter.attachRunArtifact({ name: video.name, contentType: video.contentType, data: video.data });\n }\n // Where each scenario is in the video, for the run page to jump to.\n const timeline = ui.getRunVideoTimeline();\n if (timeline) {\n reporter.attachRunArtifact({ name: \"run-timeline.json\", contentType: \"application/json\", data: JSON.stringify(timeline) });\n }\n }\n }\n if (mobile && mobileStarted.value && !mobileClosedOnCancel) {\n // Same policy as the browser video: only keep the recording when the run failed.\n const keepVideo = !!runError;\n await mobile.stop({ keepVideo });\n if (keepVideo) {\n const video = mobile.getRunVideo();\n if (video && reporter.attachRunArtifact) {\n reporter.attachRunArtifact({ name: video.name, contentType: video.contentType, data: video.data });\n }\n }\n }\n }\n}\n"]}
|
|
@@ -163,6 +163,35 @@ describe("runFromMetadata with dependsOn", () => {
|
|
|
163
163
|
const run = events.find((e) => e.type === "run");
|
|
164
164
|
expect(run.args).toMatchObject({ ok: false, total: 4, passed: 1, failed: 1, skipped: 2 });
|
|
165
165
|
});
|
|
166
|
+
it("fails only a scenario whose restoreFrom names an unknown scenario, skips what needs it, and runs the rest", async () => {
|
|
167
|
+
const events = [];
|
|
168
|
+
await expect((0, run_from_metadata_1.runFromMetadata)({
|
|
169
|
+
scenarios: [
|
|
170
|
+
pass("login"),
|
|
171
|
+
pass("workspace", { restoreFrom: "ui-login" }),
|
|
172
|
+
pass("after-workspace", { dependsOn: ["workspace"] }),
|
|
173
|
+
pass("other", { dependsOn: ["login"] }),
|
|
174
|
+
],
|
|
175
|
+
reporter: recordingReporter(events),
|
|
176
|
+
})).rejects.toThrow(/restores from unknown scenario "ui-login"/);
|
|
177
|
+
expect(events.filter((e) => e.type !== "run")).toEqual([
|
|
178
|
+
expect.objectContaining({ type: "end", id: "workspace", ok: false }),
|
|
179
|
+
{ type: "skip", id: "after-workspace", dependency: "workspace" },
|
|
180
|
+
expect.objectContaining({ type: "end", id: "login", ok: true }),
|
|
181
|
+
expect.objectContaining({ type: "end", id: "other", ok: true }),
|
|
182
|
+
]);
|
|
183
|
+
const run = events.find((e) => e.type === "run");
|
|
184
|
+
expect(run.args).toMatchObject({ ok: false, total: 4, passed: 2, failed: 1, skipped: 1 });
|
|
185
|
+
});
|
|
186
|
+
it("reports a broken scenario only when the run selected it or something that needs it", async () => {
|
|
187
|
+
const events = [];
|
|
188
|
+
await (0, run_from_metadata_1.runFromMetadata)({
|
|
189
|
+
scenarios: [pass("login"), pass("workspace", { dependsOn: ["ghost"] })],
|
|
190
|
+
scenarioIds: ["login"],
|
|
191
|
+
reporter: recordingReporter(events),
|
|
192
|
+
});
|
|
193
|
+
expect(events.filter((e) => e.type !== "run").map((e) => `${e.type}:${e.id}`)).toEqual(["end:login"]);
|
|
194
|
+
});
|
|
166
195
|
it("runs a selected scenario's dependencies first", async () => {
|
|
167
196
|
const events = [];
|
|
168
197
|
await (0, run_from_metadata_1.runFromMetadata)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-from-metadata.spec.js","sourceRoot":"","sources":["../../../src/testing/runner/run-from-metadata.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2CAA6B;AAK7B,2DAAsD;AAEtD,SAAS,QAAQ,CAAC,EAAU,EAAE,MAAe;IAC3C,OAAO;QACL,EAAE;QACF,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;KAChF,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ;IACf,MAAM,KAAK,GAAuC,EAAE,CAAC;IACrD,IAAI,MAAoE,CAAC;IACzE,MAAM,QAAQ,GAAa;QACzB,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS;QAChC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACtB,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS;QAC5B,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS;QAC1B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,GAAG,CAAC,CAAC;QACb,CAAC;KACF,CAAC;IACF,OAAO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AAC;SACpC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;YACrD,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;YAClD,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;SACtD,CAAC,CAAC;IACL,CAAC,EAAE,MAAM,CAAC,CAAC;AACb,CAAC,CAAC,CAAC","sourcesContent":["// Purpose: a run stops at the first failed scenario by default; failFast: false runs every\n// scenario and still reports the run as failed. With dependsOn, a failure skips its dependents\n// and the run keeps going; saved browser sessions are restored for dependent scenarios.\n\nimport * as http from \"http\";\nimport type { AddressInfo } from \"net\";\n\nimport type { ScenarioSpec } from \"../contracts/testing-metadata.types\";\nimport type { Reporter, RunEndArgs, ScenarioResult, ScenarioSkipInfo } from \"../reporter/reporter.types\";\nimport { runFromMetadata } from \"./run-from-metadata\";\n\nfunction scenario(id: string, passes: boolean): ScenarioSpec {\n return {\n id,\n type: \"api\",\n steps: [{ op: \"assert.equals\", with: { actual: 1, expected: passes ? 1 : 2 } }],\n };\n}\n\nfunction recorder() {\n const ended: Array<{ id: string; ok: boolean }> = [];\n let runEnd: Parameters<NonNullable<Reporter[\"onRunEnd\"]>>[0] | undefined;\n const reporter: Reporter = {\n onScenarioStart: () => undefined,\n onScenarioEnd: (s, r) => {\n ended.push({ id: s.id, ok: r.ok });\n },\n onStepStart: () => undefined,\n onStepEnd: () => undefined,\n onRunEnd: (r) => {\n runEnd = r;\n },\n };\n return { reporter, ended, getRunEnd: () => runEnd };\n}\n\ndescribe(\"runFromMetadata: failFast\", () => {\n const scenarios = [scenario(\"a\", true), scenario(\"b\", false), scenario(\"c\", true)];\n\n it(\"stops at the first failed scenario by default\", async () => {\n const { reporter, ended, getRunEnd } = recorder();\n\n await expect(runFromMetadata({ scenarios, reporter })).rejects.toThrow();\n\n expect(ended.map((e) => e.id)).toEqual([\"a\", \"b\"]);\n expect(getRunEnd()).toMatchObject({ ok: false, total: 3, passed: 1, failed: 1 });\n });\n\n it(\"stops at the first failed scenario when failFast is true\", async () => {\n const { reporter, ended } = recorder();\n\n await expect(runFromMetadata({ scenarios, reporter, failFast: true })).rejects.toThrow();\n\n expect(ended.map((e) => e.id)).toEqual([\"a\", \"b\"]);\n });\n\n it(\"runs every scenario when failFast is false, then still fails the run\", async () => {\n const { reporter, ended, getRunEnd } = recorder();\n\n await expect(runFromMetadata({ scenarios, reporter, failFast: false })).rejects.toThrow();\n\n expect(ended).toEqual([\n { id: \"a\", ok: true },\n { id: \"b\", ok: false },\n { id: \"c\", ok: true },\n ]);\n expect(getRunEnd()).toMatchObject({ ok: false, total: 3, passed: 2, failed: 1 });\n });\n\n it(\"rethrows the first failure when several scenarios fail\", async () => {\n const { reporter, getRunEnd } = recorder();\n const many = [scenario(\"a\", false), scenario(\"b\", true), scenario(\"c\", false)];\n\n await expect(runFromMetadata({ scenarios: many, reporter, failFast: false })).rejects.toThrow();\n\n expect(getRunEnd()).toMatchObject({ ok: false, total: 3, passed: 1, failed: 2 });\n });\n\n it(\"does not throw when failFast is false and everything passes\", async () => {\n const { reporter, getRunEnd } = recorder();\n\n await runFromMetadata({ scenarios: [scenario(\"a\", true), scenario(\"b\", true)], reporter, failFast: false });\n\n expect(getRunEnd()).toMatchObject({ ok: true, total: 2, passed: 2, failed: 0 });\n });\n});\n\ntype Event =\n | { type: \"end\"; id: string; ok: boolean; error?: string }\n | { type: \"skip\"; id: string; dependency: string }\n | { type: \"run\"; args: RunEndArgs };\n\nfunction recordingReporter(events: Event[]): Reporter {\n return {\n onScenarioStart() {},\n onScenarioEnd(scenario: ScenarioSpec, result: ScenarioResult) {\n events.push({ type: \"end\", id: scenario.id, ok: result.ok, error: result.error ? String(result.error) : undefined });\n },\n onScenarioSkipped(scenario: ScenarioSpec, info: ScenarioSkipInfo) {\n events.push({ type: \"skip\", id: scenario.id, dependency: info.dependency });\n },\n onStepStart() {},\n onStepEnd() {},\n onRunEnd(args: RunEndArgs) {\n events.push({ type: \"run\", args });\n },\n };\n}\n\nconst pass = (id: string, extra: Partial<ScenarioSpec> = {}): ScenarioSpec => ({\n id,\n type: \"api\",\n steps: [{ op: \"assert.equals\", with: { actual: 1, expected: 1 } }],\n ...extra,\n});\nconst fail = (id: string, extra: Partial<ScenarioSpec> = {}): ScenarioSpec => ({\n id,\n type: \"api\",\n steps: [{ op: \"assert.equals\", with: { actual: 1, expected: 2 } }],\n ...extra,\n});\n\ndescribe(\"runFromMetadata without dependencies\", () => {\n it(\"still stops at the first failure\", async () => {\n const events: Event[] = [];\n await expect(\n runFromMetadata({ scenarios: [pass(\"a\"), fail(\"b\"), pass(\"c\")], reporter: recordingReporter(events) }),\n ).rejects.toThrow(/Expected values to be equal/);\n expect(events.filter((e) => e.type === \"end\").map((e) => (e as any).id)).toEqual([\"a\", \"b\"]);\n const run = events.find((e) => e.type === \"run\") as { args: RunEndArgs };\n expect(run.args).toMatchObject({ ok: false, passed: 1, failed: 1 });\n expect(run.args.skipped).toBeUndefined();\n });\n});\n\ndescribe(\"runFromMetadata with dependsOn\", () => {\n it(\"stops at the first failure by default, like a run without dependencies\", async () => {\n const events: Event[] = [];\n await expect(\n runFromMetadata({\n scenarios: [pass(\"login\"), pass(\"a\", { dependsOn: [\"login\"] }), fail(\"b\", { dependsOn: [\"login\"] }), pass(\"c\", { dependsOn: [\"login\"] })],\n reporter: recordingReporter(events),\n }),\n ).rejects.toThrow(/Expected values to be equal/);\n expect(events.filter((e) => e.type !== \"run\").map((e) => `${e.type}:${(e as any).id}`)).toEqual([\"end:login\", \"end:a\", \"end:b\"]);\n const run = events.find((e) => e.type === \"run\") as { args: RunEndArgs };\n expect(run.args).toMatchObject({ ok: false, total: 4, passed: 2, failed: 1, skipped: 0 });\n });\n\n it(\"with failFast off, skips dependents of a failure and keeps running independent scenarios\", async () => {\n const events: Event[] = [];\n await expect(\n runFromMetadata({\n scenarios: [\n fail(\"setup\"),\n pass(\"child\", { dependsOn: [\"setup\"] }),\n pass(\"grandchild\", { dependsOn: [\"child\"] }),\n pass(\"independent\"),\n ],\n reporter: recordingReporter(events),\n failFast: false,\n }),\n ).rejects.toThrow();\n expect(events.filter((e) => e.type !== \"run\")).toEqual([\n expect.objectContaining({ type: \"end\", id: \"setup\", ok: false }),\n { type: \"skip\", id: \"child\", dependency: \"setup\" },\n { type: \"skip\", id: \"grandchild\", dependency: \"child\" },\n expect.objectContaining({ type: \"end\", id: \"independent\", ok: true }),\n ]);\n const run = events.find((e) => e.type === \"run\") as { args: RunEndArgs };\n expect(run.args).toMatchObject({ ok: false, total: 4, passed: 1, failed: 1, skipped: 2 });\n });\n\n it(\"runs a selected scenario's dependencies first\", async () => {\n const events: Event[] = [];\n await runFromMetadata({\n scenarios: [pass(\"child\", { dependsOn: [\"parent\"] }), pass(\"parent\"), pass(\"unrelated\")],\n scenarioIds: [\"child\"],\n reporter: recordingReporter(events),\n });\n expect(events.filter((e) => e.type === \"end\").map((e) => (e as any).id)).toEqual([\"parent\", \"child\"]);\n });\n});\n\ndescribe(\"runFromMetadata browser sessions\", () => {\n let server: http.Server;\n let baseUrl: string;\n\n beforeAll(async () => {\n // Shows the stored token, so each scenario can assert which session it got.\n server = http.createServer((_req, res) => {\n res.setHeader(\"content-type\", \"text/html\");\n res.end(`<!doctype html><body>\n <p id=\"who\"></p>\n <button onclick=\"localStorage.setItem('token','t-1');document.getElementById('who').textContent='t-1'\">Sign in</button>\n <script>document.getElementById('who').textContent = localStorage.getItem('token') || 'anonymous'</script>\n </body>`);\n });\n await new Promise<void>((resolve) => server.listen(0, \"127.0.0.1\", resolve));\n baseUrl = `http://127.0.0.1:${(server.address() as AddressInfo).port}`;\n });\n\n afterAll(async () => {\n await new Promise<void>((resolve) => server.close(() => resolve()));\n });\n\n it(\"restores a saved session and gives fresh scenarios an empty one\", async () => {\n const events: Event[] = [];\n const ui = (id: string, extra: Partial<ScenarioSpec>, who: string): ScenarioSpec => ({\n id,\n type: \"ui\",\n steps: [\n { op: \"ui.goto\", with: { url: \"/\" } },\n { op: \"ui.expectText\", with: { selector: \"#who\", equals: who } },\n ],\n ...extra,\n });\n await runFromMetadata({\n scenarios: [\n {\n id: \"login\",\n type: \"ui\",\n saveSession: true,\n steps: [\n { op: \"ui.goto\", with: { url: \"/\" } },\n { op: \"ui.click\", with: { selector: \"text=Sign in\" } },\n { op: \"ui.expectText\", with: { selector: \"#who\", equals: \"t-1\" } },\n ],\n },\n ui(\"fresh\", { session: \"fresh\" }, \"anonymous\"),\n ui(\"restored\", { dependsOn: [\"login\"], session: \"restore\" }, \"t-1\"),\n ],\n ui: { baseUrl, recordVideo: false },\n reporter: recordingReporter(events),\n });\n expect(events.filter((e) => e.type === \"end\")).toEqual([\n expect.objectContaining({ id: \"login\", ok: true }),\n expect.objectContaining({ id: \"fresh\", ok: true }),\n expect.objectContaining({ id: \"restored\", ok: true }),\n ]);\n }, 60_000);\n\n it(\"restoreFrom restores the named scenario's session with no saveSession or dependsOn written\", async () => {\n const events: Event[] = [];\n await runFromMetadata({\n scenarios: [\n {\n id: \"restored\",\n type: \"ui\",\n restoreFrom: \"login\",\n steps: [\n { op: \"ui.goto\", with: { url: \"/\" } },\n { op: \"ui.expectText\", with: { selector: \"#who\", equals: \"t-1\" } },\n ],\n },\n {\n id: \"login\",\n type: \"ui\",\n steps: [\n { op: \"ui.goto\", with: { url: \"/\" } },\n { op: \"ui.click\", with: { selector: \"text=Sign in\" } },\n { op: \"ui.expectText\", with: { selector: \"#who\", equals: \"t-1\" } },\n ],\n },\n ],\n ui: { baseUrl, recordVideo: false },\n reporter: recordingReporter(events),\n });\n expect(events.filter((e) => e.type === \"end\")).toEqual([\n expect.objectContaining({ id: \"login\", ok: true }),\n expect.objectContaining({ id: \"restored\", ok: true }),\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AS,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;wBACrC,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;qBACnE;iBACF;gBACD;oBACE,EAAE,EAAE,OAAO;oBACX,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE;wBACL,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;wBACrC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE;wBACtD,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;qBACnE;iBACF;aACF;YACD,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE;YACnC,QAAQ,EAAE,iBAAiB,CAAC,MAAM,CAAC;SACpC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;YACrD,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;YAClD,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;SACtD,CAAC,CAAC;IACL,CAAC,EAAE,MAAM,CAAC,CAAC;AACb,CAAC,CAAC,CAAC","sourcesContent":["// Purpose: a run stops at the first failed scenario by default; failFast: false runs every\n// scenario and still reports the run as failed. With dependsOn, a failure skips its dependents\n// and the run keeps going; saved browser sessions are restored for dependent scenarios.\n\nimport * as http from \"http\";\nimport type { AddressInfo } from \"net\";\n\nimport type { ScenarioSpec } from \"../contracts/testing-metadata.types\";\nimport type { Reporter, RunEndArgs, ScenarioResult, ScenarioSkipInfo } from \"../reporter/reporter.types\";\nimport { runFromMetadata } from \"./run-from-metadata\";\n\nfunction scenario(id: string, passes: boolean): ScenarioSpec {\n return {\n id,\n type: \"api\",\n steps: [{ op: \"assert.equals\", with: { actual: 1, expected: passes ? 1 : 2 } }],\n };\n}\n\nfunction recorder() {\n const ended: Array<{ id: string; ok: boolean }> = [];\n let runEnd: Parameters<NonNullable<Reporter[\"onRunEnd\"]>>[0] | undefined;\n const reporter: Reporter = {\n onScenarioStart: () => undefined,\n onScenarioEnd: (s, r) => {\n ended.push({ id: s.id, ok: r.ok });\n },\n onStepStart: () => undefined,\n onStepEnd: () => undefined,\n onRunEnd: (r) => {\n runEnd = r;\n },\n };\n return { reporter, ended, getRunEnd: () => runEnd };\n}\n\ndescribe(\"runFromMetadata: failFast\", () => {\n const scenarios = [scenario(\"a\", true), scenario(\"b\", false), scenario(\"c\", true)];\n\n it(\"stops at the first failed scenario by default\", async () => {\n const { reporter, ended, getRunEnd } = recorder();\n\n await expect(runFromMetadata({ scenarios, reporter })).rejects.toThrow();\n\n expect(ended.map((e) => e.id)).toEqual([\"a\", \"b\"]);\n expect(getRunEnd()).toMatchObject({ ok: false, total: 3, passed: 1, failed: 1 });\n });\n\n it(\"stops at the first failed scenario when failFast is true\", async () => {\n const { reporter, ended } = recorder();\n\n await expect(runFromMetadata({ scenarios, reporter, failFast: true })).rejects.toThrow();\n\n expect(ended.map((e) => e.id)).toEqual([\"a\", \"b\"]);\n });\n\n it(\"runs every scenario when failFast is false, then still fails the run\", async () => {\n const { reporter, ended, getRunEnd } = recorder();\n\n await expect(runFromMetadata({ scenarios, reporter, failFast: false })).rejects.toThrow();\n\n expect(ended).toEqual([\n { id: \"a\", ok: true },\n { id: \"b\", ok: false },\n { id: \"c\", ok: true },\n ]);\n expect(getRunEnd()).toMatchObject({ ok: false, total: 3, passed: 2, failed: 1 });\n });\n\n it(\"rethrows the first failure when several scenarios fail\", async () => {\n const { reporter, getRunEnd } = recorder();\n const many = [scenario(\"a\", false), scenario(\"b\", true), scenario(\"c\", false)];\n\n await expect(runFromMetadata({ scenarios: many, reporter, failFast: false })).rejects.toThrow();\n\n expect(getRunEnd()).toMatchObject({ ok: false, total: 3, passed: 1, failed: 2 });\n });\n\n it(\"does not throw when failFast is false and everything passes\", async () => {\n const { reporter, getRunEnd } = recorder();\n\n await runFromMetadata({ scenarios: [scenario(\"a\", true), scenario(\"b\", true)], reporter, failFast: false });\n\n expect(getRunEnd()).toMatchObject({ ok: true, total: 2, passed: 2, failed: 0 });\n });\n});\n\ntype Event =\n | { type: \"end\"; id: string; ok: boolean; error?: string }\n | { type: \"skip\"; id: string; dependency: string }\n | { type: \"run\"; args: RunEndArgs };\n\nfunction recordingReporter(events: Event[]): Reporter {\n return {\n onScenarioStart() {},\n onScenarioEnd(scenario: ScenarioSpec, result: ScenarioResult) {\n events.push({ type: \"end\", id: scenario.id, ok: result.ok, error: result.error ? String(result.error) : undefined });\n },\n onScenarioSkipped(scenario: ScenarioSpec, info: ScenarioSkipInfo) {\n events.push({ type: \"skip\", id: scenario.id, dependency: info.dependency });\n },\n onStepStart() {},\n onStepEnd() {},\n onRunEnd(args: RunEndArgs) {\n events.push({ type: \"run\", args });\n },\n };\n}\n\nconst pass = (id: string, extra: Partial<ScenarioSpec> = {}): ScenarioSpec => ({\n id,\n type: \"api\",\n steps: [{ op: \"assert.equals\", with: { actual: 1, expected: 1 } }],\n ...extra,\n});\nconst fail = (id: string, extra: Partial<ScenarioSpec> = {}): ScenarioSpec => ({\n id,\n type: \"api\",\n steps: [{ op: \"assert.equals\", with: { actual: 1, expected: 2 } }],\n ...extra,\n});\n\ndescribe(\"runFromMetadata without dependencies\", () => {\n it(\"still stops at the first failure\", async () => {\n const events: Event[] = [];\n await expect(\n runFromMetadata({ scenarios: [pass(\"a\"), fail(\"b\"), pass(\"c\")], reporter: recordingReporter(events) }),\n ).rejects.toThrow(/Expected values to be equal/);\n expect(events.filter((e) => e.type === \"end\").map((e) => (e as any).id)).toEqual([\"a\", \"b\"]);\n const run = events.find((e) => e.type === \"run\") as { args: RunEndArgs };\n expect(run.args).toMatchObject({ ok: false, passed: 1, failed: 1 });\n expect(run.args.skipped).toBeUndefined();\n });\n});\n\ndescribe(\"runFromMetadata with dependsOn\", () => {\n it(\"stops at the first failure by default, like a run without dependencies\", async () => {\n const events: Event[] = [];\n await expect(\n runFromMetadata({\n scenarios: [pass(\"login\"), pass(\"a\", { dependsOn: [\"login\"] }), fail(\"b\", { dependsOn: [\"login\"] }), pass(\"c\", { dependsOn: [\"login\"] })],\n reporter: recordingReporter(events),\n }),\n ).rejects.toThrow(/Expected values to be equal/);\n expect(events.filter((e) => e.type !== \"run\").map((e) => `${e.type}:${(e as any).id}`)).toEqual([\"end:login\", \"end:a\", \"end:b\"]);\n const run = events.find((e) => e.type === \"run\") as { args: RunEndArgs };\n expect(run.args).toMatchObject({ ok: false, total: 4, passed: 2, failed: 1, skipped: 0 });\n });\n\n it(\"with failFast off, skips dependents of a failure and keeps running independent scenarios\", async () => {\n const events: Event[] = [];\n await expect(\n runFromMetadata({\n scenarios: [\n fail(\"setup\"),\n pass(\"child\", { dependsOn: [\"setup\"] }),\n pass(\"grandchild\", { dependsOn: [\"child\"] }),\n pass(\"independent\"),\n ],\n reporter: recordingReporter(events),\n failFast: false,\n }),\n ).rejects.toThrow();\n expect(events.filter((e) => e.type !== \"run\")).toEqual([\n expect.objectContaining({ type: \"end\", id: \"setup\", ok: false }),\n { type: \"skip\", id: \"child\", dependency: \"setup\" },\n { type: \"skip\", id: \"grandchild\", dependency: \"child\" },\n expect.objectContaining({ type: \"end\", id: \"independent\", ok: true }),\n ]);\n const run = events.find((e) => e.type === \"run\") as { args: RunEndArgs };\n expect(run.args).toMatchObject({ ok: false, total: 4, passed: 1, failed: 1, skipped: 2 });\n });\n\n it(\"fails only a scenario whose restoreFrom names an unknown scenario, skips what needs it, and runs the rest\", async () => {\n const events: Event[] = [];\n await expect(\n runFromMetadata({\n scenarios: [\n pass(\"login\"),\n pass(\"workspace\", { restoreFrom: \"ui-login\" }),\n pass(\"after-workspace\", { dependsOn: [\"workspace\"] }),\n pass(\"other\", { dependsOn: [\"login\"] }),\n ],\n reporter: recordingReporter(events),\n }),\n ).rejects.toThrow(/restores from unknown scenario \"ui-login\"/);\n expect(events.filter((e) => e.type !== \"run\")).toEqual([\n expect.objectContaining({ type: \"end\", id: \"workspace\", ok: false }),\n { type: \"skip\", id: \"after-workspace\", dependency: \"workspace\" },\n expect.objectContaining({ type: \"end\", id: \"login\", ok: true }),\n expect.objectContaining({ type: \"end\", id: \"other\", ok: true }),\n ]);\n const run = events.find((e) => e.type === \"run\") as { args: RunEndArgs };\n expect(run.args).toMatchObject({ ok: false, total: 4, passed: 2, failed: 1, skipped: 1 });\n });\n\n it(\"reports a broken scenario only when the run selected it or something that needs it\", async () => {\n const events: Event[] = [];\n await runFromMetadata({\n scenarios: [pass(\"login\"), pass(\"workspace\", { dependsOn: [\"ghost\"] })],\n scenarioIds: [\"login\"],\n reporter: recordingReporter(events),\n });\n expect(events.filter((e) => e.type !== \"run\").map((e) => `${e.type}:${(e as any).id}`)).toEqual([\"end:login\"]);\n });\n\n it(\"runs a selected scenario's dependencies first\", async () => {\n const events: Event[] = [];\n await runFromMetadata({\n scenarios: [pass(\"child\", { dependsOn: [\"parent\"] }), pass(\"parent\"), pass(\"unrelated\")],\n scenarioIds: [\"child\"],\n reporter: recordingReporter(events),\n });\n expect(events.filter((e) => e.type === \"end\").map((e) => (e as any).id)).toEqual([\"parent\", \"child\"]);\n });\n});\n\ndescribe(\"runFromMetadata browser sessions\", () => {\n let server: http.Server;\n let baseUrl: string;\n\n beforeAll(async () => {\n // Shows the stored token, so each scenario can assert which session it got.\n server = http.createServer((_req, res) => {\n res.setHeader(\"content-type\", \"text/html\");\n res.end(`<!doctype html><body>\n <p id=\"who\"></p>\n <button onclick=\"localStorage.setItem('token','t-1');document.getElementById('who').textContent='t-1'\">Sign in</button>\n <script>document.getElementById('who').textContent = localStorage.getItem('token') || 'anonymous'</script>\n </body>`);\n });\n await new Promise<void>((resolve) => server.listen(0, \"127.0.0.1\", resolve));\n baseUrl = `http://127.0.0.1:${(server.address() as AddressInfo).port}`;\n });\n\n afterAll(async () => {\n await new Promise<void>((resolve) => server.close(() => resolve()));\n });\n\n it(\"restores a saved session and gives fresh scenarios an empty one\", async () => {\n const events: Event[] = [];\n const ui = (id: string, extra: Partial<ScenarioSpec>, who: string): ScenarioSpec => ({\n id,\n type: \"ui\",\n steps: [\n { op: \"ui.goto\", with: { url: \"/\" } },\n { op: \"ui.expectText\", with: { selector: \"#who\", equals: who } },\n ],\n ...extra,\n });\n await runFromMetadata({\n scenarios: [\n {\n id: \"login\",\n type: \"ui\",\n saveSession: true,\n steps: [\n { op: \"ui.goto\", with: { url: \"/\" } },\n { op: \"ui.click\", with: { selector: \"text=Sign in\" } },\n { op: \"ui.expectText\", with: { selector: \"#who\", equals: \"t-1\" } },\n ],\n },\n ui(\"fresh\", { session: \"fresh\" }, \"anonymous\"),\n ui(\"restored\", { dependsOn: [\"login\"], session: \"restore\" }, \"t-1\"),\n ],\n ui: { baseUrl, recordVideo: false },\n reporter: recordingReporter(events),\n });\n expect(events.filter((e) => e.type === \"end\")).toEqual([\n expect.objectContaining({ id: \"login\", ok: true }),\n expect.objectContaining({ id: \"fresh\", ok: true }),\n expect.objectContaining({ id: \"restored\", ok: true }),\n ]);\n }, 60_000);\n\n it(\"restoreFrom restores the named scenario's session with no saveSession or dependsOn written\", async () => {\n const events: Event[] = [];\n await runFromMetadata({\n scenarios: [\n {\n id: \"restored\",\n type: \"ui\",\n restoreFrom: \"login\",\n steps: [\n { op: \"ui.goto\", with: { url: \"/\" } },\n { op: \"ui.expectText\", with: { selector: \"#who\", equals: \"t-1\" } },\n ],\n },\n {\n id: \"login\",\n type: \"ui\",\n steps: [\n { op: \"ui.goto\", with: { url: \"/\" } },\n { op: \"ui.click\", with: { selector: \"text=Sign in\" } },\n { op: \"ui.expectText\", with: { selector: \"#who\", equals: \"t-1\" } },\n ],\n },\n ],\n ui: { baseUrl, recordVideo: false },\n reporter: recordingReporter(events),\n });\n expect(events.filter((e) => e.type === \"end\")).toEqual([\n expect.objectContaining({ id: \"login\", ok: true }),\n expect.objectContaining({ id: \"restored\", ok: true }),\n ]);\n }, 60_000);\n});\n"]}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { ScenarioSpec } from "../contracts/testing-metadata.types";
|
|
2
2
|
export declare function usesDependencies(scenarios: ScenarioSpec[]): boolean;
|
|
3
3
|
export declare function expandRestoreFrom(scenarios: ScenarioSpec[], resetId?: string): ScenarioSpec[];
|
|
4
|
+
export interface UnrunnableScenario {
|
|
5
|
+
scenario: ScenarioSpec;
|
|
6
|
+
error?: string;
|
|
7
|
+
blockedBy?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function splitUnrunnable(scenarios: ScenarioSpec[], resetId?: string): {
|
|
10
|
+
runnable: ScenarioSpec[];
|
|
11
|
+
unrunnable: UnrunnableScenario[];
|
|
12
|
+
};
|
|
4
13
|
export declare function expandWithDependencies(all: ScenarioSpec[], selected: ScenarioSpec[]): ScenarioSpec[];
|
|
5
14
|
export declare function orderByDependencies(scenarios: ScenarioSpec[]): ScenarioSpec[];
|
|
6
15
|
export declare function sessionSourceFor(scenario: ScenarioSpec, byId: Map<string, ScenarioSpec>): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenario-graph.d.ts","sourceRoot":"","sources":["../../../src/testing/runner/scenario-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,OAAO,CAKnE;AASD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"scenario-graph.d.ts","sourceRoot":"","sources":["../../../src/testing/runner/scenario-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,OAAO,CAKnE;AASD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CAe7F;AAmBD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,wBAAgB,eAAe,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IAAC,UAAU,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAsB3I;AAWD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAkBpG;AAMD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA0B7E;AAOD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,MAAM,GAAG,SAAS,CAc5G;AAMD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,IAAI,CAahE"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usesDependencies = usesDependencies;
|
|
4
4
|
exports.expandRestoreFrom = expandRestoreFrom;
|
|
5
|
+
exports.splitUnrunnable = splitUnrunnable;
|
|
5
6
|
exports.expandWithDependencies = expandWithDependencies;
|
|
6
7
|
exports.orderByDependencies = orderByDependencies;
|
|
7
8
|
exports.sessionSourceFor = sessionSourceFor;
|
|
@@ -15,20 +16,10 @@ function expandRestoreFrom(scenarios, resetId) {
|
|
|
15
16
|
const expanded = scenarios.map((scenario) => {
|
|
16
17
|
if (scenario.restoreFrom === undefined)
|
|
17
18
|
return scenario;
|
|
19
|
+
const problem = restoreFromProblem(scenario, byId, resetId);
|
|
20
|
+
if (problem)
|
|
21
|
+
throw new Error(problem);
|
|
18
22
|
const source = scenario.restoreFrom;
|
|
19
|
-
if (typeof source !== "string" || !source.trim()) {
|
|
20
|
-
throw new Error(`Scenario "${scenario.id}" has an invalid restoreFrom (expected one scenario id)`);
|
|
21
|
-
}
|
|
22
|
-
if (source === scenario.id)
|
|
23
|
-
throw new Error(`Scenario "${scenario.id}" cannot restoreFrom itself`);
|
|
24
|
-
if (resetId !== undefined && source === resetId) {
|
|
25
|
-
throw new Error(`Scenario "${scenario.id}" restores from the reset scenario "${source}", which only runs as setup`);
|
|
26
|
-
}
|
|
27
|
-
if (!byId.has(source))
|
|
28
|
-
throw new Error(`Scenario "${scenario.id}" restores from unknown scenario "${source}"`);
|
|
29
|
-
if (scenario.session !== undefined && scenario.session !== "restore") {
|
|
30
|
-
throw new Error(`Scenario "${scenario.id}" has restoreFrom, which means session "restore", but its session is "${String(scenario.session)}"`);
|
|
31
|
-
}
|
|
32
23
|
sources.add(source);
|
|
33
24
|
const others = dependenciesOf(scenario).filter((id) => id !== source);
|
|
34
25
|
const before = dependenciesOf(scenario);
|
|
@@ -37,6 +28,49 @@ function expandRestoreFrom(scenarios, resetId) {
|
|
|
37
28
|
});
|
|
38
29
|
return expanded.map((scenario) => (sources.has(scenario.id) && !scenario.saveSession ? { ...scenario, saveSession: true } : scenario));
|
|
39
30
|
}
|
|
31
|
+
function restoreFromProblem(scenario, byId, resetId) {
|
|
32
|
+
const source = scenario.restoreFrom;
|
|
33
|
+
if (source === undefined)
|
|
34
|
+
return undefined;
|
|
35
|
+
if (typeof source !== "string" || !source.trim())
|
|
36
|
+
return `Scenario "${scenario.id}" has an invalid restoreFrom (expected one scenario id)`;
|
|
37
|
+
if (source === scenario.id)
|
|
38
|
+
return `Scenario "${scenario.id}" cannot restoreFrom itself`;
|
|
39
|
+
if (resetId !== undefined && source === resetId) {
|
|
40
|
+
return `Scenario "${scenario.id}" restores from the reset scenario "${source}", which only runs as setup`;
|
|
41
|
+
}
|
|
42
|
+
if (!byId.has(source))
|
|
43
|
+
return `Scenario "${scenario.id}" restores from unknown scenario "${source}"`;
|
|
44
|
+
if (scenario.session !== undefined && scenario.session !== "restore") {
|
|
45
|
+
return `Scenario "${scenario.id}" has restoreFrom, which means session "restore", but its session is "${String(scenario.session)}"`;
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
function splitUnrunnable(scenarios, resetId) {
|
|
50
|
+
const byId = new Map(scenarios.map((s) => [s.id, s]));
|
|
51
|
+
const unrunnable = new Map();
|
|
52
|
+
for (const scenario of scenarios) {
|
|
53
|
+
const unknownDep = dependenciesOf(scenario).find((id) => !byId.has(id));
|
|
54
|
+
const error = restoreFromProblem(scenario, byId, resetId)
|
|
55
|
+
?? (unknownDep !== undefined ? `Scenario "${scenario.id}" depends on unknown scenario "${unknownDep}"` : undefined);
|
|
56
|
+
if (error)
|
|
57
|
+
unrunnable.set(scenario.id, { scenario, error });
|
|
58
|
+
}
|
|
59
|
+
for (let grew = unrunnable.size > 0; grew;) {
|
|
60
|
+
grew = false;
|
|
61
|
+
for (const scenario of scenarios) {
|
|
62
|
+
if (unrunnable.has(scenario.id))
|
|
63
|
+
continue;
|
|
64
|
+
const needs = [...dependenciesOf(scenario), ...(typeof scenario.restoreFrom === "string" ? [scenario.restoreFrom] : [])];
|
|
65
|
+
const blockedBy = needs.find((id) => unrunnable.has(id));
|
|
66
|
+
if (blockedBy !== undefined) {
|
|
67
|
+
unrunnable.set(scenario.id, { scenario, blockedBy });
|
|
68
|
+
grew = true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { runnable: scenarios.filter((s) => !unrunnable.has(s.id)), unrunnable: [...unrunnable.values()] };
|
|
73
|
+
}
|
|
40
74
|
function dependenciesOf(scenario) {
|
|
41
75
|
return Array.isArray(scenario.dependsOn) ? scenario.dependsOn.map(String) : [];
|
|
42
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenario-graph.js","sourceRoot":"","sources":["../../../src/testing/runner/scenario-graph.ts"],"names":[],"mappings":";;AAEA,4CAKC;AASD,8CAwBC;AAWD,wDAkBC;AAMD,kDA0BC;AAOD,4CAcC;AAMD,4CAaC;AA3ID,SAAgB,gBAAgB,CAAC,SAAyB;IACxD,OAAO,SAAS,CAAC,IAAI,CACnB,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CACpI,CAAC;AACJ,CAAC;AASD,SAAgB,iBAAiB,CAAC,SAAyB,EAAE,OAAgB;IAC3E,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC1C,IAAI,QAAQ,CAAC,WAAW,KAAK,SAAS;YAAE,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QACzB,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,IAAI,GAAG,CAAC,WAAW;YAAE,OAAO,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAMD,SAAgB,gBAAgB,CAAC,SAAyB;IACxD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC;QAC9B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACtF,MAAM,IAAI,KAAK,CAAC,aAAa,QAAQ,CAAC,EAAE,0BAA0B,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QACzH,CAAC;QACD,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CACb,aAAa,QAAQ,CAAC,EAAE,wEAAwE,CACjG,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { ScenarioSpec } from \"../contracts/testing-metadata.types\";\n\nexport function usesDependencies(scenarios: ScenarioSpec[]): boolean {\n return scenarios.some(\n (s) =>\n (Array.isArray(s.dependsOn) && s.dependsOn.length > 0) || s.restoreFrom || s.saveSession || (s.session && s.session !== \"shared\"),\n );\n}\n\n/**\n * Turns `restoreFrom` into the fields the rest of the runner already understands, once, before anything else reads the file:\n * a scenario with `restoreFrom: X` gets X first in its `dependsOn` and `session: \"restore\"`, and X gets `saveSession: true`.\n * Everything downstream (ordering, cycle checks, pulling a dependency in past a tag filter, saving and restoring a session)\n * then works unchanged. Returns copies; the input is not modified. Throws, before any scenario runs, when X does not exist,\n * is the scenario itself or the reset scenario, or when `session` is set to something other than \"restore\".\n */\nexport function expandRestoreFrom(scenarios: ScenarioSpec[], resetId?: string): ScenarioSpec[] {\n const byId = new Map(scenarios.map((s) => [s.id, s]));\n const sources = new Set<string>();\n const expanded = scenarios.map((scenario) => {\n if (scenario.restoreFrom === undefined) return scenario;\n const source = scenario.restoreFrom;\n if (typeof source !== \"string\" || !source.trim()) {\n throw new Error(`Scenario \"${scenario.id}\" has an invalid restoreFrom (expected one scenario id)`);\n }\n if (source === scenario.id) throw new Error(`Scenario \"${scenario.id}\" cannot restoreFrom itself`);\n if (resetId !== undefined && source === resetId) {\n throw new Error(`Scenario \"${scenario.id}\" restores from the reset scenario \"${source}\", which only runs as setup`);\n }\n if (!byId.has(source)) throw new Error(`Scenario \"${scenario.id}\" restores from unknown scenario \"${source}\"`);\n if (scenario.session !== undefined && scenario.session !== \"restore\") {\n throw new Error(`Scenario \"${scenario.id}\" has restoreFrom, which means session \"restore\", but its session is \"${String(scenario.session)}\"`);\n }\n sources.add(source);\n const others = dependenciesOf(scenario).filter((id) => id !== source);\n const before = dependenciesOf(scenario);\n const dependsOn = before.includes(source) ? before : [source, ...others];\n return { ...scenario, dependsOn, session: \"restore\" as const };\n });\n return expanded.map((scenario) => (sources.has(scenario.id) && !scenario.saveSession ? { ...scenario, saveSession: true } : scenario));\n}\n\nfunction dependenciesOf(scenario: ScenarioSpec): string[] {\n return Array.isArray(scenario.dependsOn) ? scenario.dependsOn.map(String) : [];\n}\n\n/**\n * Add every transitive `dependsOn` of `selected`, taken from `all`. A dependency is\n * pulled in even when the tag filter or skip list excluded it, because the dependent\n * cannot run without it. Throws on a dependency id that does not exist.\n */\nexport function expandWithDependencies(all: ScenarioSpec[], selected: ScenarioSpec[]): ScenarioSpec[] {\n const byId = new Map(all.map((s) => [s.id, s]));\n const included = new Set(selected.map((s) => s.id));\n const queue = [...selected];\n while (queue.length) {\n const scenario = queue.shift()!;\n for (const depId of dependenciesOf(scenario)) {\n const dep = byId.get(depId);\n if (!dep) {\n throw new Error(`Scenario \"${scenario.id}\" depends on unknown scenario \"${depId}\"`);\n }\n if (!included.has(depId)) {\n included.add(depId);\n queue.push(dep);\n }\n }\n }\n return all.filter((s) => included.has(s.id));\n}\n\n/**\n * Order scenarios so each runs after its dependencies, otherwise keeping file order.\n * Throws on an unknown dependency or a cycle, naming the scenarios involved.\n */\nexport function orderByDependencies(scenarios: ScenarioSpec[]): ScenarioSpec[] {\n const byId = new Map(scenarios.map((s) => [s.id, s]));\n const ordered: ScenarioSpec[] = [];\n const state = new Map<string, \"visiting\" | \"done\">();\n\n const visit = (scenario: ScenarioSpec, trail: string[]) => {\n const mark = state.get(scenario.id);\n if (mark === \"done\") return;\n if (mark === \"visiting\") {\n const cycle = [...trail.slice(trail.indexOf(scenario.id)), scenario.id];\n throw new Error(`Scenario dependency cycle: ${cycle.join(\" → \")}`);\n }\n state.set(scenario.id, \"visiting\");\n for (const depId of dependenciesOf(scenario)) {\n const dep = byId.get(depId);\n if (!dep) {\n throw new Error(`Scenario \"${scenario.id}\" depends on \"${depId}\", which is not in this run`);\n }\n visit(dep, [...trail, scenario.id]);\n }\n state.set(scenario.id, \"done\");\n ordered.push(scenario);\n };\n\n for (const scenario of scenarios) visit(scenario, []);\n return ordered;\n}\n\n/**\n * The dependency whose saved session a `session: restore` scenario starts from: the one\n * `restoreFrom` names, otherwise the nearest one (direct dependencies first, in declared order, then theirs) that sets\n * `saveSession`.\n */\nexport function sessionSourceFor(scenario: ScenarioSpec, byId: Map<string, ScenarioSpec>): string | undefined {\n if (scenario.restoreFrom) return scenario.restoreFrom;\n const seen = new Set<string>();\n const queue = dependenciesOf(scenario);\n while (queue.length) {\n const id = queue.shift()!;\n if (seen.has(id)) continue;\n seen.add(id);\n const dep = byId.get(id);\n if (!dep) continue;\n if (dep.saveSession) return id;\n queue.push(...dependenciesOf(dep));\n }\n return undefined;\n}\n\n/**\n * Check the session settings before anything runs, so a misconfigured scenario fails\n * the run up front rather than midway.\n */\nexport function validateSessions(scenarios: ScenarioSpec[]): void {\n const byId = new Map(scenarios.map((s) => [s.id, s]));\n for (const scenario of scenarios) {\n const mode = scenario.session;\n if (mode !== undefined && mode !== \"shared\" && mode !== \"restore\" && mode !== \"fresh\") {\n throw new Error(`Scenario \"${scenario.id}\" has invalid session \"${String(mode)}\" (expected shared, restore or fresh)`);\n }\n if (mode === \"restore\" && !sessionSourceFor(scenario, byId)) {\n throw new Error(\n `Scenario \"${scenario.id}\" uses session \"restore\" but none of its dependencies sets saveSession`,\n );\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"scenario-graph.js","sourceRoot":"","sources":["../../../src/testing/runner/scenario-graph.ts"],"names":[],"mappings":";;AAEA,4CAKC;AASD,8CAeC;AA8BD,0CAsBC;AAWD,wDAkBC;AAMD,kDA0BC;AAOD,4CAcC;AAMD,4CAaC;AAtLD,SAAgB,gBAAgB,CAAC,SAAyB;IACxD,OAAO,SAAS,CAAC,IAAI,CACnB,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CACpI,CAAC;AACJ,CAAC;AASD,SAAgB,iBAAiB,CAAC,SAAyB,EAAE,OAAgB;IAC3E,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;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AAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC;QAC9B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACtF,MAAM,IAAI,KAAK,CAAC,aAAa,QAAQ,CAAC,EAAE,0BAA0B,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QACzH,CAAC;QACD,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CACb,aAAa,QAAQ,CAAC,EAAE,wEAAwE,CACjG,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { ScenarioSpec } from \"../contracts/testing-metadata.types\";\n\nexport function usesDependencies(scenarios: ScenarioSpec[]): boolean {\n return scenarios.some(\n (s) =>\n (Array.isArray(s.dependsOn) && s.dependsOn.length > 0) || s.restoreFrom || s.saveSession || (s.session && s.session !== \"shared\"),\n );\n}\n\n/**\n * Turns `restoreFrom` into the fields the rest of the runner already understands, once, before anything else reads the file:\n * a scenario with `restoreFrom: X` gets X first in its `dependsOn` and `session: \"restore\"`, and X gets `saveSession: true`.\n * Everything downstream (ordering, cycle checks, pulling a dependency in past a tag filter, saving and restoring a session)\n * then works unchanged. Returns copies; the input is not modified. Throws, before any scenario runs, when X does not exist,\n * is the scenario itself or the reset scenario, or when `session` is set to something other than \"restore\".\n */\nexport function expandRestoreFrom(scenarios: ScenarioSpec[], resetId?: string): ScenarioSpec[] {\n const byId = new Map(scenarios.map((s) => [s.id, s]));\n const sources = new Set<string>();\n const expanded = scenarios.map((scenario) => {\n if (scenario.restoreFrom === undefined) return scenario;\n const problem = restoreFromProblem(scenario, byId, resetId);\n if (problem) throw new Error(problem);\n const source = scenario.restoreFrom as string;\n sources.add(source);\n const others = dependenciesOf(scenario).filter((id) => id !== source);\n const before = dependenciesOf(scenario);\n const dependsOn = before.includes(source) ? before : [source, ...others];\n return { ...scenario, dependsOn, session: \"restore\" as const };\n });\n return expanded.map((scenario) => (sources.has(scenario.id) && !scenario.saveSession ? { ...scenario, saveSession: true } : scenario));\n}\n\n/** What is wrong with a scenario's `restoreFrom`, or undefined when it names another scenario it can restore from. */\nfunction restoreFromProblem(scenario: ScenarioSpec, byId: Map<string, ScenarioSpec>, resetId?: string): string | undefined {\n const source = scenario.restoreFrom;\n if (source === undefined) return undefined;\n if (typeof source !== \"string\" || !source.trim()) return `Scenario \"${scenario.id}\" has an invalid restoreFrom (expected one scenario id)`;\n if (source === scenario.id) return `Scenario \"${scenario.id}\" cannot restoreFrom itself`;\n if (resetId !== undefined && source === resetId) {\n return `Scenario \"${scenario.id}\" restores from the reset scenario \"${source}\", which only runs as setup`;\n }\n if (!byId.has(source)) return `Scenario \"${scenario.id}\" restores from unknown scenario \"${source}\"`;\n if (scenario.session !== undefined && scenario.session !== \"restore\") {\n return `Scenario \"${scenario.id}\" has restoreFrom, which means session \"restore\", but its session is \"${String(scenario.session)}\"`;\n }\n return undefined;\n}\n\n/** A scenario that cannot run in this run: its own reference is broken (`error`), or one it needs cannot run (`blockedBy`). */\nexport interface UnrunnableScenario {\n scenario: ScenarioSpec;\n error?: string;\n blockedBy?: string;\n}\n\n/**\n * Sets aside the scenarios whose `restoreFrom` or `dependsOn` cannot be met — one naming a scenario that does not exist,\n * itself, or the reset scenario — and, transitively, the scenarios that need them. A mistake in one scenario then fails\n * that scenario instead of stopping the whole run before anything starts; the rest run as usual.\n */\nexport function splitUnrunnable(scenarios: ScenarioSpec[], resetId?: string): { runnable: ScenarioSpec[]; unrunnable: UnrunnableScenario[] } {\n const byId = new Map(scenarios.map((s) => [s.id, s]));\n const unrunnable = new Map<string, UnrunnableScenario>();\n for (const scenario of scenarios) {\n const unknownDep = dependenciesOf(scenario).find((id) => !byId.has(id));\n const error = restoreFromProblem(scenario, byId, resetId)\n ?? (unknownDep !== undefined ? `Scenario \"${scenario.id}\" depends on unknown scenario \"${unknownDep}\"` : undefined);\n if (error) unrunnable.set(scenario.id, { scenario, error });\n }\n for (let grew = unrunnable.size > 0; grew; ) {\n grew = false;\n for (const scenario of scenarios) {\n if (unrunnable.has(scenario.id)) continue;\n const needs = [...dependenciesOf(scenario), ...(typeof scenario.restoreFrom === \"string\" ? [scenario.restoreFrom] : [])];\n const blockedBy = needs.find((id) => unrunnable.has(id));\n if (blockedBy !== undefined) {\n unrunnable.set(scenario.id, { scenario, blockedBy });\n grew = true;\n }\n }\n }\n return { runnable: scenarios.filter((s) => !unrunnable.has(s.id)), unrunnable: [...unrunnable.values()] };\n}\n\nfunction dependenciesOf(scenario: ScenarioSpec): string[] {\n return Array.isArray(scenario.dependsOn) ? scenario.dependsOn.map(String) : [];\n}\n\n/**\n * Add every transitive `dependsOn` of `selected`, taken from `all`. A dependency is\n * pulled in even when the tag filter or skip list excluded it, because the dependent\n * cannot run without it. Throws on a dependency id that does not exist.\n */\nexport function expandWithDependencies(all: ScenarioSpec[], selected: ScenarioSpec[]): ScenarioSpec[] {\n const byId = new Map(all.map((s) => [s.id, s]));\n const included = new Set(selected.map((s) => s.id));\n const queue = [...selected];\n while (queue.length) {\n const scenario = queue.shift()!;\n for (const depId of dependenciesOf(scenario)) {\n const dep = byId.get(depId);\n if (!dep) {\n throw new Error(`Scenario \"${scenario.id}\" depends on unknown scenario \"${depId}\"`);\n }\n if (!included.has(depId)) {\n included.add(depId);\n queue.push(dep);\n }\n }\n }\n return all.filter((s) => included.has(s.id));\n}\n\n/**\n * Order scenarios so each runs after its dependencies, otherwise keeping file order.\n * Throws on an unknown dependency or a cycle, naming the scenarios involved.\n */\nexport function orderByDependencies(scenarios: ScenarioSpec[]): ScenarioSpec[] {\n const byId = new Map(scenarios.map((s) => [s.id, s]));\n const ordered: ScenarioSpec[] = [];\n const state = new Map<string, \"visiting\" | \"done\">();\n\n const visit = (scenario: ScenarioSpec, trail: string[]) => {\n const mark = state.get(scenario.id);\n if (mark === \"done\") return;\n if (mark === \"visiting\") {\n const cycle = [...trail.slice(trail.indexOf(scenario.id)), scenario.id];\n throw new Error(`Scenario dependency cycle: ${cycle.join(\" → \")}`);\n }\n state.set(scenario.id, \"visiting\");\n for (const depId of dependenciesOf(scenario)) {\n const dep = byId.get(depId);\n if (!dep) {\n throw new Error(`Scenario \"${scenario.id}\" depends on \"${depId}\", which is not in this run`);\n }\n visit(dep, [...trail, scenario.id]);\n }\n state.set(scenario.id, \"done\");\n ordered.push(scenario);\n };\n\n for (const scenario of scenarios) visit(scenario, []);\n return ordered;\n}\n\n/**\n * The dependency whose saved session a `session: restore` scenario starts from: the one\n * `restoreFrom` names, otherwise the nearest one (direct dependencies first, in declared order, then theirs) that sets\n * `saveSession`.\n */\nexport function sessionSourceFor(scenario: ScenarioSpec, byId: Map<string, ScenarioSpec>): string | undefined {\n if (scenario.restoreFrom) return scenario.restoreFrom;\n const seen = new Set<string>();\n const queue = dependenciesOf(scenario);\n while (queue.length) {\n const id = queue.shift()!;\n if (seen.has(id)) continue;\n seen.add(id);\n const dep = byId.get(id);\n if (!dep) continue;\n if (dep.saveSession) return id;\n queue.push(...dependenciesOf(dep));\n }\n return undefined;\n}\n\n/**\n * Check the session settings before anything runs, so a misconfigured scenario fails\n * the run up front rather than midway.\n */\nexport function validateSessions(scenarios: ScenarioSpec[]): void {\n const byId = new Map(scenarios.map((s) => [s.id, s]));\n for (const scenario of scenarios) {\n const mode = scenario.session;\n if (mode !== undefined && mode !== \"shared\" && mode !== \"restore\" && mode !== \"fresh\") {\n throw new Error(`Scenario \"${scenario.id}\" has invalid session \"${String(mode)}\" (expected shared, restore or fresh)`);\n }\n if (mode === \"restore\" && !sessionSourceFor(scenario, byId)) {\n throw new Error(\n `Scenario \"${scenario.id}\" uses session \"restore\" but none of its dependencies sets saveSession`,\n );\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/ui/navigation.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"navigation.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/ui/navigation.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAgBxD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAmGpE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerNavigationSteps = registerNavigationSteps;
|
|
4
|
+
const step_data_1 = require("../../core/step-data");
|
|
4
5
|
function requirePage(ctx, op) {
|
|
5
6
|
if (!ctx.ui || !ctx.ui.page) {
|
|
6
7
|
throw new Error(`Missing UI page on context for op "${op}"`);
|
|
@@ -72,7 +73,9 @@ function registerNavigationSteps(registry) {
|
|
|
72
73
|
if (!m) {
|
|
73
74
|
throw new Error(`ui.storeText: regex "${input.match}" found no match in text "${text.slice(0, 120)}"`);
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
+
const value = m[1] !== undefined ? m[1] : m[0];
|
|
77
|
+
(0, step_data_1.recordStepData)(ctx, { kind: "match", source: `match:${input.match}`, value, ...(step.saveAs ? { saveAs: step.saveAs } : {}) });
|
|
78
|
+
return value;
|
|
76
79
|
}
|
|
77
80
|
return text;
|
|
78
81
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/ui/navigation.step.ts"],"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\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\nimport { recordStepData } from \"../../core/step-data\";\n\ntype GotoInput = { url: string; timeoutMs?: number };\ntype ExpectUrlInput = { equals?: string; contains?: string; timeoutMs?: number };\ntype NewTabInput = { url?: string; timeoutMs?: number };\ntype SwitchTabInput = { index: number };\ntype StoreTextInput = { selector: string; match?: string; timeoutMs?: number; readValue?: boolean };\n\nfunction requirePage(ctx: TestContext, op: string) {\n if (!ctx.ui || !ctx.ui.page) {\n throw new Error(`Missing UI page on context for op \"${op}\"`);\n }\n return ctx.ui.page;\n}\n\nexport function registerNavigationSteps(registry: StepRegistry): void {\n registry.register(\"ui.goto\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.goto\");\n const input = (step.with ?? {}) as GotoInput;\n if (!input.url) {\n throw new Error('Missing \"url\" in step.with for op \"ui.goto\"');\n }\n const url = ctx.ui?.resolveUrl(input.url) ?? input.url;\n await page.goto(url, {\n timeout: ctx.ui?.resolveNavigationTimeout(input.timeoutMs),\n });\n });\n\n registry.register(\"ui.expectUrl\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.expectUrl\");\n const input = (step.with ?? {}) as ExpectUrlInput;\n\n if (input.equals === undefined && input.contains === undefined) {\n throw new Error(\n 'Missing \"equals\" or \"contains\" in step.with for op \"ui.expectUrl\"',\n );\n }\n\n const expectation =\n input.equals !== undefined\n ? `equal \"${input.equals}\"`\n : `contain \"${input.contains}\"`;\n\n // Waits for the URL rather than sampling it, so an assertion placed straight\n // after a click does not race the navigation.\n try {\n await page.waitForURL(\n (url) =>\n input.equals !== undefined\n ? url.toString() === input.equals\n : url.toString().includes(String(input.contains)),\n { timeout: ctx.ui?.resolveNavigationTimeout(input.timeoutMs) },\n );\n } catch {\n throw new Error(\n `Expected URL to ${expectation} but got \"${page.url()}\"`,\n );\n }\n });\n\n // Open a new tab (optionally navigating it) and make it the active page. The\n // previous tab stays alive on the context, so a long-running SPA flow is not\n // destroyed while we visit another site (e.g. to read an OTP).\n registry.register(\"ui.newTab\", async (ctx: TestContext, step: OpStep) => {\n if (!ctx.ui) throw new Error('Missing UI adapter on context for op \"ui.newTab\"');\n const input = (step.with ?? {}) as NewTabInput;\n await ctx.ui.openTab(input.url, input.timeoutMs);\n });\n\n // Switch the active tab. `index` 0 is the first/original (onboarding) tab.\n registry.register(\"ui.switchTab\", async (ctx: TestContext, step: OpStep) => {\n if (!ctx.ui) throw new Error('Missing UI adapter on context for op \"ui.switchTab\"');\n const input = (step.with ?? {}) as SwitchTabInput;\n if (input.index === undefined || input.index === null) {\n throw new Error('Missing \"index\" in step.with for op \"ui.switchTab\"');\n }\n ctx.ui.switchTab(Number(input.index));\n });\n\n // Close the active tab and make the first remaining tab active. Never closes\n // the last tab. Use after reading data from a secondary tab (e.g. the OTP portal).\n registry.register(\"ui.closeTab\", async (ctx: TestContext) => {\n if (!ctx.ui) throw new Error('Missing UI adapter on context for op \"ui.closeTab\"');\n await ctx.ui.closeTab();\n });\n\n // Read a selector's visible text and RETURN it, so `saveAs` can capture it into\n // ${res:...}. With `match`, returns capture group 1 (else the whole match) of the\n // regex applied to the text — e.g. pull a 4-digit OTP out of an SMS row.\n registry.register(\"ui.storeText\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.storeText\");\n const input = (step.with ?? {}) as StoreTextInput;\n if (!input.selector) {\n throw new Error('Missing \"selector\" in step.with for op \"ui.storeText\"');\n }\n // `readValue: true` reads an <input>/<textarea>/<select> current value via\n // inputValue() instead of innerText() — innerText is empty for form controls.\n const loc = page.locator(input.selector).first();\n const text = input.readValue\n ? await loc.inputValue({ timeout: ctx.ui?.resolveTimeout(input.timeoutMs) })\n : await loc.innerText({ timeout: ctx.ui?.resolveTimeout(input.timeoutMs) });\n if (input.match) {\n const m = text.match(new RegExp(input.match));\n if (!m) {\n throw new Error(\n `ui.storeText: regex \"${input.match}\" found no match in text \"${text.slice(0, 120)}\"`,\n );\n }\n const value = m[1] !== undefined ? m[1] : m[0];\n recordStepData(ctx, { kind: \"match\", source: `match:${input.match}`, value, ...(step.saveAs ? { saveAs: step.saveAs } : {}) });\n return value;\n }\n return text;\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/util/random.step.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"random.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/util/random.step.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQxD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAc/D"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerRandomStep = registerRandomStep;
|
|
4
4
|
const random_data_1 = require("../../core/random-data");
|
|
5
|
+
const step_data_1 = require("../../core/step-data");
|
|
5
6
|
function registerRandomStep(registry) {
|
|
6
7
|
registry.register("util.random", async (ctx, step) => {
|
|
7
8
|
const input = (step.with ?? {});
|
|
@@ -12,7 +13,9 @@ function registerRandomStep(registry) {
|
|
|
12
13
|
if (typeof args !== "object" || Array.isArray(args)) {
|
|
13
14
|
throw new Error('"args" must be an object for op "util.random", e.g. { "domain": "acme.test" }');
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
const value = (0, random_data_1.randomDataFor)(ctx).generate(String(input.generator), args);
|
|
17
|
+
(0, step_data_1.recordStepData)(ctx, { kind: "random", source: `random:${input.generator}`, value, ...(step.saveAs ? { saveAs: step.saveAs } : {}) });
|
|
18
|
+
return value;
|
|
16
19
|
});
|
|
17
20
|
}
|
|
18
21
|
//# sourceMappingURL=random.step.js.map
|