@solidxai/core 0.1.1 → 0.1.4

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 (295) hide show
  1. package/dist/commands/run-tests.command.d.ts +37 -0
  2. package/dist/commands/run-tests.command.d.ts.map +1 -0
  3. package/dist/commands/run-tests.command.js +345 -0
  4. package/dist/commands/run-tests.command.js.map +1 -0
  5. package/dist/commands/test-data.command.d.ts +6 -6
  6. package/dist/commands/test-data.command.d.ts.map +1 -1
  7. package/dist/commands/test-data.command.js +25 -25
  8. package/dist/commands/test-data.command.js.map +1 -1
  9. package/dist/commands/test.command.d.ts +5 -0
  10. package/dist/commands/test.command.d.ts.map +1 -0
  11. package/dist/commands/test.command.js +26 -0
  12. package/dist/commands/test.command.js.map +1 -0
  13. package/dist/controllers/service.controller.d.ts +0 -9
  14. package/dist/controllers/service.controller.d.ts.map +1 -1
  15. package/dist/controllers/service.controller.js +0 -45
  16. package/dist/controllers/service.controller.js.map +1 -1
  17. package/dist/dtos/basic-filters.dto.d.ts.map +1 -1
  18. package/dist/dtos/basic-filters.dto.js.map +1 -1
  19. package/dist/dtos/create-user.dto.d.ts +1 -0
  20. package/dist/dtos/create-user.dto.d.ts.map +1 -1
  21. package/dist/dtos/create-user.dto.js +2 -1
  22. package/dist/dtos/create-user.dto.js.map +1 -1
  23. package/dist/helpers/schematic.service.js +1 -1
  24. package/dist/helpers/schematic.service.js.map +1 -1
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +3 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
  30. package/dist/seeders/module-metadata-seeder.service.js +3 -21
  31. package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
  32. package/dist/seeders/module-test-data.service.d.ts.map +1 -1
  33. package/dist/seeders/module-test-data.service.js +3 -3
  34. package/dist/seeders/module-test-data.service.js.map +1 -1
  35. package/dist/seeders/seed-data/solid-core-metadata.json +34 -9
  36. package/dist/services/chatter-message.service.d.ts +2 -0
  37. package/dist/services/chatter-message.service.d.ts.map +1 -1
  38. package/dist/services/chatter-message.service.js +18 -2
  39. package/dist/services/chatter-message.service.js.map +1 -1
  40. package/dist/services/crud.service.d.ts.map +1 -1
  41. package/dist/services/crud.service.js.map +1 -1
  42. package/dist/services/model-metadata.service.d.ts.map +1 -1
  43. package/dist/services/model-metadata.service.js +2 -1
  44. package/dist/services/model-metadata.service.js.map +1 -1
  45. package/dist/services/module-metadata.service.d.ts.map +1 -1
  46. package/dist/services/module-metadata.service.js +2 -1
  47. package/dist/services/module-metadata.service.js.map +1 -1
  48. package/dist/services/queues/common.d.ts +3 -0
  49. package/dist/services/queues/common.d.ts.map +1 -0
  50. package/dist/services/queues/common.js +39 -0
  51. package/dist/services/queues/common.js.map +1 -0
  52. package/dist/services/queues/database-publisher.service.d.ts.map +1 -1
  53. package/dist/services/queues/database-publisher.service.js +3 -1
  54. package/dist/services/queues/database-publisher.service.js.map +1 -1
  55. package/dist/services/queues/database-subscriber.service.d.ts.map +1 -1
  56. package/dist/services/queues/database-subscriber.service.js +5 -2
  57. package/dist/services/queues/database-subscriber.service.js.map +1 -1
  58. package/dist/services/queues/rabbitmq-publisher.service.d.ts.map +1 -1
  59. package/dist/services/queues/rabbitmq-publisher.service.js +13 -6
  60. package/dist/services/queues/rabbitmq-publisher.service.js.map +1 -1
  61. package/dist/services/queues/rabbitmq-subscriber.service.d.ts +14 -1
  62. package/dist/services/queues/rabbitmq-subscriber.service.d.ts.map +1 -1
  63. package/dist/services/queues/rabbitmq-subscriber.service.js +197 -65
  64. package/dist/services/queues/rabbitmq-subscriber.service.js.map +1 -1
  65. package/dist/solid-core.module.d.ts.map +1 -1
  66. package/dist/solid-core.module.js +4 -0
  67. package/dist/solid-core.module.js.map +1 -1
  68. package/dist/testing/__examples__/register-example-specs.d.ts +3 -0
  69. package/dist/testing/__examples__/register-example-specs.d.ts.map +1 -0
  70. package/dist/testing/__examples__/register-example-specs.js +8 -0
  71. package/dist/testing/__examples__/register-example-specs.js.map +1 -0
  72. package/dist/testing/__examples__/specs/custom-health.spec.d.ts +17 -0
  73. package/dist/testing/__examples__/specs/custom-health.spec.d.ts.map +1 -0
  74. package/dist/testing/__examples__/specs/custom-health.spec.js +30 -0
  75. package/dist/testing/__examples__/specs/custom-health.spec.js.map +1 -0
  76. package/dist/testing/adapters/api/api-adapter.d.ts +9 -0
  77. package/dist/testing/adapters/api/api-adapter.d.ts.map +1 -0
  78. package/dist/testing/adapters/api/api-adapter.js +76 -0
  79. package/dist/testing/adapters/api/api-adapter.js.map +1 -0
  80. package/dist/testing/adapters/api/api.types.d.ts +14 -0
  81. package/dist/testing/adapters/api/api.types.d.ts.map +1 -0
  82. package/dist/testing/adapters/api/api.types.js +3 -0
  83. package/dist/testing/adapters/api/api.types.js.map +1 -0
  84. package/dist/testing/adapters/ui/playwright-adapter.d.ts +14 -0
  85. package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -0
  86. package/dist/testing/adapters/ui/playwright-adapter.js +47 -0
  87. package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -0
  88. package/dist/testing/adapters/ui/ui.types.d.ts +5 -0
  89. package/dist/testing/adapters/ui/ui.types.d.ts.map +1 -0
  90. package/dist/testing/adapters/ui/ui.types.js +3 -0
  91. package/dist/testing/adapters/ui/ui.types.js.map +1 -0
  92. package/dist/testing/contracts/runtime-context.types.d.ts +35 -0
  93. package/dist/testing/contracts/runtime-context.types.d.ts.map +1 -0
  94. package/dist/testing/contracts/runtime-context.types.js +3 -0
  95. package/dist/testing/contracts/runtime-context.types.js.map +1 -0
  96. package/dist/testing/contracts/test-spec.types.d.ts +21 -0
  97. package/dist/testing/contracts/test-spec.types.d.ts.map +1 -0
  98. package/dist/testing/contracts/test-spec.types.js +3 -0
  99. package/dist/testing/contracts/test-spec.types.js.map +1 -0
  100. package/dist/testing/contracts/testing-metadata.types.d.ts +41 -0
  101. package/dist/testing/contracts/testing-metadata.types.d.ts.map +1 -0
  102. package/dist/testing/contracts/testing-metadata.types.js +3 -0
  103. package/dist/testing/contracts/testing-metadata.types.js.map +1 -0
  104. package/dist/testing/core/interpolation.d.ts +4 -0
  105. package/dist/testing/core/interpolation.d.ts.map +1 -0
  106. package/dist/testing/core/interpolation.js +180 -0
  107. package/dist/testing/core/interpolation.js.map +1 -0
  108. package/dist/testing/core/normalize-steps.d.ts +7 -0
  109. package/dist/testing/core/normalize-steps.d.ts.map +1 -0
  110. package/dist/testing/core/normalize-steps.js +20 -0
  111. package/dist/testing/core/normalize-steps.js.map +1 -0
  112. package/dist/testing/core/resource-store.d.ts +8 -0
  113. package/dist/testing/core/resource-store.d.ts.map +1 -0
  114. package/dist/testing/core/resource-store.js +41 -0
  115. package/dist/testing/core/resource-store.js.map +1 -0
  116. package/dist/testing/core/spec-registry.d.ts +10 -0
  117. package/dist/testing/core/spec-registry.d.ts.map +1 -0
  118. package/dist/testing/core/spec-registry.js +32 -0
  119. package/dist/testing/core/spec-registry.js.map +1 -0
  120. package/dist/testing/core/step-registry.d.ts +10 -0
  121. package/dist/testing/core/step-registry.d.ts.map +1 -0
  122. package/dist/testing/core/step-registry.js +26 -0
  123. package/dist/testing/core/step-registry.js.map +1 -0
  124. package/dist/testing/core/testing-engine.d.ts +14 -0
  125. package/dist/testing/core/testing-engine.d.ts.map +1 -0
  126. package/dist/testing/core/testing-engine.js +97 -0
  127. package/dist/testing/core/testing-engine.js.map +1 -0
  128. package/dist/testing/core/timeout.d.ts +2 -0
  129. package/dist/testing/core/timeout.d.ts.map +1 -0
  130. package/dist/testing/core/timeout.js +18 -0
  131. package/dist/testing/core/timeout.js.map +1 -0
  132. package/dist/testing/reporter/attachments.d.ts +4 -0
  133. package/dist/testing/reporter/attachments.d.ts.map +1 -0
  134. package/dist/testing/reporter/attachments.js +25 -0
  135. package/dist/testing/reporter/attachments.js.map +1 -0
  136. package/dist/testing/reporter/console-reporter.d.ts +45 -0
  137. package/dist/testing/reporter/console-reporter.d.ts.map +1 -0
  138. package/dist/testing/reporter/console-reporter.js +189 -0
  139. package/dist/testing/reporter/console-reporter.js.map +1 -0
  140. package/dist/testing/reporter/reporter.types.d.ts +37 -0
  141. package/dist/testing/reporter/reporter.types.d.ts.map +1 -0
  142. package/dist/testing/reporter/reporter.types.js +3 -0
  143. package/dist/testing/reporter/reporter.types.js.map +1 -0
  144. package/dist/testing/runner/lifecycle.d.ts +9 -0
  145. package/dist/testing/runner/lifecycle.d.ts.map +1 -0
  146. package/dist/testing/runner/lifecycle.js +33 -0
  147. package/dist/testing/runner/lifecycle.js.map +1 -0
  148. package/dist/testing/runner/run-from-metadata.d.ts +24 -0
  149. package/dist/testing/runner/run-from-metadata.d.ts.map +1 -0
  150. package/dist/testing/runner/run-from-metadata.js +70 -0
  151. package/dist/testing/runner/run-from-metadata.js.map +1 -0
  152. package/dist/testing/runner/scenario-filter.d.ts +9 -0
  153. package/dist/testing/runner/scenario-filter.d.ts.map +1 -0
  154. package/dist/testing/runner/scenario-filter.js +22 -0
  155. package/dist/testing/runner/scenario-filter.js.map +1 -0
  156. package/dist/testing/steps/api/auth.step.d.ts +3 -0
  157. package/dist/testing/steps/api/auth.step.d.ts.map +1 -0
  158. package/dist/testing/steps/api/auth.step.js +38 -0
  159. package/dist/testing/steps/api/auth.step.js.map +1 -0
  160. package/dist/testing/steps/api/index.d.ts +3 -0
  161. package/dist/testing/steps/api/index.d.ts.map +1 -0
  162. package/dist/testing/steps/api/index.js +10 -0
  163. package/dist/testing/steps/api/index.js.map +1 -0
  164. package/dist/testing/steps/api/request.step.d.ts +3 -0
  165. package/dist/testing/steps/api/request.step.d.ts.map +1 -0
  166. package/dist/testing/steps/api/request.step.js +281 -0
  167. package/dist/testing/steps/api/request.step.js.map +1 -0
  168. package/dist/testing/steps/assert/http.step.d.ts +3 -0
  169. package/dist/testing/steps/assert/http.step.d.ts.map +1 -0
  170. package/dist/testing/steps/assert/http.step.js +27 -0
  171. package/dist/testing/steps/assert/http.step.js.map +1 -0
  172. package/dist/testing/steps/assert/index.d.ts +3 -0
  173. package/dist/testing/steps/assert/index.d.ts.map +1 -0
  174. package/dist/testing/steps/assert/index.js +12 -0
  175. package/dist/testing/steps/assert/index.js.map +1 -0
  176. package/dist/testing/steps/assert/jsonpath.step.d.ts +3 -0
  177. package/dist/testing/steps/assert/jsonpath.step.d.ts.map +1 -0
  178. package/dist/testing/steps/assert/jsonpath.step.js +40 -0
  179. package/dist/testing/steps/assert/jsonpath.step.js.map +1 -0
  180. package/dist/testing/steps/assert/primitives.step.d.ts +3 -0
  181. package/dist/testing/steps/assert/primitives.step.d.ts.map +1 -0
  182. package/dist/testing/steps/assert/primitives.step.js +43 -0
  183. package/dist/testing/steps/assert/primitives.step.js.map +1 -0
  184. package/dist/testing/steps/test/index.d.ts +3 -0
  185. package/dist/testing/steps/test/index.d.ts.map +1 -0
  186. package/dist/testing/steps/test/index.js +8 -0
  187. package/dist/testing/steps/test/index.js.map +1 -0
  188. package/dist/testing/steps/test/test-spec.step.d.ts +3 -0
  189. package/dist/testing/steps/test/test-spec.step.d.ts.map +1 -0
  190. package/dist/testing/steps/test/test-spec.step.js +41 -0
  191. package/dist/testing/steps/test/test-spec.step.js.map +1 -0
  192. package/dist/testing/steps/ui/actions.step.d.ts +3 -0
  193. package/dist/testing/steps/ui/actions.step.d.ts.map +1 -0
  194. package/dist/testing/steps/ui/actions.step.js +31 -0
  195. package/dist/testing/steps/ui/actions.step.js.map +1 -0
  196. package/dist/testing/steps/ui/assertions.step.d.ts +3 -0
  197. package/dist/testing/steps/ui/assertions.step.d.ts.map +1 -0
  198. package/dist/testing/steps/ui/assertions.step.js +41 -0
  199. package/dist/testing/steps/ui/assertions.step.js.map +1 -0
  200. package/dist/testing/steps/ui/form.step.d.ts +3 -0
  201. package/dist/testing/steps/ui/form.step.d.ts.map +1 -0
  202. package/dist/testing/steps/ui/form.step.js +34 -0
  203. package/dist/testing/steps/ui/form.step.js.map +1 -0
  204. package/dist/testing/steps/ui/index.d.ts +3 -0
  205. package/dist/testing/steps/ui/index.d.ts.map +1 -0
  206. package/dist/testing/steps/ui/index.js +14 -0
  207. package/dist/testing/steps/ui/index.js.map +1 -0
  208. package/dist/testing/steps/ui/navigation.step.d.ts +3 -0
  209. package/dist/testing/steps/ui/navigation.step.d.ts.map +1 -0
  210. package/dist/testing/steps/ui/navigation.step.js +39 -0
  211. package/dist/testing/steps/ui/navigation.step.js.map +1 -0
  212. package/dist/testing/steps/util/index.d.ts +3 -0
  213. package/dist/testing/steps/util/index.d.ts.map +1 -0
  214. package/dist/testing/steps/util/index.js +12 -0
  215. package/dist/testing/steps/util/index.js.map +1 -0
  216. package/dist/testing/steps/util/log.step.d.ts +3 -0
  217. package/dist/testing/steps/util/log.step.d.ts.map +1 -0
  218. package/dist/testing/steps/util/log.step.js +18 -0
  219. package/dist/testing/steps/util/log.step.js.map +1 -0
  220. package/dist/testing/steps/util/require.step.d.ts +3 -0
  221. package/dist/testing/steps/util/require.step.d.ts.map +1 -0
  222. package/dist/testing/steps/util/require.step.js +16 -0
  223. package/dist/testing/steps/util/require.step.js.map +1 -0
  224. package/dist/testing/steps/util/sleep.step.d.ts +3 -0
  225. package/dist/testing/steps/util/sleep.step.d.ts.map +1 -0
  226. package/dist/testing/steps/util/sleep.step.js +13 -0
  227. package/dist/testing/steps/util/sleep.step.js.map +1 -0
  228. package/docs/test-data-workflow.md +51 -11
  229. package/package.json +4 -2
  230. package/src/commands/run-tests.command.ts +278 -0
  231. package/src/commands/test-data.command.ts +26 -26
  232. package/src/commands/test.command.ts +14 -0
  233. package/src/controllers/service.controller.ts +58 -59
  234. package/src/dtos/basic-filters.dto.ts +0 -2
  235. package/src/dtos/create-user.dto.ts +1 -0
  236. package/src/helpers/schematic.service.ts +1 -1
  237. package/src/index.ts +3 -0
  238. package/src/seeders/module-metadata-seeder.service.ts +5 -25
  239. package/src/seeders/module-test-data.service.ts +5 -3
  240. package/src/seeders/seed-data/solid-core-metadata.json +34 -9
  241. package/src/services/chatter-message.service.ts +18 -1
  242. package/src/services/crud.service.ts +1 -0
  243. package/src/services/model-metadata.service.ts +2 -1
  244. package/src/services/module-metadata.service.ts +2 -1
  245. package/src/services/queues/common.ts +75 -0
  246. package/src/services/queues/database-publisher.service.ts +4 -1
  247. package/src/services/queues/database-subscriber.service.ts +5 -3
  248. package/src/services/queues/rabbitmq-publisher.service.ts +17 -7
  249. package/src/services/queues/rabbitmq-subscriber.service.ts +223 -95
  250. package/src/solid-core.module.ts +4 -0
  251. package/src/testing/README.md +364 -0
  252. package/src/testing/__examples__/register-example-specs.ts +6 -0
  253. package/src/testing/__examples__/specs/custom-health.spec.ts +29 -0
  254. package/src/testing/__examples__/testing.sample.json +82 -0
  255. package/src/testing/adapters/api/api-adapter.ts +85 -0
  256. package/src/testing/adapters/api/api.types.ts +15 -0
  257. package/src/testing/adapters/ui/playwright-adapter.ts +54 -0
  258. package/src/testing/adapters/ui/ui.types.ts +4 -0
  259. package/src/testing/contracts/runtime-context.types.ts +36 -0
  260. package/src/testing/contracts/test-spec.types.ts +24 -0
  261. package/src/testing/contracts/testing-metadata.types.ts +46 -0
  262. package/src/testing/core/interpolation.ts +189 -0
  263. package/src/testing/core/normalize-steps.ts +21 -0
  264. package/src/testing/core/resource-store.ts +38 -0
  265. package/src/testing/core/spec-registry.ts +33 -0
  266. package/src/testing/core/step-registry.ts +27 -0
  267. package/src/testing/core/testing-engine.ts +127 -0
  268. package/src/testing/core/timeout.ts +19 -0
  269. package/src/testing/reporter/attachments.ts +25 -0
  270. package/src/testing/reporter/console-reporter.ts +229 -0
  271. package/src/testing/reporter/reporter.types.ts +36 -0
  272. package/src/testing/runner/lifecycle.ts +31 -0
  273. package/src/testing/runner/run-from-metadata.ts +87 -0
  274. package/src/testing/runner/scenario-filter.ts +33 -0
  275. package/src/testing/steps/api/auth.step.ts +66 -0
  276. package/src/testing/steps/api/index.ts +10 -0
  277. package/src/testing/steps/api/request.step.ts +358 -0
  278. package/src/testing/steps/assert/http.step.ts +33 -0
  279. package/src/testing/steps/assert/index.ts +12 -0
  280. package/src/testing/steps/assert/jsonpath.step.ts +50 -0
  281. package/src/testing/steps/assert/primitives.step.ts +69 -0
  282. package/src/testing/steps/test/index.ts +8 -0
  283. package/src/testing/steps/test/test-spec.step.ts +52 -0
  284. package/src/testing/steps/ui/actions.step.ts +36 -0
  285. package/src/testing/steps/ui/assertions.step.ts +54 -0
  286. package/src/testing/steps/ui/form.step.ts +39 -0
  287. package/src/testing/steps/ui/index.ts +12 -0
  288. package/src/testing/steps/ui/navigation.step.ts +53 -0
  289. package/src/testing/steps/util/index.ts +10 -0
  290. package/src/testing/steps/util/log.step.ts +19 -0
  291. package/src/testing/steps/util/require.step.ts +16 -0
  292. package/src/testing/steps/util/sleep.step.ts +15 -0
  293. package/tsconfig.json +35 -25
  294. package/tsconfig.tests.json +14 -0
  295. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -18,7 +18,7 @@ The commands below are the canonical flow.
