@solidxai/core 0.1.22-beta.3 → 0.1.22-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/constants/error-messages.d.ts +1 -1
  3. package/dist/constants/error-messages.d.ts.map +1 -1
  4. package/dist/constants/error-messages.js +1 -1
  5. package/dist/constants/error-messages.js.map +1 -1
  6. package/dist/controllers/admin-embed.controller.d.ts +5 -0
  7. package/dist/controllers/admin-embed.controller.d.ts.map +1 -0
  8. package/dist/controllers/admin-embed.controller.js +58 -0
  9. package/dist/controllers/admin-embed.controller.js.map +1 -0
  10. package/dist/controllers/agent-registry.controller.d.ts +2 -0
  11. package/dist/controllers/agent-registry.controller.d.ts.map +1 -1
  12. package/dist/controllers/agent-registry.controller.js +14 -0
  13. package/dist/controllers/agent-registry.controller.js.map +1 -1
  14. package/dist/controllers/agent-session.controller.d.ts +8 -1
  15. package/dist/controllers/agent-session.controller.d.ts.map +1 -1
  16. package/dist/controllers/agent-session.controller.js +88 -2
  17. package/dist/controllers/agent-session.controller.js.map +1 -1
  18. package/dist/controllers/authentication.controller.d.ts +12 -1
  19. package/dist/controllers/authentication.controller.d.ts.map +1 -1
  20. package/dist/controllers/authentication.controller.js +26 -2
  21. package/dist/controllers/authentication.controller.js.map +1 -1
  22. package/dist/controllers/test-data.controller.d.ts +12 -0
  23. package/dist/controllers/test-data.controller.d.ts.map +1 -0
  24. package/dist/controllers/test-data.controller.js +66 -0
  25. package/dist/controllers/test-data.controller.js.map +1 -0
  26. package/dist/controllers/test-data.controller.spec.d.ts +2 -0
  27. package/dist/controllers/test-data.controller.spec.d.ts.map +1 -0
  28. package/dist/controllers/test-data.controller.spec.js +78 -0
  29. package/dist/controllers/test-data.controller.spec.js.map +1 -0
  30. package/dist/dtos/create-agent-job.dto.d.ts +1 -0
  31. package/dist/dtos/create-agent-job.dto.d.ts.map +1 -1
  32. package/dist/dtos/create-agent-job.dto.js +8 -1
  33. package/dist/dtos/create-agent-job.dto.js.map +1 -1
  34. package/dist/dtos/create-agent-process.dto.d.ts +5 -0
  35. package/dist/dtos/create-agent-process.dto.d.ts.map +1 -1
  36. package/dist/dtos/create-agent-process.dto.js +37 -1
  37. package/dist/dtos/create-agent-process.dto.js.map +1 -1
  38. package/dist/dtos/create-agent-registry.dto.d.ts +5 -0
  39. package/dist/dtos/create-agent-registry.dto.d.ts.map +1 -1
  40. package/dist/dtos/create-agent-registry.dto.js +39 -1
  41. package/dist/dtos/create-agent-registry.dto.js.map +1 -1
  42. package/dist/dtos/create-agent-session.dto.js +1 -1
  43. package/dist/dtos/create-agent-session.dto.js.map +1 -1
  44. package/dist/dtos/test-run-request.dto.d.ts +1 -0
  45. package/dist/dtos/test-run-request.dto.d.ts.map +1 -1
  46. package/dist/dtos/test-run-request.dto.js +7 -1
  47. package/dist/dtos/test-run-request.dto.js.map +1 -1
  48. package/dist/dtos/update-agent-deployment.dto.d.ts +8 -0
  49. package/dist/dtos/update-agent-deployment.dto.d.ts.map +1 -0
  50. package/dist/dtos/update-agent-deployment.dto.js +60 -0
  51. package/dist/dtos/update-agent-deployment.dto.js.map +1 -0
  52. package/dist/dtos/update-agent-job.dto.d.ts +1 -0
  53. package/dist/dtos/update-agent-job.dto.d.ts.map +1 -1
  54. package/dist/dtos/update-agent-job.dto.js +8 -1
  55. package/dist/dtos/update-agent-job.dto.js.map +1 -1
  56. package/dist/dtos/update-agent-process.dto.d.ts +5 -0
  57. package/dist/dtos/update-agent-process.dto.d.ts.map +1 -1
  58. package/dist/dtos/update-agent-process.dto.js +37 -1
  59. package/dist/dtos/update-agent-process.dto.js.map +1 -1
  60. package/dist/dtos/update-agent-registry.dto.d.ts +5 -0
  61. package/dist/dtos/update-agent-registry.dto.d.ts.map +1 -1
  62. package/dist/dtos/update-agent-registry.dto.js +39 -1
  63. package/dist/dtos/update-agent-registry.dto.js.map +1 -1
  64. package/dist/dtos/update-agent-session.dto.js +1 -1
  65. package/dist/dtos/update-agent-session.dto.js.map +1 -1
  66. package/dist/entities/agent-job.entity.d.ts +1 -0
  67. package/dist/entities/agent-job.entity.d.ts.map +1 -1
  68. package/dist/entities/agent-job.entity.js +7 -2
  69. package/dist/entities/agent-job.entity.js.map +1 -1
  70. package/dist/entities/agent-process.entity.d.ts +8 -0
  71. package/dist/entities/agent-process.entity.d.ts.map +1 -1
  72. package/dist/entities/agent-process.entity.js +38 -1
  73. package/dist/entities/agent-process.entity.js.map +1 -1
  74. package/dist/entities/agent-registry.entity.d.ts +5 -0
  75. package/dist/entities/agent-registry.entity.d.ts.map +1 -1
  76. package/dist/entities/agent-registry.entity.js +22 -1
  77. package/dist/entities/agent-registry.entity.js.map +1 -1
  78. package/dist/entities/agent-session.entity.d.ts.map +1 -1
  79. package/dist/entities/agent-session.entity.js +3 -1
  80. package/dist/entities/agent-session.entity.js.map +1 -1
  81. package/dist/guards/access-token.guard.d.ts +3 -1
  82. package/dist/guards/access-token.guard.d.ts.map +1 -1
  83. package/dist/guards/access-token.guard.js +11 -2
  84. package/dist/guards/access-token.guard.js.map +1 -1
  85. package/dist/helpers/agent-config-version-name.d.ts +2 -0
  86. package/dist/helpers/agent-config-version-name.d.ts.map +1 -0
  87. package/dist/helpers/agent-config-version-name.js +17 -0
  88. package/dist/helpers/agent-config-version-name.js.map +1 -0
  89. package/dist/helpers/agent-config-version-name.spec.d.ts +2 -0
  90. package/dist/helpers/agent-config-version-name.spec.d.ts.map +1 -0
  91. package/dist/helpers/agent-config-version-name.spec.js +31 -0
  92. package/dist/helpers/agent-config-version-name.spec.js.map +1 -0
  93. package/dist/index.d.ts +3 -0
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +2 -0
  96. package/dist/index.js.map +1 -1
  97. package/dist/interfaces/active-user-data.interface.d.ts +1 -0
  98. package/dist/interfaces/active-user-data.interface.d.ts.map +1 -1
  99. package/dist/interfaces/active-user-data.interface.js.map +1 -1
  100. package/dist/jobs/database/test-run-queue-subscriber-database.service.d.ts.map +1 -1
  101. package/dist/jobs/database/test-run-queue-subscriber-database.service.js +8 -4
  102. package/dist/jobs/database/test-run-queue-subscriber-database.service.js.map +1 -1
  103. package/dist/resources/admin-embed/solid-admin-embed.js +133 -0
  104. package/dist/resources/agent-embed/solid-agent-embed.js +243 -4
  105. package/dist/seeders/module-test-data.service.d.ts +19 -0
  106. package/dist/seeders/module-test-data.service.d.ts.map +1 -1
  107. package/dist/seeders/module-test-data.service.js +95 -15
  108. package/dist/seeders/module-test-data.service.js.map +1 -1
  109. package/dist/seeders/module-test-data.service.spec.d.ts +2 -0
  110. package/dist/seeders/module-test-data.service.spec.d.ts.map +1 -0
  111. package/dist/seeders/module-test-data.service.spec.js +158 -0
  112. package/dist/seeders/module-test-data.service.spec.js.map +1 -0
  113. package/dist/seeders/seed-data/solid-core-metadata.json +375 -11
  114. package/dist/services/agent-hub-process-manager.service.d.ts +16 -0
  115. package/dist/services/agent-hub-process-manager.service.d.ts.map +1 -1
  116. package/dist/services/agent-hub-process-manager.service.js +27 -3
  117. package/dist/services/agent-hub-process-manager.service.js.map +1 -1
  118. package/dist/services/agent-registry.service.d.ts +2 -0
  119. package/dist/services/agent-registry.service.d.ts.map +1 -1
  120. package/dist/services/agent-registry.service.js +36 -1
  121. package/dist/services/agent-registry.service.js.map +1 -1
  122. package/dist/services/api-key-portal-session.spec.d.ts +2 -0
  123. package/dist/services/api-key-portal-session.spec.d.ts.map +1 -0
  124. package/dist/services/api-key-portal-session.spec.js +71 -0
  125. package/dist/services/api-key-portal-session.spec.js.map +1 -0
  126. package/dist/services/api-key.service.d.ts +12 -0
  127. package/dist/services/api-key.service.d.ts.map +1 -1
  128. package/dist/services/api-key.service.js +58 -0
  129. package/dist/services/api-key.service.js.map +1 -1
  130. package/dist/services/authentication.service.d.ts +1 -0
  131. package/dist/services/authentication.service.d.ts.map +1 -1
  132. package/dist/services/authentication.service.js +14 -1
  133. package/dist/services/authentication.service.js.map +1 -1
  134. package/dist/services/crud.service.d.ts +1 -0
  135. package/dist/services/crud.service.d.ts.map +1 -1
  136. package/dist/services/crud.service.js +26 -2
  137. package/dist/services/crud.service.js.map +1 -1
  138. package/dist/services/settings/default-settings-provider.service.d.ts +16 -6
  139. package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
  140. package/dist/services/settings/default-settings-provider.service.js +9 -3
  141. package/dist/services/settings/default-settings-provider.service.js.map +1 -1
  142. package/dist/solid-core.module.d.ts.map +1 -1
  143. package/dist/solid-core.module.js +5 -0
  144. package/dist/solid-core.module.js.map +1 -1
  145. package/dist/testing/adapters/ui/browser-provisioner.d.ts +11 -0
  146. package/dist/testing/adapters/ui/browser-provisioner.d.ts.map +1 -1
  147. package/dist/testing/adapters/ui/browser-provisioner.js +51 -1
  148. package/dist/testing/adapters/ui/browser-provisioner.js.map +1 -1
  149. package/dist/testing/adapters/ui/browser-provisioner.spec.d.ts +2 -0
  150. package/dist/testing/adapters/ui/browser-provisioner.spec.d.ts.map +1 -0
  151. package/dist/testing/adapters/ui/browser-provisioner.spec.js +137 -0
  152. package/dist/testing/adapters/ui/browser-provisioner.spec.js.map +1 -0
  153. package/dist/testing/adapters/ui/playwright-adapter.d.ts +7 -0
  154. package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -1
  155. package/dist/testing/adapters/ui/playwright-adapter.js +40 -9
  156. package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -1
  157. package/dist/testing/adapters/ui/run-video.d.ts +40 -0
  158. package/dist/testing/adapters/ui/run-video.d.ts.map +1 -0
  159. package/dist/testing/adapters/ui/run-video.js +113 -0
  160. package/dist/testing/adapters/ui/run-video.js.map +1 -0
  161. package/dist/testing/adapters/ui/run-video.spec.d.ts +2 -0
  162. package/dist/testing/adapters/ui/run-video.spec.d.ts.map +1 -0
  163. package/dist/testing/adapters/ui/run-video.spec.js +62 -0
  164. package/dist/testing/adapters/ui/run-video.spec.js.map +1 -0
  165. package/dist/testing/contracts/runtime-context.types.d.ts +7 -0
  166. package/dist/testing/contracts/runtime-context.types.d.ts.map +1 -1
  167. package/dist/testing/contracts/runtime-context.types.js.map +1 -1
  168. package/dist/testing/contracts/testing-metadata.types.d.ts +1 -0
  169. package/dist/testing/contracts/testing-metadata.types.d.ts.map +1 -1
  170. package/dist/testing/contracts/testing-metadata.types.js.map +1 -1
  171. package/dist/testing/core/interpolation.d.ts.map +1 -1
  172. package/dist/testing/core/interpolation.js +14 -2
  173. package/dist/testing/core/interpolation.js.map +1 -1
  174. package/dist/testing/core/step-data.d.ts +5 -0
  175. package/dist/testing/core/step-data.d.ts.map +1 -0
  176. package/dist/testing/core/step-data.js +14 -0
  177. package/dist/testing/core/step-data.js.map +1 -0
  178. package/dist/testing/core/step-data.spec.d.ts +2 -0
  179. package/dist/testing/core/step-data.spec.d.ts.map +1 -0
  180. package/dist/testing/core/step-data.spec.js +48 -0
  181. package/dist/testing/core/step-data.spec.js.map +1 -0
  182. package/dist/testing/core/testing-engine.d.ts +1 -1
  183. package/dist/testing/core/testing-engine.d.ts.map +1 -1
  184. package/dist/testing/core/testing-engine.js +27 -4
  185. package/dist/testing/core/testing-engine.js.map +1 -1
  186. package/dist/testing/reporter/lifecycle-events.types.d.ts +3 -2
  187. package/dist/testing/reporter/lifecycle-events.types.d.ts.map +1 -1
  188. package/dist/testing/reporter/lifecycle-events.types.js.map +1 -1
  189. package/dist/testing/reporter/lifecycle-webhook-reporter.d.ts +2 -1
  190. package/dist/testing/reporter/lifecycle-webhook-reporter.d.ts.map +1 -1
  191. package/dist/testing/reporter/lifecycle-webhook-reporter.js +3 -0
  192. package/dist/testing/reporter/lifecycle-webhook-reporter.js.map +1 -1
  193. package/dist/testing/reporter/reporter.types.d.ts +2 -1
  194. package/dist/testing/reporter/reporter.types.d.ts.map +1 -1
  195. package/dist/testing/reporter/reporter.types.js.map +1 -1
  196. package/dist/testing/runner/read-scenarios-file.d.ts +1 -0
  197. package/dist/testing/runner/read-scenarios-file.d.ts.map +1 -1
  198. package/dist/testing/runner/read-scenarios-file.js +20 -0
  199. package/dist/testing/runner/read-scenarios-file.js.map +1 -1
  200. package/dist/testing/runner/run-from-metadata.d.ts.map +1 -1
  201. package/dist/testing/runner/run-from-metadata.js +48 -10
  202. package/dist/testing/runner/run-from-metadata.js.map +1 -1
  203. package/dist/testing/runner/run-from-metadata.spec.js +41 -1
  204. package/dist/testing/runner/run-from-metadata.spec.js.map +1 -1
  205. package/dist/testing/runner/scenario-graph.d.ts +9 -0
  206. package/dist/testing/runner/scenario-graph.d.ts.map +1 -1
  207. package/dist/testing/runner/scenario-graph.js +47 -13
  208. package/dist/testing/runner/scenario-graph.js.map +1 -1
  209. package/dist/testing/steps/ui/navigation.step.d.ts.map +1 -1
  210. package/dist/testing/steps/ui/navigation.step.js +4 -1
  211. package/dist/testing/steps/ui/navigation.step.js.map +1 -1
  212. package/dist/testing/steps/util/random.step.d.ts.map +1 -1
  213. package/dist/testing/steps/util/random.step.js +4 -1
  214. package/dist/testing/steps/util/random.step.js.map +1 -1
  215. package/package.json +1 -1
  216. package/resources/admin-embed/solid-admin-embed.js +133 -0
  217. package/resources/agent-embed/solid-agent-embed.js +243 -4
  218. package/src/constants/error-messages.ts +2 -1
  219. package/src/controllers/admin-embed.controller.ts +34 -0
  220. package/src/controllers/agent-registry.controller.ts +8 -1
  221. package/src/controllers/agent-session.controller.ts +53 -2
  222. package/src/controllers/authentication.controller.ts +20 -1
  223. package/src/controllers/test-data.controller.spec.ts +94 -0
  224. package/src/controllers/test-data.controller.ts +58 -0
  225. package/src/dtos/create-agent-job.dto.ts +6 -0
  226. package/src/dtos/create-agent-process.dto.ts +32 -1
  227. package/src/dtos/create-agent-registry.dto.ts +34 -1
  228. package/src/dtos/create-agent-session.dto.ts +1 -1
  229. package/src/dtos/test-run-request.dto.ts +6 -0
  230. package/src/dtos/update-agent-deployment.dto.ts +37 -0
  231. package/src/dtos/update-agent-job.dto.ts +6 -0
  232. package/src/dtos/update-agent-process.dto.ts +32 -1
  233. package/src/dtos/update-agent-registry.dto.ts +34 -1
  234. package/src/dtos/update-agent-session.dto.ts +1 -1
  235. package/src/entities/agent-job.entity.ts +5 -1
  236. package/src/entities/agent-process.entity.ts +28 -0
  237. package/src/entities/agent-registry.entity.ts +15 -0
  238. package/src/entities/agent-session.entity.ts +3 -0
  239. package/src/guards/access-token.guard.ts +11 -1
  240. package/src/helpers/agent-config-version-name.spec.ts +35 -0
  241. package/src/helpers/agent-config-version-name.ts +16 -0
  242. package/src/index.ts +5 -0
  243. package/src/interfaces/active-user-data.interface.ts +3 -0
  244. package/src/jobs/database/test-run-queue-subscriber-database.service.ts +10 -6
  245. package/src/seeders/module-test-data.service.spec.ts +184 -0
  246. package/src/seeders/module-test-data.service.ts +136 -20
  247. package/src/seeders/seed-data/solid-core-metadata.json +376 -12
  248. package/src/services/agent-hub-process-manager.service.ts +35 -4
  249. package/src/services/agent-registry.service.ts +38 -2
  250. package/src/services/api-key-portal-session.spec.ts +75 -0
  251. package/src/services/api-key.service.ts +61 -0
  252. package/src/services/authentication.service.ts +16 -2
  253. package/src/services/crud.service.ts +30 -2
  254. package/src/services/settings/default-settings-provider.service.ts +13 -3
  255. package/src/solid-core.module.ts +5 -0
  256. package/src/testing/adapters/ui/browser-provisioner.spec.ts +131 -0
  257. package/src/testing/adapters/ui/browser-provisioner.ts +85 -2
  258. package/src/testing/adapters/ui/playwright-adapter.ts +53 -11
  259. package/src/testing/adapters/ui/run-video.spec.ts +72 -0
  260. package/src/testing/adapters/ui/run-video.ts +122 -0
  261. package/src/testing/contracts/runtime-context.types.ts +16 -0
  262. package/src/testing/contracts/testing-metadata.types.ts +5 -0
  263. package/src/testing/core/interpolation.ts +11 -2
  264. package/src/testing/core/step-data.spec.ts +59 -0
  265. package/src/testing/core/step-data.ts +14 -0
  266. package/src/testing/core/testing-engine.ts +33 -5
  267. package/src/testing/reporter/lifecycle-events.types.ts +5 -2
  268. package/src/testing/reporter/lifecycle-webhook-reporter.ts +4 -1
  269. package/src/testing/reporter/reporter.types.ts +3 -1
  270. package/src/testing/runner/read-scenarios-file.ts +24 -0
  271. package/src/testing/runner/run-from-metadata.spec.ts +48 -1
  272. package/src/testing/runner/run-from-metadata.ts +66 -21
  273. package/src/testing/runner/scenario-graph.ts +55 -12
  274. package/src/testing/steps/ui/navigation.step.ts +4 -1
  275. package/src/testing/steps/util/random.step.ts +4 -1
