@testsmith/testblocks 0.9.4 → 0.9.7
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/cli/index.js +4 -1
- package/dist/client/assets/index-B8OSvcUg.css +1 -0
- package/dist/client/assets/index-CMMJHs_d.js +2197 -0
- package/dist/client/assets/index-CMMJHs_d.js.map +1 -0
- package/dist/client/index.html +2 -2
- package/dist/core/blocks/api/ApiAssertBodyContainsBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiAssertBodyContainsBlock.js +40 -0
- package/dist/core/blocks/api/ApiAssertStatusBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiAssertStatusBlock.js +35 -0
- package/dist/core/blocks/api/ApiClearHeadersBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiClearHeadersBlock.js +25 -0
- package/dist/core/blocks/api/ApiDeleteBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiDeleteBlock.js +37 -0
- package/dist/core/blocks/api/ApiExtractBlock.d.ts +14 -0
- package/dist/core/blocks/api/ApiExtractBlock.js +40 -0
- package/dist/core/blocks/api/ApiExtractJsonPathBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiExtractJsonPathBlock.js +47 -0
- package/dist/core/blocks/api/ApiExtractXPathBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiExtractXPathBlock.js +70 -0
- package/dist/core/blocks/api/ApiGetBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiGetBlock.js +36 -0
- package/dist/core/blocks/api/ApiHeadersBlock.d.ts +14 -0
- package/dist/core/blocks/api/ApiHeadersBlock.js +44 -0
- package/dist/core/blocks/api/ApiJsonBodyBlock.d.ts +14 -0
- package/dist/core/blocks/api/ApiJsonBodyBlock.js +28 -0
- package/dist/core/blocks/api/ApiPatchBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiPatchBlock.js +47 -0
- package/dist/core/blocks/api/ApiPostBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiPostBlock.js +47 -0
- package/dist/core/blocks/api/ApiPutBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiPutBlock.js +47 -0
- package/dist/core/blocks/api/ApiSetHeaderBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiSetHeaderBlock.js +37 -0
- package/dist/core/blocks/api/ApiSetHeadersBlock.d.ts +13 -0
- package/dist/core/blocks/api/ApiSetHeadersBlock.js +41 -0
- package/dist/core/blocks/api/index.d.ts +25 -0
- package/dist/core/blocks/api/index.js +83 -0
- package/dist/core/blocks/base/Block.d.ts +59 -0
- package/dist/core/blocks/base/Block.js +151 -0
- package/dist/core/blocks/base/ContainerBlock.d.ts +14 -0
- package/dist/core/blocks/base/ContainerBlock.js +16 -0
- package/dist/core/blocks/base/ControlFlowBlock.d.ts +13 -0
- package/dist/core/blocks/base/ControlFlowBlock.js +17 -0
- package/dist/core/blocks/base/StatementBlock.d.ts +9 -0
- package/dist/core/blocks/base/StatementBlock.js +16 -0
- package/dist/core/blocks/base/ValueBlock.d.ts +12 -0
- package/dist/core/blocks/base/ValueBlock.js +16 -0
- package/dist/core/blocks/base/index.d.ts +5 -0
- package/dist/core/blocks/base/index.js +13 -0
- package/dist/core/blocks/data/DataCsvBlock.d.ts +14 -0
- package/dist/core/blocks/data/DataCsvBlock.js +51 -0
- package/dist/core/blocks/data/DataDefineBlock.d.ts +14 -0
- package/dist/core/blocks/data/DataDefineBlock.js +28 -0
- package/dist/core/blocks/data/DataForeachBlock.d.ts +13 -0
- package/dist/core/blocks/data/DataForeachBlock.js +37 -0
- package/dist/core/blocks/data/DataFromVariableBlock.d.ts +14 -0
- package/dist/core/blocks/data/DataFromVariableBlock.js +27 -0
- package/dist/core/blocks/data/DataGetCurrentBlock.d.ts +14 -0
- package/dist/core/blocks/data/DataGetCurrentBlock.js +34 -0
- package/dist/core/blocks/data/DataGetIndexBlock.d.ts +14 -0
- package/dist/core/blocks/data/DataGetIndexBlock.js +24 -0
- package/dist/core/blocks/data/DataGetNameBlock.d.ts +14 -0
- package/dist/core/blocks/data/DataGetNameBlock.js +24 -0
- package/dist/core/blocks/data/DataRangeBlock.d.ts +14 -0
- package/dist/core/blocks/data/DataRangeBlock.js +40 -0
- package/dist/core/blocks/data/DataRowBlock.d.ts +14 -0
- package/dist/core/blocks/data/DataRowBlock.js +33 -0
- package/dist/core/blocks/data/DataTableBlock.d.ts +14 -0
- package/dist/core/blocks/data/DataTableBlock.js +51 -0
- package/dist/core/blocks/data/index.d.ts +20 -0
- package/dist/core/blocks/data/index.js +57 -0
- package/dist/core/blocks/index.d.ts +66 -5
- package/dist/core/blocks/index.js +134 -35
- package/dist/core/blocks/lifecycle/LifecycleAfterAllBlock.d.ts +15 -0
- package/dist/core/blocks/lifecycle/LifecycleAfterAllBlock.js +27 -0
- package/dist/core/blocks/lifecycle/LifecycleAfterEachBlock.d.ts +15 -0
- package/dist/core/blocks/lifecycle/LifecycleAfterEachBlock.js +27 -0
- package/dist/core/blocks/lifecycle/LifecycleBeforeAllBlock.d.ts +15 -0
- package/dist/core/blocks/lifecycle/LifecycleBeforeAllBlock.js +28 -0
- package/dist/core/blocks/lifecycle/LifecycleBeforeEachBlock.d.ts +15 -0
- package/dist/core/blocks/lifecycle/LifecycleBeforeEachBlock.js +27 -0
- package/dist/core/blocks/lifecycle/LifecycleOnFailureBlock.d.ts +13 -0
- package/dist/core/blocks/lifecycle/LifecycleOnFailureBlock.js +25 -0
- package/dist/core/blocks/lifecycle/LifecycleRetryBlock.d.ts +13 -0
- package/dist/core/blocks/lifecycle/LifecycleRetryBlock.js +29 -0
- package/dist/core/blocks/lifecycle/LifecycleSetupBlock.d.ts +13 -0
- package/dist/core/blocks/lifecycle/LifecycleSetupBlock.js +27 -0
- package/dist/core/blocks/lifecycle/LifecycleSkipIfBlock.d.ts +13 -0
- package/dist/core/blocks/lifecycle/LifecycleSkipIfBlock.js +31 -0
- package/dist/core/blocks/lifecycle/LifecycleTeardownBlock.d.ts +13 -0
- package/dist/core/blocks/lifecycle/LifecycleTeardownBlock.js +27 -0
- package/dist/core/blocks/lifecycle/TestCaseBlock.d.ts +21 -0
- package/dist/core/blocks/lifecycle/TestCaseBlock.js +72 -0
- package/dist/core/blocks/lifecycle/TestCaseDataDrivenBlock.d.ts +21 -0
- package/dist/core/blocks/lifecycle/TestCaseDataDrivenBlock.js +102 -0
- package/dist/core/blocks/lifecycle/index.d.ts +21 -0
- package/dist/core/blocks/lifecycle/index.js +63 -0
- package/dist/core/blocks/logic/LogicArrayBlock.d.ts +14 -0
- package/dist/core/blocks/logic/LogicArrayBlock.js +28 -0
- package/dist/core/blocks/logic/LogicAssertBlock.d.ts +13 -0
- package/dist/core/blocks/logic/LogicAssertBlock.js +32 -0
- package/dist/core/blocks/logic/LogicBooleanBlock.d.ts +14 -0
- package/dist/core/blocks/logic/LogicBooleanBlock.js +26 -0
- package/dist/core/blocks/logic/LogicBooleanOpBlock.d.ts +14 -0
- package/dist/core/blocks/logic/LogicBooleanOpBlock.js +31 -0
- package/dist/core/blocks/logic/LogicCommentBlock.d.ts +13 -0
- package/dist/core/blocks/logic/LogicCommentBlock.js +26 -0
- package/dist/core/blocks/logic/LogicCompareBlock.d.ts +14 -0
- package/dist/core/blocks/logic/LogicCompareBlock.js +52 -0
- package/dist/core/blocks/logic/LogicFailBlock.d.ts +16 -0
- package/dist/core/blocks/logic/LogicFailBlock.js +30 -0
- package/dist/core/blocks/logic/LogicForeachBlock.d.ts +13 -0
- package/dist/core/blocks/logic/LogicForeachBlock.js +29 -0
- package/dist/core/blocks/logic/LogicGetVariableBlock.d.ts +14 -0
- package/dist/core/blocks/logic/LogicGetVariableBlock.js +27 -0
- package/dist/core/blocks/logic/LogicIfBlock.d.ts +13 -0
- package/dist/core/blocks/logic/LogicIfBlock.js +36 -0
- package/dist/core/blocks/logic/LogicLogBlock.d.ts +13 -0
- package/dist/core/blocks/logic/LogicLogBlock.js +30 -0
- package/dist/core/blocks/logic/LogicNotBlock.d.ts +14 -0
- package/dist/core/blocks/logic/LogicNotBlock.js +26 -0
- package/dist/core/blocks/logic/LogicNumberBlock.d.ts +14 -0
- package/dist/core/blocks/logic/LogicNumberBlock.js +26 -0
- package/dist/core/blocks/logic/LogicObjectBlock.d.ts +14 -0
- package/dist/core/blocks/logic/LogicObjectBlock.js +28 -0
- package/dist/core/blocks/logic/LogicRepeatBlock.d.ts +13 -0
- package/dist/core/blocks/logic/LogicRepeatBlock.js +27 -0
- package/dist/core/blocks/logic/LogicSetVariableBlock.d.ts +13 -0
- package/dist/core/blocks/logic/LogicSetVariableBlock.js +34 -0
- package/dist/core/blocks/logic/LogicTextBlock.d.ts +14 -0
- package/dist/core/blocks/logic/LogicTextBlock.js +27 -0
- package/dist/core/blocks/logic/LogicTryCatchBlock.d.ts +13 -0
- package/dist/core/blocks/logic/LogicTryCatchBlock.js +26 -0
- package/dist/core/blocks/logic/index.d.ts +28 -0
- package/dist/core/blocks/logic/index.js +95 -0
- package/dist/core/blocks/playwright/assertions/WebAssertAccessibleDescriptionBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertAccessibleDescriptionBlock.js +41 -0
- package/dist/core/blocks/playwright/assertions/WebAssertAccessibleNameBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertAccessibleNameBlock.js +41 -0
- package/dist/core/blocks/playwright/assertions/WebAssertAttachedBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertAttachedBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/WebAssertAttributeBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertAttributeBlock.js +44 -0
- package/dist/core/blocks/playwright/assertions/WebAssertCheckedBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertCheckedBlock.js +48 -0
- package/dist/core/blocks/playwright/assertions/WebAssertClassBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertClassBlock.js +43 -0
- package/dist/core/blocks/playwright/assertions/WebAssertCountBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertCountBlock.js +41 -0
- package/dist/core/blocks/playwright/assertions/WebAssertCssBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertCssBlock.js +44 -0
- package/dist/core/blocks/playwright/assertions/WebAssertDisabledBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertDisabledBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/WebAssertEditableBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertEditableBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/WebAssertEmptyBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertEmptyBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/WebAssertEnabledBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertEnabledBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/WebAssertFocusedBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertFocusedBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/WebAssertIdBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertIdBlock.js +41 -0
- package/dist/core/blocks/playwright/assertions/WebAssertInViewportBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertInViewportBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/WebAssertNotVisibleBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertNotVisibleBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/WebAssertRoleBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertRoleBlock.js +69 -0
- package/dist/core/blocks/playwright/assertions/WebAssertTextContainsBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertTextContainsBlock.js +41 -0
- package/dist/core/blocks/playwright/assertions/WebAssertTextEqualsBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertTextEqualsBlock.js +41 -0
- package/dist/core/blocks/playwright/assertions/WebAssertTitleContainsBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertTitleContainsBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/WebAssertTitleEqualsBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertTitleEqualsBlock.js +36 -0
- package/dist/core/blocks/playwright/assertions/WebAssertUrlContainsBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertUrlContainsBlock.js +40 -0
- package/dist/core/blocks/playwright/assertions/WebAssertUrlEqualsBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertUrlEqualsBlock.js +37 -0
- package/dist/core/blocks/playwright/assertions/WebAssertValueBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertValueBlock.js +43 -0
- package/dist/core/blocks/playwright/assertions/WebAssertValueContainsBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertValueContainsBlock.js +43 -0
- package/dist/core/blocks/playwright/assertions/WebAssertVisibleBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/assertions/WebAssertVisibleBlock.js +39 -0
- package/dist/core/blocks/playwright/assertions/index.d.ts +36 -0
- package/dist/core/blocks/playwright/assertions/index.js +127 -0
- package/dist/core/blocks/playwright/index.d.ts +16 -0
- package/dist/core/blocks/playwright/index.js +28 -3
- package/dist/core/blocks/playwright/interactions/WebCheckboxBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebCheckboxBlock.js +43 -0
- package/dist/core/blocks/playwright/interactions/WebClickBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebClickBlock.js +34 -0
- package/dist/core/blocks/playwright/interactions/WebDragAndDropBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebDragAndDropBlock.js +37 -0
- package/dist/core/blocks/playwright/interactions/WebFillBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebFillBlock.js +38 -0
- package/dist/core/blocks/playwright/interactions/WebFocusBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebFocusBlock.js +34 -0
- package/dist/core/blocks/playwright/interactions/WebHoverBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebHoverBlock.js +34 -0
- package/dist/core/blocks/playwright/interactions/WebPressKeyBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebPressKeyBlock.js +37 -0
- package/dist/core/blocks/playwright/interactions/WebScrollIntoViewBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebScrollIntoViewBlock.js +34 -0
- package/dist/core/blocks/playwright/interactions/WebSelectBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebSelectBlock.js +37 -0
- package/dist/core/blocks/playwright/interactions/WebTypeBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebTypeBlock.js +41 -0
- package/dist/core/blocks/playwright/interactions/WebUploadFileBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/interactions/WebUploadFileBlock.js +39 -0
- package/dist/core/blocks/playwright/interactions/index.d.ts +21 -0
- package/dist/core/blocks/playwright/interactions/index.js +56 -0
- package/dist/core/blocks/playwright/navigation/WebNavigateBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/navigation/WebNavigateBlock.js +36 -0
- package/dist/core/blocks/playwright/navigation/WebScreenshotBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/navigation/WebScreenshotBlock.js +36 -0
- package/dist/core/blocks/playwright/navigation/WebWaitBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/navigation/WebWaitBlock.js +32 -0
- package/dist/core/blocks/playwright/navigation/WebWaitForElementBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/navigation/WebWaitForElementBlock.js +37 -0
- package/dist/core/blocks/playwright/navigation/WebWaitForUrlBlock.d.ts +13 -0
- package/dist/core/blocks/playwright/navigation/WebWaitForUrlBlock.js +34 -0
- package/dist/core/blocks/playwright/navigation/index.d.ts +15 -0
- package/dist/core/blocks/playwright/navigation/index.js +32 -0
- package/dist/core/blocks/playwright/retrieval/WebCountElementsBlock.d.ts +16 -0
- package/dist/core/blocks/playwright/retrieval/WebCountElementsBlock.js +36 -0
- package/dist/core/blocks/playwright/retrieval/WebGetAttributeBlock.d.ts +16 -0
- package/dist/core/blocks/playwright/retrieval/WebGetAttributeBlock.js +42 -0
- package/dist/core/blocks/playwright/retrieval/WebGetInputValueBlock.d.ts +16 -0
- package/dist/core/blocks/playwright/retrieval/WebGetInputValueBlock.js +40 -0
- package/dist/core/blocks/playwright/retrieval/WebGetTextBlock.d.ts +16 -0
- package/dist/core/blocks/playwright/retrieval/WebGetTextBlock.js +40 -0
- package/dist/core/blocks/playwright/retrieval/WebGetTitleBlock.d.ts +16 -0
- package/dist/core/blocks/playwright/retrieval/WebGetTitleBlock.js +31 -0
- package/dist/core/blocks/playwright/retrieval/WebGetUrlBlock.d.ts +16 -0
- package/dist/core/blocks/playwright/retrieval/WebGetUrlBlock.js +31 -0
- package/dist/core/blocks/playwright/retrieval/index.d.ts +16 -0
- package/dist/core/blocks/playwright/retrieval/index.js +36 -0
- package/dist/core/blocks/playwright/types.d.ts +14 -0
- package/dist/core/blocks/procedures/ProcedureCallBlock.d.ts +13 -0
- package/dist/core/blocks/procedures/ProcedureCallBlock.js +66 -0
- package/dist/core/blocks/procedures/ProcedureCallWithReturnBlock.d.ts +14 -0
- package/dist/core/blocks/procedures/ProcedureCallWithReturnBlock.js +51 -0
- package/dist/core/blocks/procedures/ProcedureDefineBlock.d.ts +15 -0
- package/dist/core/blocks/procedures/ProcedureDefineBlock.js +59 -0
- package/dist/core/blocks/procedures/ProcedureFillFormBlock.d.ts +13 -0
- package/dist/core/blocks/procedures/ProcedureFillFormBlock.js +30 -0
- package/dist/core/blocks/procedures/ProcedureGetParamBlock.d.ts +14 -0
- package/dist/core/blocks/procedures/ProcedureGetParamBlock.js +33 -0
- package/dist/core/blocks/procedures/ProcedureInlineBlock.d.ts +14 -0
- package/dist/core/blocks/procedures/ProcedureInlineBlock.js +31 -0
- package/dist/core/blocks/procedures/ProcedureLoginBlock.d.ts +13 -0
- package/dist/core/blocks/procedures/ProcedureLoginBlock.js +37 -0
- package/dist/core/blocks/procedures/ProcedureMapBlock.d.ts +14 -0
- package/dist/core/blocks/procedures/ProcedureMapBlock.js +36 -0
- package/dist/core/blocks/procedures/ProcedureReturnBlock.d.ts +15 -0
- package/dist/core/blocks/procedures/ProcedureReturnBlock.js +28 -0
- package/dist/core/blocks/procedures/ProcedureWaitAndClickBlock.d.ts +13 -0
- package/dist/core/blocks/procedures/ProcedureWaitAndClickBlock.js +32 -0
- package/dist/core/blocks/procedures/index.d.ts +21 -0
- package/dist/core/blocks/procedures/index.js +62 -0
- package/dist/core/blocks/{procedures.d.ts → procedures/procedureRegistry.d.ts} +10 -2
- package/dist/core/blocks/procedures/procedureRegistry.js +27 -0
- package/dist/core/blocks/utils/apiUtils.d.ts +81 -0
- package/dist/core/blocks/utils/apiUtils.js +176 -0
- package/dist/core/blocks/utils/index.d.ts +2 -0
- package/dist/core/blocks/utils/index.js +16 -0
- package/dist/core/blocks/utils/variableUtils.d.ts +19 -0
- package/dist/core/blocks/utils/variableUtils.js +69 -0
- package/dist/server/index.js +117 -11
- package/dist/server/openApiParser.d.ts +82 -0
- package/dist/server/openApiParser.js +495 -0
- package/dist/server/startServer.d.ts +1 -0
- package/dist/server/startServer.js +164 -0
- package/package.json +4 -2
- package/dist/client/assets/index-BLBBQ6Rn.js +0 -2195
- package/dist/client/assets/index-BLBBQ6Rn.js.map +0 -1
- package/dist/client/assets/index-qjoPPl9y.css +0 -1
- package/dist/core/blocks/api.d.ts +0 -2
- package/dist/core/blocks/api.js +0 -607
- package/dist/core/blocks/data-driven.d.ts +0 -2
- package/dist/core/blocks/data-driven.js +0 -245
- package/dist/core/blocks/lifecycle.d.ts +0 -2
- package/dist/core/blocks/lifecycle.js +0 -201
- package/dist/core/blocks/logic.d.ts +0 -2
- package/dist/core/blocks/logic.js +0 -360
- package/dist/core/blocks/playwright/assertions.d.ts +0 -5
- package/dist/core/blocks/playwright/assertions.js +0 -311
- package/dist/core/blocks/playwright/interactions.d.ts +0 -5
- package/dist/core/blocks/playwright/interactions.js +0 -208
- package/dist/core/blocks/playwright/navigation.d.ts +0 -5
- package/dist/core/blocks/playwright/navigation.js +0 -131
- package/dist/core/blocks/playwright/retrieval.d.ts +0 -5
- package/dist/core/blocks/playwright/retrieval.js +0 -153
- package/dist/core/blocks/playwright.d.ts +0 -13
- package/dist/core/blocks/playwright.js +0 -17
- package/dist/core/blocks/procedures.js +0 -321
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ExecutionContext } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Parse header string into an object.
|
|
4
|
+
* Supports JSON format or key:value format.
|
|
5
|
+
*
|
|
6
|
+
* @param headersStr - The headers string (JSON or key:value pairs)
|
|
7
|
+
* @param context - The execution context for variable resolution
|
|
8
|
+
* @returns The parsed headers object
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseHeaders(headersStr: string, context: ExecutionContext): Record<string, string>;
|
|
11
|
+
/**
|
|
12
|
+
* Parse an HTTP response into a structured object.
|
|
13
|
+
*
|
|
14
|
+
* @param response - The fetch Response object
|
|
15
|
+
* @returns Parsed response with status, headers, and body
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseResponse(response: Response): Promise<{
|
|
18
|
+
status: number;
|
|
19
|
+
headers: Record<string, string>;
|
|
20
|
+
body: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Get a value from an object by dot-notation path.
|
|
24
|
+
* Supports array indexing like "items[0]".
|
|
25
|
+
*
|
|
26
|
+
* @param obj - The object to traverse
|
|
27
|
+
* @param path - The dot-notation path (e.g., "data.user.name" or "items[0].id")
|
|
28
|
+
* @returns The value at the path, or undefined if not found
|
|
29
|
+
*/
|
|
30
|
+
export declare function getValueByPath(obj: unknown, path: string): unknown;
|
|
31
|
+
/**
|
|
32
|
+
* Extract value from an XPath node.
|
|
33
|
+
*
|
|
34
|
+
* @param node - The XPath node
|
|
35
|
+
* @returns The string value of the node
|
|
36
|
+
*/
|
|
37
|
+
export declare function getNodeValue(node: unknown): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Get the last API response from context.
|
|
40
|
+
*
|
|
41
|
+
* @param context - The execution context
|
|
42
|
+
* @returns The last response or throws if none available
|
|
43
|
+
*/
|
|
44
|
+
export declare function getLastResponse(context: ExecutionContext): {
|
|
45
|
+
status: number;
|
|
46
|
+
headers: Record<string, string>;
|
|
47
|
+
body: unknown;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Get context headers (set via api_set_header/api_set_headers blocks).
|
|
51
|
+
*
|
|
52
|
+
* @param context - The execution context
|
|
53
|
+
* @returns The headers object
|
|
54
|
+
*/
|
|
55
|
+
export declare function getContextHeaders(context: ExecutionContext): Record<string, string>;
|
|
56
|
+
/**
|
|
57
|
+
* Set context headers.
|
|
58
|
+
*
|
|
59
|
+
* @param context - The execution context
|
|
60
|
+
* @param headers - The headers to set
|
|
61
|
+
*/
|
|
62
|
+
export declare function setContextHeaders(context: ExecutionContext, headers: Record<string, string>): void;
|
|
63
|
+
/**
|
|
64
|
+
* Merge headers with context headers and inline headers.
|
|
65
|
+
*
|
|
66
|
+
* @param context - The execution context
|
|
67
|
+
* @param inlineHeadersStr - Optional inline headers string
|
|
68
|
+
* @returns The merged headers
|
|
69
|
+
*/
|
|
70
|
+
export declare function mergeHeaders(context: ExecutionContext, inlineHeadersStr?: string): Record<string, string>;
|
|
71
|
+
/**
|
|
72
|
+
* Store an API response in the context.
|
|
73
|
+
*
|
|
74
|
+
* @param context - The execution context
|
|
75
|
+
* @param response - The parsed response to store
|
|
76
|
+
*/
|
|
77
|
+
export declare function storeResponse(context: ExecutionContext, response: {
|
|
78
|
+
status: number;
|
|
79
|
+
headers: Record<string, string>;
|
|
80
|
+
body: unknown;
|
|
81
|
+
}): void;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseHeaders = parseHeaders;
|
|
4
|
+
exports.parseResponse = parseResponse;
|
|
5
|
+
exports.getValueByPath = getValueByPath;
|
|
6
|
+
exports.getNodeValue = getNodeValue;
|
|
7
|
+
exports.getLastResponse = getLastResponse;
|
|
8
|
+
exports.getContextHeaders = getContextHeaders;
|
|
9
|
+
exports.setContextHeaders = setContextHeaders;
|
|
10
|
+
exports.mergeHeaders = mergeHeaders;
|
|
11
|
+
exports.storeResponse = storeResponse;
|
|
12
|
+
const variableUtils_1 = require("./variableUtils");
|
|
13
|
+
/**
|
|
14
|
+
* Parse header string into an object.
|
|
15
|
+
* Supports JSON format or key:value format.
|
|
16
|
+
*
|
|
17
|
+
* @param headersStr - The headers string (JSON or key:value pairs)
|
|
18
|
+
* @param context - The execution context for variable resolution
|
|
19
|
+
* @returns The parsed headers object
|
|
20
|
+
*/
|
|
21
|
+
function parseHeaders(headersStr, context) {
|
|
22
|
+
if (!headersStr || !headersStr.trim())
|
|
23
|
+
return {};
|
|
24
|
+
const resolved = (0, variableUtils_1.resolveVariables)(headersStr, context);
|
|
25
|
+
// Try JSON format first: {"Authorization": "Bearer token"}
|
|
26
|
+
try {
|
|
27
|
+
const parsed = JSON.parse(resolved);
|
|
28
|
+
if (typeof parsed === 'object' && parsed !== null) {
|
|
29
|
+
return parsed;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Not JSON, try key:value format
|
|
34
|
+
}
|
|
35
|
+
// Try key:value format (one per line or semicolon-separated)
|
|
36
|
+
// Example: "Authorization: Bearer token; Content-Type: application/json"
|
|
37
|
+
const headers = {};
|
|
38
|
+
const pairs = resolved.split(/[;\n]/).map(s => s.trim()).filter(s => s);
|
|
39
|
+
for (const pair of pairs) {
|
|
40
|
+
const colonIndex = pair.indexOf(':');
|
|
41
|
+
if (colonIndex > 0) {
|
|
42
|
+
const key = pair.slice(0, colonIndex).trim();
|
|
43
|
+
const value = pair.slice(colonIndex + 1).trim();
|
|
44
|
+
headers[key] = value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return headers;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Parse an HTTP response into a structured object.
|
|
51
|
+
*
|
|
52
|
+
* @param response - The fetch Response object
|
|
53
|
+
* @returns Parsed response with status, headers, and body
|
|
54
|
+
*/
|
|
55
|
+
async function parseResponse(response) {
|
|
56
|
+
const headers = {};
|
|
57
|
+
response.headers.forEach((value, key) => {
|
|
58
|
+
headers[key] = value;
|
|
59
|
+
});
|
|
60
|
+
let body;
|
|
61
|
+
const contentType = response.headers.get('content-type') || '';
|
|
62
|
+
if (contentType.includes('application/json')) {
|
|
63
|
+
body = await response.json();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
body = await response.text();
|
|
67
|
+
}
|
|
68
|
+
return { status: response.status, headers, body };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get a value from an object by dot-notation path.
|
|
72
|
+
* Supports array indexing like "items[0]".
|
|
73
|
+
*
|
|
74
|
+
* @param obj - The object to traverse
|
|
75
|
+
* @param path - The dot-notation path (e.g., "data.user.name" or "items[0].id")
|
|
76
|
+
* @returns The value at the path, or undefined if not found
|
|
77
|
+
*/
|
|
78
|
+
function getValueByPath(obj, path) {
|
|
79
|
+
if (!path)
|
|
80
|
+
return obj;
|
|
81
|
+
const parts = path.split('.');
|
|
82
|
+
let current = obj;
|
|
83
|
+
for (const part of parts) {
|
|
84
|
+
if (current === null || current === undefined)
|
|
85
|
+
return undefined;
|
|
86
|
+
// Handle array indexing like "items[0]"
|
|
87
|
+
const arrayMatch = part.match(/^(\w+)\[(\d+)\]$/);
|
|
88
|
+
if (arrayMatch) {
|
|
89
|
+
const [, key, index] = arrayMatch;
|
|
90
|
+
current = current[key];
|
|
91
|
+
if (Array.isArray(current)) {
|
|
92
|
+
current = current[parseInt(index, 10)];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
current = current[part];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return current;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Extract value from an XPath node.
|
|
103
|
+
*
|
|
104
|
+
* @param node - The XPath node
|
|
105
|
+
* @returns The string value of the node
|
|
106
|
+
*/
|
|
107
|
+
function getNodeValue(node) {
|
|
108
|
+
if (!node)
|
|
109
|
+
return null;
|
|
110
|
+
const n = node;
|
|
111
|
+
// Text node or attribute
|
|
112
|
+
if (n.nodeValue !== undefined) {
|
|
113
|
+
return n.nodeValue;
|
|
114
|
+
}
|
|
115
|
+
// Element node - get text content
|
|
116
|
+
if (n.textContent !== undefined) {
|
|
117
|
+
return n.textContent;
|
|
118
|
+
}
|
|
119
|
+
// Fallback to string representation
|
|
120
|
+
if (n.toString) {
|
|
121
|
+
return n.toString();
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get the last API response from context.
|
|
127
|
+
*
|
|
128
|
+
* @param context - The execution context
|
|
129
|
+
* @returns The last response or throws if none available
|
|
130
|
+
*/
|
|
131
|
+
function getLastResponse(context) {
|
|
132
|
+
const response = context.variables.get('__lastResponse');
|
|
133
|
+
if (!response) {
|
|
134
|
+
throw new Error('No response available. Make sure to call an API request first.');
|
|
135
|
+
}
|
|
136
|
+
return response;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get context headers (set via api_set_header/api_set_headers blocks).
|
|
140
|
+
*
|
|
141
|
+
* @param context - The execution context
|
|
142
|
+
* @returns The headers object
|
|
143
|
+
*/
|
|
144
|
+
function getContextHeaders(context) {
|
|
145
|
+
return context.variables.get('__requestHeaders') || {};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Set context headers.
|
|
149
|
+
*
|
|
150
|
+
* @param context - The execution context
|
|
151
|
+
* @param headers - The headers to set
|
|
152
|
+
*/
|
|
153
|
+
function setContextHeaders(context, headers) {
|
|
154
|
+
context.variables.set('__requestHeaders', headers);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Merge headers with context headers and inline headers.
|
|
158
|
+
*
|
|
159
|
+
* @param context - The execution context
|
|
160
|
+
* @param inlineHeadersStr - Optional inline headers string
|
|
161
|
+
* @returns The merged headers
|
|
162
|
+
*/
|
|
163
|
+
function mergeHeaders(context, inlineHeadersStr) {
|
|
164
|
+
const contextHeaders = getContextHeaders(context);
|
|
165
|
+
const inlineHeaders = inlineHeadersStr ? parseHeaders(inlineHeadersStr, context) : {};
|
|
166
|
+
return { ...contextHeaders, ...inlineHeaders };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Store an API response in the context.
|
|
170
|
+
*
|
|
171
|
+
* @param context - The execution context
|
|
172
|
+
* @param response - The parsed response to store
|
|
173
|
+
*/
|
|
174
|
+
function storeResponse(context, response) {
|
|
175
|
+
context.variables.set('__lastResponse', response);
|
|
176
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storeResponse = exports.mergeHeaders = exports.setContextHeaders = exports.getContextHeaders = exports.getLastResponse = exports.getNodeValue = exports.getValueByPath = exports.parseResponse = exports.parseHeaders = exports.resolveSimpleVariables = exports.resolveVariables = void 0;
|
|
4
|
+
var variableUtils_1 = require("./variableUtils");
|
|
5
|
+
Object.defineProperty(exports, "resolveVariables", { enumerable: true, get: function () { return variableUtils_1.resolveVariables; } });
|
|
6
|
+
Object.defineProperty(exports, "resolveSimpleVariables", { enumerable: true, get: function () { return variableUtils_1.resolveSimpleVariables; } });
|
|
7
|
+
var apiUtils_1 = require("./apiUtils");
|
|
8
|
+
Object.defineProperty(exports, "parseHeaders", { enumerable: true, get: function () { return apiUtils_1.parseHeaders; } });
|
|
9
|
+
Object.defineProperty(exports, "parseResponse", { enumerable: true, get: function () { return apiUtils_1.parseResponse; } });
|
|
10
|
+
Object.defineProperty(exports, "getValueByPath", { enumerable: true, get: function () { return apiUtils_1.getValueByPath; } });
|
|
11
|
+
Object.defineProperty(exports, "getNodeValue", { enumerable: true, get: function () { return apiUtils_1.getNodeValue; } });
|
|
12
|
+
Object.defineProperty(exports, "getLastResponse", { enumerable: true, get: function () { return apiUtils_1.getLastResponse; } });
|
|
13
|
+
Object.defineProperty(exports, "getContextHeaders", { enumerable: true, get: function () { return apiUtils_1.getContextHeaders; } });
|
|
14
|
+
Object.defineProperty(exports, "setContextHeaders", { enumerable: true, get: function () { return apiUtils_1.setContextHeaders; } });
|
|
15
|
+
Object.defineProperty(exports, "mergeHeaders", { enumerable: true, get: function () { return apiUtils_1.mergeHeaders; } });
|
|
16
|
+
Object.defineProperty(exports, "storeResponse", { enumerable: true, get: function () { return apiUtils_1.storeResponse; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ExecutionContext } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve variable references in a text string.
|
|
4
|
+
* Supports ${varName} and ${varName.property.path} syntax.
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text containing variable references
|
|
7
|
+
* @param context - The execution context containing variables
|
|
8
|
+
* @returns The text with variables resolved
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveVariables(text: string, context: ExecutionContext): string;
|
|
11
|
+
/**
|
|
12
|
+
* Simple variable resolution that only handles ${varName} syntax.
|
|
13
|
+
* Used in data-driven contexts where nested paths are not needed.
|
|
14
|
+
*
|
|
15
|
+
* @param text - The text containing variable references
|
|
16
|
+
* @param context - The execution context
|
|
17
|
+
* @returns The text with variables resolved
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveSimpleVariables(text: string, context: ExecutionContext): string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveVariables = resolveVariables;
|
|
4
|
+
exports.resolveSimpleVariables = resolveSimpleVariables;
|
|
5
|
+
/**
|
|
6
|
+
* Resolve variable references in a text string.
|
|
7
|
+
* Supports ${varName} and ${varName.property.path} syntax.
|
|
8
|
+
*
|
|
9
|
+
* @param text - The text containing variable references
|
|
10
|
+
* @param context - The execution context containing variables
|
|
11
|
+
* @returns The text with variables resolved
|
|
12
|
+
*/
|
|
13
|
+
function resolveVariables(text, context) {
|
|
14
|
+
// Match ${varName} or ${varName.property.path}
|
|
15
|
+
return text.replace(/\$\{([\w.]+)\}/g, (match, path) => {
|
|
16
|
+
const parts = path.split('.');
|
|
17
|
+
const varName = parts[0];
|
|
18
|
+
// Check param prefix first (for procedures)
|
|
19
|
+
let value = context.variables.get(`__param_${varName}`);
|
|
20
|
+
// Then check current data (for data-driven tests)
|
|
21
|
+
if (value === undefined && context.currentData?.values[varName] !== undefined) {
|
|
22
|
+
value = context.currentData.values[varName];
|
|
23
|
+
}
|
|
24
|
+
// Then check regular variables
|
|
25
|
+
if (value === undefined) {
|
|
26
|
+
value = context.variables.get(varName);
|
|
27
|
+
}
|
|
28
|
+
// Navigate through object properties if path has dots
|
|
29
|
+
if (parts.length > 1 && value !== undefined && value !== null) {
|
|
30
|
+
for (let i = 1; i < parts.length; i++) {
|
|
31
|
+
if (value === undefined || value === null)
|
|
32
|
+
break;
|
|
33
|
+
value = value[parts[i]];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (value === undefined || value === null) {
|
|
37
|
+
return match; // Keep original if not found
|
|
38
|
+
}
|
|
39
|
+
// Return stringified value
|
|
40
|
+
if (typeof value === 'object') {
|
|
41
|
+
return JSON.stringify(value);
|
|
42
|
+
}
|
|
43
|
+
return String(value);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Simple variable resolution that only handles ${varName} syntax.
|
|
48
|
+
* Used in data-driven contexts where nested paths are not needed.
|
|
49
|
+
*
|
|
50
|
+
* @param text - The text containing variable references
|
|
51
|
+
* @param context - The execution context
|
|
52
|
+
* @returns The text with variables resolved
|
|
53
|
+
*/
|
|
54
|
+
function resolveSimpleVariables(text, context) {
|
|
55
|
+
return text.replace(/\$\{(\w+)\}/g, (_, varName) => {
|
|
56
|
+
// Check param prefix first
|
|
57
|
+
const paramValue = context.variables.get(`__param_${varName}`);
|
|
58
|
+
if (paramValue !== undefined) {
|
|
59
|
+
return String(paramValue);
|
|
60
|
+
}
|
|
61
|
+
// Then check current data
|
|
62
|
+
if (context.currentData?.values[varName] !== undefined) {
|
|
63
|
+
return String(context.currentData.values[varName]);
|
|
64
|
+
}
|
|
65
|
+
// Then regular variables
|
|
66
|
+
const value = context.variables.get(varName);
|
|
67
|
+
return value !== undefined ? String(value) : '';
|
|
68
|
+
});
|
|
69
|
+
}
|
package/dist/server/index.js
CHANGED
|
@@ -48,6 +48,7 @@ const reporters_1 = require("../cli/reporters");
|
|
|
48
48
|
const plugins_1 = require("./plugins");
|
|
49
49
|
const globals_1 = require("./globals");
|
|
50
50
|
const codegenManager_1 = require("./codegenManager");
|
|
51
|
+
const openApiParser_1 = require("./openApiParser");
|
|
51
52
|
// Set plugins directory (default to examples/plugins or can be overridden via env)
|
|
52
53
|
const pluginsDir = process.env.PLUGINS_DIR || path_1.default.join(process.cwd(), 'examples', 'plugins');
|
|
53
54
|
(0, plugins_1.setPluginsDirectory)(pluginsDir);
|
|
@@ -370,6 +371,108 @@ app.get('/api/record/status/:sessionId', (req, res) => {
|
|
|
370
371
|
error: session.error,
|
|
371
372
|
});
|
|
372
373
|
});
|
|
374
|
+
// ===== OpenAPI Import Endpoints =====
|
|
375
|
+
// Parse an OpenAPI/Swagger spec from URL
|
|
376
|
+
app.post('/api/openapi/parse', async (req, res) => {
|
|
377
|
+
try {
|
|
378
|
+
const { url } = req.body;
|
|
379
|
+
if (!url) {
|
|
380
|
+
return res.status(400).json({ error: 'URL is required' });
|
|
381
|
+
}
|
|
382
|
+
console.log(`Parsing OpenAPI spec from URL: ${url}`);
|
|
383
|
+
const spec = await (0, openApiParser_1.parseOpenApiSpec)(url, true);
|
|
384
|
+
res.json({
|
|
385
|
+
info: spec.info,
|
|
386
|
+
servers: spec.servers,
|
|
387
|
+
endpoints: spec.endpoints.map(e => ({
|
|
388
|
+
operationId: e.operationId,
|
|
389
|
+
method: e.method,
|
|
390
|
+
path: e.path,
|
|
391
|
+
summary: e.summary,
|
|
392
|
+
description: e.description,
|
|
393
|
+
tags: e.tags,
|
|
394
|
+
deprecated: e.deprecated,
|
|
395
|
+
hasRequestBody: !!e.requestBody,
|
|
396
|
+
responses: e.responses.map(r => r.statusCode),
|
|
397
|
+
})),
|
|
398
|
+
securitySchemes: spec.securitySchemes,
|
|
399
|
+
tags: spec.tags,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
console.error('Failed to parse OpenAPI spec:', error);
|
|
404
|
+
res.status(500).json({
|
|
405
|
+
error: 'Failed to parse OpenAPI spec',
|
|
406
|
+
message: error.message,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
// Parse an OpenAPI/Swagger spec from content
|
|
411
|
+
app.post('/api/openapi/parse-content', async (req, res) => {
|
|
412
|
+
try {
|
|
413
|
+
const { content } = req.body;
|
|
414
|
+
if (!content) {
|
|
415
|
+
return res.status(400).json({ error: 'Content is required' });
|
|
416
|
+
}
|
|
417
|
+
console.log('Parsing OpenAPI spec from content');
|
|
418
|
+
const spec = await (0, openApiParser_1.parseOpenApiSpec)(content, false);
|
|
419
|
+
res.json({
|
|
420
|
+
info: spec.info,
|
|
421
|
+
servers: spec.servers,
|
|
422
|
+
endpoints: spec.endpoints.map(e => ({
|
|
423
|
+
operationId: e.operationId,
|
|
424
|
+
method: e.method,
|
|
425
|
+
path: e.path,
|
|
426
|
+
summary: e.summary,
|
|
427
|
+
description: e.description,
|
|
428
|
+
tags: e.tags,
|
|
429
|
+
deprecated: e.deprecated,
|
|
430
|
+
hasRequestBody: !!e.requestBody,
|
|
431
|
+
responses: e.responses.map(r => r.statusCode),
|
|
432
|
+
})),
|
|
433
|
+
securitySchemes: spec.securitySchemes,
|
|
434
|
+
tags: spec.tags,
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
catch (error) {
|
|
438
|
+
console.error('Failed to parse OpenAPI spec:', error);
|
|
439
|
+
res.status(500).json({
|
|
440
|
+
error: 'Failed to parse OpenAPI spec',
|
|
441
|
+
message: error.message,
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
// Generate test files from selected endpoints
|
|
446
|
+
app.post('/api/openapi/generate', async (req, res) => {
|
|
447
|
+
try {
|
|
448
|
+
const { url, content, selectedEndpoints, options } = req.body;
|
|
449
|
+
if (!url && !content) {
|
|
450
|
+
return res.status(400).json({ error: 'Either URL or content is required' });
|
|
451
|
+
}
|
|
452
|
+
if (!selectedEndpoints || selectedEndpoints.length === 0) {
|
|
453
|
+
return res.status(400).json({ error: 'No endpoints selected' });
|
|
454
|
+
}
|
|
455
|
+
console.log(`Generating tests for ${selectedEndpoints.length} endpoints`);
|
|
456
|
+
const spec = url
|
|
457
|
+
? await (0, openApiParser_1.parseOpenApiSpec)(url, true)
|
|
458
|
+
: await (0, openApiParser_1.parseOpenApiSpec)(content, false);
|
|
459
|
+
const files = (0, openApiParser_1.generateTestFiles)(spec, selectedEndpoints, options);
|
|
460
|
+
res.json({
|
|
461
|
+
files: files.map(f => ({
|
|
462
|
+
fileName: f.fileName,
|
|
463
|
+
testFile: f.testFile,
|
|
464
|
+
testCount: f.testFile.tests.length,
|
|
465
|
+
})),
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
catch (error) {
|
|
469
|
+
console.error('Failed to generate test files:', error);
|
|
470
|
+
res.status(500).json({
|
|
471
|
+
error: 'Failed to generate test files',
|
|
472
|
+
message: error.message,
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
});
|
|
373
476
|
// ===== Report Generation Endpoints =====
|
|
374
477
|
// Generate HTML report from test results
|
|
375
478
|
app.post('/api/reports/html', (req, res) => {
|
|
@@ -459,15 +562,18 @@ process.on('SIGINT', () => {
|
|
|
459
562
|
app.listen(PORT, () => {
|
|
460
563
|
console.log(`TestBlocks server running on http://localhost:${PORT}`);
|
|
461
564
|
console.log('API endpoints:');
|
|
462
|
-
console.log(' GET /api/health
|
|
463
|
-
console.log(' GET /api/plugins
|
|
464
|
-
console.log(' GET /api/globals
|
|
465
|
-
console.log(' POST /api/run
|
|
466
|
-
console.log(' POST /api/run/:id
|
|
467
|
-
console.log(' POST /api/validate
|
|
468
|
-
console.log(' POST /api/record/start
|
|
469
|
-
console.log(' POST /api/record/stop
|
|
470
|
-
console.log(' GET /api/record/status
|
|
471
|
-
console.log(' POST /api/
|
|
472
|
-
console.log(' POST /api/
|
|
565
|
+
console.log(' GET /api/health - Health check');
|
|
566
|
+
console.log(' GET /api/plugins - List plugins');
|
|
567
|
+
console.log(' GET /api/globals - Get globals and snippets');
|
|
568
|
+
console.log(' POST /api/run - Run all tests');
|
|
569
|
+
console.log(' POST /api/run/:id - Run single test');
|
|
570
|
+
console.log(' POST /api/validate - Validate test file');
|
|
571
|
+
console.log(' POST /api/record/start - Start recording session');
|
|
572
|
+
console.log(' POST /api/record/stop - Stop recording and get steps');
|
|
573
|
+
console.log(' GET /api/record/status - Get recording session status');
|
|
574
|
+
console.log(' POST /api/openapi/parse - Parse OpenAPI spec from URL');
|
|
575
|
+
console.log(' POST /api/openapi/parse-content - Parse OpenAPI spec from content');
|
|
576
|
+
console.log(' POST /api/openapi/generate - Generate tests from OpenAPI spec');
|
|
577
|
+
console.log(' POST /api/reports/html - Generate HTML report');
|
|
578
|
+
console.log(' POST /api/reports/junit - Generate JUnit XML report');
|
|
473
579
|
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { TestFile } from '../core';
|
|
2
|
+
export interface ParsedParameter {
|
|
3
|
+
name: string;
|
|
4
|
+
in: 'path' | 'query' | 'header' | 'cookie';
|
|
5
|
+
required: boolean;
|
|
6
|
+
description?: string;
|
|
7
|
+
schema?: {
|
|
8
|
+
type: string;
|
|
9
|
+
format?: string;
|
|
10
|
+
default?: unknown;
|
|
11
|
+
example?: unknown;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface ParsedRequestBody {
|
|
15
|
+
required: boolean;
|
|
16
|
+
contentType: string;
|
|
17
|
+
schema?: Record<string, unknown>;
|
|
18
|
+
example?: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface ParsedResponse {
|
|
21
|
+
statusCode: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
schema?: Record<string, unknown>;
|
|
24
|
+
example?: unknown;
|
|
25
|
+
}
|
|
26
|
+
export interface ParsedEndpoint {
|
|
27
|
+
operationId: string;
|
|
28
|
+
method: 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
29
|
+
path: string;
|
|
30
|
+
summary?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
tags: string[];
|
|
33
|
+
parameters: ParsedParameter[];
|
|
34
|
+
requestBody?: ParsedRequestBody;
|
|
35
|
+
responses: ParsedResponse[];
|
|
36
|
+
security?: Record<string, string[]>[];
|
|
37
|
+
deprecated?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface ParsedSecurityScheme {
|
|
40
|
+
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
41
|
+
name?: string;
|
|
42
|
+
in?: 'header' | 'query' | 'cookie';
|
|
43
|
+
scheme?: string;
|
|
44
|
+
bearerFormat?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ParsedSpec {
|
|
48
|
+
info: {
|
|
49
|
+
title: string;
|
|
50
|
+
version: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
};
|
|
53
|
+
servers: {
|
|
54
|
+
url: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
}[];
|
|
57
|
+
endpoints: ParsedEndpoint[];
|
|
58
|
+
securitySchemes: Record<string, ParsedSecurityScheme>;
|
|
59
|
+
tags: {
|
|
60
|
+
name: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
}[];
|
|
63
|
+
}
|
|
64
|
+
export interface ImportOptions {
|
|
65
|
+
baseUrl: string;
|
|
66
|
+
fileStrategy: 'single' | 'per-tag' | 'per-path';
|
|
67
|
+
includeExamples: boolean;
|
|
68
|
+
generateAssertions: boolean;
|
|
69
|
+
authVariablePrefix: string;
|
|
70
|
+
}
|
|
71
|
+
export interface GeneratedTestFile {
|
|
72
|
+
fileName: string;
|
|
73
|
+
testFile: TestFile;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parse an OpenAPI/Swagger spec from a URL or content string
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseOpenApiSpec(source: string, isUrl?: boolean): Promise<ParsedSpec>;
|
|
79
|
+
/**
|
|
80
|
+
* Generate test files from selected endpoints
|
|
81
|
+
*/
|
|
82
|
+
export declare function generateTestFiles(spec: ParsedSpec, selectedEndpoints: string[], options: ImportOptions): GeneratedTestFile[];
|