18
18
 
19
19
  Command:
20
20
  ```
21
- npx @solidxai/solidctl test-data --create-datasources
21
+ npx @solidxai/solidctl test data --setup
22
22
  ```
23
23
 
24
24
  What this does:
@@ -33,7 +33,7 @@ What this does:
33
33
 
34
34
  Example output:
35
35
  ```
36
- ▶ Running solid test-data
36
+ ▶ Running solid test data
37
37
  Creating test datasource environment file and manifest.
38
38
  Backed up .env to .env.backup.steady_wolf and applied new test datasource names to .env.
39
39
  Creating test database/schema "default_20260201234402_steady_wolf" on datasource "default"...
@@ -55,7 +55,7 @@ Creating test database/schema "default_20260201234402_steady_wolf" on datasource
55
55
  5) Tear down
56
56
  ============================================================
57
57
 
58
- ✔ solid test-data completed
58
+ ✔ solid test data completed
59
59
  ```
60
60
 
61
61
  Rationale:
@@ -97,7 +97,7 @@ Rationale:
97
97
 
98
98
  Command:
99
99
  ```
100
- npx @solidxai/solidctl test-data --load-data
100
+ npx @solidxai/solidctl test data --load
101
101
  ```
102
102
 
103
103
  What this does:
@@ -109,13 +109,13 @@ What this does:
109
109
 
