@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonpath.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/assert/jsonpath.step.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAuBxD,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAsBxE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerJsonPathAssertSteps = registerJsonPathAssertSteps;
|
|
4
|
+
function resolveJsonPath(from, path) {
|
|
5
|
+
let normalized = path.trim();
|
|
6
|
+
if (normalized.startsWith("$.")) {
|
|
7
|
+
normalized = normalized.slice(2);
|
|
8
|
+
}
|
|
9
|
+
else if (normalized === "$") {
|
|
10
|
+
return from;
|
|
11
|
+
}
|
|
12
|
+
normalized = normalized.replace(/\[(\d+)\]/g, ".$1");
|
|
13
|
+
const parts = normalized.split(".").filter(Boolean);
|
|
14
|
+
let current = from;
|
|
15
|
+
for (const part of parts) {
|
|
16
|
+
if (current == null)
|
|
17
|
+
return undefined;
|
|
18
|
+
current = current[part];
|
|
19
|
+
}
|
|
20
|
+
return current;
|
|
21
|
+
}
|
|
22
|
+
function registerJsonPathAssertSteps(registry) {
|
|
23
|
+
registry.register("assert.jsonPath", async (_ctx, step) => {
|
|
24
|
+
const input = (step.with ?? {});
|
|
25
|
+
if (!("from" in input)) {
|
|
26
|
+
throw new Error('Missing "from" in step.with for op "assert.jsonPath"');
|
|
27
|
+
}
|
|
28
|
+
if (!input.path) {
|
|
29
|
+
throw new Error('Missing "path" in step.with for op "assert.jsonPath"');
|
|
30
|
+
}
|
|
31
|
+
if (!("equals" in input)) {
|
|
32
|
+
throw new Error('Missing "equals" in step.with for op "assert.jsonPath"');
|
|
33
|
+
}
|
|
34
|
+
const actual = resolveJsonPath(input.from, input.path);
|
|
35
|
+
if (actual !== input.equals) {
|
|
36
|
+
throw new Error(`Expected JSONPath "${input.path}" to equal ${String(input.equals)} but got ${String(actual)}`);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=jsonpath.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonpath.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/assert/jsonpath.step.ts"],"names":[],"mappings":";;AA2BA,kEAsBC;AAzCD,SAAS,eAAe,CAAC,IAAS,EAAE,IAAY;IAC9C,IAAI,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;SAAM,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,OAAO,GAAQ,IAAI,CAAC;IACxB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAO,IAAI,IAAI;YAAE,OAAO,SAAS,CAAC;QACtC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,2BAA2B,CAAC,QAAsB;IAChE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,EAAE,KAAK,EAAE,IAAiB,EAAE,IAAY,EAAE,EAAE;QAC7E,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAkB,CAAC;QACjD,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;QAED,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACvD,IAAI,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CACb,sBAAsB,KAAK,CAAC,IAAI,cAAc,MAAM,CAClD,KAAK,CAAC,MAAM,CACb,YAAY,MAAM,CAAC,MAAM,CAAC,EAAE,CAC9B,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Purpose: JSONPath assertion step registrations.\n\nimport type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\ntype JsonPathInput = { from: any; path: string; equals: any };\n\nfunction resolveJsonPath(from: any, path: string): unknown {\n let normalized = path.trim();\n if (normalized.startsWith(\"$.\")) {\n normalized = normalized.slice(2);\n } else if (normalized === \"$\") {\n return from;\n }\n\n normalized = normalized.replace(/\\[(\\d+)\\]/g, \".$1\");\n const parts = normalized.split(\".\").filter(Boolean);\n\n let current: any = from;\n for (const part of parts) {\n if (current == null) return undefined;\n current = current[part];\n }\n return current;\n}\n\nexport function registerJsonPathAssertSteps(registry: StepRegistry): void {\n registry.register(\"assert.jsonPath\", async (_ctx: TestContext, step: OpStep) => {\n const input = (step.with ?? {}) as JsonPathInput;\n if (!(\"from\" in input)) {\n throw new Error('Missing \"from\" in step.with for op \"assert.jsonPath\"');\n }\n if (!input.path) {\n throw new Error('Missing \"path\" in step.with for op \"assert.jsonPath\"');\n }\n if (!(\"equals\" in input)) {\n throw new Error('Missing \"equals\" in step.with for op \"assert.jsonPath\"');\n }\n\n const actual = resolveJsonPath(input.from, input.path);\n if (actual !== input.equals) {\n throw new Error(\n `Expected JSONPath \"${input.path}\" to equal ${String(\n input.equals,\n )} but got ${String(actual)}`,\n );\n }\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/assert/primitives.step.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAMxD,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CA0DzE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerPrimitiveAssertSteps = registerPrimitiveAssertSteps;
|
|
4
|
+
function registerPrimitiveAssertSteps(registry) {
|
|
5
|
+
registry.register("assert.equals", async (_ctx, step) => {
|
|
6
|
+
const input = (step.with ?? {});
|
|
7
|
+
if (!("actual" in input)) {
|
|
8
|
+
throw new Error('Missing "actual" in step.with for op "assert.equals"');
|
|
9
|
+
}
|
|
10
|
+
if (!("expected" in input)) {
|
|
11
|
+
throw new Error('Missing "expected" in step.with for op "assert.equals"');
|
|
12
|
+
}
|
|
13
|
+
if (input.actual !== input.expected) {
|
|
14
|
+
throw new Error(`Expected values to be equal. Actual: ${String(input.actual)}, Expected: ${String(input.expected)}`);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
registry.register("assert.contains", async (_ctx, step) => {
|
|
18
|
+
const input = (step.with ?? {});
|
|
19
|
+
if (!input.actual) {
|
|
20
|
+
throw new Error('Missing "actual" in step.with for op "assert.contains"');
|
|
21
|
+
}
|
|
22
|
+
if (input.expected === undefined) {
|
|
23
|
+
throw new Error('Missing "expected" in step.with for op "assert.contains"');
|
|
24
|
+
}
|
|
25
|
+
if (!input.actual.includes(input.expected)) {
|
|
26
|
+
throw new Error(`Expected "${input.actual}" to contain "${input.expected}"`);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
registry.register("assert.matches", async (_ctx, step) => {
|
|
30
|
+
const input = (step.with ?? {});
|
|
31
|
+
if (!input.actual) {
|
|
32
|
+
throw new Error('Missing "actual" in step.with for op "assert.matches"');
|
|
33
|
+
}
|
|
34
|
+
if (!input.pattern) {
|
|
35
|
+
throw new Error('Missing "pattern" in step.with for op "assert.matches"');
|
|
36
|
+
}
|
|
37
|
+
const regex = new RegExp(input.pattern);
|
|
38
|
+
if (!regex.test(input.actual)) {
|
|
39
|
+
throw new Error(`Expected "${input.actual}" to match /${input.pattern}/`);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=primitives.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/assert/primitives.step.ts"],"names":[],"mappings":";;AAUA,oEA0DC;AA1DD,SAAgB,4BAA4B,CAAC,QAAsB;IACjE,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,EAAE,IAAiB,EAAE,IAAY,EAAE,EAAE;QAC3E,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAgB,CAAC;QAC/C,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,CAAC,UAAU,IAAI,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,wCAAwC,MAAM,C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CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,aAAa,KAAK,CAAC,MAAM,eAAe,KAAK,CAAC,OAAO,GAAG,CACzD,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Purpose: Primitive assertion step registrations.\n\nimport type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\ntype EqualsInput = { actual: unknown; expected: unknown };\ntype ContainsInput = { actual: string; expected: string };\ntype MatchesInput = { actual: string; pattern: string };\n\nexport function registerPrimitiveAssertSteps(registry: StepRegistry): void {\n registry.register(\"assert.equals\", async (_ctx: TestContext, step: OpStep) => {\n const input = (step.with ?? {}) as EqualsInput;\n if (!(\"actual\" in input)) {\n throw new Error('Missing \"actual\" in step.with for op \"assert.equals\"');\n }\n if (!(\"expected\" in input)) {\n throw new Error('Missing \"expected\" in step.with for op \"assert.equals\"');\n }\n if (input.actual !== input.expected) {\n throw new Error(\n `Expected values to be equal. Actual: ${String(\n input.actual,\n )}, Expected: ${String(input.expected)}`,\n );\n }\n });\n\n registry.register(\n \"assert.contains\",\n async (_ctx: TestContext, step: OpStep) => {\n const input = (step.with ?? {}) as ContainsInput;\n if (!input.actual) {\n throw new Error('Missing \"actual\" in step.with for op \"assert.contains\"');\n }\n if (input.expected === undefined) {\n throw new Error(\n 'Missing \"expected\" in step.with for op \"assert.contains\"',\n );\n }\n if (!input.actual.includes(input.expected)) {\n throw new Error(\n `Expected \"${input.actual}\" to contain \"${input.expected}\"`,\n );\n }\n },\n );\n\n registry.register(\n \"assert.matches\",\n async (_ctx: TestContext, step: OpStep) => {\n const input = (step.with ?? {}) as MatchesInput;\n if (!input.actual) {\n throw new Error('Missing \"actual\" in step.with for op \"assert.matches\"');\n }\n if (!input.pattern) {\n throw new Error(\n 'Missing \"pattern\" in step.with for op \"assert.matches\"',\n );\n }\n const regex = new RegExp(input.pattern);\n if (!regex.test(input.actual)) {\n throw new Error(\n `Expected \"${input.actual}\" to match /${input.pattern}/`,\n );\n }\n },\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/test/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAE9D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerTestSteps = registerTestSteps;
|
|
4
|
+
const test_spec_step_1 = require("./test-spec.step");
|
|
5
|
+
function registerTestSteps(registry) {
|
|
6
|
+
(0, test_spec_step_1.registerTestSpecStep)(registry);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/steps/test/index.ts"],"names":[],"mappings":";;AAKA,8CAEC;AAJD,qDAAwD;AAExD,SAAgB,iBAAiB,CAAC,QAAsB;IACtD,IAAA,qCAAoB,EAAC,QAAQ,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Purpose: Test step registrations.\n\nimport { StepRegistry } from \"../../core/step-registry\";\nimport { registerTestSpecStep } from \"./test-spec.step\";\n\nexport function registerTestSteps(registry: StepRegistry): void {\n registerTestSpecStep(registry);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-spec.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/test/test-spec.step.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CA6CjE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerTestSpecStep = registerTestSpecStep;
|
|
4
|
+
function registerTestSpecStep(registry) {
|
|
5
|
+
registry.register("test.spec", async (ctx, step) => {
|
|
6
|
+
const specId = step.spec ?? step.with?.specId;
|
|
7
|
+
if (!specId) {
|
|
8
|
+
throw new Error('Missing "spec" on step (or "specId" in step.with) for op "test.spec"');
|
|
9
|
+
}
|
|
10
|
+
if (!ctx.specRegistry) {
|
|
11
|
+
throw new Error('Missing specRegistry on context for op "test.spec"');
|
|
12
|
+
}
|
|
13
|
+
const input = (step.with?.input ?? {});
|
|
14
|
+
const spec = ctx.specRegistry.create(specId);
|
|
15
|
+
const result = await spec.run({ ctx, input });
|
|
16
|
+
ctx.reporter.onSpecResult?.({
|
|
17
|
+
scenarioId: ctx.scenarioId,
|
|
18
|
+
specId,
|
|
19
|
+
stepName: step.name,
|
|
20
|
+
result,
|
|
21
|
+
});
|
|
22
|
+
if (result.attachments && ctx.reporter.attach) {
|
|
23
|
+
for (const attachment of result.attachments) {
|
|
24
|
+
const data = attachment.encoding === "base64"
|
|
25
|
+
? Buffer.from(attachment.data, "base64")
|
|
26
|
+
: attachment.data;
|
|
27
|
+
ctx.reporter.attach({
|
|
28
|
+
scenarioId: ctx.scenarioId,
|
|
29
|
+
name: attachment.name,
|
|
30
|
+
contentType: attachment.contentType,
|
|
31
|
+
data,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!result.ok) {
|
|
36
|
+
throw new Error(`test.spec failed: ${specId}`);
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=test-spec.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-spec.step.js","sourceRoot":"","sources":["../../../../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,CAAC,QAAQ,CAAC,MAAM,CAAC;oBAClB,UAAU,EAAE,GAAG,CAAC,UAAU;oBAC1B,IAAI,EAAE,UAAU,CAAC,IAAI;oBACrB,WAAW,EAAE,UAAU,CAAC,WAAW;oBACnC,IAAI;iBACL,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,qBAAqB,MAAM,EAAE,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Purpose: test.spec step registration.\n\nimport type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\nexport function registerTestSpecStep(registry: StepRegistry): void {\n registry.register(\"test.spec\", async (ctx: TestContext, step: OpStep) => {\n const specId =\n step.spec ?? (step.with?.specId as string | undefined);\n if (!specId) {\n throw new Error(\n 'Missing \"spec\" on step (or \"specId\" in step.with) for op \"test.spec\"',\n );\n }\n if (!ctx.specRegistry) {\n throw new Error('Missing specRegistry on context for op \"test.spec\"');\n }\n\n const input = (step.with?.input ?? {}) as Record<string, any>;\n const spec = ctx.specRegistry.create(specId);\n const result = await spec.run({ ctx, input });\n\n ctx.reporter.onSpecResult?.({\n scenarioId: ctx.scenarioId,\n specId,\n stepName: step.name,\n result,\n });\n\n if (result.attachments && ctx.reporter.attach) {\n for (const attachment of result.attachments) {\n const data =\n attachment.encoding === \"base64\"\n ? Buffer.from(attachment.data, \"base64\")\n : attachment.data;\n ctx.reporter.attach({\n scenarioId: ctx.scenarioId,\n name: attachment.name,\n contentType: attachment.contentType,\n data,\n });\n }\n }\n\n if (!result.ok) {\n throw new Error(`test.spec failed: ${specId}`);\n }\n\n return result;\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/ui/actions.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAYxD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAqBhE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerActionSteps = registerActionSteps;
|
|
4
|
+
function requirePage(ctx, op) {
|
|
5
|
+
if (!ctx.ui || !ctx.ui.page) {
|
|
6
|
+
throw new Error(`Missing UI page on context for op "${op}"`);
|
|
7
|
+
}
|
|
8
|
+
return ctx.ui.page;
|
|
9
|
+
}
|
|
10
|
+
function registerActionSteps(registry) {
|
|
11
|
+
registry.register("ui.click", async (ctx, step) => {
|
|
12
|
+
const page = requirePage(ctx, "ui.click");
|
|
13
|
+
const input = (step.with ?? {});
|
|
14
|
+
if (!input.selector) {
|
|
15
|
+
throw new Error('Missing "selector" in step.with for op "ui.click"');
|
|
16
|
+
}
|
|
17
|
+
await page.click(input.selector);
|
|
18
|
+
});
|
|
19
|
+
registry.register("ui.press", async (ctx, step) => {
|
|
20
|
+
const page = requirePage(ctx, "ui.press");
|
|
21
|
+
const input = (step.with ?? {});
|
|
22
|
+
if (!input.selector) {
|
|
23
|
+
throw new Error('Missing "selector" in step.with for op "ui.press"');
|
|
24
|
+
}
|
|
25
|
+
if (!input.key) {
|
|
26
|
+
throw new Error('Missing "key" in step.with for op "ui.press"');
|
|
27
|
+
}
|
|
28
|
+
await page.press(input.selector, input.key);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=actions.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/ui/actions.step.ts"],"names":[],"mappings":";;AAcA,kDAqBC;AA5BD,SAAS,WAAW,CAAC,G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AAG,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\ntype ClickInput = { selector: string };\ntype PressInput = { selector: string; key: string };\n\nfunction requirePage(ctx: TestContext, op: string) {\n if (!ctx.ui || !ctx.ui.page) {\n throw new Error(`Missing UI page on context for op \"${op}\"`);\n }\n return ctx.ui.page;\n}\n\nexport function registerActionSteps(registry: StepRegistry): void {\n registry.register(\"ui.click\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.click\");\n const input = (step.with ?? {}) as ClickInput;\n if (!input.selector) {\n throw new Error('Missing \"selector\" in step.with for op \"ui.click\"');\n }\n await page.click(input.selector);\n });\n\n registry.register(\"ui.press\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.press\");\n const input = (step.with ?? {}) as PressInput;\n if (!input.selector) {\n throw new Error('Missing \"selector\" in step.with for op \"ui.press\"');\n }\n if (!input.key) {\n throw new Error('Missing \"key\" in step.with for op \"ui.press\"');\n }\n await page.press(input.selector, input.key);\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/ui/assertions.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAYxD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAuCnE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerAssertionSteps = registerAssertionSteps;
|
|
4
|
+
function requirePage(ctx, op) {
|
|
5
|
+
if (!ctx.ui || !ctx.ui.page) {
|
|
6
|
+
throw new Error(`Missing UI page on context for op "${op}"`);
|
|
7
|
+
}
|
|
8
|
+
return ctx.ui.page;
|
|
9
|
+
}
|
|
10
|
+
function registerAssertionSteps(registry) {
|
|
11
|
+
registry.register("ui.expectVisible", async (ctx, step) => {
|
|
12
|
+
const page = requirePage(ctx, "ui.expectVisible");
|
|
13
|
+
const input = (step.with ?? {});
|
|
14
|
+
if (!input.selector) {
|
|
15
|
+
throw new Error('Missing "selector" in step.with for op "ui.expectVisible"');
|
|
16
|
+
}
|
|
17
|
+
await page.waitForSelector(input.selector, { state: "visible" });
|
|
18
|
+
});
|
|
19
|
+
registry.register("ui.expectText", async (ctx, step) => {
|
|
20
|
+
const page = requirePage(ctx, "ui.expectText");
|
|
21
|
+
const input = (step.with ?? {});
|
|
22
|
+
if (!input.selector) {
|
|
23
|
+
throw new Error('Missing "selector" in step.with for op "ui.expectText"');
|
|
24
|
+
}
|
|
25
|
+
const text = await page.locator(input.selector).innerText();
|
|
26
|
+
if (input.equals !== undefined) {
|
|
27
|
+
if (text !== input.equals) {
|
|
28
|
+
throw new Error(`Expected text to equal "${input.equals}" but got "${text}"`);
|
|
29
|
+
}
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (input.contains !== undefined) {
|
|
33
|
+
if (!text.includes(input.contains)) {
|
|
34
|
+
throw new Error(`Expected text to contain "${input.contains}" but got "${text}"`);
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
throw new Error('Missing "equals" or "contains" in step.with for op "ui.expectText"');
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=assertions.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/ui/assertions.step.ts"],"names":[],"mappings":";;AAcA,wDAuCC;AA9CD,SAAS,WAAW,CAAC,GAAgB,EAAE,EAAU;IAC/C,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,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AC1B,MAAM,IAAI,KAAK,CACb,2BAA2B,KAAK,CAAC,MAAM,cAAc,IAAI,GAAG,CAC7D,CAAC;YACJ,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CACb,6BAA6B,KAAK,CAAC,QAAQ,cAAc,IAAI,GAAG,CACjE,CAAC;YACJ,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\ntype VisibleInput = { selector: string };\ntype ExpectTextInput = { selector: string; equals?: string; contains?: string };\n\nfunction requirePage(ctx: TestContext, op: string) {\n if (!ctx.ui || !ctx.ui.page) {\n throw new Error(`Missing UI page on context for op \"${op}\"`);\n }\n return ctx.ui.page;\n}\n\nexport function registerAssertionSteps(registry: StepRegistry): void {\n registry.register(\"ui.expectVisible\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.expectVisible\");\n const input = (step.with ?? {}) as VisibleInput;\n if (!input.selector) {\n throw new Error('Missing \"selector\" in step.with for op \"ui.expectVisible\"');\n }\n await page.waitForSelector(input.selector, { state: \"visible\" });\n });\n\n registry.register(\"ui.expectText\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.expectText\");\n const input = (step.with ?? {}) as ExpectTextInput;\n if (!input.selector) {\n throw new Error('Missing \"selector\" in step.with for op \"ui.expectText\"');\n }\n\n const text = await page.locator(input.selector).innerText();\n if (input.equals !== undefined) {\n if (text !== input.equals) {\n throw new Error(\n `Expected text to equal \"${input.equals}\" but got \"${text}\"`,\n );\n }\n return;\n }\n if (input.contains !== undefined) {\n if (!text.includes(input.contains)) {\n throw new Error(\n `Expected text to contain \"${input.contains}\" but got \"${text}\"`,\n );\n }\n return;\n }\n\n throw new Error(\n 'Missing \"equals\" or \"contains\" in step.with for op \"ui.expectText\"',\n );\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/ui/form.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAYxD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAwB9D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerFormSteps = registerFormSteps;
|
|
4
|
+
function requirePage(ctx, op) {
|
|
5
|
+
if (!ctx.ui || !ctx.ui.page) {
|
|
6
|
+
throw new Error(`Missing UI page on context for op "${op}"`);
|
|
7
|
+
}
|
|
8
|
+
return ctx.ui.page;
|
|
9
|
+
}
|
|
10
|
+
function registerFormSteps(registry) {
|
|
11
|
+
registry.register("ui.fill", async (ctx, step) => {
|
|
12
|
+
const page = requirePage(ctx, "ui.fill");
|
|
13
|
+
const input = (step.with ?? {});
|
|
14
|
+
if (!input.selector) {
|
|
15
|
+
throw new Error('Missing "selector" in step.with for op "ui.fill"');
|
|
16
|
+
}
|
|
17
|
+
if (input.value === undefined) {
|
|
18
|
+
throw new Error('Missing "value" in step.with for op "ui.fill"');
|
|
19
|
+
}
|
|
20
|
+
await page.fill(input.selector, String(input.value));
|
|
21
|
+
});
|
|
22
|
+
registry.register("ui.select", async (ctx, step) => {
|
|
23
|
+
const page = requirePage(ctx, "ui.select");
|
|
24
|
+
const input = (step.with ?? {});
|
|
25
|
+
if (!input.selector) {
|
|
26
|
+
throw new Error('Missing "selector" in step.with for op "ui.select"');
|
|
27
|
+
}
|
|
28
|
+
if (input.value === undefined) {
|
|
29
|
+
throw new Error('Missing "value" in step.with for op "ui.select"');
|
|
30
|
+
}
|
|
31
|
+
await page.selectOption(input.selector, String(input.value));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=form.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/ui/form.step.ts"],"names":[],"mappings":";;AAcA,8CAwBC;AA/BD,SAAS,WAAW,CAAC,GAAgB,EAAE,EAAU;IAC/C,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,SAAgB,iBAAiB,CAAC,QAAsB;IACtD,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,EAAE,GAAgB,EAAE,IAAY,EAAE,EAAE;QACpE,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAc,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,EAAE,GAAgB,EAAE,IAAY,EAAE,EAAE;QACtE,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAgB,CAAC;QAC/C,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\ntype FillInput = { selector: string; value: string };\ntype SelectInput = { selector: string; value: string };\n\nfunction requirePage(ctx: TestContext, op: string) {\n if (!ctx.ui || !ctx.ui.page) {\n throw new Error(`Missing UI page on context for op \"${op}\"`);\n }\n return ctx.ui.page;\n}\n\nexport function registerFormSteps(registry: StepRegistry): void {\n registry.register(\"ui.fill\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.fill\");\n const input = (step.with ?? {}) as FillInput;\n if (!input.selector) {\n throw new Error('Missing \"selector\" in step.with for op \"ui.fill\"');\n }\n if (input.value === undefined) {\n throw new Error('Missing \"value\" in step.with for op \"ui.fill\"');\n }\n await page.fill(input.selector, String(input.value));\n });\n\n registry.register(\"ui.select\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.select\");\n const input = (step.with ?? {}) as SelectInput;\n if (!input.selector) {\n throw new Error('Missing \"selector\" in step.with for op \"ui.select\"');\n }\n if (input.value === undefined) {\n throw new Error('Missing \"value\" in step.with for op \"ui.select\"');\n }\n await page.selectOption(input.selector, String(input.value));\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAMxD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAK5D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerUiSteps = registerUiSteps;
|
|
4
|
+
const navigation_step_1 = require("./navigation.step");
|
|
5
|
+
const form_step_1 = require("./form.step");
|
|
6
|
+
const actions_step_1 = require("./actions.step");
|
|
7
|
+
const assertions_step_1 = require("./assertions.step");
|
|
8
|
+
function registerUiSteps(registry) {
|
|
9
|
+
(0, navigation_step_1.registerNavigationSteps)(registry);
|
|
10
|
+
(0, form_step_1.registerFormSteps)(registry);
|
|
11
|
+
(0, actions_step_1.registerActionSteps)(registry);
|
|
12
|
+
(0, assertions_step_1.registerAssertionSteps)(registry);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/steps/ui/index.ts"],"names":[],"mappings":";;AAMA,0CAKC;AAVD,uDAA4D;AAC5D,2CAAgD;AAChD,iDAAqD;AACrD,uDAA2D;AAE3D,SAAgB,eAAe,CAAC,QAAsB;IACpD,IAAA,yCAAuB,EAAC,QAAQ,CAAC,CAAC;IAClC,IAAA,6BAAiB,EAAC,QAAQ,CAAC,CAAC;IAC5B,IAAA,kCAAmB,EAAC,QAAQ,CAAC,CAAC;IAC9B,IAAA,wCAAsB,EAAC,QAAQ,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import { StepRegistry } from \"../../core/step-registry\";\nimport { registerNavigationSteps } from \"./navigation.step\";\nimport { registerFormSteps } from \"./form.step\";\nimport { registerActionSteps } from \"./actions.step\";\nimport { registerAssertionSteps } from \"./assertions.step\";\n\nexport function registerUiSteps(registry: StepRegistry): void {\n registerNavigationSteps(registry);\n registerFormSteps(registry);\n registerActionSteps(registry);\n registerAssertionSteps(registry);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/ui/navigation.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAYxD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAsCpE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerNavigationSteps = registerNavigationSteps;
|
|
4
|
+
function requirePage(ctx, op) {
|
|
5
|
+
if (!ctx.ui || !ctx.ui.page) {
|
|
6
|
+
throw new Error(`Missing UI page on context for op "${op}"`);
|
|
7
|
+
}
|
|
8
|
+
return ctx.ui.page;
|
|
9
|
+
}
|
|
10
|
+
function registerNavigationSteps(registry) {
|
|
11
|
+
registry.register("ui.goto", async (ctx, step) => {
|
|
12
|
+
const page = requirePage(ctx, "ui.goto");
|
|
13
|
+
const input = (step.with ?? {});
|
|
14
|
+
if (!input.url) {
|
|
15
|
+
throw new Error('Missing "url" in step.with for op "ui.goto"');
|
|
16
|
+
}
|
|
17
|
+
const url = ctx.ui?.resolveUrl(input.url) ?? input.url;
|
|
18
|
+
await page.goto(url);
|
|
19
|
+
});
|
|
20
|
+
registry.register("ui.expectUrl", async (ctx, step) => {
|
|
21
|
+
const page = requirePage(ctx, "ui.expectUrl");
|
|
22
|
+
const input = (step.with ?? {});
|
|
23
|
+
const current = page.url();
|
|
24
|
+
if (input.equals !== undefined) {
|
|
25
|
+
if (current !== input.equals) {
|
|
26
|
+
throw new Error(`Expected URL to equal "${input.equals}" but got "${current}"`);
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (input.contains !== undefined) {
|
|
31
|
+
if (!current.includes(input.contains)) {
|
|
32
|
+
throw new Error(`Expected URL to contain "${input.contains}" but got "${current}"`);
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
throw new Error('Missing "equals" or "contains" in step.with for op "ui.expectUrl"');
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=navigation.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/ui/navigation.step.ts"],"names":[],"mappings":";;AAcA,0DAsCC;AA7CD,SAAS,WAAW,CAAC,GAAgB,EAAE,EAAU;IAC/C,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,SAAgB,uBAAuB,CAAC,QAAsB;IAC5D,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,EAAE,GAAgB,EAAE,IAAY,EAAE,EAAE;QACpE,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAc,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,GAAG,GAAG,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC;QACvD,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE,KAAK,EAAE,GAAgB,EAAE,IAAY,EAAE,EAAE;QACzE,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAC9C,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAmB,CAAC;QAClD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE3B,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC/B,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CACb,0BAA0B,KAAK,CAAC,MAAM,cAAc,OAAO,GAAG,CAC/D,CAAC;YACJ,CAAC;YACD,OAAO;QACT,CAAC;QAED,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACtC,MAAM,IAAI,KAAK,CACb,4BAA4B,KAAK,CAAC,QAAQ,cAAc,OAAO,GAAG,CACnE,CAAC;YACJ,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\ntype GotoInput = { url: string };\ntype ExpectUrlInput = { equals?: string; contains?: string };\n\nfunction requirePage(ctx: TestContext, op: string) {\n if (!ctx.ui || !ctx.ui.page) {\n throw new Error(`Missing UI page on context for op \"${op}\"`);\n }\n return ctx.ui.page;\n}\n\nexport function registerNavigationSteps(registry: StepRegistry): void {\n registry.register(\"ui.goto\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.goto\");\n const input = (step.with ?? {}) as GotoInput;\n if (!input.url) {\n throw new Error('Missing \"url\" in step.with for op \"ui.goto\"');\n }\n const url = ctx.ui?.resolveUrl(input.url) ?? input.url;\n await page.goto(url);\n });\n\n registry.register(\"ui.expectUrl\", async (ctx: TestContext, step: OpStep) => {\n const page = requirePage(ctx, \"ui.expectUrl\");\n const input = (step.with ?? {}) as ExpectUrlInput;\n const current = page.url();\n\n if (input.equals !== undefined) {\n if (current !== input.equals) {\n throw new Error(\n `Expected URL to equal \"${input.equals}\" but got \"${current}\"`,\n );\n }\n return;\n }\n\n if (input.contains !== undefined) {\n if (!current.includes(input.contains)) {\n throw new Error(\n `Expected URL to contain \"${input.contains}\" but got \"${current}\"`,\n );\n }\n return;\n }\n\n throw new Error(\n 'Missing \"equals\" or \"contains\" in step.with for op \"ui.expectUrl\"',\n );\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/util/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKxD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAI9D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerUtilSteps = registerUtilSteps;
|
|
4
|
+
const log_step_1 = require("./log.step");
|
|
5
|
+
const sleep_step_1 = require("./sleep.step");
|
|
6
|
+
const require_step_1 = require("./require.step");
|
|
7
|
+
function registerUtilSteps(registry) {
|
|
8
|
+
(0, log_step_1.registerLogStep)(registry);
|
|
9
|
+
(0, sleep_step_1.registerSleepStep)(registry);
|
|
10
|
+
(0, require_step_1.registerRequireStep)(registry);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/steps/util/index.ts"],"names":[],"mappings":";;AAKA,8CAIC;AARD,yCAA6C;AAC7C,6CAAiD;AACjD,iDAAqD;AAErD,SAAgB,iBAAiB,CAAC,QAAsB;IACtD,IAAA,0BAAe,EAAC,QAAQ,CAAC,CAAC;IAC1B,IAAA,8BAAiB,EAAC,QAAQ,CAAC,CAAC;IAC5B,IAAA,kCAAmB,EAAC,QAAQ,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { StepRegistry } from \"../../core/step-registry\";\nimport { registerLogStep } from \"./log.step\";\nimport { registerSleepStep } from \"./sleep.step\";\nimport { registerRequireStep } from \"./require.step\";\n\nexport function registerUtilSteps(registry: StepRegistry): void {\n registerLogStep(registry);\n registerSleepStep(registry);\n registerRequireStep(registry);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/util/log.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIxD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAY5D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerLogStep = registerLogStep;
|
|
4
|
+
function registerLogStep(registry) {
|
|
5
|
+
registry.register("util.log", async (_ctx, step) => {
|
|
6
|
+
const input = (step.with ?? {});
|
|
7
|
+
if (!input.message) {
|
|
8
|
+
throw new Error('Missing "message" in step.with for op "util.log"');
|
|
9
|
+
}
|
|
10
|
+
if (input.data !== undefined) {
|
|
11
|
+
console.log(input.message, input.data);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
console.log(input.message);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=log.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/util/log.step.ts"],"names":[],"mappings":";;AAMA,0CAYC;AAZD,SAAgB,eAAe,CAAC,QAAsB;IACpD,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,IAAiB,EAAE,IAAY,EAAE,EAAE;QACtE,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAa,CAAC;QAC5C,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\ntype LogInput = { message: string; data?: unknown };\n\nexport function registerLogStep(registry: StepRegistry): void {\n registry.register(\"util.log\", async (_ctx: TestContext, step: OpStep) => {\n const input = (step.with ?? {}) as LogInput;\n if (!input.message) {\n throw new Error('Missing \"message\" in step.with for op \"util.log\"');\n }\n if (input.data !== undefined) {\n console.log(input.message, input.data);\n } else {\n console.log(input.message);\n }\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/util/require.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAWhE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerRequireStep = registerRequireStep;
|
|
4
|
+
function registerRequireStep(registry) {
|
|
5
|
+
registry.register("util.require", async (ctx, step) => {
|
|
6
|
+
const input = (step.with ?? {});
|
|
7
|
+
if (!input.resource) {
|
|
8
|
+
throw new Error('Missing "resource" in step.with for op "util.require"');
|
|
9
|
+
}
|
|
10
|
+
if (!ctx.resources.has(input.resource)) {
|
|
11
|
+
const suffix = input.message ? ` ${input.message}` : "";
|
|
12
|
+
throw new Error(`Missing required resource: "${input.resource}".${suffix}`);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=require.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/util/require.step.ts"],"names":[],"mappings":";;AAIA,kDAWC;AAXD,SAAgB,mBAAmB,CAAC,QAAsB;IACxD,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE,KAAK,EAAE,GAAgB,EAAE,IAAY,EAAE,EAAE;QACzE,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAA4C,CAAC;QAC3E,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CAAC,+BAA+B,KAAK,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\nexport function registerRequireStep(registry: StepRegistry): void {\n registry.register(\"util.require\", async (ctx: TestContext, step: OpStep) => {\n const input = (step.with ?? {}) as { resource?: string; message?: string };\n if (!input.resource) {\n throw new Error('Missing \"resource\" in step.with for op \"util.require\"');\n }\n if (!ctx.resources.has(input.resource)) {\n const suffix = input.message ? ` ${input.message}` : \"\";\n throw new Error(`Missing required resource: \"${input.resource}\".${suffix}`);\n }\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.step.d.ts","sourceRoot":"","sources":["../../../../src/testing/steps/util/sleep.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIxD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAQ9D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerSleepStep = registerSleepStep;
|
|
4
|
+
function registerSleepStep(registry) {
|
|
5
|
+
registry.register("util.sleep", async (_ctx, step) => {
|
|
6
|
+
const input = (step.with ?? {});
|
|
7
|
+
if (input.ms === undefined) {
|
|
8
|
+
throw new Error('Missing "ms" in step.with for op "util.sleep"');
|
|
9
|
+
}
|
|
10
|
+
await new Promise((resolve) => setTimeout(resolve, input.ms));
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=sleep.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.step.js","sourceRoot":"","sources":["../../../../src/testing/steps/util/sleep.step.ts"],"names":[],"mappings":";;AAMA,8CAQC;AARD,SAAgB,iBAAiB,CAAC,QAAsB;IACtD,QAAQ,CAAC,QAAQ,CAAC,YAAY,EAAE,KAAK,EAAE,IAAiB,EAAE,IAAY,EAAE,EAAE;QACxE,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAe,CAAC;QAC9C,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { TestContext } from \"../../contracts/runtime-context.types\";\nimport type { OpStep } from \"../../contracts/testing-metadata.types\";\nimport { StepRegistry } from \"../../core/step-registry\";\n\ntype SleepInput = { ms: number };\n\nexport function registerSleepStep(registry: StepRegistry): void {\n registry.register(\"util.sleep\", async (_ctx: TestContext, step: OpStep) => {\n const input = (step.with ?? {}) as SleepInput;\n if (input.ms === undefined) {\n throw new Error('Missing \"ms\" in step.with for op \"util.sleep\"');\n }\n await new Promise((resolve) => setTimeout(resolve, input.ms));\n });\n}\n"]}
|