@@ -42,3 +42,27 @@ export function readScenariosFile(absPath: string): ReadScenariosResult {
42
42
  return { scenarios: [], ok: false, error: (err as Error)?.message || "read_error" };
43
43
  }
44
44
  }
45
+
46
+ /**
47
+ * Read one scenario per file, in the order given: Testing Hub keeps each scenario in its own JSON file
48
+ * (`<app>/<scenario key>.json`) and sends their paths. Every file must hold one scenario object; the first missing,
49
+ * unreadable or invalid file fails the whole read (naming the file), so a run never silently drops a scenario.
50
+ */
51
+ export function readScenarioFiles(absPaths: string[]): ReadScenariosResult {
52
+ const scenarios: ScenarioSpec[] = [];
53
+ for (const absPath of absPaths) {
54
+ if (!absPath || !fs.existsSync(absPath)) {
55
+ return { scenarios: [], ok: false, error: `file_not_found: ${absPath}` };
56
+ }
57
+ try {
58
+ const parsed = JSON.parse(fs.readFileSync(absPath, "utf-8"));
59
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
60
+ return { scenarios: [], ok: false, error: `not_a_scenario: ${absPath}` };
61
+ }
62
+ scenarios.push(parsed as ScenarioSpec);
63
+ } catch (err) {
64
+ return { scenarios: [], ok: false, error: `${(err as Error)?.message || "read_error"}: ${absPath}` };
65
+ }
66
+ }
67
+ return { scenarios, ok: true };
68
+ }
@@ -134,7 +134,20 @@ describe("runFromMetadata without dependencies", () => {
134
134
  });