110
110
  Example output:
111
111
  ```
112
- ▶ Running solid test-data
112
+ ▶ Running solid test data
113
113
  Test data setup for all modules.
114
114
  Processing test data for module: solid-core
115
115
  ✔ Test data setup complete for module: solid-core
116
116
  Processing test data for module: venue
117
117
  ✔ Test data setup complete for module: venue
118
- ✔ solid test-data completed
118
+ ✔ solid test data completed
119
119
  ```
120
120
 
121
121
  Rationale:
@@ -123,11 +123,51 @@ Rationale:
123
123
 
124
124
  ---
125
125
 
126
- ## Step 4: Tear everything down
126
+
127
+ ## Step 4: Run Tests
128
+ ```
129
+ npx @solidxai/solidctl test run --module venue --api-base-url http://localhost:3000 --ui-base-url http://localhost:5173 --headless false
130
+ ```
131
+
132
+ ```
133
+ npx @solidxai/solidctl test run --module venue --list-specs
134
+ ```
135
+
136
+ What this does:
137
+ - Loads `testing.scenarios` from the module metadata file.
138
+ - Applies `--scenario-ids` or `--include-tags` filtering if provided.
139
+ - Boots API and UI adapters with the supplied base URLs.
140
+ - Registers any custom test specs listed in `testing.specs`.
141
+ - Executes scenarios in order with fail‑fast behavior.
142
+
143
+ Useful variants:
144
+ ```
145
+ npx @solidxai/solidctl test run --module venue --scenario-ids api-authenticate-success,api-create-states
146
+ ```
147
+
148
+ ```
149
+ npx @solidxai/solidctl test run --module venue --include-tags smoke
150
+ ```
151
+
152
+ ```
153
+ npx @solidxai/solidctl test run --module venue --api-base-url http://localhost:3000 --headless true
154
+ ```
155
+
156
+ ```
157
+ npx @solidxai/solidctl test run --module venue --headless false
158
+ ```
159
+
160
+ Notes:
161
+ - If your scenario depends on a previous scenario’s `saveAs` output (e.g., `loginSuccess`), ensure the auth scenario runs first.
162
+ - For UI tests, `--ui-base-url` should point to a running frontend server.
163
+ - `--list-specs` prints registered custom `test.spec` ids and exits.
164
+
165
+
166
+ ## Step 5: Tear everything down
127
167
 
