@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,39 @@
|
|
|
1
|
+
import type { TestContext } from "../../contracts/runtime-context.types";
|
|
2
|
+
import type { OpStep } from "../../contracts/testing-metadata.types";
|
|
3
|
+
import { StepRegistry } from "../../core/step-registry";
|
|
4
|
+
|
|
5
|
+
type FillInput = { selector: string; value: string };
|
|
6
|
+
type SelectInput = { selector: string; value: string };
|
|
7
|
+
|
|
8
|
+
function requirePage(ctx: TestContext, op: string) {
|
|
9
|
+
if (!ctx.ui || !ctx.ui.page) {
|
|
10
|
+
throw new Error(`Missing UI page on context for op "${op}"`);
|
|
11
|
+
}
|
|
12
|
+
return ctx.ui.page;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function registerFormSteps(registry: StepRegistry): void {
|
|
16
|
+
registry.register("ui.fill", async (ctx: TestContext, step: OpStep) => {
|
|
17
|
+
const page = requirePage(ctx, "ui.fill");
|
|
18
|
+
const input = (step.with ?? {}) as FillInput;
|
|
19
|
+
if (!input.selector) {
|
|
20
|
+
throw new Error('Missing "selector" in step.with for op "ui.fill"');
|
|
21
|
+
}
|
|
22
|
+
if (input.value === undefined) {
|
|
23
|
+
throw new Error('Missing "value" in step.with for op "ui.fill"');
|
|
24
|
+
}
|
|
25
|
+
await page.fill(input.selector, String(input.value));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
registry.register("ui.select", async (ctx: TestContext, step: OpStep) => {
|
|
29
|
+
const page = requirePage(ctx, "ui.select");
|
|
30
|
+
const input = (step.with ?? {}) as SelectInput;
|
|
31
|
+
if (!input.selector) {
|
|
32
|
+
throw new Error('Missing "selector" in step.with for op "ui.select"');
|
|
33
|
+
}
|
|
34
|
+
if (input.value === undefined) {
|
|
35
|
+
throw new Error('Missing "value" in step.with for op "ui.select"');
|
|
36
|
+
}
|
|
37
|
+
await page.selectOption(input.selector, String(input.value));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StepRegistry } from "../../core/step-registry";
|
|
2
|
+
import { registerNavigationSteps } from "./navigation.step";
|
|
3
|
+
import { registerFormSteps } from "./form.step";
|
|
4
|
+
import { registerActionSteps } from "./actions.step";
|
|
5
|
+
import { registerAssertionSteps } from "./assertions.step";
|
|
6
|
+
|
|
7
|
+
export function registerUiSteps(registry: StepRegistry): void {
|
|
8
|
+
registerNavigationSteps(registry);
|
|
9
|
+
registerFormSteps(registry);
|
|
10
|
+
registerActionSteps(registry);
|
|
11
|
+
registerAssertionSteps(registry);
|
|
12
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { TestContext } from "../../contracts/runtime-context.types";
|
|
2
|
+
import type { OpStep } from "../../contracts/testing-metadata.types";
|
|
3
|
+
import { StepRegistry } from "../../core/step-registry";
|
|
4
|
+
|
|
5
|
+
type GotoInput = { url: string };
|
|
6
|
+
type ExpectUrlInput = { equals?: string; contains?: string };
|
|
7
|
+
|
|
8
|
+
function requirePage(ctx: TestContext, op: string) {
|
|
9
|
+
if (!ctx.ui || !ctx.ui.page) {
|
|
10
|
+
throw new Error(`Missing UI page on context for op "${op}"`);
|
|
11
|
+
}
|
|
12
|
+
return ctx.ui.page;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function registerNavigationSteps(registry: StepRegistry): void {
|
|
16
|
+
registry.register("ui.goto", async (ctx: TestContext, step: OpStep) => {
|
|
17
|
+
const page = requirePage(ctx, "ui.goto");
|
|
18
|
+
const input = (step.with ?? {}) as GotoInput;
|
|
19
|
+
if (!input.url) {
|
|
20
|
+
throw new Error('Missing "url" in step.with for op "ui.goto"');
|
|
21
|
+
}
|
|
22
|
+
const url = ctx.ui?.resolveUrl(input.url) ?? input.url;
|
|
23
|
+
await page.goto(url);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
registry.register("ui.expectUrl", async (ctx: TestContext, step: OpStep) => {
|
|
27
|
+
const page = requirePage(ctx, "ui.expectUrl");
|
|
28
|
+
const input = (step.with ?? {}) as ExpectUrlInput;
|
|
29
|
+
const current = page.url();
|
|
30
|
+
|
|
31
|
+
if (input.equals !== undefined) {
|
|
32
|
+
if (current !== input.equals) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`Expected URL to equal "${input.equals}" but got "${current}"`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (input.contains !== undefined) {
|
|
41
|
+
if (!current.includes(input.contains)) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Expected URL to contain "${input.contains}" but got "${current}"`,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
throw new Error(
|
|
50
|
+
'Missing "equals" or "contains" in step.with for op "ui.expectUrl"',
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StepRegistry } from "../../core/step-registry";
|
|
2
|
+
import { registerLogStep } from "./log.step";
|
|
3
|
+
import { registerSleepStep } from "./sleep.step";
|
|
4
|
+
import { registerRequireStep } from "./require.step";
|
|
5
|
+
|
|
6
|
+
export function registerUtilSteps(registry: StepRegistry): void {
|
|
7
|
+
registerLogStep(registry);
|
|
8
|
+
registerSleepStep(registry);
|
|
9
|
+
registerRequireStep(registry);
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TestContext } from "../../contracts/runtime-context.types";
|
|
2
|
+
import type { OpStep } from "../../contracts/testing-metadata.types";
|
|
3
|
+
import { StepRegistry } from "../../core/step-registry";
|
|
4
|
+
|
|
5
|
+
type LogInput = { message: string; data?: unknown };
|
|
6
|
+
|
|
7
|
+
export function registerLogStep(registry: StepRegistry): void {
|
|
8
|
+
registry.register("util.log", async (_ctx: TestContext, step: OpStep) => {
|
|
9
|
+
const input = (step.with ?? {}) as LogInput;
|
|
10
|
+
if (!input.message) {
|
|
11
|
+
throw new Error('Missing "message" in step.with for op "util.log"');
|
|
12
|
+
}
|
|
13
|
+
if (input.data !== undefined) {
|
|
14
|
+
console.log(input.message, input.data);
|
|
15
|
+
} else {
|
|
16
|
+
console.log(input.message);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TestContext } from "../../contracts/runtime-context.types";
|
|
2
|
+
import type { OpStep } from "../../contracts/testing-metadata.types";
|
|
3
|
+
import { StepRegistry } from "../../core/step-registry";
|
|
4
|
+
|
|
5
|
+
export function registerRequireStep(registry: StepRegistry): void {
|
|
6
|
+
registry.register("util.require", async (ctx: TestContext, step: OpStep) => {
|
|
7
|
+
const input = (step.with ?? {}) as { resource?: string; message?: string };
|
|
8
|
+
if (!input.resource) {
|
|
9
|
+
throw new Error('Missing "resource" in step.with for op "util.require"');
|
|
10
|
+
}
|
|
11
|
+
if (!ctx.resources.has(input.resource)) {
|
|
12
|
+
const suffix = input.message ? ` ${input.message}` : "";
|
|
13
|
+
throw new Error(`Missing required resource: "${input.resource}".${suffix}`);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TestContext } from "../../contracts/runtime-context.types";
|
|
2
|
+
import type { OpStep } from "../../contracts/testing-metadata.types";
|
|
3
|
+
import { StepRegistry } from "../../core/step-registry";
|
|
4
|
+
|
|
5
|
+
type SleepInput = { ms: number };
|
|
6
|
+
|
|
7
|
+
export function registerSleepStep(registry: StepRegistry): void {
|
|
8
|
+
registry.register("util.sleep", async (_ctx: TestContext, step: OpStep) => {
|
|
9
|
+
const input = (step.with ?? {}) as SleepInput;
|
|
10
|
+
if (input.ms === undefined) {
|
|
11
|
+
throw new Error('Missing "ms" in step.with for op "util.sleep"');
|
|
12
|
+
}
|
|
13
|
+
await new Promise((resolve) => setTimeout(resolve, input.ms));
|
|
14
|
+
});
|
|
15
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"declarationMap": true, // Maps declaration files to source files
|
|
6
|
+
"removeComments": true,
|
|
7
|
+
"emitDecoratorMetadata": true,
|
|
8
|
+
"experimentalDecorators": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"target": "ES2021",
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"outDir": "./dist",
|
|
13
|
+
"rootDir": "./src",
|
|
14
|
+
"baseUrl": "./",
|
|
15
|
+
"incremental": false,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"strictNullChecks": false,
|
|
18
|
+
"noImplicitAny": false,
|
|
19
|
+
"strictBindCallApply": false,
|
|
20
|
+
"forceConsistentCasingInFileNames": false,
|
|
21
|
+
"noFallthroughCasesInSwitch": false,
|
|
22
|
+
"esModuleInterop": true,
|
|
23
|
+
"resolveJsonModule": true,
|
|
24
|
+
"inlineSources": true
|
|
25
|
+
},
|
|
26
|
+
"include": [
|
|
27
|
+
"src/**/*.ts"
|
|
28
|
+
],
|
|
29
|
+
"exclude": [
|
|
30
|
+
"node_modules",
|
|
31
|
+
"dist",
|
|
32
|
+
"dist-tests",
|
|
33
|
+
"tests",
|
|
34
|
+
"playwright.config.ts"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist-tests",
|
|
5
|
+
"rootDir": "./tests",
|
|
6
|
+
"declaration": false,
|
|
7
|
+
"declarationMap": false,
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"incremental": false,
|
|
10
|
+
"tsBuildInfoFile": null
|
|
11
|
+
},
|
|
12
|
+
"include": ["tests/**/*.ts"],
|
|
13
|
+
"exclude": ["node_modules", "dist", "dist-tests"]
|
|
14
|
+
}
|