@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.
- package/dist/commands/run-tests.command.d.ts +37 -0
- package/dist/commands/run-tests.command.d.ts.map +1 -0
- package/dist/commands/run-tests.command.js +345 -0
- package/dist/commands/run-tests.command.js.map +1 -0
- package/dist/commands/test-data.command.d.ts +6 -6
- package/dist/commands/test-data.command.d.ts.map +1 -1
- package/dist/commands/test-data.command.js +25 -25
- package/dist/commands/test-data.command.js.map +1 -1
- package/dist/commands/test.command.d.ts +5 -0
- package/dist/commands/test.command.d.ts.map +1 -0
- package/dist/commands/test.command.js +26 -0
- package/dist/commands/test.command.js.map +1 -0
- package/dist/controllers/service.controller.d.ts +0 -9
- package/dist/controllers/service.controller.d.ts.map +1 -1
- package/dist/controllers/service.controller.js +0 -45
- package/dist/controllers/service.controller.js.map +1 -1
- package/dist/dtos/basic-filters.dto.d.ts.map +1 -1
- package/dist/dtos/basic-filters.dto.js.map +1 -1
- package/dist/dtos/create-user.dto.d.ts +1 -0
- package/dist/dtos/create-user.dto.d.ts.map +1 -1
- package/dist/dtos/create-user.dto.js +2 -1
- package/dist/dtos/create-user.dto.js.map +1 -1
- package/dist/helpers/schematic.service.js +1 -1
- package/dist/helpers/schematic.service.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +3 -21
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/module-test-data.service.d.ts.map +1 -1
- package/dist/seeders/module-test-data.service.js +3 -3
- package/dist/seeders/module-test-data.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +34 -9
- package/dist/services/chatter-message.service.d.ts +2 -0
- package/dist/services/chatter-message.service.d.ts.map +1 -1
- package/dist/services/chatter-message.service.js +18 -2
- package/dist/services/chatter-message.service.js.map +1 -1
- package/dist/services/crud.service.d.ts.map +1 -1
- package/dist/services/crud.service.js.map +1 -1
- package/dist/services/model-metadata.service.d.ts.map +1 -1
- package/dist/services/model-metadata.service.js +2 -1
- package/dist/services/model-metadata.service.js.map +1 -1
- package/dist/services/module-metadata.service.d.ts.map +1 -1
- package/dist/services/module-metadata.service.js +2 -1
- package/dist/services/module-metadata.service.js.map +1 -1
- package/dist/services/queues/common.d.ts +3 -0
- package/dist/services/queues/common.d.ts.map +1 -0
- package/dist/services/queues/common.js +39 -0
- package/dist/services/queues/common.js.map +1 -0
- package/dist/services/queues/database-publisher.service.d.ts.map +1 -1
- package/dist/services/queues/database-publisher.service.js +3 -1
- package/dist/services/queues/database-publisher.service.js.map +1 -1
- package/dist/services/queues/database-subscriber.service.d.ts.map +1 -1
- package/dist/services/queues/database-subscriber.service.js +5 -2
- package/dist/services/queues/database-subscriber.service.js.map +1 -1
- package/dist/services/queues/rabbitmq-publisher.service.d.ts.map +1 -1
- package/dist/services/queues/rabbitmq-publisher.service.js +13 -6
- package/dist/services/queues/rabbitmq-publisher.service.js.map +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.d.ts +14 -1
- package/dist/services/queues/rabbitmq-subscriber.service.d.ts.map +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.js +197 -65
- package/dist/services/queues/rabbitmq-subscriber.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +4 -0
- package/dist/solid-core.module.js.map +1 -1
- package/dist/testing/__examples__/register-example-specs.d.ts +3 -0
- package/dist/testing/__examples__/register-example-specs.d.ts.map +1 -0
- package/dist/testing/__examples__/register-example-specs.js +8 -0
- package/dist/testing/__examples__/register-example-specs.js.map +1 -0
- package/dist/testing/__examples__/specs/custom-health.spec.d.ts +17 -0
- package/dist/testing/__examples__/specs/custom-health.spec.d.ts.map +1 -0
- package/dist/testing/__examples__/specs/custom-health.spec.js +30 -0
- package/dist/testing/__examples__/specs/custom-health.spec.js.map +1 -0
- package/dist/testing/adapters/api/api-adapter.d.ts +9 -0
- package/dist/testing/adapters/api/api-adapter.d.ts.map +1 -0
- package/dist/testing/adapters/api/api-adapter.js +76 -0
- package/dist/testing/adapters/api/api-adapter.js.map +1 -0
- package/dist/testing/adapters/api/api.types.d.ts +14 -0
- package/dist/testing/adapters/api/api.types.d.ts.map +1 -0
- package/dist/testing/adapters/api/api.types.js +3 -0
- package/dist/testing/adapters/api/api.types.js.map +1 -0
- package/dist/testing/adapters/ui/playwright-adapter.d.ts +14 -0
- package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -0
- package/dist/testing/adapters/ui/playwright-adapter.js +47 -0
- package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -0
- package/dist/testing/adapters/ui/ui.types.d.ts +5 -0
- package/dist/testing/adapters/ui/ui.types.d.ts.map +1 -0
- package/dist/testing/adapters/ui/ui.types.js +3 -0
- package/dist/testing/adapters/ui/ui.types.js.map +1 -0
- package/dist/testing/contracts/runtime-context.types.d.ts +35 -0
- package/dist/testing/contracts/runtime-context.types.d.ts.map +1 -0
- package/dist/testing/contracts/runtime-context.types.js +3 -0
- package/dist/testing/contracts/runtime-context.types.js.map +1 -0
- package/dist/testing/contracts/test-spec.types.d.ts +21 -0
- package/dist/testing/contracts/test-spec.types.d.ts.map +1 -0
- package/dist/testing/contracts/test-spec.types.js +3 -0
- package/dist/testing/contracts/test-spec.types.js.map +1 -0
- package/dist/testing/contracts/testing-metadata.types.d.ts +41 -0
- package/dist/testing/contracts/testing-metadata.types.d.ts.map +1 -0
- package/dist/testing/contracts/testing-metadata.types.js +3 -0
- package/dist/testing/contracts/testing-metadata.types.js.map +1 -0
- package/dist/testing/core/interpolation.d.ts +4 -0
- package/dist/testing/core/interpolation.d.ts.map +1 -0
- package/dist/testing/core/interpolation.js +180 -0
- package/dist/testing/core/interpolation.js.map +1 -0
- package/dist/testing/core/normalize-steps.d.ts +7 -0
- package/dist/testing/core/normalize-steps.d.ts.map +1 -0
- package/dist/testing/core/normalize-steps.js +20 -0
- package/dist/testing/core/normalize-steps.js.map +1 -0
- package/dist/testing/core/resource-store.d.ts +8 -0
- package/dist/testing/core/resource-store.d.ts.map +1 -0
- package/dist/testing/core/resource-store.js +41 -0
- package/dist/testing/core/resource-store.js.map +1 -0
- package/dist/testing/core/spec-registry.d.ts +10 -0
- package/dist/testing/core/spec-registry.d.ts.map +1 -0
- package/dist/testing/core/spec-registry.js +32 -0
- package/dist/testing/core/spec-registry.js.map +1 -0
- package/dist/testing/core/step-registry.d.ts +10 -0
- package/dist/testing/core/step-registry.d.ts.map +1 -0
- package/dist/testing/core/step-registry.js +26 -0
- package/dist/testing/core/step-registry.js.map +1 -0
- package/dist/testing/core/testing-engine.d.ts +14 -0
- package/dist/testing/core/testing-engine.d.ts.map +1 -0
- package/dist/testing/core/testing-engine.js +97 -0
- package/dist/testing/core/testing-engine.js.map +1 -0
- package/dist/testing/core/timeout.d.ts +2 -0
- package/dist/testing/core/timeout.d.ts.map +1 -0
- package/dist/testing/core/timeout.js +18 -0
- package/dist/testing/core/timeout.js.map +1 -0
- package/dist/testing/reporter/attachments.d.ts +4 -0
- package/dist/testing/reporter/attachments.d.ts.map +1 -0
- package/dist/testing/reporter/attachments.js +25 -0
- package/dist/testing/reporter/attachments.js.map +1 -0
- package/dist/testing/reporter/console-reporter.d.ts +45 -0
- package/dist/testing/reporter/console-reporter.d.ts.map +1 -0
- package/dist/testing/reporter/console-reporter.js +189 -0
- package/dist/testing/reporter/console-reporter.js.map +1 -0
- package/dist/testing/reporter/reporter.types.d.ts +37 -0
- package/dist/testing/reporter/reporter.types.d.ts.map +1 -0
- package/dist/testing/reporter/reporter.types.js +3 -0
- package/dist/testing/reporter/reporter.types.js.map +1 -0
- package/dist/testing/runner/lifecycle.d.ts +9 -0
- package/dist/testing/runner/lifecycle.d.ts.map +1 -0
- package/dist/testing/runner/lifecycle.js +33 -0
- package/dist/testing/runner/lifecycle.js.map +1 -0
- package/dist/testing/runner/run-from-metadata.d.ts +24 -0
- package/dist/testing/runner/run-from-metadata.d.ts.map +1 -0
- package/dist/testing/runner/run-from-metadata.js +70 -0
- package/dist/testing/runner/run-from-metadata.js.map +1 -0
- package/dist/testing/runner/scenario-filter.d.ts +9 -0
- package/dist/testing/runner/scenario-filter.d.ts.map +1 -0
- package/dist/testing/runner/scenario-filter.js +22 -0
- package/dist/testing/runner/scenario-filter.js.map +1 -0
- package/dist/testing/steps/api/auth.step.d.ts +3 -0
- package/dist/testing/steps/api/auth.step.d.ts.map +1 -0
- package/dist/testing/steps/api/auth.step.js +38 -0
- package/dist/testing/steps/api/auth.step.js.map +1 -0
- package/dist/testing/steps/api/index.d.ts +3 -0
- package/dist/testing/steps/api/index.d.ts.map +1 -0
- package/dist/testing/steps/api/index.js +10 -0
- package/dist/testing/steps/api/index.js.map +1 -0
- package/dist/testing/steps/api/request.step.d.ts +3 -0
- package/dist/testing/steps/api/request.step.d.ts.map +1 -0
- package/dist/testing/steps/api/request.step.js +281 -0
- package/dist/testing/steps/api/request.step.js.map +1 -0
- package/dist/testing/steps/assert/http.step.d.ts +3 -0
- package/dist/testing/steps/assert/http.step.d.ts.map +1 -0
- package/dist/testing/steps/assert/http.step.js +27 -0
- package/dist/testing/steps/assert/http.step.js.map +1 -0
- package/dist/testing/steps/assert/index.d.ts +3 -0
- package/dist/testing/steps/assert/index.d.ts.map +1 -0
- package/dist/testing/steps/assert/index.js +12 -0
- package/dist/testing/steps/assert/index.js.map +1 -0
- package/dist/testing/steps/assert/jsonpath.step.d.ts +3 -0
- package/dist/testing/steps/assert/jsonpath.step.d.ts.map +1 -0
- package/dist/testing/steps/assert/jsonpath.step.js +40 -0
- package/dist/testing/steps/assert/jsonpath.step.js.map +1 -0
- package/dist/testing/steps/assert/primitives.step.d.ts +3 -0
- package/dist/testing/steps/assert/primitives.step.d.ts.map +1 -0
- package/dist/testing/steps/assert/primitives.step.js +43 -0
- package/dist/testing/steps/assert/primitives.step.js.map +1 -0
- package/dist/testing/steps/test/index.d.ts +3 -0
- package/dist/testing/steps/test/index.d.ts.map +1 -0
- package/dist/testing/steps/test/index.js +8 -0
- package/dist/testing/steps/test/index.js.map +1 -0
- package/dist/testing/steps/test/test-spec.step.d.ts +3 -0
- package/dist/testing/steps/test/test-spec.step.d.ts.map +1 -0
- package/dist/testing/steps/test/test-spec.step.js +41 -0
- package/dist/testing/steps/test/test-spec.step.js.map +1 -0
- package/dist/testing/steps/ui/actions.step.d.ts +3 -0
- package/dist/testing/steps/ui/actions.step.d.ts.map +1 -0
- package/dist/testing/steps/ui/actions.step.js +31 -0
- package/dist/testing/steps/ui/actions.step.js.map +1 -0
- package/dist/testing/steps/ui/assertions.step.d.ts +3 -0
- package/dist/testing/steps/ui/assertions.step.d.ts.map +1 -0
- package/dist/testing/steps/ui/assertions.step.js +41 -0
- package/dist/testing/steps/ui/assertions.step.js.map +1 -0
- package/dist/testing/steps/ui/form.step.d.ts +3 -0
- package/dist/testing/steps/ui/form.step.d.ts.map +1 -0
- package/dist/testing/steps/ui/form.step.js +34 -0
- package/dist/testing/steps/ui/form.step.js.map +1 -0
- package/dist/testing/steps/ui/index.d.ts +3 -0
- package/dist/testing/steps/ui/index.d.ts.map +1 -0
- package/dist/testing/steps/ui/index.js +14 -0
- package/dist/testing/steps/ui/index.js.map +1 -0
- package/dist/testing/steps/ui/navigation.step.d.ts +3 -0
- package/dist/testing/steps/ui/navigation.step.d.ts.map +1 -0
- package/dist/testing/steps/ui/navigation.step.js +39 -0
- package/dist/testing/steps/ui/navigation.step.js.map +1 -0
- package/dist/testing/steps/util/index.d.ts +3 -0
- package/dist/testing/steps/util/index.d.ts.map +1 -0
- package/dist/testing/steps/util/index.js +12 -0
- package/dist/testing/steps/util/index.js.map +1 -0
- package/dist/testing/steps/util/log.step.d.ts +3 -0
- package/dist/testing/steps/util/log.step.d.ts.map +1 -0
- package/dist/testing/steps/util/log.step.js +18 -0
- package/dist/testing/steps/util/log.step.js.map +1 -0
- package/dist/testing/steps/util/require.step.d.ts +3 -0
- package/dist/testing/steps/util/require.step.d.ts.map +1 -0
- package/dist/testing/steps/util/require.step.js +16 -0
- package/dist/testing/steps/util/require.step.js.map +1 -0
- package/dist/testing/steps/util/sleep.step.d.ts +3 -0
- package/dist/testing/steps/util/sleep.step.d.ts.map +1 -0
- package/dist/testing/steps/util/sleep.step.js +13 -0
- package/dist/testing/steps/util/sleep.step.js.map +1 -0
- package/docs/test-data-workflow.md +51 -11
- package/package.json +4 -2
- package/src/commands/run-tests.command.ts +278 -0
- package/src/commands/test-data.command.ts +26 -26
- package/src/commands/test.command.ts +14 -0
- package/src/controllers/service.controller.ts +58 -59
- package/src/dtos/basic-filters.dto.ts +0 -2
- package/src/dtos/create-user.dto.ts +1 -0
- package/src/helpers/schematic.service.ts +1 -1
- package/src/index.ts +3 -0
- package/src/seeders/module-metadata-seeder.service.ts +5 -25
- package/src/seeders/module-test-data.service.ts +5 -3
- package/src/seeders/seed-data/solid-core-metadata.json +34 -9
- package/src/services/chatter-message.service.ts +18 -1
- package/src/services/crud.service.ts +1 -0
- package/src/services/model-metadata.service.ts +2 -1
- package/src/services/module-metadata.service.ts +2 -1
- package/src/services/queues/common.ts +75 -0
- package/src/services/queues/database-publisher.service.ts +4 -1
- package/src/services/queues/database-subscriber.service.ts +5 -3
- package/src/services/queues/rabbitmq-publisher.service.ts +17 -7
- package/src/services/queues/rabbitmq-subscriber.service.ts +223 -95
- package/src/solid-core.module.ts +4 -0
- package/src/testing/README.md +364 -0
- package/src/testing/__examples__/register-example-specs.ts +6 -0
- package/src/testing/__examples__/specs/custom-health.spec.ts +29 -0
- package/src/testing/__examples__/testing.sample.json +82 -0
- package/src/testing/adapters/api/api-adapter.ts +85 -0
- package/src/testing/adapters/api/api.types.ts +15 -0
- package/src/testing/adapters/ui/playwright-adapter.ts +54 -0
- package/src/testing/adapters/ui/ui.types.ts +4 -0
- package/src/testing/contracts/runtime-context.types.ts +36 -0
- package/src/testing/contracts/test-spec.types.ts +24 -0
- package/src/testing/contracts/testing-metadata.types.ts +46 -0
- package/src/testing/core/interpolation.ts +189 -0
- package/src/testing/core/normalize-steps.ts +21 -0
- package/src/testing/core/resource-store.ts +38 -0
- package/src/testing/core/spec-registry.ts +33 -0
- package/src/testing/core/step-registry.ts +27 -0
- package/src/testing/core/testing-engine.ts +127 -0
- package/src/testing/core/timeout.ts +19 -0
- package/src/testing/reporter/attachments.ts +25 -0
- package/src/testing/reporter/console-reporter.ts +229 -0
- package/src/testing/reporter/reporter.types.ts +36 -0
- package/src/testing/runner/lifecycle.ts +31 -0
- package/src/testing/runner/run-from-metadata.ts +87 -0
- package/src/testing/runner/scenario-filter.ts +33 -0
- package/src/testing/steps/api/auth.step.ts +66 -0
- package/src/testing/steps/api/index.ts +10 -0
- package/src/testing/steps/api/request.step.ts +358 -0
- package/src/testing/steps/assert/http.step.ts +33 -0
- package/src/testing/steps/assert/index.ts +12 -0
- package/src/testing/steps/assert/jsonpath.step.ts +50 -0
- package/src/testing/steps/assert/primitives.step.ts +69 -0
- package/src/testing/steps/test/index.ts +8 -0
- package/src/testing/steps/test/test-spec.step.ts +52 -0
- package/src/testing/steps/ui/actions.step.ts +36 -0
- package/src/testing/steps/ui/assertions.step.ts +54 -0
- package/src/testing/steps/ui/form.step.ts +39 -0
- package/src/testing/steps/ui/index.ts +12 -0
- package/src/testing/steps/ui/navigation.step.ts +53 -0
- package/src/testing/steps/util/index.ts +10 -0
- package/src/testing/steps/util/log.step.ts +19 -0
- package/src/testing/steps/util/require.step.ts +16 -0
- package/src/testing/steps/util/sleep.step.ts +15 -0
- package/tsconfig.json +35 -25
- package/tsconfig.tests.json +14 -0
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
118
|
+
✔ solid test data completed
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
Rationale:
|
|
@@ -123,11 +123,51 @@ Rationale:
|
|
|
123
123
|
|
|
124
124
|
---
|
|
125
125
|
|
|
126
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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 {
|
|
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
|
-
|
|
6
|
+
load?: boolean;
|
|
7
7
|
modulesToTest?: string;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
setup?: boolean;
|
|
9
|
+
teardown?: boolean;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
@
|
|
13
|
-
name: '
|
|
14
|
-
description: 'Seed test data from
|
|
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
|
|
26
|
-
const
|
|
27
|
-
const
|
|
25
|
+
const load = Boolean(options?.load);
|
|
26
|
+
const setup = Boolean(options?.setup);
|
|
27
|
+
const teardown = Boolean(options?.teardown);
|
|
28
28
|
|
|
29
|
-
const selectedModes = [
|
|
29
|
+
const selectedModes = [load, setup, teardown].filter(Boolean).length;
|
|
30
30
|
if (selectedModes > 1) {
|
|
31
|
-
this.logger.error('Please specify only one of --load
|
|
32
|
-
console.log('Please specify only one of --load
|
|
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 (!
|
|
37
|
-
this.logger.error('Please specify one of --load
|
|
38
|
-
console.log('Please specify one of --load
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
|
81
|
-
description: 'Seed test data from
|
|
80
|
+
flags: '--load',
|
|
81
|
+
description: 'Seed test data from testing.data sections',
|
|
82
82
|
})
|
|
83
|
-
|
|
83
|
+
parseLoad(): boolean {
|
|
84
84
|
return true;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
@Option({
|
|
88
|
-
flags: '--
|
|
88
|
+
flags: '--setup',
|
|
89
89
|
description: 'Create a new .env.<dbRunName> and test datasource manifest',
|
|
90
90
|
})
|
|
91
|
-
|
|
91
|
+
parseSetup(): boolean {
|
|
92
92
|
return true;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
@Option({
|
|
96
|
-
flags: '--
|
|
96
|
+
flags: '--teardown',
|
|
97
97
|
description: 'Delete test datasource env/manifest and drop test databases',
|
|
98
98
|
})
|
|
99
|
-
|
|
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
|
+
}
|