128
168
  Command:
129
169
  ```
130
- npx @solidxai/solidctl test-data --delete-datasources
170
+ npx @solidxai/solidctl test data --teardown
131
171
  ```
132
172
 
133
173
  What this does:
@@ -138,11 +178,11 @@ What this does:
138
178
 
139
179
  Example output:
140
180
  ```
141
- ▶ Running solid test-data
181
+ ▶ Running solid test data
142
182
  Deleting test datasource environment and databases.
143
183
  Dropping test database/schema "default_20260201234402_steady_wolf" on datasource "default"...
144
184
  ✔ Test datasource env files and manifest deleted; test databases dropped.
145
- ✔ solid test-data completed
185
+ ✔ solid test data completed
146
186
  ```
147
187
 
148
188
  Rationale:
@@ -154,7 +194,7 @@ Rationale:
154
194
 
155
195
  You can restrict test data loading to a subset of modules:
156
196
  ```
157
- npx @solidxai/solidctl test-data --load-data --modules-to-test venue,reports
197
+ npx @solidxai/solidctl test data --load --modules-to-test venue,reports
158
198
  ```
159
199
 
160
200
  Only the listed modules are processed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidxai/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "description": "This module is a NestJS module containing all the required core providers required by a Solid application",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,8 @@
24
24
  "test:cov": "jest --coverage",