135
135
 
136
136
  describe("runFromMetadata with dependsOn", () => {
137
- it("skips dependents of a failure and keeps running independent scenarios", async () => {
137
+ it("stops at the first failure by default, like a run without dependencies", async () => {
138
+ const events: Event[] = [];
139
+ await expect(
140
+ runFromMetadata({
141
+ scenarios: [pass("login"), pass("a", { dependsOn: ["login"] }), fail("b", { dependsOn: ["login"] }), pass("c", { dependsOn: ["login"] })],
142
+ reporter: recordingReporter(events),
143
+ }),
144
+ ).rejects.toThrow(/Expected values to be equal/);
145
+ expect(events.filter((e) => e.type !== "run").map((e) => `${e.type}:${(e as any).id}`)).toEqual(["end:login", "end:a", "end:b"]);
146
+ const run = events.find((e) => e.type === "run") as { args: RunEndArgs };
147
+ expect(run.args).toMatchObject({ ok: false, total: 4, passed: 2, failed: 1, skipped: 0 });
148
+ });
149
+
150
+ it("with failFast off, skips dependents of a failure and keeps running independent scenarios", async () => {
138
151
  const events: Event[] = [];
139
152
  await expect(
140
153
  runFromMetadata({
@@ -145,6 +158,7 @@ describe("runFromMetadata with dependsOn", () => {
145
158
  pass("independent"),
146
159
  ],
147
160
  reporter: recordingReporter(events),
161
+ failFast: false,
148
162
  }),
149
163
  ).rejects.toThrow();
150
164
  expect(events.filter((e) => e.type !== "run")).toEqual([
@@ -157,6 +171,39 @@ describe("runFromMetadata with dependsOn", () => {
157
171
  expect(run.args).toMatchObject({ ok: false, total: 4, passed: 1, failed: 1, skipped: 2 });
158
172
  });
159
173
 
174
+ it("fails only a scenario whose restoreFrom names an unknown scenario, skips what needs it, and runs the rest", async () => {
175
+ const events: Event[] = [];
176
+ await expect(
177
+ runFromMetadata({
178
+ scenarios: [
179
+ pass("login"),
180
+ pass("workspace", { restoreFrom: "ui-login" }),
181
+ pass("after-workspace", { dependsOn: ["workspace"] }),
182
+ pass("other", { dependsOn: ["login"] }),
183
+ ],
184
+ reporter: recordingReporter(events),
185
+ }),
186
+ ).rejects.toThrow(/restores from unknown scenario "ui-login"/);
187
+ expect(events.filter((e) => e.type !== "run")).toEqual([
188
+ expect.objectContaining({ type: "end", id: "workspace", ok: false }),
189
+ { type: "skip", id: "after-workspace", dependency: "workspace" },
190
+ expect.objectContaining({ type: "end", id: "login", ok: true }),
191
+ expect.objectContaining({ type: "end", id: "other", ok: true }),
192
+ ]);
193
+ const run = events.find((e) => e.type === "run") as { args: RunEndArgs };
194
+ expect(run.args).toMatchObject({ ok: false, total: 4, passed: 2, failed: 1, skipped: 1 });
195
+ });
196
+
197
+ it("reports a broken scenario only when the run selected it or something that needs it", async () => {
198
+ const events: Event[] = [];
199
+ await runFromMetadata({
200
+ scenarios: [pass("login"), pass("workspace", { dependsOn: ["ghost"] })],
201
+ scenarioIds: ["login"],
202
+ reporter: recordingReporter(events),
203
+ });
204
+ expect(events.filter((e) => e.type !== "run").map((e) => `${e.type}:${(e as any).id}`)).toEqual(["end:login"]);
205
+ });
206
+
160
207
  it("runs a selected scenario's dependencies first", async () => {
161
208
  const events: Event[] = [];
162
209
  await runFromMetadata({
@@ -32,14 +32,32 @@ import {
32
32
  orderByDependencies,
33
33
  expandRestoreFrom,
34
34
  sessionSourceFor,
35
+ splitUnrunnable,
35
36
  usesDependencies,
36
37
  validateSessions,
38
+ type UnrunnableScenario,
37
39
  } from "./scenario-graph";
38
40
 
39
41
  /**
40
42
  * Give a scenario the browser context its `session` asks for. `justStarted` skips a
41
43
  * redundant context swap when the browser was opened for this very scenario.
42
44
  */
45
+ /**
46
+ * The scenarios set aside as unrunnable that this run reports: the ones it selected, plus the broken ones they wait on
47
+ * (so a skip names a failure the run shows). Broken ones first, so each skip follows the failure that caused it.
48
+ */
49
+ function selectedUnrunnable(unrunnable: UnrunnableScenario[], selected: Array<{ id: string }>): UnrunnableScenario[] {
50
+ const byId = new Map(unrunnable.map((u) => [u.scenario.id, u]));
51
+ const keep = new Set<string>();
52
+ for (const { id } of selected) {
53
+ for (let at = byId.get(id); at && !keep.has(at.scenario.id); at = at.blockedBy ? byId.get(at.blockedBy) : undefined) {
54
+ keep.add(at.scenario.id);
55
+ }
56
+ }
57
+ const kept = unrunnable.filter((u) => keep.has(u.scenario.id));
58
+ return [...kept.filter((u) => u.error), ...kept.filter((u) => !u.error)];
59
+ }
60
+
43
61
  async function prepareSession(
44
62
  ui: UiAdapter,
45
63
  scenario: ScenarioSpec,
@@ -93,8 +111,9 @@ export type RunnerOptions = {
93
111
  defaults?: { timeoutMs?: number; retries?: number };
94
112
  options?: { printApiLogs?: boolean };
95
113
  /**
96
- * Stop the run at the first failed scenario (default `true`). When `false`, every
97
- * scenario runs; the run still throws after the last one if any failed.
114
+ * Stop the run at the first failed scenario (default `true`), also in a run with dependencies
115
+ * (dependsOn / restoreFrom / session). When `false`, every scenario runs — a failed one's dependents
116
+ * are skipped — and the run still throws after the last one if any failed.
98
117
  */
99
118
  failFast?: boolean;
100
119
  specs?: (registry: SpecRegistry) => void;
@@ -165,16 +184,18 @@ export async function runFromMetadata(opts: RunnerOptions): Promise<void> {
165
184
  const { reset: resetScenario, rest: unexpandedScenarios } = splitResetScenario(
166
185
  opts.scenarios ?? opts.metadata?.testing?.scenarios ?? [],
167
186
  );
187
+ // A scenario whose restoreFrom or dependsOn names a scenario that is not there cannot run, nor can what needs it. They
188
+ // are reported as failed / skipped below instead of stopping the run before the others start.
189
+ const { runnable, unrunnable } = splitUnrunnable(unexpandedScenarios, resetScenario?.id);
168
190
  // restoreFrom becomes dependsOn + session: restore + saveSession on its source, so the rest of the run sees only those.
169
- const allScenarios = expandRestoreFrom(unexpandedScenarios, resetScenario?.id);
170
- const selected = expandWithDependencies(
171
- allScenarios,
172
- filterScenarios(allScenarios, {
173
- scenarioIds: opts.scenarioIds,
174
- includeTags: opts.includeTags,
175
- skipScenarioIds: opts.skipScenarioIds,
176
- }),
177
- );
191
+ const allScenarios = expandRestoreFrom(runnable, resetScenario?.id);
192
+ const filterOptions = {
193
+ scenarioIds: opts.scenarioIds,
194
+ includeTags: opts.includeTags,
195
+ skipScenarioIds: opts.skipScenarioIds,
196
+ };
197
+ const selected = expandWithDependencies(allScenarios, filterScenarios(allScenarios, filterOptions));
198
+ const notRunnable = selectedUnrunnable(unrunnable, filterScenarios(unrunnable.map((u) => u.scenario), filterOptions));
178
199
  // Without dependsOn/session settings a run keeps its original contract: file order,
179
200
  // one shared browser context, stop at the first failure.
180
201
  const dependencyMode = usesDependencies(selected);
@@ -230,14 +251,30 @@ export async function runFromMetadata(opts: RunnerOptions): Promise<void> {
230
251
  if (opts.signal?.aborted) throw new RunCanceledError();
231
252
  };
232
253
 
254
+ const reported = [...notRunnable.map((u) => u.scenario), ...scenarios];
233
255
  reporter.onRunStart?.({
234
- total: scenarios.length,
256
+ total: reported.length,
235
257
  startedAt: new Date(startedAt).toISOString(),
236
- scenarioIds: scenarios.map((s) => s.id),
237
- scenarios: scenarios.map((s) => ({ id: s.id, name: s.name, type: s.type })),
258
+ scenarioIds: reported.map((s) => s.id),
259
+ scenarios: reported.map((s) => ({ id: s.id, name: s.name, type: s.type })),
238
260
  });
239
261
 
240
262
  try {
263
+ // Scenarios that cannot run fail (a broken reference) or are skipped (they need one that cannot run), and the run goes on.
264
+ for (const { scenario, error, blockedBy } of notRunnable) {
265
+ if (error) {
266
+ const failure = new Error(error);
267
+ reporter.onScenarioStart(scenario);
268
+ reporter.onScenarioEnd(scenario, { ok: false, error: failure, durationMs: 0 });
269
+ failed += 1;
270
+ runError = failure;
271
+ outcomes.set(scenario.id, "failed");
272
+ } else {
273
+ skipped += 1;
274
+ outcomes.set(scenario.id, "skipped");
275
+ reporter.onScenarioSkipped?.(scenario, { reason: "dependency_failed", dependency: String(blockedBy) });
276
+ }
277
+ }
241
278
  // Checked inside the try so a bad mobile setup still reports run.end.
242
279
  for (const scenario of scenarios) {
243
280
  const problem = mobileScenarioProblem(scenario);
@@ -284,6 +321,7 @@ export async function runFromMetadata(opts: RunnerOptions): Promise<void> {
284
321
  failed += 1;
285
322
  runError = error;
286
323
  outcomes.set(scenario.id, "failed");
324
+ if (opts.failFast !== false) throw error;
287
325
  continue;
288
326
  }
289
327
  }
@@ -310,6 +348,7 @@ export async function runFromMetadata(opts: RunnerOptions): Promise<void> {
310
348
  failed += 1;
311
349
  runError = error;
312
350
  outcomes.set(scenario.id, "failed");
351
+ if (opts.failFast !== false) throw error;
313
352
  continue;
314
353
  }
315
354
  }
@@ -343,11 +382,11 @@ export async function runFromMetadata(opts: RunnerOptions): Promise<void> {
343
382
  } catch (error) {
344
383
  failed += 1;
345
384
  outcomes.set(scenario.id, "failed");
346
- // Keep going; the first failure is rethrown once every scenario has run.
347
- // A dependsOn run always keeps going and skips the failed scenario's dependents.
385
+ // failFast (the default) stops the run here, with or without dependencies. Otherwise keep going: the
386
+ // first failure is rethrown once every scenario has run, and a dependsOn run skips the failed one's dependents.
348
387
  runError ??= error;
349
388
  throwIfCanceled();
350
- if (!dependencyMode && opts.failFast !== false) throw error;
389
+ if (opts.failFast !== false) throw error;
351
390
  }
352
391
  }
353
392
  if (runError) throw runError;
@@ -359,16 +398,17 @@ export async function runFromMetadata(opts: RunnerOptions): Promise<void> {
359
398
  } finally {
360
399
  reporter.onRunEnd?.({
361
400
  ok: !runError,
362
- total: scenarios.length,
401
+ total: reported.length,
363
402
  passed,
364
403
  failed,
365
- ...(dependencyMode ? { skipped } : {}),
404
+ ...(dependencyMode || skipped > 0 ? { skipped } : {}),
366
405
  durationMs: Date.now() - startedAt,
367
406
  });
368
407
  opts.signal?.removeEventListener("abort", closeOnCancel);
369
408
  if (uiStarted.value && !uiClosedOnCancel) {
370
- // Only KEEP the whole-run video when the run FAILED — passing runs discard it unread.
371
- const keepVideo = !!runError;
409
+ // Only KEEP the whole-run video when the run FAILED in the browser — passing runs, and runs where only API
410
+ // scenarios failed (nothing of theirs is on screen), discard it unread.
411
+ const keepVideo = !!runError && scenarios.some((s) => scenarioNeedsUi(s) && outcomes.get(s.id) === "failed");
372
412
  await ui.stop({ keepVideo });
373
413
  // Video bytes are only finalized after ui.stop(); attach it as a run-level artifact so
374
414
  // the reporter uploads it and references it on run.end (queued before flushPending runs).
@@ -376,6 +416,11 @@ export async function runFromMetadata(opts: RunnerOptions): Promise<void> {
376
416
  for (const video of ui.getRunVideos()) {
377
417
  reporter.attachRunArtifact({ name: video.name, contentType: video.contentType, data: video.data });
378
418
  }
419
+ // Where each scenario is in the video, for the run page to jump to.
420
+ const timeline = ui.getRunVideoTimeline();
421
+ if (timeline) {
422
+ reporter.attachRunArtifact({ name: "run-timeline.json", contentType: "application/json", data: JSON.stringify(timeline) });
423
+ }
379
424
  }
380
425
  }
381
426
  if (mobile && mobileStarted.value && !mobileClosedOnCancel) {
@@ -19,18 +19,9 @@ export function expandRestoreFrom(scenarios: ScenarioSpec[], resetId?: string):
19
19
  const sources = new Set<string>();
20
20
  const expanded = scenarios.map((scenario) => {
21
21
  if (scenario.restoreFrom === undefined) return scenario;
22
- const source = scenario.restoreFrom;
23
- if (typeof source !== "string" || !source.trim()) {
24
- throw new Error(`Scenario "${scenario.id}" has an invalid restoreFrom (expected one scenario id)`);
25
- }
26
- if (source === scenario.id) throw new Error(`Scenario "${scenario.id}" cannot restoreFrom itself`);
27
- if (resetId !== undefined && source === resetId) {
28
- throw new Error(`Scenario "${scenario.id}" restores from the reset scenario "${source}", which only runs as setup`);
29
- }
30
- if (!byId.has(source)) throw new Error(`Scenario "${scenario.id}" restores from unknown scenario "${source}"`);
31
- if (scenario.session !== undefined && scenario.session !== "restore") {
32
- throw new Error(`Scenario "${scenario.id}" has restoreFrom, which means session "restore", but its session is "${String(scenario.session)}"`);
33
- }
22
+ const problem = restoreFromProblem(scenario, byId, resetId);
23
+ if (problem) throw new Error(problem);
24
+ const source = scenario.restoreFrom as string;
34
25
  sources.add(source);
35
26
  const others = dependenciesOf(scenario).filter((id) => id !== source);
36
27
  const before = dependenciesOf(scenario);
@@ -40,6 +31,58 @@ export function expandRestoreFrom(scenarios: ScenarioSpec[], resetId?: string):
40
31
  return expanded.map((scenario) => (sources.has(scenario.id) && !scenario.saveSession ? { ...scenario, saveSession: true } : scenario));
41
32
  }
42
33
 
34
+ /** What is wrong with a scenario's `restoreFrom`, or undefined when it names another scenario it can restore from. */
35
+ function restoreFromProblem(scenario: ScenarioSpec, byId: Map<string, ScenarioSpec>, resetId?: string): string | undefined {
36
+ const source = scenario.restoreFrom;
37
+ if (source === undefined) return undefined;
38
+ if (typeof source !== "string" || !source.trim()) return `Scenario "${scenario.id}" has an invalid restoreFrom (expected one scenario id)`;
39
+ if (source === scenario.id) return `Scenario "${scenario.id}" cannot restoreFrom itself`;
40
+ if (resetId !== undefined && source === resetId) {
41
+ return `Scenario "${scenario.id}" restores from the reset scenario "${source}", which only runs as setup`;
42
+ }
43
+ if (!byId.has(source)) 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
+
50
+ /** A scenario that cannot run in this run: its own reference is broken (`error`), or one it needs cannot run (`blockedBy`). */
51
+ export interface UnrunnableScenario {
52
+ scenario: ScenarioSpec;
53
+ error?: string;
54
+ blockedBy?: string;
55
+ }
56
+
57
+ /**
58
+ * Sets aside the scenarios whose `restoreFrom` or `dependsOn` cannot be met — one naming a scenario that does not exist,
59
+ * itself, or the reset scenario — and, transitively, the scenarios that need them. A mistake in one scenario then fails
60
+ * that scenario instead of stopping the whole run before anything starts; the rest run as usual.
61
+ */
62
+ export function splitUnrunnable(scenarios: ScenarioSpec[], resetId?: string): { runnable: ScenarioSpec[]; unrunnable: UnrunnableScenario[] } {
63
+ const byId = new Map(scenarios.map((s) => [s.id, s]));
64
+ const unrunnable = new Map<string, UnrunnableScenario>();
65
+ for (const scenario of scenarios) {
66
+ const unknownDep = dependenciesOf(scenario).find((id) => !byId.has(id));
67
+ const error = restoreFromProblem(scenario, byId, resetId)
68
+ ?? (unknownDep !== undefined ? `Scenario "${scenario.id}" depends on unknown scenario "${unknownDep}"` : undefined);
69
+ if (error) unrunnable.set(scenario.id, { scenario, error });
70
+ }
71
+ for (let grew = unrunnable.size > 0; grew; ) {
72
+ grew = false;
73
+ for (const scenario of scenarios) {
74
+ if (unrunnable.has(scenario.id)) continue;
75
+ const needs = [...dependenciesOf(scenario), ...(typeof scenario.restoreFrom === "string" ? [scenario.restoreFrom] : [])];
76
+ const blockedBy = needs.find((id) => unrunnable.has(id));
77
+ if (blockedBy !== undefined) {
78
+ unrunnable.set(scenario.id, { scenario, blockedBy });
79
+ grew = true;
80
+ }
81
+ }
82
+ }
83
+ return { runnable: scenarios.filter((s) => !unrunnable.has(s.id)), unrunnable: [...unrunnable.values()] };
84
+ }
85
+
43
86
  function dependenciesOf(scenario: ScenarioSpec): string[] {
44
87
  return Array.isArray(scenario.dependsOn) ? scenario.dependsOn.map(String) : [];
45
88
  }
@@ -1,6 +1,7 @@
1
1
  import type { TestContext } from "../../contracts/runtime-context.types";
2
2
  import type { OpStep } from "../../contracts/testing-metadata.types";
3
3
  import { StepRegistry } from "../../core/step-registry";
4
+ import { recordStepData } from "../../core/step-data";
4
5
 
5
6
  type GotoInput = { url: string; timeoutMs?: number };
6
7
  type ExpectUrlInput = { equals?: string; contains?: string; timeoutMs?: number };
@@ -108,7 +109,9 @@ export function registerNavigationSteps(registry: StepRegistry): void {
108
109
  `ui.storeText: regex "${input.match}" found no match in text "${text.slice(0, 120)}"`,
109
110
  );
110
111
  }
111
- return m[1] !== undefined ? m[1] : m[0];
112
+ const value = m[1] !== undefined ? m[1] : m[0];
113
+ recordStepData(ctx, { kind: "match", source: `match:${input.match}`, value, ...(step.saveAs ? { saveAs: step.saveAs } : {}) });
114
+ return value;
112
115
  }
113
116
  return text;
114
117
  });
@@ -2,6 +2,7 @@ import type { TestContext } from "../../contracts/runtime-context.types";
2
2
  import type { OpStep } from "../../contracts/testing-metadata.types";
3
3
  import { randomDataFor } from "../../core/random-data";
4
4
  import { StepRegistry } from "../../core/step-registry";
5
+ import { recordStepData } from "../../core/step-data";
5
6
 
6
7
  type RandomInput = { generator: string; args?: Record<string, unknown> };
7
8
 
@@ -18,6 +19,8 @@ export function registerRandomStep(registry: StepRegistry): void {
18
19
  if (typeof args !== "object" || Array.isArray(args)) {
19
20
  throw new Error('"args" must be an object for op "util.random", e.g. { "domain": "acme.test" }');
20
21
  }
21
- return randomDataFor(ctx).generate(String(input.generator), args);
22
+ const value = randomDataFor(ctx).generate(String(input.generator), args);
23
+ recordStepData(ctx, { kind: "random", source: `random:${input.generator}`, value, ...(step.saveAs ? { saveAs: step.saveAs } : {}) });
24
+ return value;
22
25
  });
23
26
  }