25
25
  "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
26
26
  "test:e2e": "jest --config ./test/jest-e2e.json",
27
- "prepare": "npm run build"
27
+ "prepare": "npm run build",
28
+ "prepack": "npm run build"
28
29
  },
29
30
  "author": "Oswald Rodrigues <oswald@logicloop.io>",
30
31
  "license": "ISC",
@@ -118,6 +119,7 @@
118
119
  "@nestjs/testing": "^10.0.0",
119
120
  "@nestjs/typeorm": "^10.0.1",
120
121
  "@solidxai/code-builder": "^0.0.2",
122
+ "@playwright/test": "^1.50.0",
121
123
  "@types/express": "^4.17.17",
122
124
  "@types/hapi__joi": "^17.1.12",
123
125
  "@types/jest": "^29.5.2",
@@ -0,0 +1,278 @@
1
+ import { Logger } from '@nestjs/common';
2
+ import { SubCommand, CommandRunner, Option } from 'nest-commander';
3
+ import * as path from 'path';
4
+ import { ModuleMetadataHelperService } from 'src/helpers/module-metadata-helper.service';
5
+ import { ConsoleReporter } from 'src/testing/reporter/console-reporter';
6
+ import { runFromMetadata } from 'src/testing/runner/run-from-metadata';
7
+ import type { TestingMetadata } from 'src/testing/contracts/testing-metadata.types';
8
+ import { SpecRegistry } from 'src/testing/core/spec-registry';
9
+
10
+ interface TestRunCommandOptions {
11
+ module?: string;
12
+ moduleName?: string;
13
+ scenarioIds?: string;
14
+ includeTags?: string;
15
+ skipScenarioIds?: string;
16
+ reporter?: string;
17
+ apiBaseUrl?: string;
18
+ uiBaseUrl?: string;
19
+ headless?: boolean;
20
+ timeoutMs?: number;
21
+ retries?: number;
22
+ listSpecs?: boolean;
23
+ printApiLogs?: boolean;
24
+ }
25
+
26
+ @SubCommand({
27
+ name: 'run',
28
+ description: 'Run testing scenarios from module metadata.',
29
+ })
30
+ export class TestRunCommand extends CommandRunner {
31
+ private readonly logger = new Logger(TestRunCommand.name);
32
+
33
+ constructor(
34
+ private readonly moduleMetadataHelperService: ModuleMetadataHelperService,
35
+ ) {
36
+ super();
37
+ }
38
+
39
+ async run(passedParam: string[], options?: TestRunCommandOptions): Promise<void> {
40
+ try {
41
+ const moduleName = options?.moduleName ?? options?.module ?? passedParam?.[0];
42
+ if (!moduleName) {
43
+ this.logger.error('Module name is required. Use --module or pass it as the first argument.');
44
+ return;
45
+ }
46
+
47
+ const metadataPath = await this.moduleMetadataHelperService.getModuleMetadataFilePath(moduleName);
48
+ if (!metadataPath) {
49
+ this.logger.error(`Unable to resolve metadata path for module: ${moduleName}`);
50
+ return;
51
+ }
52
+
53
+ const metadata = await this.moduleMetadataHelperService.getModuleMetadataConfiguration(metadataPath);
54
+ if (!metadata?.testing) {
55
+ this.logger.error(`No testing configuration found in metadata: ${metadataPath}`);
56
+ return;
57
+ }
58
+
59
+ const listSpecs = options?.listSpecs ?? false;
60
+ const specEntries = Array.isArray(metadata.testing?.specs)
61
+ ? metadata.testing.specs
62
+ : [];
63
+
64
+ if (listSpecs) {
65
+ const registry = new SpecRegistry();
66
+ if (specEntries.length) {
67
+ loadSpecRegistrations(specEntries, metadataPath, registry);
68
+ }
69
+ printSpecList(registry.list());
70
+ return;
71
+ }
72
+ if (!metadata?.testing?.scenarios || !Array.isArray(metadata.testing.scenarios)) {
73
+ this.logger.error(`No testing.scenarios found in metadata: ${metadataPath}`);
74
+ return;
75
+ }
76
+
77
+ const scenarioIds = splitCsv(options?.scenarioIds);
78
+ const includeTags = splitCsv(options?.includeTags);
79
+ const skipScenarioIds = splitCsv(options?.skipScenarioIds);
80
+
81
+ const reporterName = options?.reporter ?? 'console';
82
+ if (reporterName !== 'console') {
83
+ this.logger.error(`Unsupported reporter: ${reporterName}. Use "console".`);
84
+ return;
85
+ }
86
+
87
+ const apiBaseUrl = options?.apiBaseUrl ?? process.env.BASE_URL;
88
+ const uiBaseUrl = options?.uiBaseUrl ?? process.env.FRONTEND_BASE_URL;
89
+ const headless = options?.headless ?? true;
90
+ const printApiLogs = options?.printApiLogs ?? false;
91
+
92
+ await runFromMetadata({
93
+ metadata: metadata as TestingMetadata,
94
+ scenarioIds,
95
+ includeTags,
96
+ skipScenarioIds,
97
+ reporter: new ConsoleReporter(),
98
+ api: apiBaseUrl ? { baseUrl: apiBaseUrl } : undefined,
99
+ ui: { baseUrl: uiBaseUrl, headless },
100
+ defaults: {
101
+ timeoutMs: options?.timeoutMs,
102
+ retries: options?.retries,
103
+ },
104
+ options: { printApiLogs },
105
+ specs: specEntries.length
106
+ ? (registry) => loadSpecRegistrations(specEntries, metadataPath, registry)
107
+ : undefined,
108
+ });
109
+ } catch (err: any) {
110
+ this.logger.error('Run tests command failed');
111
+ console.error('Run tests command failed');
112
+ process.exitCode = 1;
113
+ return;
114
+ }
115
+ }
116
+
117
+ @Option({
118
+ flags: '-m, --module [module name]',
119
+ description: 'Module name to load metadata from.',
120
+ required: false,
121
+ })
122
+ parseModule(val: string): string {
123
+ return val;
124
+ }
125
+
126
+ @Option({
127
+ flags: '--scenario-ids [ids]',
128
+ description: 'Comma-separated list of scenario ids to run.',
129
+ required: false,
130
+ })
131
+ parseScenarioIds(val: string): string {
132
+ return val;
133
+ }
134
+
135
+ @Option({
136
+ flags: '--include-tags [tags]',
137
+ description: 'Comma-separated list of tags; scenario must include all.',
138
+ required: false,
139
+ })
140
+ parseIncludeTags(val: string): string {
141
+ return val;
142
+ }
143
+
144
+ @Option({
145
+ flags: '--skip-scenario-ids [ids]',
146
+ description: 'Comma-separated list of scenario ids to skip.',
147
+ required: false,
148
+ })
149
+ parseSkipScenarioIds(val: string): string {
150
+ return val;
151
+ }
152
+
153
+ @Option({
154
+ flags: '--reporter [name]',
155
+ description: 'Reporter name (currently only "console").',
156
+ required: false,
157
+ })
158
+ parseReporter(val: string): string {
159
+ return val;
160
+ }
161
+
162
+ @Option({
163
+ flags: '--list-specs [true|false]',
164
+ description: 'List registered test specs and exit.',
165
+ required: false,
166
+ })
167
+ parseListSpecs(val?: string): boolean {
168
+ if (val === undefined) return true;
169
+ return val === 'false' ? false : true;
170
+ }
171
+
172
+ @Option({
173
+ flags: '--print-api-logs [true|false]',
174
+ description: 'Print full API request/response logs for api.request steps.',
175
+ required: false,
176
+ })
177
+ parsePrintApiLogs(val?: string): boolean {
178
+ if (val === undefined) return true;
179
+ return val === 'false' ? false : true;
180
+ }
181
+
182
+ @Option({
183
+ flags: '--api-base-url [url]',
184
+ description: 'API base URL (defaults to process.env.BASE_URL).',
185
+ required: false,
186
+ })
187
+ parseApiBaseUrl(val: string): string {
188
+ return val;
189
+ }
190
+
191
+ @Option({
192
+ flags: '--ui-base-url [url]',
193
+ description: 'UI base URL (defaults to process.env.FRONTEND_BASE_URL).',
194
+ required: false,
195
+ })
196
+ parseUiBaseUrl(val: string): string {
197
+ return val;
198
+ }
199
+
200
+ @Option({
201
+ flags: '--headless [true|false]',
202
+ description: 'Run UI browser in headless mode (default: true).',
203
+ required: false,
204
+ })
205
+ parseHeadless(val: string): boolean {
206
+ return val === 'false' ? false : true;
207
+ }
208
+
209
+ @Option({
210
+ flags: '--timeout-ms [number]',
211
+ description: 'Default scenario timeout in milliseconds.',
212
+ required: false,
213
+ })
214
+ parseTimeoutMs(val: string): number {
215
+ return Number(val);
216
+ }
217
+
218
+ @Option({
219
+ flags: '--retries [number]',
220
+ description: 'Default scenario retries.',
221
+ required: false,
222
+ })
223
+ parseRetries(val: string): number {
224
+ return Number(val);
225
+ }
226
+ }
227
+
228
+ function splitCsv(value?: string): string[] | undefined {
229
+ if (!value) return undefined;
230
+ const items = value
231
+ .split(',')
232
+ .map((item) => item.trim())
233
+ .filter(Boolean);
234
+ return items.length ? items : undefined;
235
+ }
236
+
237
+ function resolveSpecPath(entry: string, metadataPath: string): string {
238
+ if (path.isAbsolute(entry)) {
239
+ return entry;
240
+ }
241
+ if (entry.startsWith('.')) {
242
+ return path.resolve(path.dirname(metadataPath), entry);
243
+ }
244
+ return path.resolve(process.cwd(), entry);
245
+ }
246
+
247
+ function loadSpecRegistrations(entries: string[], metadataPath: string, registry: SpecRegistry): void {
248
+ for (const entry of entries) {
249
+ const resolved = resolveSpecPath(entry, metadataPath);
250
+ let mod: any;
251
+ try {
252
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
253
+ mod = require(resolved);
254
+ } catch (err: any) {
255
+ const message = err?.message ?? String(err);
256
+ throw new Error(
257
+ `Failed to load test spec module "${entry}" resolved to "${resolved}": ${message}`,
258
+ );
259
+ }
260
+ const register = mod?.registerTestSpecs ?? mod?.default ?? mod;
261
+ if (typeof register !== 'function') {
262
+ throw new Error(
263
+ `Test spec module "${entry}" did not export a register function (expected "registerTestSpecs" or default export).`,
264
+ );
265
+ }
266
+ register(registry);
267
+ }
268
+ }
269
+ function printSpecList(specIds: string[]): void {
270
+ if (!specIds.length) {
271
+ console.log('No test specs registered.');
272
+ return;
273
+ }
274
+ console.log('Registered test specs:');
275
+ for (const id of specIds) {
276
+ console.log(`- ${id}`);
277
+ }
278
+ }
@@ -1,17 +1,17 @@
1
1
  import { Logger } from '@nestjs/common';
2
- import { Command, CommandRunner, Option } from 'nest-commander';
2
+ import { SubCommand, CommandRunner, Option } from 'nest-commander';
3
3
  import { ModuleTestDataService } from 'src/seeders/module-test-data.service';
4
4
 
5
5
  interface TestDataCommandOptions {
6
- loadData?: boolean;
6
+ load?: boolean;
7
7
  modulesToTest?: string;
8
- createDatasources?: boolean;
9
- deleteDatasources?: boolean;
8
+ setup?: boolean;
9
+ teardown?: boolean;
10
10
  }
11
11
 
12
- @Command({
13
- name: 'test-data',
14
- description: 'Seed test data from testData sections',
12
+ @SubCommand({
13
+ name: 'data',
14
+ description: 'Seed test data from testing.data sections',
15
15
  })
16
16
  export class TestDataCommand extends CommandRunner {
17
17
  private readonly logger = new Logger(TestDataCommand.name);
@@ -22,38 +22,38 @@ export class TestDataCommand extends CommandRunner {
22
22
 
23
23
  async run(_passedParam: string[], options?: TestDataCommandOptions): Promise<void> {
24
24
  try {
25
- const loadData = Boolean(options?.loadData);
26
- const createDatasources = Boolean(options?.createDatasources);
27
- const deleteDatasources = Boolean(options?.deleteDatasources);
25
+ const load = Boolean(options?.load);
26
+ const setup = Boolean(options?.setup);
27
+ const teardown = Boolean(options?.teardown);
28
28
 
29
- const selectedModes = [loadData, createDatasources, deleteDatasources].filter(Boolean).length;
29
+ const selectedModes = [load, setup, teardown].filter(Boolean).length;
30
30
  if (selectedModes > 1) {
31
- this.logger.error('Please specify only one of --load-data, --create-datasources, or --delete-datasources.');
32
- console.log('Please specify only one of --load-data, --create-datasources, or --delete-datasources.');
31
+ this.logger.error('Please specify only one of --load, --setup, or --teardown.');
32
+ console.log('Please specify only one of --load, --setup, or --teardown.');
33
33
  return;
34
34
  }
35
35
 
36
- if (!loadData && !createDatasources && !deleteDatasources) {
37
- this.logger.error('Please specify one of --load-data, --create-datasources, or --delete-datasources.');
38
- console.log('Please specify one of --load-data, --create-datasources, or --delete-datasources.');
36
+ if (!load && !setup && !teardown) {
37
+ this.logger.error('Please specify one of --load, --setup, or --teardown.');
38
+ console.log('Please specify one of --load, --setup, or --teardown.');
39
39
  return;
40
40
  }
41
41
 
42
- if (deleteDatasources) {
42
+ if (teardown) {
43
43
  this.logger.log('Deleting test datasource environment and databases.');
44
44
  console.log('Deleting test datasource environment and databases.');
45
45
  await this.testDataService.deleteTestDatasources();
46
46
  return;
47
47
  }
48
48
 
49
- if (createDatasources) {
49
+ if (setup) {
50
50
  this.logger.log('Creating test datasource environment file and manifest.');
51
51
  console.log('Creating test datasource environment file and manifest.');
52
52
  await this.testDataService.createTestDatasources();
53
53
  return;
54
54
  }
55
55
 
56
- if (loadData) {
56
+ if (load) {
57
57
  const modulesToTest = options?.modulesToTest ? options.modulesToTest.split(',').map((m) => m.trim()).filter(Boolean) : null;
58
58
  if (modulesToTest?.length) {
59
59
  this.logger.log(`Test data setup for modules: ${modulesToTest.join(', ')}`);
@@ -77,26 +77,26 @@ export class TestDataCommand extends CommandRunner {
77
77
  }
78
78
 
79
79
  @Option({
80
- flags: '--load-data',
81
- description: 'Seed test data from testData sections',
80
+ flags: '--load',
81
+ description: 'Seed test data from testing.data sections',
82
82
  })
83
- parseLoadData(): boolean {
83
+ parseLoad(): boolean {
84
84
  return true;
85
85
  }
86
86
 
87
87
  @Option({
88
- flags: '--create-datasources',
88
+ flags: '--setup',
89
89
  description: 'Create a new .env.<dbRunName> and test datasource manifest',
90
90
  })
91
- parseCreateDatasources(): boolean {
91
+ parseSetup(): boolean {
92
92
  return true;
93
93
  }
94
94
 
95
95
  @Option({
96
- flags: '--delete-datasources',
96
+ flags: '--teardown',
97
97
  description: 'Delete test datasource env/manifest and drop test databases',
98
98
  })
99
- parseDeleteDatasources(): boolean {
99
+ parseTeardown(): boolean {
100
100
  return true;
101
101
  }
102
102
 
@@ -0,0 +1,14 @@
1
+ import { Command, CommandRunner } from 'nest-commander';
2
+ import { TestDataCommand } from './test-data.command';
3
+ import { TestRunCommand } from './run-tests.command';
4
+
5
+ @Command({
6
+ name: 'test',
7
+ description: 'Testing utilities.',
8
+ subCommands: [TestRunCommand, TestDataCommand],
9
+ })
10
+ export class TestCommand extends CommandRunner {
11
+ async run(): Promise<void> {
12
+ console.log('Usage: solidctl test <run|data> [options]');
13
+ }
14
+ }