From 3000a15c605a941df01484e006292246060bfb01 Mon Sep 17 00:00:00 2001 From: Fabio <161820267+fabiomaienschein@users.noreply.github.com> Date: Thu, 24 Jul 2025 10:57:37 +0200 Subject: [PATCH 1/4] add cli actions --- openapi.yaml | 248 ++++++++++++++++++++++++++++++++++++++------------- src/api.ts | 104 +++++++++++++++++++++ src/cli.ts | 45 ++++++++++ src/tools.ts | 172 ++++++++++++++++++++++++++++++++++- 4 files changed, 508 insertions(+), 61 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 8401074..8119772 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -22,7 +22,7 @@ components: properties: source: type: string - enum: [ "github" ] + enum: ["github"] example: "github" issueNumber: type: integer @@ -48,7 +48,7 @@ components: properties: type: type: string - enum: [ "USER" ] + enum: ["USER"] example: "USER" userId: type: string @@ -62,7 +62,7 @@ components: properties: source: type: string - enum: [ "azureDevOps" ] + enum: ["azureDevOps"] example: "azureDevOps" accessToken: type: string @@ -94,7 +94,7 @@ components: properties: type: type: string - enum: [ "USER" ] + enum: ["USER"] example: "USER" userId: type: string @@ -108,7 +108,7 @@ components: properties: source: type: string - enum: [ "discovery" ] + enum: ["discovery"] example: "discovery" description: type: string @@ -119,13 +119,13 @@ components: properties: type: type: string - enum: [ "INITIAL" ] + enum: ["INITIAL"] example: "INITIAL" - type: object properties: type: type: string - enum: [ "USER" ] + enum: ["USER"] example: "USER" userId: type: string @@ -135,7 +135,7 @@ components: properties: source: type: string - enum: [ "manual" ] + enum: ["manual"] example: "manual" description: type: string @@ -145,7 +145,7 @@ components: properties: type: type: string - enum: [ "USER" ] + enum: ["USER"] example: "USER" userId: type: string @@ -155,7 +155,7 @@ components: properties: source: type: string - enum: [ "scheduled" ] + enum: ["scheduled"] example: "scheduled" triggeredBy: type: object @@ -163,7 +163,7 @@ components: properties: type: type: string - enum: [ "USER" ] + enum: ["USER"] example: "USER" userId: type: string @@ -173,7 +173,7 @@ components: properties: source: type: string - enum: [ "proposal" ] + enum: ["proposal"] example: "proposal" description: type: string @@ -184,13 +184,13 @@ components: properties: type: type: string - enum: [ "INITIAL" ] + enum: ["INITIAL"] example: "INITIAL" - type: object properties: type: type: string - enum: [ "USER" ] + enum: ["USER"] example: "USER" userId: type: string @@ -256,7 +256,7 @@ components: properties: source: type: string - enum: [ "manual" ] + enum: ["manual"] description: The source of the test trigger. example: "manual" description: @@ -268,7 +268,7 @@ components: properties: type: type: string - enum: [ "USER" ] + enum: ["USER"] description: The type of entity triggering the test. example: "USER" userId: @@ -307,7 +307,7 @@ components: example: "2024-09-06T13:01:51.686Z" status: type: string - enum: [ "WAITING", "PASSED", "FAILED", "ERROR" ] + enum: ["WAITING", "PASSED", "FAILED", "ERROR"] description: The status of the specific test result, will be WAITING as long as the result is running, FAILED if the execution failed, PASSED if it succeeded, and ERROR if an internal error occurred. errorMessage: type: string @@ -350,7 +350,7 @@ components: example: "https://en.wikipedia.org/" status: type: string - enum: [ "WAITING", "PASSED", "FAILED" ] + enum: ["WAITING", "PASSED", "FAILED"] description: The status of the test report, will be WAITING as long as any result is running, FAILED if the report is done but has any failed result and PASSED if all test results are done and successful context: $ref: "#/components/schemas/TestReportContext" @@ -391,7 +391,7 @@ components: example: "https://app.octomind.dev/testreports/826c15af-644b-4b28-89b4-f50ff34e46b7" testReport: $ref: "#/components/schemas/TestReport" - + TestCasesResponse: type: array items: @@ -427,7 +427,21 @@ components: format: uuid action: type: string - enum: [EXTRACT, ENTER_TEXT, CLICK, SELECT_OPTION, TYPE_TEXT, KEY_PRESS, HOVER,UPLOAD, GO_TO, DRAG_AND_DROP, CLOSE_PAGE, OPEN_EMAIL] + enum: + [ + EXTRACT, + ENTER_TEXT, + CLICK, + SELECT_OPTION, + TYPE_TEXT, + KEY_PRESS, + HOVER, + UPLOAD, + GO_TO, + DRAG_AND_DROP, + CLOSE_PAGE, + OPEN_EMAIL, + ] calledWith: type: string nullable: true @@ -443,7 +457,16 @@ components: format: uuid expectation: type: string - enum: [VISIBLE, NOT_VISIBLE, TO_BE_CHECKED, NOT_TO_BE_CHECKED, TO_HAVE_VALUE, TO_CONTAIN_TEXT, TO_HAVE_STYLE] + enum: + [ + VISIBLE, + NOT_VISIBLE, + TO_BE_CHECKED, + NOT_TO_BE_CHECKED, + TO_HAVE_VALUE, + TO_CONTAIN_TEXT, + TO_HAVE_STYLE, + ] calledWith: type: string nullable: true @@ -842,13 +865,119 @@ components: description: "Human-readable message of the error that occurred while parsing." example: "Expected object, received string" + Notification: + type: object + properties: + id: + type: string + format: uuid + description: Unique identifier for the event. + example: "826c15af-644b-4b28-89b4-f50ff34e46b7" + testTargetId: + type: string + format: uuid + description: The unique identifier of the test target this event belongs to. + example: "3435918b-3d29-4ebd-8c68-9a540532f45a" + createdAt: + type: string + format: date-time + description: The timestamp when the event was created. + example: "2024-09-06T13:01:51.686Z" + updatedAt: + type: string + format: date-time + description: The timestamp when the event was last updated. + example: "2024-09-06T13:01:51.686Z" + payload: + type: object + description: JSON payload containing event-specific data. + example: { testCaseId: "5deeef76-f37a-418b-8101-7d69529fa561" } + type: + type: string + enum: + [ + "VALIDATION_PASSED", + "VALIDATION_FAILED", + "DISCOVERY_FINISHED", + "PROPOSAL_SUCCESS", + "PROPOSAL_FAILED", + "REPORT_EXECUTION_FINISHED", + ] + description: The type of event that occurred. + example: "VALIDATION_PASSED" + ack: + type: string + enum: ["IN_WEB_APP"] + description: Optional acknowledgment status of the event. + example: "IN_WEB_APP" + nullable: true + required: + - id + - testTargetId + - createdAt + - updatedAt + - payload + - type + + ExternalDiscoveryBody: + type: object + properties: + name: + type: string + description: Name of the discovered test case + example: "Login Form Validation Test" + entryPointUrlPath: + type: string + description: Entry point URL path of the discovered test case + example: "/login" + prerequisiteName: + type: string + description: Prerequisite test case name + example: "Cookie Banner Acceptance" + externalId: + type: string + description: External ID of the discovered test case + example: "ext-test-001" + tagNames: + type: array + items: + type: string + description: Tags to assign to the discovered test case + example: ["authentication", "forms", "validation"] + prompt: + type: string + description: Prompt to generate the discovered test case + example: "Test the login form with valid and invalid credentials" + folderName: + type: string + description: Folder name of the discovered test case + example: "Authentication Tests" + type: + type: string + enum: ["LOGIN", "COOKIE_BANNER"] + description: Type of the discovered test case + example: "LOGIN" + required: + - name + - prompt + + DiscoveryResponse: + type: object + properties: + discoveryId: + type: string + format: uuid + testCaseId: + type: string + format: uuid + paths: /apiKey/v2/test-suites: get: summary: Retrieve test suites description: get a list of all defined test suites. security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] tags: - test-suites responses: @@ -861,7 +990,7 @@ paths: post: summary: Create a test suite security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] tags: - test-suites requestBody: @@ -888,7 +1017,7 @@ paths: patch: summary: Update a test suite security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] tags: - test-suites requestBody: @@ -913,7 +1042,7 @@ paths: delete: summary: Delete a test suite security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] tags: - test-suites responses: @@ -934,7 +1063,7 @@ paths: tags: - execute security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] requestBody: required: true content: @@ -963,12 +1092,12 @@ paths: delete: summary: Delete an environment security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] tags: - environments responses: - '200': - description: Environment deleted successfully + "200": + description: Environment deleted successfully parameters: - in: path name: testTargetId @@ -987,7 +1116,7 @@ paths: patch: summary: Update an environment security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] tags: - environments parameters: @@ -1048,7 +1177,7 @@ paths: type: string nullable: true responses: - '200': + "200": description: Environment updated successfully content: application/json: @@ -1060,7 +1189,7 @@ paths: summary: Create an environment description: Create a custom environment. security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] tags: - environments parameters: @@ -1123,7 +1252,7 @@ paths: summary: Retrieve environments description: get a list of all defined environments. security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] tags: - environments parameters: @@ -1164,7 +1293,7 @@ paths: format: uuid description: ID of the test report to fetch security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] responses: "200": description: Test Report information @@ -1230,7 +1359,7 @@ paths: description: The value to compare with to find matches. example: "3435918b-3d29-4ebd-8c68-9a540532f45a" security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] responses: "200": description: Test Reports information @@ -1255,7 +1384,6 @@ paths: type: boolean description: If the query in question has another page to retrieve - "400": description: Invalid request parameters content: @@ -1285,7 +1413,7 @@ paths: format: uuid description: The ID of the test target responses: - '200': + "200": description: List of notifications content: application/json: @@ -1312,7 +1440,7 @@ paths: failed: type: boolean context: - $ref: '#/components/schemas/ExecutionContext' + $ref: "#/components/schemas/ExecutionContext" testReportId: type: string format: uuid @@ -1329,19 +1457,19 @@ paths: enum: - IN_WEB_APP nullable: true - '401': + "401": description: Unauthorized - Invalid or missing API key - '404': + "404": description: Test target not found /apiKey/v1/private-location: get: security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] summary: Retrieve all private locations description: "gets a list of private location workers" tags: - - private-location + - private-location responses: "200": description: OK @@ -1353,7 +1481,7 @@ paths: /apiKey/v1/private-location/register: put: security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] summary: Register a private location description: "registers a private location worker" tags: @@ -1379,7 +1507,7 @@ paths: /apiKey/v1/private-location/unregister: put: security: - - ApiKeyAuth: [ ] + - ApiKeyAuth: [] summary: Unregister a private location description: "Unregisters a private location worker." tags: @@ -1428,7 +1556,7 @@ paths: format: uuid description: The ID of the test case responses: - '200': + "200": description: Code for the test case content: application/json: @@ -1438,31 +1566,31 @@ paths: testCode: type: string description: The code representation of the test case - '404': + "404": description: Test case not found /apiKey/v2/test-targets/{testTargetId}/test-cases: - get: - summary: Retrieve test cases + get: + summary: Retrieve test cases description: Get a list of test cases for a specific test target - security: + security: - ApiKeyAuth: [] tags: - Test Cases parameters: - - name: testTargetId + - name: testTargetId in: path required: true schema: type: string format: uuid - description: The ID of the test target + description: The ID of the test target responses: - '200': + "200": description: List of test cases content: application/json: - schema: + schema: $ref: "#/components/schemas/TestCasesResponse" /apiKey/v2/test-targets/{testTargetId}/test-cases/{testCaseId}: @@ -1489,15 +1617,15 @@ paths: format: uuid description: The ID of the test case responses: - '200': + "200": description: Test case details content: application/json: schema: $ref: "#/components/schemas/TestCaseResponse" - '401': + "401": description: Unauthorized - Invalid or missing API key - '404': + "404": description: Test target or test case not found /apiKey/v2/test-targets/{testTargetId}/config: @@ -1591,7 +1719,7 @@ paths: description: Optional ID of the folder to place the discovery in nullable: true responses: - '200': + "200": description: Discovery created successfully content: application/json: @@ -1609,9 +1737,9 @@ paths: type: string format: uuid description: The ID of the associated test case - '401': + "401": description: Unauthorized - Invalid or missing API key - '404': + "404": description: Test target not found - '400': + "400": description: Invalid request body diff --git a/src/api.ts b/src/api.ts index 693fc8b..07ee0d1 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1729,6 +1729,110 @@ export interface components { */ message?: string; }[]; + Notification: { + /** + * Format: uuid + * @description Unique identifier for the event. + * @example 826c15af-644b-4b28-89b4-f50ff34e46b7 + */ + id: string; + /** + * Format: uuid + * @description The unique identifier of the test target this event belongs to. + * @example 3435918b-3d29-4ebd-8c68-9a540532f45a + */ + testTargetId: string; + /** + * Format: date-time + * @description The timestamp when the event was created. + * @example 2024-09-06T13:01:51.686Z + */ + createdAt: string; + /** + * Format: date-time + * @description The timestamp when the event was last updated. + * @example 2024-09-06T13:01:51.686Z + */ + updatedAt: string; + /** + * @description JSON payload containing event-specific data. + * @example { + * "testCaseId": "5deeef76-f37a-418b-8101-7d69529fa561" + * } + */ + payload: Record; + /** + * @description The type of event that occurred. + * @example VALIDATION_PASSED + * @enum {string} + */ + type: + | "VALIDATION_PASSED" + | "VALIDATION_FAILED" + | "DISCOVERY_FINISHED" + | "PROPOSAL_SUCCESS" + | "PROPOSAL_FAILED" + | "REPORT_EXECUTION_FINISHED"; + /** + * @description Optional acknowledgment status of the event. + * @example IN_WEB_APP + * @enum {string|null} + */ + ack?: "IN_WEB_APP" | null; + }; + ExternalDiscoveryBody: { + /** + * @description Name of the discovered test case + * @example Login Form Validation Test + */ + name: string; + /** + * @description Entry point URL path of the discovered test case + * @example /login + */ + entryPointUrlPath?: string; + /** + * @description Prerequisite test case name + * @example Cookie Banner Acceptance + */ + prerequisiteName?: string; + /** + * @description External ID of the discovered test case + * @example ext-test-001 + */ + externalId?: string; + /** + * @description Tags to assign to the discovered test case + * @example [ + * "authentication", + * "forms", + * "validation" + * ] + */ + tagNames?: string[]; + /** + * @description Prompt to generate the discovered test case + * @example Test the login form with valid and invalid credentials + */ + prompt: string; + /** + * @description Folder name of the discovered test case + * @example Authentication Tests + */ + folderName?: string; + /** + * @description Type of the discovered test case + * @example LOGIN + * @enum {string} + */ + type?: "LOGIN" | "COOKIE_BANNER"; + }; + DiscoveryResponse: { + /** Format: uuid */ + discoveryId?: string; + /** Format: uuid */ + testCaseId?: string; + }; }; responses: never; parameters: never; diff --git a/src/cli.ts b/src/cli.ts index 6a01c56..73885c2 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,9 +1,12 @@ import { program, Command } from "commander"; import { version } from "./version"; import { + createDiscovery, createEnvironment, deleteEnvironment, executeTests, + getNotifications, + getTestCase, getTestReport, listEnvironments, listPrivateLocations, @@ -206,5 +209,47 @@ export const buildCmd = (): Command => { .requiredOption("-e, --environment-id ", "Environment ID") .option("-t, --test-target-id ", "Test target ID") .action(deleteEnvironment); + + createCommandWithCommonOptions("notifications") + .description("Get notifications for a test target") + .option("-t, --test-target-id ", "Test target ID") + .action((_, options) => + getNotifications({ + ...options, + testTargetId: resolveTestTargetId(options.testTargetId), + }), + ); + + createCommandWithCommonOptions("test-case") + .description("Get details of a specific test case") + .requiredOption("-c, --test-case-id ", "Test case ID") + .option("-t, --test-target-id ", "Test target ID") + .action((_, options) => + getTestCase({ + ...options, + testTargetId: resolveTestTargetId(options.testTargetId), + }), + ); + + createCommandWithCommonOptions("create-discovery") + .description("Create a new test case discovery") + .requiredOption("-n, --name ", "Discovery name") + .requiredOption("-p, --prompt ", "Discovery prompt") + .option("-t, --test-target-id ", "Test target ID") + .option("-e, --entry-point-url-path ", "Entry point URL path") + .option("--prerequisite-id ", "Prerequisite test case ID") + .option("--external-id ", "External identifier") + .option( + "--assigned-tag-ids ", + "Comma-separated list of tag IDs", + splitter, + ) + .option("--folder-id ", "Folder ID") + .action((_, options) => + createDiscovery({ + ...options, + testTargetId: resolveTestTargetId(options.testTargetId), + }), + ); return program; }; diff --git a/src/tools.ts b/src/tools.ts index 98e67f2..01b15f1 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -24,7 +24,18 @@ export type UpdateEnvironmentOptions = paths["/apiKey/v2/test-targets/{testTargetId}/environments/{environmentId}"]["patch"]["requestBody"]["content"]["application/json"]; export type EnvironmentResponse = components["schemas"]["EnvironmentResponse"]; -export type ErrorResponse = components["schemas"]["ZodResponse"] | undefined; +export type ErrorResponse = + | components["schemas"]["ZodResponse"] + | string + | undefined; +export type getNotificationsParams = + paths["/apiKey/v2/test-targets/{testTargetId}/notifications"]["get"]["parameters"]["path"]; +export type Notification = components["schemas"]["Notification"]; +export type getTestCaseParams = + paths["/apiKey/v2/test-targets/{testTargetId}/test-cases/{testCaseId}"]["get"]["parameters"]["path"]; +export type createDiscoveryBody = + components["schemas"]["ExternalDiscoveryBody"]; +export type DiscoveryResponse = components["schemas"]["DiscoveryResponse"]; const BASE_URL = "https://app.octomind.dev/api"; @@ -41,6 +52,22 @@ const authMiddleware: Middleware = { request.headers.set("x-api-key", apiKey); return request; }, + async onResponse({ response }) { + const { body, ...resOptions } = response; + if (!response.ok) { + const res = new Response(body, resOptions); + const errorBody = await res.json(); + return new Response( + `${response.status}, ${response.statusText}: ${errorBody ? JSON.stringify(errorBody, null, 2) : ""}`, + { ...resOptions, status: response.status }, + ); + } + return response; + }, + onError({ error }) { + console.error(error); + process.exit(1); + }, }; client.use(authMiddleware); @@ -388,6 +415,149 @@ export const deleteEnvironment = async (options: { console.log("Environment deleted successfully!"); }; +export const getNotifications = async ( + options: getNotificationsParams & { json?: boolean }, +): Promise => { + const { data, error } = await client.GET( + "/apiKey/v2/test-targets/{testTargetId}/notifications", + { + params: { + path: { + testTargetId: options.testTargetId, + }, + }, + }, + ); + + handleError(error); + const response = data as Notification[]; + if (options.json) { + outputResult(response); + return; + } + + console.log("Notifications:"); + response.forEach((notification) => { + console.log(`\nID: ${notification.id}`); + console.log(`Type: ${notification.type}`); + console.log(`Created At: ${notification.createdAt}`); + if (notification.payload?.testReportId) { + console.log(`Test Report ID: ${notification.payload.testReportId}`); + } + if (notification.payload?.testCaseId) { + console.log(`Test Case ID: ${notification.payload.testCaseId}`); + } + if (notification.payload?.failed !== undefined) { + console.log(`Failed: ${notification.payload.failed}`); + } + if (notification.ack) { + console.log(`Acknowledged: ${notification.ack}`); + } + }); +}; + +export const getTestCase = async ( + options: getTestCaseParams & { json?: boolean }, +): Promise => { + const { data, error } = await client.GET( + "/apiKey/v2/test-targets/{testTargetId}/test-cases/{testCaseId}", + { + params: { + path: { + testTargetId: options.testTargetId, + testCaseId: options.testCaseId, + }, + }, + }, + ); + + handleError(error); + + const response = data as TestCaseResponse; + + if (options.json) { + outputResult(response); + return; + } + + console.log("Test Case Details:"); + console.log(`ID: ${response.id}`); + console.log(`Description: ${response.description}`); + console.log(`Status: ${response.status}`); + console.log(`Run Status: ${response.runStatus}`); + console.log(`Created At: ${response.createdAt}`); + console.log(`Updated At: ${response.updatedAt}`); + + if (response.elements && response.elements.length > 0) { + console.log("\nElements:"); + response.elements.forEach((element, index) => { + console.log(`\nElement ${index + 1}:`); + if (element.interaction) { + console.log(` Action: ${element.interaction.action}`); + if (element.interaction.calledWith) { + console.log(` Called With: ${element.interaction.calledWith}`); + } + } + if (element.assertion) { + console.log(` Expectation: ${element.assertion.expectation}`); + if (element.assertion.calledWith) { + console.log(` Called With: ${element.assertion.calledWith}`); + } + } + console.log(" Selectors:"); + element.selectors?.forEach((selector) => { + console.log(` - ${selector.selectorType}: ${selector.selector}`); + if (selector.options?.name) { + console.log(` Name: ${selector.options.name}`); + } + }); + }); + } +}; + +export const createDiscovery = async ( + options: createDiscoveryBody & { json?: boolean; testTargetId: string }, +): Promise => { + const requestBody = { + name: options.name, + prompt: options.prompt, + ...(options.entryPointUrlPath && { + entryPointUrlPath: options.entryPointUrlPath, + }), + ...(options.prerequisiteName && { + prerequisiteName: options.prerequisiteName, + }), + ...(options.externalId && { externalId: options.externalId }), + ...(options.tagNames && { tagNames: options.tagNames }), + ...(options.folderName && { folderName: options.folderName }), + ...(options.type && { type: options.type }), + }; + + const { data, error } = await client.POST( + "/apiKey/v2/test-targets/{testTargetId}/discoveries", + { + params: { + path: { + testTargetId: options.testTargetId, + }, + }, + body: requestBody, + }, + ); + + handleError(error); + + const response = data as DiscoveryResponse; + if (options.json) { + outputResult(response); + return; + } + + console.log("Discovery created successfully!"); + console.log(`Discovery ID: ${response.discoveryId}`); + console.log(`Test Case ID: ${response.testCaseId}`); +}; + export const getPlaywrightConfig = async (options: { testTargetId: string; environmentId?: string; From 0c9e944a092024ebc29aea0b07064821d0cf9f43 Mon Sep 17 00:00:00 2001 From: Fabio <161820267+fabiomaienschein@users.noreply.github.com> Date: Thu, 24 Jul 2025 11:54:14 +0200 Subject: [PATCH 2/4] fix async behaviour --- src/api.ts | 3457 ++++++++++++++++++++++++------------------------ src/cli.ts | 70 +- src/helpers.ts | 4 +- src/tools.ts | 1 - 4 files changed, 1748 insertions(+), 1784 deletions(-) diff --git a/src/api.ts b/src/api.ts index 6e0c616..875dd56 100644 --- a/src/api.ts +++ b/src/api.ts @@ -4,1195 +4,1207 @@ */ export interface paths { - "/apiKey/v2/test-suites": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Retrieve test suites - * @description get a list of all defined test suites. - */ - get: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description test suites */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["TestSuitesResponse"]; - }; - }; - }; - }; - put?: never; - /** Create a test suite */ - post: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": components["schemas"]["TestSuiteCreateRequest"]; - }; - }; - responses: { - /** @description test suites */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["TestSuiteResponse"]; - }; + "/apiKey/v2/test-suites": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - /** @description Invalid request parameters */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ZodResponse"]; - }; - }; - }; - }; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-suites/{testSuiteId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - post?: never; - /** Delete a test suite */ - delete: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description test suites */ - 204: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["SuccessResponse"]; - }; + /** + * Retrieve test suites + * @description get a list of all defined test suites. + */ + get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description test suites */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["TestSuitesResponse"]; + }; + }; + }; }; - /** @description test suite not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; + put?: never; + /** Create a test suite */ + post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["TestSuiteCreateRequest"]; + }; + }; + responses: { + /** @description test suites */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["TestSuiteResponse"]; + }; + }; + /** @description Invalid request parameters */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ZodResponse"]; + }; + }; + }; }; - }; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - options?: never; - head?: never; - /** Update a test suite */ - patch: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": components["schemas"]["TestSuitePatchRequest"]; - }; - }; - responses: { - /** @description test suites */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["TestSuiteResponse"]; - }; + "/apiKey/v2/test-suites/{testSuiteId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** Delete a test suite */ + delete: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description test suites */ + 204: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["SuccessResponse"]; + }; + }; + /** @description test suite not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - /** @description Invalid request parameters */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ZodResponse"]; - }; + options?: never; + head?: never; + /** Update a test suite */ + patch: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["TestSuitePatchRequest"]; + }; + }; + responses: { + /** @description test suites */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["TestSuiteResponse"]; + }; + }; + /** @description Invalid request parameters */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ZodResponse"]; + }; + }; + }; }; - }; - }; - trace?: never; - }; - "/apiKey/v2/execute": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + trace?: never; }; - get?: never; - put?: never; - /** - * Execute tests of the given test target - * @description This endpoint triggers a test execution by sending an test target id, an URL and optionally tags, an environment and variables. - * - */ - post: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": components["schemas"]["TestTargetExecutionRequest"]; - }; - }; - responses: { - /** @description Test executed successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["TestReportResponse"]; - }; - }; - /** @description Invalid request parameters */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ZodResponse"]; - }; - }; - /** @description Invalid or missing API key */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; + "/apiKey/v2/execute": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Execute tests of the given test target + * @description This endpoint triggers a test execution by sending an test target id, an URL and optionally tags, an environment and variables. + * + */ + post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["TestTargetExecutionRequest"]; + }; + }; + responses: { + /** @description Test executed successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["TestReportResponse"]; + }; + }; + /** @description Invalid request parameters */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ZodResponse"]; + }; + }; + /** @description Invalid or missing API key */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - }; - }; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/environments/{environmentId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - get?: never; - put?: never; - post?: never; - /** Delete an environment */ - delete: { - parameters: { - query?: never; - header?: never; - path: { - /** @description ID of the test target to which the test report belongs to */ - testTargetId: string; - /** @description ID of the environment to update */ - environmentId: string; + "/apiKey/v2/test-targets/{testTargetId}/environments/{environmentId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** Delete an environment */ + delete: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the test target to which the test report belongs to */ + testTargetId: string; + /** @description ID of the environment to update */ + environmentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Environment deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Environment deleted successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content?: never; + options?: never; + head?: never; + /** Update an environment */ + patch: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the test target to which the environment belongs to */ + testTargetId: string; + /** @description ID of the environment to update */ + environmentId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + name?: string | null; + /** Format: url */ + discoveryUrl?: string | null; + testAccount?: { + username?: string; + password?: string; + otpInitializerKey?: string | null; + } | null; + basicAuth?: { + username?: string; + password?: string; + } | null; + /** @description name of the private location */ + privateLocationName?: string | null; + additionalHeaderFields?: { + [key: string]: string; + } | null; + }; + }; + }; + responses: { + /** @description Environment updated successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EnvironmentResponse"]; + }; + }; + }; }; - }; + trace?: never; }; - options?: never; - head?: never; - /** Update an environment */ - patch: { - parameters: { - query?: never; - header?: never; - path: { - /** @description ID of the test target to which the environment belongs to */ - testTargetId: string; - /** @description ID of the environment to update */ - environmentId: string; + "/apiKey/v2/test-targets/{testTargetId}/environments": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - name?: string | null; - /** Format: url */ - discoveryUrl?: string | null; - testAccount?: { - username?: string; - password?: string; - otpInitializerKey?: string | null; - } | null; - basicAuth?: { - username?: string; - password?: string; - } | null; - /** @description name of the private location */ - privateLocationName?: string | null; - additionalHeaderFields?: { - [key: string]: string; - } | null; - }; - }; - }; - responses: { - /** @description Environment updated successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["EnvironmentResponse"]; - }; - }; - }; - }; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/environments": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Retrieve environments - * @description get a list of all defined environments. - */ - get: { - parameters: { - query?: never; - header?: never; - path: { - /** @description ID of the test target to which the test report belongs to */ - testTargetId: string; + /** + * Retrieve environments + * @description get a list of all defined environments. + */ + get: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the test target to which the test report belongs to */ + testTargetId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description environments */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EnvironmentsResponse"]; + }; + }; + }; }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description environments */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["EnvironmentsResponse"]; - }; + put?: never; + /** + * Create an environment + * @description Create a custom environment. + */ + post: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the test target to which the environment belongs to */ + testTargetId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + name?: string; + /** Format: url */ + discoveryUrl?: string; + testAccount?: { + username?: string; + password?: string; + otpInitializerKey?: string | null; + } | null; + basicAuth?: { + username?: string; + password?: string; + } | null; + /** @description name of the private location */ + privateLocationName?: string; + additionalHeaderFields?: { + [key: string]: string; + } | null; + }; + }; + }; + responses: { + /** @description environment created */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EnvironmentResponse"]; + }; + }; + }; }; - }; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - put?: never; - /** - * Create an environment - * @description Create a custom environment. - */ - post: { - parameters: { - query?: never; - header?: never; - path: { - /** @description ID of the test target to which the environment belongs to */ - testTargetId: string; + "/apiKey/v2/test-targets/{testTargetId}/test-reports/{testReportId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - name?: string; - /** Format: url */ - discoveryUrl?: string; - testAccount?: { - username?: string; - password?: string; - otpInitializerKey?: string | null; - } | null; - basicAuth?: { - username?: string; - password?: string; - } | null; - /** @description name of the private location */ - privateLocationName?: string; - additionalHeaderFields?: { - [key: string]: string; - } | null; - }; - }; - }; - responses: { - /** @description environment created */ - 201: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["EnvironmentResponse"]; - }; + /** + * Retrieve information about a test report + * @description Poll from within a CI-pipeline to wait for the completion of a report. + */ + get: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the test target to which the test report belongs to */ + testTargetId: string; + /** @description ID of the test report to fetch */ + testReportId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Test Report information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["TestReport"]; + }; + }; + /** @description Invalid request parameters */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ZodResponse"]; + }; + }; + /** @description Invalid or missing API key */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - }; - }; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/test-reports/{testReportId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - /** - * Retrieve information about a test report - * @description Poll from within a CI-pipeline to wait for the completion of a report. - */ - get: { - parameters: { - query?: never; - header?: never; - path: { - /** @description ID of the test target to which the test report belongs to */ - testTargetId: string; - /** @description ID of the test report to fetch */ - testReportId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Test Report information */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["TestReport"]; - }; + "/apiKey/v2/test-targets/{testTargetId}/test-reports": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - /** @description Invalid request parameters */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ZodResponse"]; - }; - }; - /** @description Invalid or missing API key */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; + /** + * Retrieve paginated information about test reports + * @description Allow fetching the history of test reports for your test target. + */ + get: { + parameters: { + query?: { + key?: { + /** + * Format: date-time + * @description The timestamp of the key of the next page to fetch - See [Keyset Pagination](https://use-the-index-luke.com/no-offset) + * @example 2024-09-06T13:01:51.686Z + */ + createdAt?: string; + }; + filter?: { + /** + * @description The name of the property to filter for, e.g. an environmentId + * @example environmentId + */ + key?: string; + /** + * @description How to compare the property in question, only EQUALS is supported so far. + * @enum {string} + */ + operator?: "EQUALS"; + /** + * Format: uuid + * @description The value to compare with to find matches. + * @example 3435918b-3d29-4ebd-8c68-9a540532f45a + */ + value?: string; + }[]; + }; + header?: never; + path: { + /** @description ID of the test target for which to fetch the history for */ + testTargetId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Test Reports information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + data?: components["schemas"]["TestReport"][]; + key?: { + /** + * Format: date-time + * @description The timestamp of the key of the next page to fetch - use this in the query when fetching the next page of reports - See [Keyset Pagination](https://use-the-index-luke.com/no-offset) + * @example 2024-09-06T13:01:51.686Z + */ + createdAt?: string; + }; + /** @description If the query in question has another page to retrieve */ + hasNextPage?: boolean; + }; + }; + }; + /** @description Invalid request parameters */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ZodResponse"]; + }; + }; + /** @description Invalid or missing API key */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/test-reports": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - /** - * Retrieve paginated information about test reports - * @description Allow fetching the history of test reports for your test target. - */ - get: { - parameters: { - query?: { - key?: { - /** - * Format: date-time - * @description The timestamp of the key of the next page to fetch - See [Keyset Pagination](https://use-the-index-luke.com/no-offset) - * @example 2024-09-06T13:01:51.686Z - */ - createdAt?: string; - }; - filter?: { - /** - * @description The name of the property to filter for, e.g. an environmentId - * @example environmentId - */ - key?: string; - /** - * @description How to compare the property in question, only EQUALS is supported so far. - * @enum {string} - */ - operator?: "EQUALS"; - /** - * Format: uuid - * @description The value to compare with to find matches. - * @example 3435918b-3d29-4ebd-8c68-9a540532f45a - */ - value?: string; - }[]; + "/apiKey/v2/test-targets/{testTargetId}/notifications": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - header?: never; - path: { - /** @description ID of the test target for which to fetch the history for */ - testTargetId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Test Reports information */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - data?: components["schemas"]["TestReport"][]; - key?: { - /** - * Format: date-time - * @description The timestamp of the key of the next page to fetch - use this in the query when fetching the next page of reports - See [Keyset Pagination](https://use-the-index-luke.com/no-offset) - * @example 2024-09-06T13:01:51.686Z - */ - createdAt?: string; - }; - /** @description If the query in question has another page to retrieve */ - hasNextPage?: boolean; + /** + * Retrieve notifications + * @description Get a list of notifications for a specific test target. + */ + get: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the test target */ + testTargetId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of notifications */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** Format: uuid */ + id?: string; + /** Format: uuid */ + testTargetId?: string; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt?: string; + payload?: { + failed?: boolean; + context?: components["schemas"]["ExecutionContext"]; + /** Format: uuid */ + testReportId?: string; + /** Format: uuid */ + testCaseId?: string; + }; + /** @enum {string} */ + type?: "REPORT_EXECUTION_FINISHED" | "VALIDATION_PASSED"; + /** @enum {string|null} */ + ack?: "IN_WEB_APP" | null; + }[]; + }; + }; + /** @description Unauthorized - Invalid or missing API key */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Test target not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; - }; - }; - /** @description Invalid request parameters */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ZodResponse"]; - }; - }; - /** @description Invalid or missing API key */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/notifications": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - /** - * Retrieve notifications - * @description Get a list of notifications for a specific test target. - */ - get: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the test target */ - testTargetId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description List of notifications */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** Format: uuid */ - id?: string; - /** Format: uuid */ - testTargetId?: string; - /** Format: date-time */ - createdAt?: string; - /** Format: date-time */ - updatedAt?: string; - payload?: { - failed?: boolean; - context?: components["schemas"]["ExecutionContext"]; - /** Format: uuid */ - testReportId?: string; - /** Format: uuid */ - testCaseId?: string; - }; - /** @enum {string} */ - type?: "REPORT_EXECUTION_FINISHED" | "VALIDATION_PASSED"; - /** @enum {string|null} */ - ack?: "IN_WEB_APP" | null; - }[]; - }; - }; - /** @description Unauthorized - Invalid or missing API key */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Test target not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; + "/apiKey/v1/private-location": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v1/private-location": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Retrieve all private locations - * @description gets a list of private location workers - */ - get: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["PrivateLocationInfo"]; - }; + /** + * Retrieve all private locations + * @description gets a list of private location workers + */ + get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["PrivateLocationInfo"]; + }; + }; + }; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v1/private-location/register": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - get?: never; - /** - * Register a private location - * @description registers a private location worker - */ - put: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": components["schemas"]["RegisterRequest"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["SuccessResponse"]; - }; - }; - /** @description private location of that name not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; + "/apiKey/v1/private-location/register": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * Register a private location + * @description registers a private location worker + */ + put: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["RegisterRequest"]; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["SuccessResponse"]; + }; + }; + /** @description private location of that name not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - }; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v1/private-location/unregister": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - /** - * Unregister a private location - * @description Unregisters a private location worker. - */ - put: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": components["schemas"]["UnregisterRequest"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["SuccessResponse"]; - }; - }; - /** @description private location of that name not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Internal server error */ - 500: { - headers: { - [name: string]: unknown; - }; - content?: never; + "/apiKey/v1/private-location/unregister": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * Unregister a private location + * @description Unregisters a private location worker. + */ + put: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["UnregisterRequest"]; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["SuccessResponse"]; + }; + }; + /** @description private location of that name not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - }; - }; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/test-cases/{testCaseId}/code": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - /** - * Retrieve code for a test case - * @description Get the code representation of a specific test case - */ - get: { - parameters: { - query: { - /** @description Optional ID of the environment to use for the test case code */ - environmentId?: string; - /** @description URL of the app to test */ - executionUrl: string; + "/apiKey/v2/test-targets/{testTargetId}/test-cases/{testCaseId}/code": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - header?: never; - path: { - /** @description The ID of the test target */ - testTargetId: string; - /** @description The ID of the test case */ - testCaseId: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Code for the test case */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @description The code representation of the test case */ - testCode: string; + /** + * Retrieve code for a test case + * @description Get the code representation of a specific test case + */ + get: { + parameters: { + query: { + /** @description Optional ID of the environment to use for the test case code */ + environmentId?: string; + /** @description URL of the app to test */ + executionUrl: string; + }; + header?: never; + path: { + /** @description The ID of the test target */ + testTargetId: string; + /** @description The ID of the test case */ + testCaseId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Code for the test case */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @description The code representation of the test case */ + testCode: string; + }; + }; + }; + /** @description Test case not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; - }; - }; - /** @description Test case not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/test-cases": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - /** - * Retrieve test cases - * @description Get a list of test cases for a specific test target - */ - get: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the test target */ - testTargetId: string; + "/apiKey/v2/test-targets/{testTargetId}/test-cases": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description List of test cases */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["TestCasesResponse"]; - }; + /** + * Retrieve test cases + * @description Get a list of test cases for a specific test target + */ + get: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the test target */ + testTargetId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of test cases */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["TestCasesResponse"]; + }; + }; + }; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/test-cases/{testCaseId}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - /** - * Retrieve a test case - * @description Get detailed information about a specific test case - */ - get: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the test target */ - testTargetId: string; - /** @description The ID of the test case */ - testCaseId: string; + "/apiKey/v2/test-targets/{testTargetId}/test-cases/{testCaseId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Test case details */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["TestCaseResponse"]; - }; - }; - /** @description Unauthorized - Invalid or missing API key */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Test target or test case not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; + /** + * Retrieve a test case + * @description Get detailed information about a specific test case + */ + get: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the test target */ + testTargetId: string; + /** @description The ID of the test case */ + testCaseId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Test case details */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["TestCaseResponse"]; + }; + }; + /** @description Unauthorized - Invalid or missing API key */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Test target or test case not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - }; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/config": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Retrieve test target configuration - * @description Get the configuration of a specific test target - */ - get: { - parameters: { - query: { - /** @description Optional ID of the environment to use for the test target configuration */ - environmentId?: string; - /** @description URL of the app to test */ - url: string; - /** @description Directory to write the playwright output to */ - outputDir: string; - /** @description Whether to run the test in headless mode */ - headless?: boolean; - }; - header?: never; - path: { - /** @description The ID of the test target */ - testTargetId: string; + "/apiKey/v2/test-targets/{testTargetId}/config": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Test target configuration */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "text/plain": string; - }; + /** + * Retrieve test target configuration + * @description Get the configuration of a specific test target + */ + get: { + parameters: { + query: { + /** @description Optional ID of the environment to use for the test target configuration */ + environmentId?: string; + /** @description URL of the app to test */ + url: string; + /** @description Directory to write the playwright output to */ + outputDir: string; + /** @description Whether to run the test in headless mode */ + headless?: boolean; + }; + header?: never; + path: { + /** @description The ID of the test target */ + testTargetId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Test target configuration */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": string; + }; + }; + }; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/apiKey/v2/test-targets/{testTargetId}/discoveries": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - get?: never; - put?: never; - /** - * Create a discovery - * @description Create a new test case discovery with a given name and prompt - */ - post: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The ID of the test target */ - testTargetId: string; - }; - cookie?: never; - }; - requestBody: { - content: { - "application/json": { - /** - * @description Name of the discovery - * @example foo - */ - name: string; - /** - * @description The prompt describing what to discover - * @example make sure current time is visible - */ - prompt: string; - /** @description Optional URL path for the entry point */ - entryPointUrlPath?: string | null; - /** - * Format: uuid - * @description Optional ID of a prerequisite test case - */ - prerequisiteId?: string | null; - /** @description Optional external identifier */ - externalId?: string | null; - /** @description Optional list of tag IDs to assign */ - assignedTagIds?: string[] | null; - /** - * Format: uuid - * @description Optional ID of the folder to place the discovery in - */ - folderId?: string | null; - }; - }; - }; - responses: { - /** @description Discovery created successfully */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** - * Format: uuid - * @description The ID of the created discovery - */ - discoveryId: string; - /** - * Format: uuid - * @description The ID of the associated test case - */ - testCaseId: string; + "/apiKey/v2/test-targets/{testTargetId}/discoveries": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create a discovery + * @description Create a new test case discovery with a given name and prompt + */ + post: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The ID of the test target */ + testTargetId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * @description Name of the discovery + * @example foo + */ + name: string; + /** + * @description The prompt describing what to discover + * @example make sure current time is visible + */ + prompt: string; + /** @description Optional URL path for the entry point */ + entryPointUrlPath?: string | null; + /** + * Format: uuid + * @description Optional ID of a prerequisite test case + */ + prerequisiteId?: string | null; + /** @description Optional external identifier */ + externalId?: string | null; + /** @description Optional list of tag IDs to assign */ + assignedTagIds?: string[] | null; + /** + * Format: uuid + * @description Optional ID of the folder to place the discovery in + */ + folderId?: string | null; + }; + }; + }; + responses: { + /** @description Discovery created successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** + * Format: uuid + * @description The ID of the created discovery + */ + discoveryId: string; + /** + * Format: uuid + * @description The ID of the associated test case + */ + testCaseId: string; + }; + }; + }; + /** @description Invalid request body */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized - Invalid or missing API key */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Test target not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; - }; - }; - /** @description Invalid request body */ - 400: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Unauthorized - Invalid or missing API key */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Test target not found */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; }; - }; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; } export type webhooks = Record; export interface components { - schemas: { - ExecutionContext: - | { - /** - * @example github - * @enum {string} - */ - source?: "github"; - /** @example 123 */ - issueNumber?: number | null; - /** @example refs/heads/main */ - ref?: string | null; - /** @example abc123def456 */ - sha?: string | null; - /** @example my-repo */ - repo?: string; - /** @example repo-owner */ - owner?: string; - triggeredBy?: { + schemas: { + ExecutionContext: { /** - * @example USER + * @example github * @enum {string} */ - type?: "USER"; - /** @example user123 */ - userId?: string; - } | null; - /** @example node-123 */ - nodeId?: string | null; - } - | { - /** - * @example azureDevOps - * @enum {string} - */ - source?: "azureDevOps"; - /** @example token123 */ - accessToken?: string; - /** @example my-org */ - organization?: string; - /** @example my-project */ - project?: string; - /** @example repo-123 */ - repositoryId?: string; - /** @example abc123def456 */ - sha?: string | null; - /** @example refs/heads/main */ - ref?: string | null; - /** @example 101 */ - pullRequestId?: number | null; - triggeredBy?: { + source?: "github"; + /** @example 123 */ + issueNumber?: number | null; + /** @example refs/heads/main */ + ref?: string | null; + /** @example abc123def456 */ + sha?: string | null; + /** @example my-repo */ + repo?: string; + /** @example repo-owner */ + owner?: string; + triggeredBy?: { + /** + * @example USER + * @enum {string} + */ + type?: "USER"; + /** @example user123 */ + userId?: string; + } | null; + /** @example node-123 */ + nodeId?: string | null; + } | { /** - * @example USER + * @example azureDevOps * @enum {string} */ - type?: "USER"; - /** @example user123 */ - userId?: string; - } | null; - /** @example thread-123 */ - threadId?: string | null; - } - | { - /** - * @example discovery - * @enum {string} - */ - source?: "discovery"; - /** @example A discovery test */ - description?: string; - triggeredBy?: - | { + source?: "azureDevOps"; + /** @example token123 */ + accessToken?: string; + /** @example my-org */ + organization?: string; + /** @example my-project */ + project?: string; + /** @example repo-123 */ + repositoryId?: string; + /** @example abc123def456 */ + sha?: string | null; + /** @example refs/heads/main */ + ref?: string | null; + /** @example 101 */ + pullRequestId?: number | null; + triggeredBy?: { + /** + * @example USER + * @enum {string} + */ + type?: "USER"; + /** @example user123 */ + userId?: string; + } | null; + /** @example thread-123 */ + threadId?: string | null; + } | { + /** + * @example discovery + * @enum {string} + */ + source?: "discovery"; + /** @example A discovery test */ + description?: string; + triggeredBy?: { /** * @example INITIAL * @enum {string} */ type?: "INITIAL"; - } - | { + } | { + /** + * @example USER + * @enum {string} + */ + type?: "USER"; + /** @example user123 */ + userId?: string; + }; + } | { + /** + * @example manual + * @enum {string} + */ + source?: "manual"; + /** @example A manual trigger */ + description?: string; + triggeredBy?: { /** * @example USER * @enum {string} @@ -1200,59 +1212,37 @@ export interface components { type?: "USER"; /** @example user123 */ userId?: string; - }; - } - | { - /** - * @example manual - * @enum {string} - */ - source?: "manual"; - /** @example A manual trigger */ - description?: string; - triggeredBy?: { + }; + } | { /** - * @example USER + * @example scheduled * @enum {string} */ - type?: "USER"; - /** @example user123 */ - userId?: string; - }; - } - | { - /** - * @example scheduled - * @enum {string} - */ - source?: "scheduled"; - triggeredBy?: { + source?: "scheduled"; + triggeredBy?: { + /** + * @example USER + * @enum {string} + */ + type?: "USER"; + /** @example user123 */ + userId?: string; + } | null; + } | { /** - * @example USER + * @example proposal * @enum {string} */ - type?: "USER"; - /** @example user123 */ - userId?: string; - } | null; - } - | { - /** - * @example proposal - * @enum {string} - */ - source?: "proposal"; - /** @example A proposal trigger */ - description?: string; - triggeredBy?: - | { + source?: "proposal"; + /** @example A proposal trigger */ + description?: string; + triggeredBy?: { /** * @example INITIAL * @enum {string} */ type?: "INITIAL"; - } - | { + } | { /** * @example USER * @enum {string} @@ -1260,596 +1250,571 @@ export interface components { type?: "USER"; /** @example user123 */ userId?: string; - }; + }; }; - /** - * @description The variables to overwrite exclusively for this test run. - * @example { - * "SPACE_ID": [ - * "64ee32b4-7365-47a6-b5b0-2903b6ad849d" - * ] - * } - */ - Variables: { - [key: string]: string[]; - }; - TestTargetExecutionRequest: { - /** - * Format: uuid - * @description Unique identifier for the testTarget. - * @example 2e2bb27b-a19c-47ce-a9b6-cd1bd31622dc - */ - testTargetId: string; - /** - * Format: uri - * @description The URL of the test target for this run. - * @example https://example.com - */ - url: string; - context: components["schemas"]["ExecutionContext"]; - /** - * Format: environment name - * @description the environment name you want to run your test against - * @default default - */ - environmentName: string; - variablesToOverwrite?: components["schemas"]["Variables"]; - /** - * @default [] - * @example [ - * "tag1", - * "tag2" - * ] - */ - tags: string[]; - }; - TestTargetExecutionResponse: { - /** - * @description The URL the test target was executed. - * @example https://example.com - */ - testReportUrl?: string; - /** - * @description The test report from the run. - * @example some json - */ - testReport?: Record; - }; - TestReportContext: { - /** - * @description The source of the test trigger. - * @example manual - * @enum {string} - */ - source?: "manual"; - /** - * @description The description of the test context. - * @example manual trigger - */ - description?: string; - triggeredBy?: { - /** - * @description The type of entity triggering the test. - * @example USER - * @enum {string} - */ - type?: "USER"; /** - * Format: uuid - * @description The unique identifier of the user who triggered the test. - * @example 2e2bb27b-a19c-47ce-a9b6-cd1bd31622dc + * @description The variables to overwrite exclusively for this test run. + * @example { + * "SPACE_ID": [ + * "64ee32b4-7365-47a6-b5b0-2903b6ad849d" + * ] + * } */ - userId?: string; - }; - }; - TestResult: { - /** - * Format: uuid - * @description Unique identifier for the test result. - * @example 826c15af-644b-4b28-89b4-f50ff34e46b7 - */ - id?: string; - /** - * Format: uuid - * @description Unique identifier of the test report this result belongs to. - * @example 3435918b-3d29-4ebd-8c68-9a540532f45a - */ - testTargetId?: string; - /** - * Format: uuid - * @description Unique identifier of the test case this result belongs to. - * @example 5b844cf1-d597-4048-9e74-7c0f9ce3e2ee - */ - testCaseId?: string; - /** - * Format: date-time - * @description The timestamp when the test result was created. - * @example 2024-09-06T13:01:51.686Z - */ - createdAt?: string; - /** - * Format: date-time - * @description The timestamp when the test result was last updated. - * @example 2024-09-06T13:01:51.686Z - */ - updatedAt?: string; - /** - * @description The status of the specific test result, will be WAITING as long as the result is running, FAILED if the execution failed, PASSED if it succeeded, and ERROR if an internal error occurred. - * @enum {string} - */ - status?: "WAITING" | "PASSED" | "FAILED" | "ERROR"; - /** - * @description The error that has occurred during execution - only set if the status is FAILED or ERROR. - * @example TimeoutError: locator.click: Timeout 30000ms exceeded. - */ - errorMessage?: string | null; - /** - * @description Link to the playwright trace of the test execution - only set once the test result is finished (PASSED or FAILED). - * @example https://storage.googleapis.com/automagically-traces/826c15af-644b-4b28-89b4-f50ff34e46b7-trace.zip - */ - traceUrl?: string | null; - }; - TestReport: { - /** - * Format: uuid - * @description Unique identifier for the test report. - * @example 826c15af-644b-4b28-89b4-f50ff34e46b7 - */ - id?: string; - /** - * Format: uuid - * @description The unique identifier of the test target. - * @example 3435918b-3d29-4ebd-8c68-9a540532f45a - */ - testTargetId?: string; - /** - * Format: date-time - * @description The timestamp when the test report was created. - * @example 2024-09-06T13:01:51.686Z - */ - createdAt?: string; - /** - * Format: date-time - * @description The timestamp when the test report was last updated. - * @example 2024-09-06T13:01:51.686Z - */ - updatedAt?: string; - /** - * Format: uri - * @description The URL where the test execution was performed. - * @example https://en.wikipedia.org/ - */ - executionUrl?: string; - /** - * @description The status of the test report, will be WAITING as long as any result is running, FAILED if the report is done but has any failed result and PASSED if all test results are done and successful - * @enum {string} - */ - status?: "WAITING" | "PASSED" | "FAILED"; - context?: components["schemas"]["TestReportContext"]; - testResults?: components["schemas"]["TestResult"][]; - }; - PrivateLocationInfo: { - /** @enum {string} */ - status: "OFFLINE" | "ONLINE"; - /** - * Format: uri - * @example https://example.com:3128 - */ - address: string; - /** @example my-private-location */ - name: string; - }[]; - TestReportResponse: { - /** - * Format: uri - * @description The URL where the test report can be accessed. - * @example https://app.octomind.dev/testreports/826c15af-644b-4b28-89b4-f50ff34e46b7 - */ - testReportUrl?: string; - testReport?: components["schemas"]["TestReport"]; - }; - TestCasesResponse: components["schemas"]["TestCaseResponse"][]; - TestCaseResponse: { - /** Format: uuid */ - id?: string; - /** Format: uuid */ - testTargetId?: string; - type?: string | null; - elements?: { - /** Format: uuid */ - id?: string; - index?: number; - interaction?: { - /** Format: uuid */ - id?: string; - /** @enum {string} */ - action?: - | "EXTRACT" - | "ENTER_TEXT" - | "CLICK" - | "SELECT_OPTION" - | "TYPE_TEXT" - | "KEY_PRESS" - | "HOVER" - | "UPLOAD" - | "GO_TO" - | "DRAG_AND_DROP" - | "CLOSE_PAGE" - | "OPEN_EMAIL"; - calledWith?: string | null; - /** Format: uuid */ - testCaseElementId?: string; - } | null; - assertion?: { - /** Format: uuid */ - id?: string; - /** @enum {string} */ - expectation?: - | "VISIBLE" - | "NOT_VISIBLE" - | "TO_BE_CHECKED" - | "NOT_TO_BE_CHECKED" - | "TO_HAVE_VALUE" - | "TO_CONTAIN_TEXT" - | "TO_HAVE_STYLE"; - calledWith?: string | null; - /** Format: uuid */ - testCaseElementId?: string; - } | null; - scrollState?: Record | null; - selectors?: { - /** Format: uuid */ - id?: string; - index?: number; - selector?: string; - /** @enum {string} */ - selectorType?: "TEXT" | "LABEL" | "PLACEHOLDER" | "ROLE"; - options?: { - name?: string; - } | null; - /** Format: uuid */ - testCaseElementId?: string; - scrollStateId?: string | null; + Variables: { + [key: string]: string[]; + }; + TestTargetExecutionRequest: { + /** + * Format: uuid + * @description Unique identifier for the testTarget. + * @example 2e2bb27b-a19c-47ce-a9b6-cd1bd31622dc + */ + testTargetId: string; + /** + * Format: uri + * @description The URL of the test target for this run. + * @example https://example.com + */ + url: string; + context: components["schemas"]["ExecutionContext"]; + /** + * Format: environment name + * @description the environment name you want to run your test against + * @default default + */ + environmentName: string; + variablesToOverwrite?: components["schemas"]["Variables"]; + /** + * @default [] + * @example [ + * "tag1", + * "tag2" + * ] + */ + tags: string[]; + }; + TestTargetExecutionResponse: { + /** + * @description The URL the test target was executed. + * @example https://example.com + */ + testReportUrl?: string; + /** + * @description The test report from the run. + * @example some json + */ + testReport?: Record; + }; + TestReportContext: { + /** + * @description The source of the test trigger. + * @example manual + * @enum {string} + */ + source?: "manual"; + /** + * @description The description of the test context. + * @example manual trigger + */ + description?: string; + triggeredBy?: { + /** + * @description The type of entity triggering the test. + * @example USER + * @enum {string} + */ + type?: "USER"; + /** + * Format: uuid + * @description The unique identifier of the user who triggered the test. + * @example 2e2bb27b-a19c-47ce-a9b6-cd1bd31622dc + */ + userId?: string; + }; + }; + TestResult: { + /** + * Format: uuid + * @description Unique identifier for the test result. + * @example 826c15af-644b-4b28-89b4-f50ff34e46b7 + */ + id?: string; + /** + * Format: uuid + * @description Unique identifier of the test report this result belongs to. + * @example 3435918b-3d29-4ebd-8c68-9a540532f45a + */ + testTargetId?: string; + /** + * Format: uuid + * @description Unique identifier of the test case this result belongs to. + * @example 5b844cf1-d597-4048-9e74-7c0f9ce3e2ee + */ + testCaseId?: string; + /** + * Format: date-time + * @description The timestamp when the test result was created. + * @example 2024-09-06T13:01:51.686Z + */ + createdAt?: string; + /** + * Format: date-time + * @description The timestamp when the test result was last updated. + * @example 2024-09-06T13:01:51.686Z + */ + updatedAt?: string; + /** + * @description The status of the specific test result, will be WAITING as long as the result is running, FAILED if the execution failed, PASSED if it succeeded, and ERROR if an internal error occurred. + * @enum {string} + */ + status?: "WAITING" | "PASSED" | "FAILED" | "ERROR"; + /** + * @description The error that has occurred during execution - only set if the status is FAILED or ERROR. + * @example TimeoutError: locator.click: Timeout 30000ms exceeded. + */ + errorMessage?: string | null; + /** + * @description Link to the playwright trace of the test execution - only set once the test result is finished (PASSED or FAILED). + * @example https://storage.googleapis.com/automagically-traces/826c15af-644b-4b28-89b4-f50ff34e46b7-trace.zip + */ + traceUrl?: string | null; + }; + TestReport: { + /** + * Format: uuid + * @description Unique identifier for the test report. + * @example 826c15af-644b-4b28-89b4-f50ff34e46b7 + */ + id?: string; + /** + * Format: uuid + * @description The unique identifier of the test target. + * @example 3435918b-3d29-4ebd-8c68-9a540532f45a + */ + testTargetId?: string; + /** + * Format: date-time + * @description The timestamp when the test report was created. + * @example 2024-09-06T13:01:51.686Z + */ + createdAt?: string; + /** + * Format: date-time + * @description The timestamp when the test report was last updated. + * @example 2024-09-06T13:01:51.686Z + */ + updatedAt?: string; + /** + * Format: uri + * @description The URL where the test execution was performed. + * @example https://en.wikipedia.org/ + */ + executionUrl?: string; + /** + * @description The status of the test report, will be WAITING as long as any result is running, FAILED if the report is done but has any failed result and PASSED if all test results are done and successful + * @enum {string} + */ + status?: "WAITING" | "PASSED" | "FAILED"; + context?: components["schemas"]["TestReportContext"]; + testResults?: components["schemas"]["TestResult"][]; + }; + PrivateLocationInfo: { + /** @enum {string} */ + status: "OFFLINE" | "ONLINE"; + /** + * Format: uri + * @example https://example.com:3128 + */ + address: string; + /** @example my-private-location */ + name: string; }[]; - /** Format: uuid */ - testCaseId?: string; - ignoreFailure?: boolean; - }[]; - /** Format: date-time */ - createdAt?: string; - /** Format: date-time */ - updatedAt?: string; - description?: string; - /** @enum {string} */ - status?: "ENABLED" | "DRAFT"; - externalId?: string | null; - entryPointUrlPath?: string | null; - tags?: string[]; - /** @enum {string} */ - createdBy?: "EDIT"; - /** @enum {string} */ - runStatus?: "ON" | "OFF"; - prerequisiteId?: string | null; - proposalRunId?: string | null; - folderId?: string | null; - discovery?: { - /** Format: uuid */ - id?: string; - freePrompt?: string; - traceUrl?: string | null; - traceJsonManifestUrl?: string | null; - /** @enum {string} */ - status?: "OUTDATED"; - abortCause?: string | null; - message?: string | null; - /** Format: uuid */ - testCaseId?: string; - lastJobExecutionName?: string | null; - /** Format: date-time */ - createdAt?: string; - /** Format: date-time */ - updatedAt?: string; - executedTestCaseElements?: string[]; - testCase?: { - /** Format: uuid */ - id?: string; - /** Format: uuid */ - testTargetId?: string; - description?: string; - /** Format: date-time */ - createdAt?: string; - /** Format: date-time */ - updatedAt?: string; - entryPointUrlPath?: string | null; - type?: string | null; - /** @enum {string} */ - status?: "ENABLED"; - /** @enum {string} */ - runStatus?: "ON"; - /** @enum {string} */ - interactionStatus?: "NEW"; - /** @enum {string} */ - createdBy?: "EDIT"; - proposalRunId?: string | null; - externalId?: string | null; - folderId?: string | null; - prerequisiteId?: string | null; - /** Format: uuid */ - predecessorId?: string; - testTarget?: { + TestReportResponse: { + /** + * Format: uri + * @description The URL where the test report can be accessed. + * @example https://app.octomind.dev/testreports/826c15af-644b-4b28-89b4-f50ff34e46b7 + */ + testReportUrl?: string; + testReport?: components["schemas"]["TestReport"]; + }; + TestCasesResponse: components["schemas"]["TestCaseResponse"][]; + TestCaseResponse: { /** Format: uuid */ - id?: string; - app?: string; + id: string; + /** Format: uuid */ + testTargetId: string; + type?: string | null; + elements?: { + /** Format: uuid */ + id?: string; + index?: number; + interaction?: { + /** Format: uuid */ + id?: string; + /** @enum {string} */ + action?: "EXTRACT" | "ENTER_TEXT" | "CLICK" | "SELECT_OPTION" | "TYPE_TEXT" | "KEY_PRESS" | "HOVER" | "UPLOAD" | "GO_TO" | "DRAG_AND_DROP" | "CLOSE_PAGE" | "OPEN_EMAIL"; + calledWith?: string | null; + /** Format: uuid */ + testCaseElementId?: string; + } | null; + assertion?: { + /** Format: uuid */ + id?: string; + /** @enum {string} */ + expectation?: "VISIBLE" | "NOT_VISIBLE" | "TO_BE_CHECKED" | "NOT_TO_BE_CHECKED" | "TO_HAVE_VALUE" | "TO_CONTAIN_TEXT" | "TO_HAVE_STYLE"; + calledWith?: string | null; + /** Format: uuid */ + testCaseElementId?: string; + } | null; + scrollState?: Record | null; + selectors?: { + /** Format: uuid */ + id?: string; + index?: number; + selector?: string; + /** @enum {string} */ + selectorType?: "TEXT" | "LABEL" | "PLACEHOLDER" | "ROLE"; + options?: { + name?: string; + } | null; + /** Format: uuid */ + testCaseElementId?: string; + scrollStateId?: string | null; + }[]; + /** Format: uuid */ + testCaseId?: string; + ignoreFailure?: boolean; + }[]; /** Format: date-time */ createdAt?: string; /** Format: date-time */ updatedAt?: string; + description?: string; + /** @enum {string} */ + status?: "ENABLED" | "DRAFT"; + externalId?: string | null; + entryPointUrlPath?: string | null; + tags?: string[]; + /** @enum {string} */ + createdBy?: "EDIT"; + /** @enum {string} */ + runStatus?: "ON" | "OFF"; + prerequisiteId?: string | null; + proposalRunId?: string | null; + folderId?: string | null; + discovery?: { + /** Format: uuid */ + id?: string; + freePrompt?: string; + traceUrl?: string | null; + traceJsonManifestUrl?: string | null; + /** @enum {string} */ + status?: "OUTDATED"; + abortCause?: string | null; + message?: string | null; + /** Format: uuid */ + testCaseId?: string; + lastJobExecutionName?: string | null; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt?: string; + executedTestCaseElements?: string[]; + testCase?: { + /** Format: uuid */ + id?: string; + /** Format: uuid */ + testTargetId?: string; + description?: string; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt?: string; + entryPointUrlPath?: string | null; + type?: string | null; + /** @enum {string} */ + status?: "ENABLED"; + /** @enum {string} */ + runStatus?: "ON"; + /** @enum {string} */ + interactionStatus?: "NEW"; + /** @enum {string} */ + createdBy?: "EDIT"; + proposalRunId?: string | null; + externalId?: string | null; + folderId?: string | null; + prerequisiteId?: string | null; + /** Format: uuid */ + predecessorId?: string; + testTarget?: { + /** Format: uuid */ + id?: string; + app?: string; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt?: string; + /** Format: uuid */ + orgId?: string; + testIdAttribute?: string | null; + timeoutPerStep?: number; + }; + }; + }; + }; + SuccessResponse: { + /** + * @description Indicates whether the operation was successful. + * @example true + */ + success?: boolean; + }; + UnregisterRequest: { + name?: string; + }; + RegisterRequest: { + name?: string; + registrationData?: { + /** @example secret22 */ + proxypass?: string; + /** @example user */ + proxyuser?: string; + /** + * @description the address of the remote endpoint. IP and port + * @example 34.45.23.22:23455 + */ + address?: string; + }; + }; + EnvironmentsResponse: components["schemas"]["EnvironmentResponse"][]; + EnvironmentResponse: { + /** Format: uuid */ + id: string; + name: string; + /** Format: uuid */ + testTargetId: string; + /** Format: date-time */ + updatedAt?: string; + type: string; + /** Format: url */ + discoveryUrl?: string; + additionalHeaderFields?: { + [key: string]: string; + } | null; + testAccount?: { + username?: string; + password?: string; + otpInitializerKey?: string | null; + /** Format: date-time */ + updatedAt?: string; + } | null; + basicAuth?: { + username?: string; + password?: string; + /** Format: date-time */ + updatedAt?: string; + } | null; + privateLocation?: { + /** Format: uuid */ + id?: string; + name?: string; + status?: string; + type?: string; + }; + }; + TestSuiteRequestCommons: { + /** + * Format: uuid + * @description The test case to run before all test cases + */ + beforeAll?: string | null; + /** + * Format: uuid + * @description The test case to run after all test cases + */ + afterAll?: string | null; + /** + * Format: uuid + * @description The test case to run before each test case in the suite + */ + beforeEach?: string | null; + /** + * Format: uuid + * @description The test case to run after each test case in the suite + */ + afterEach?: string | null; + }; + TestSuitePatchRequest: { + /** + * @description The name of the test suite + * @example regression for chat + */ + name?: string | null; + /** + * @description The test cases to include in the suite + * @example [ + * "5b844cf1-d597-4048-9e74-7c0f9ce3e2ee" + * ] + */ + testCases?: string[] | null; + /** + * @description the environment name you want to run your test suite against + * @example default + */ + environmentName?: string | null; + } & components["schemas"]["TestSuiteRequestCommons"]; + TestSuiteCreateRequest: { + /** + * @description The name of the test suite + * @example regression for chat + */ + name?: string; + /** + * @description The test cases to include in the suite + * @example [ + * "5b844cf1-d597-4048-9e74-7c0f9ce3e2ee" + * ] + */ + testCases?: string[]; + /** + * @description the environment name you want to run your test suite against + * @example default + */ + environmentName?: string; + } & components["schemas"]["TestSuiteRequestCommons"]; + TestSuiteResponse: { /** Format: uuid */ - orgId?: string; - testIdAttribute?: string | null; - timeoutPerStep?: number; - }; + id?: string; + } & components["schemas"]["TestSuiteCreateRequest"]; + TestSuitesResponse: components["schemas"]["TestSuiteResponse"][]; + ZodResponse: { + /** + * @description What error code happened while parsing the request + * @example invalid_type + */ + code?: string; + /** + * @description What the expected type was + * @example object + */ + expected?: string; + /** + * @description What the actual passed type was + * @example string + */ + received?: string; + path?: string[]; + /** + * @description Human-readable message of the error that occurred while parsing. + * @example Expected object, received string + */ + message?: string; + }[]; + Notification: { + /** + * Format: uuid + * @description Unique identifier for the event. + * @example 826c15af-644b-4b28-89b4-f50ff34e46b7 + */ + id: string; + /** + * Format: uuid + * @description The unique identifier of the test target this event belongs to. + * @example 3435918b-3d29-4ebd-8c68-9a540532f45a + */ + testTargetId: string; + /** + * Format: date-time + * @description The timestamp when the event was created. + * @example 2024-09-06T13:01:51.686Z + */ + createdAt: string; + /** + * Format: date-time + * @description The timestamp when the event was last updated. + * @example 2024-09-06T13:01:51.686Z + */ + updatedAt: string; + /** + * @description JSON payload containing event-specific data. + * @example { + * "testCaseId": "5deeef76-f37a-418b-8101-7d69529fa561" + * } + */ + payload: Record; + /** + * @description The type of event that occurred. + * @example VALIDATION_PASSED + * @enum {string} + */ + type: "VALIDATION_PASSED" | "VALIDATION_FAILED" | "DISCOVERY_FINISHED" | "PROPOSAL_SUCCESS" | "PROPOSAL_FAILED" | "REPORT_EXECUTION_FINISHED"; + /** + * @description Optional acknowledgment status of the event. + * @example IN_WEB_APP + * @enum {string|null} + */ + ack?: "IN_WEB_APP" | null; + }; + ExternalDiscoveryBody: { + /** + * @description Name of the discovered test case + * @example Login Form Validation Test + */ + name: string; + /** + * @description Entry point URL path of the discovered test case + * @example /login + */ + entryPointUrlPath?: string; + /** + * @description Prerequisite test case name + * @example Cookie Banner Acceptance + */ + prerequisiteName?: string; + /** + * @description External ID of the discovered test case + * @example ext-test-001 + */ + externalId?: string; + /** + * @description Tags to assign to the discovered test case + * @example [ + * "authentication", + * "forms", + * "validation" + * ] + */ + tagNames?: string[]; + /** + * @description Prompt to generate the discovered test case + * @example Test the login form with valid and invalid credentials + */ + prompt: string; + /** + * @description Folder name of the discovered test case + * @example Authentication Tests + */ + folderName?: string; + /** + * @description Type of the discovered test case + * @example LOGIN + * @enum {string} + */ + type?: "LOGIN" | "COOKIE_BANNER"; + }; + DiscoveryResponse: { + /** Format: uuid */ + discoveryId?: string; + /** Format: uuid */ + testCaseId?: string; }; - }; - }; - SuccessResponse: { - /** - * @description Indicates whether the operation was successful. - * @example true - */ - success?: boolean; - }; - UnregisterRequest: { - name?: string; - }; - RegisterRequest: { - name?: string; - registrationData?: { - /** @example secret22 */ - proxypass?: string; - /** @example user */ - proxyuser?: string; - /** - * @description the address of the remote endpoint. IP and port - * @example 34.45.23.22:23455 - */ - address?: string; - }; - }; - EnvironmentsResponse: components["schemas"]["EnvironmentResponse"][]; - EnvironmentResponse: { - /** Format: uuid */ - id?: string; - name?: string; - /** Format: uuid */ - testTargetId?: string; - /** Format: date-time */ - updatedAt?: string; - type?: string; - /** Format: url */ - discoveryUrl?: string; - additionalHeaderFields?: { - [key: string]: string; - } | null; - testAccount?: { - username?: string; - password?: string; - otpInitializerKey?: string | null; - /** Format: date-time */ - updatedAt?: string; - } | null; - basicAuth?: { - username?: string; - password?: string; - /** Format: date-time */ - updatedAt?: string; - } | null; - privateLocation?: { - /** Format: uuid */ - id?: string; - name?: string; - status?: string; - type?: string; - }; - }; - TestSuiteRequestCommons: { - /** - * Format: uuid - * @description The test case to run before all test cases - */ - beforeAll?: string | null; - /** - * Format: uuid - * @description The test case to run after all test cases - */ - afterAll?: string | null; - /** - * Format: uuid - * @description The test case to run before each test case in the suite - */ - beforeEach?: string | null; - /** - * Format: uuid - * @description The test case to run after each test case in the suite - */ - afterEach?: string | null; - }; - TestSuitePatchRequest: { - /** - * @description The name of the test suite - * @example regression for chat - */ - name?: string | null; - /** - * @description The test cases to include in the suite - * @example [ - * "5b844cf1-d597-4048-9e74-7c0f9ce3e2ee" - * ] - */ - testCases?: string[] | null; - /** - * @description the environment name you want to run your test suite against - * @example default - */ - environmentName?: string | null; - } & components["schemas"]["TestSuiteRequestCommons"]; - TestSuiteCreateRequest: { - /** - * @description The name of the test suite - * @example regression for chat - */ - name?: string; - /** - * @description The test cases to include in the suite - * @example [ - * "5b844cf1-d597-4048-9e74-7c0f9ce3e2ee" - * ] - */ - testCases?: string[]; - /** - * @description the environment name you want to run your test suite against - * @example default - */ - environmentName?: string; - } & components["schemas"]["TestSuiteRequestCommons"]; - TestSuiteResponse: { - /** Format: uuid */ - id?: string; - } & components["schemas"]["TestSuiteCreateRequest"]; - TestSuitesResponse: components["schemas"]["TestSuiteResponse"][]; - ZodResponse: { - /** - * @description What error code happened while parsing the request - * @example invalid_type - */ - code?: string; - /** - * @description What the expected type was - * @example object - */ - expected?: string; - /** - * @description What the actual passed type was - * @example string - */ - received?: string; - path?: string[]; - /** - * @description Human-readable message of the error that occurred while parsing. - * @example Expected object, received string - */ - message?: string; - }[]; - Notification: { - /** - * Format: uuid - * @description Unique identifier for the event. - * @example 826c15af-644b-4b28-89b4-f50ff34e46b7 - */ - id: string; - /** - * Format: uuid - * @description The unique identifier of the test target this event belongs to. - * @example 3435918b-3d29-4ebd-8c68-9a540532f45a - */ - testTargetId: string; - /** - * Format: date-time - * @description The timestamp when the event was created. - * @example 2024-09-06T13:01:51.686Z - */ - createdAt: string; - /** - * Format: date-time - * @description The timestamp when the event was last updated. - * @example 2024-09-06T13:01:51.686Z - */ - updatedAt: string; - /** - * @description JSON payload containing event-specific data. - * @example { - * "testCaseId": "5deeef76-f37a-418b-8101-7d69529fa561" - * } - */ - payload: Record; - /** - * @description The type of event that occurred. - * @example VALIDATION_PASSED - * @enum {string} - */ - type: - | "VALIDATION_PASSED" - | "VALIDATION_FAILED" - | "DISCOVERY_FINISHED" - | "PROPOSAL_SUCCESS" - | "PROPOSAL_FAILED" - | "REPORT_EXECUTION_FINISHED"; - /** - * @description Optional acknowledgment status of the event. - * @example IN_WEB_APP - * @enum {string|null} - */ - ack?: "IN_WEB_APP" | null; - }; - ExternalDiscoveryBody: { - /** - * @description Name of the discovered test case - * @example Login Form Validation Test - */ - name: string; - /** - * @description Entry point URL path of the discovered test case - * @example /login - */ - entryPointUrlPath?: string; - /** - * @description Prerequisite test case name - * @example Cookie Banner Acceptance - */ - prerequisiteName?: string; - /** - * @description External ID of the discovered test case - * @example ext-test-001 - */ - externalId?: string; - /** - * @description Tags to assign to the discovered test case - * @example [ - * "authentication", - * "forms", - * "validation" - * ] - */ - tagNames?: string[]; - /** - * @description Prompt to generate the discovered test case - * @example Test the login form with valid and invalid credentials - */ - prompt: string; - /** - * @description Folder name of the discovered test case - * @example Authentication Tests - */ - folderName?: string; - /** - * @description Type of the discovered test case - * @example LOGIN - * @enum {string} - */ - type?: "LOGIN" | "COOKIE_BANNER"; - }; - DiscoveryResponse: { - /** Format: uuid */ - discoveryId?: string; - /** Format: uuid */ - testCaseId?: string; }; - }; - responses: never; - parameters: never; - requestBodies: never; - headers: never; - pathItems: never; + responses: never; + parameters: never; + requestBodies: never; + headers: never; + pathItems: never; } export type $defs = Record; export type operations = Record; diff --git a/src/cli.ts b/src/cli.ts index ff602af..79f4003 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -31,7 +31,7 @@ export const buildCmd = (): Command => { program .name("octomind-cli") .description( - `Octomind CLI tool. Version: ${version}. see https://octomind.dev/docs/api-reference/`, + `Octomind CLI tool. Version: ${version}. see https://octomind.dev/docs/api-reference/` ) .version(version); @@ -55,7 +55,7 @@ export const buildCmd = (): Command => { if (existingConfig.apiKey && !options.force) { console.log("⚠️ Configuration already exists."); const overwrite = await promptUser( - "Do you want to overwrite it? (y/N): ", + "Do you want to overwrite it? (y/N): " ); if ( @@ -70,7 +70,7 @@ export const buildCmd = (): Command => { let apiKey; if (!options.apiKey) { apiKey = await promptUser( - "Enter your API key. Go to https://octomind.dev/docs/run-tests/execution-curl#create-an-api-key to learn how to generate one: ", + "Enter your API key. Go to https://octomind.dev/docs/run-tests/execution-curl#create-an-api-key to learn how to generate one: " ); if (!apiKey) { console.log("❌ API key is required."); @@ -80,7 +80,7 @@ export const buildCmd = (): Command => { let testTargetId; if (!options.testTargetId) { testTargetId = await promptUser( - "Enter test target id (optional, press Enter to skip): ", + "Enter test target id (optional, press Enter to skip): " ); } @@ -96,11 +96,11 @@ export const buildCmd = (): Command => { } catch (error) { console.error( "❌ Error during initialization:", - (error as Error).message, + (error as Error).message ); process.exit(1); } - }, + } ); createCommandWithCommonOptions("debug") @@ -108,25 +108,25 @@ export const buildCmd = (): Command => { .requiredOption("-u, --url ", "url the tests should run against") .option( "-i, --id ", - "id of the test case you want to run, if not provided will run all test cases in the test target", + "id of the test case you want to run, if not provided will run all test cases in the test target" ) .option( "-e, --environmentId ", - "id of the environment you want to run against, if not provided will run all test cases against the default environment", + "id of the environment you want to run against, if not provided will run all test cases against the default environment" ) .option( "-a, --testTargetId ", - "id of the test target of the test case", + "id of the test target of the test case" ) .option( "--headless", - "if we should run headless without the UI of playwright and the browser", + "if we should run headless without the UI of playwright and the browser" ) - .action((_, options) => + .action(async (_, options) => runDebugtopus({ ...options, - testTargetId: resolveTestTargetId(options.testTargetId), - }), + testTargetId: await resolveTestTargetId(options.testTargetId), + }) ); createCommandWithCommonOptions("execute") @@ -139,7 +139,7 @@ export const buildCmd = (): Command => { .option( "-v, --variables-to-overwrite ", "JSON object of variables to overwrite", - toJSON, + toJSON ) .action(async (options) => { const testTargetId = await resolveTestTargetId(options.testTargetId); @@ -181,11 +181,11 @@ export const buildCmd = (): Command => { createCommandWithCommonOptions("list-environments") .description("List all environments") .option("-t, --test-target-id ", "Test target ID") - .action((_, options) => + .action(async (_, options) => listEnvironments({ ...options, - testTargetId: resolveTestTargetId(options.testTargetId), - }), + testTargetId: await resolveTestTargetId(options.testTargetId), + }) ); createCommandWithCommonOptions("create-environment") @@ -197,16 +197,16 @@ export const buildCmd = (): Command => { .option("--test-account-password ", "Test account password") .option( "--test-account-otp-initializer-key ", - "Test account OTP initializer key", + "Test account OTP initializer key" ) .option("--basic-auth-username ", "Basic auth username") .option("--basic-auth-password ", "Basic auth password") .option("--private-location-name ", "Private location name") - .action((_, options) => + .action(async (_, options) => createEnvironment({ ...options, - testTargetId: resolveTestTargetId(options.testTargetId), - }), + testTargetId: await resolveTestTargetId(options.testTargetId), + }) ); createCommandWithCommonOptions("update-environment") @@ -219,16 +219,16 @@ export const buildCmd = (): Command => { .option("--test-account-password ", "Test account password") .option( "--test-account-otp-initializer-key ", - "Test account OTP initializer key", + "Test account OTP initializer key" ) .option("--basic-auth-username ", "Basic auth username") .option("--basic-auth-password ", "Basic auth password") .option("--private-location-name ", "Private location name") - .action((_, options) => + .action(async (_, options) => updateEnvironment({ ...options, - testTargetId: resolveTestTargetId(options.testTargetId), - }), + testTargetId: await resolveTestTargetId(options.testTargetId), + }) ); createCommandWithCommonOptions("delete-environment") @@ -240,22 +240,22 @@ export const buildCmd = (): Command => { createCommandWithCommonOptions("notifications") .description("Get notifications for a test target") .option("-t, --test-target-id ", "Test target ID") - .action((_, options) => + .action(async (_, options) => getNotifications({ ...options, - testTargetId: resolveTestTargetId(options.testTargetId), - }), + testTargetId: await resolveTestTargetId(options.testTargetId), + }) ); createCommandWithCommonOptions("test-case") .description("Get details of a specific test case") .requiredOption("-c, --test-case-id ", "Test case ID") .option("-t, --test-target-id ", "Test target ID") - .action((_, options) => + .action(async (_, options) => getTestCase({ ...options, - testTargetId: resolveTestTargetId(options.testTargetId), - }), + testTargetId: await resolveTestTargetId(options.testTargetId), + }) ); createCommandWithCommonOptions("create-discovery") @@ -269,14 +269,14 @@ export const buildCmd = (): Command => { .option( "--assigned-tag-ids ", "Comma-separated list of tag IDs", - splitter, + splitter ) .option("--folder-id ", "Folder ID") - .action((_, options) => + .action(async (_, options) => createDiscovery({ ...options, - testTargetId: resolveTestTargetId(options.testTargetId), - }), + testTargetId: await resolveTestTargetId(options.testTargetId), + }) ); return program; }; diff --git a/src/helpers.ts b/src/helpers.ts index efaf28c..03935bf 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -14,7 +14,7 @@ export function promptUser(question: string): Promise { } export const resolveTestTargetId = async ( - providedTestTargetId?: string, + providedTestTargetId?: string ): Promise => { if (providedTestTargetId) { return providedTestTargetId; @@ -23,7 +23,7 @@ export const resolveTestTargetId = async ( const config = await loadConfig(); if (!config.testTargetId) { throw new Error( - "testTargetId is required. Please provide it as a parameter or configure it first by running 'octomind init'", + "testTargetId is required. Please provide it as a parameter or configure it first by running 'octomind init'" ); } return config.testTargetId; diff --git a/src/tools.ts b/src/tools.ts index 9f13ad7..6971302 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -609,7 +609,6 @@ export const getPlaywrightConfig = async (options: { }, ); - handleError(error); if (!data) { From 8b8b015b5a9da656f5543dfc09d7550abf5d19f9 Mon Sep 17 00:00:00 2001 From: Fabio <161820267+fabiomaienschein@users.noreply.github.com> Date: Thu, 24 Jul 2025 13:03:25 +0200 Subject: [PATCH 3/4] fix bug, refactor --- src/cli.ts | 65 ++++++++++++++++++++++++++++------------------------ src/tools.ts | 53 +++++++++++++++++++++--------------------- 2 files changed, 62 insertions(+), 56 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 79f4003..286edb7 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -122,12 +122,13 @@ export const buildCmd = (): Command => { "--headless", "if we should run headless without the UI of playwright and the browser" ) - .action(async (_, options) => - runDebugtopus({ - ...options, - testTargetId: await resolveTestTargetId(options.testTargetId), - }) - ); + .action(async (options, command) => { + const resolvedTestTargetId = await resolveTestTargetId( + options.testTargetId + ); + command.setOptionValue("testTargetId", resolvedTestTargetId); + void runDebugtopus(options); + }); createCommandWithCommonOptions("execute") .description("Execute test cases") @@ -181,12 +182,13 @@ export const buildCmd = (): Command => { createCommandWithCommonOptions("list-environments") .description("List all environments") .option("-t, --test-target-id ", "Test target ID") - .action(async (_, options) => - listEnvironments({ - ...options, - testTargetId: await resolveTestTargetId(options.testTargetId), - }) - ); + .action(async (options, command) => { + const resolvedTestTargetId = await resolveTestTargetId( + options.testTargetId + ); + command.setOptionValue("testTargetId", resolvedTestTargetId); + void listEnvironments(options); + }); createCommandWithCommonOptions("create-environment") .description("Create a new environment") @@ -240,23 +242,25 @@ export const buildCmd = (): Command => { createCommandWithCommonOptions("notifications") .description("Get notifications for a test target") .option("-t, --test-target-id ", "Test target ID") - .action(async (_, options) => - getNotifications({ - ...options, - testTargetId: await resolveTestTargetId(options.testTargetId), - }) - ); + .action(async (options, command) => { + const resolvedTestTargetId = await resolveTestTargetId( + options.testTargetId + ); + command.setOptionValue("testTargetId", resolvedTestTargetId); + void getNotifications(options); + }); createCommandWithCommonOptions("test-case") .description("Get details of a specific test case") .requiredOption("-c, --test-case-id ", "Test case ID") .option("-t, --test-target-id ", "Test target ID") - .action(async (_, options) => - getTestCase({ - ...options, - testTargetId: await resolveTestTargetId(options.testTargetId), - }) - ); + .action(async (options, command) => { + const resolvedTestTargetId = await resolveTestTargetId( + options.testTargetId + ); + command.setOptionValue("testTargetId", resolvedTestTargetId); + void getTestCase(options); + }); createCommandWithCommonOptions("create-discovery") .description("Create a new test case discovery") @@ -272,11 +276,12 @@ export const buildCmd = (): Command => { splitter ) .option("--folder-id ", "Folder ID") - .action(async (_, options) => - createDiscovery({ - ...options, - testTargetId: await resolveTestTargetId(options.testTargetId), - }) - ); + .action(async (options, command) => { + const resolvedTestTargetId = await resolveTestTargetId( + options.testTargetId + ); + command.setOptionValue("testTargetId", resolvedTestTargetId); + void createDiscovery(options); + }); return program; }; diff --git a/src/tools.ts b/src/tools.ts index 6971302..2115e89 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -46,7 +46,7 @@ const authMiddleware: Middleware = { const { apiKey } = await loadConfig(); if (!apiKey) { throw new Error( - "API key is required. Please configure it first by running 'octomind init'", + "API key is required. Please configure it first by running 'octomind init'" ); } request.headers.set("x-api-key", apiKey); @@ -59,7 +59,7 @@ const authMiddleware: Middleware = { const errorBody = await res.json(); return new Response( `${response.status}, ${response.statusText}: ${errorBody ? JSON.stringify(errorBody, null, 2) : ""}`, - { ...resOptions, status: response.status }, + { ...resOptions, status: response.status } ); } return response; @@ -79,7 +79,7 @@ const handleError = (error: ErrorResponse) => { }; export const listEnvironments = async ( - options: listEnvironmentsOptions & { json?: boolean }, + options: listEnvironmentsOptions & { json?: boolean } ): Promise => { const { data, error } = await client.GET( "/apiKey/v2/test-targets/{testTargetId}/environments", @@ -87,7 +87,7 @@ export const listEnvironments = async ( params: { path: { testTargetId: options.testTargetId }, }, - }, + } ); handleError(error); @@ -109,7 +109,7 @@ export const listEnvironments = async ( }; export const getEnvironments = async ( - options: listEnvironmentsOptions & { json?: boolean }, + options: listEnvironmentsOptions & { json?: boolean } ): Promise => { const { data, error } = await client.GET( "/apiKey/v2/test-targets/{testTargetId}/environments", @@ -117,7 +117,7 @@ export const getEnvironments = async ( params: { path: { testTargetId: options.testTargetId }, }, - }, + } ); handleError(error); @@ -138,7 +138,7 @@ const outputResult = (result: unknown): void => { }; export const executeTests = async ( - options: executeTestsBody & { json?: boolean; description?: string }, + options: executeTestsBody & { json?: boolean; description?: string } ): Promise => { const { data, error } = await client.POST("/apiKey/v2/execute", { body: { @@ -186,7 +186,7 @@ export const executeTests = async ( }; export const getTestReport = async ( - options: getTestReportParams & { json?: boolean }, + options: getTestReportParams & { json?: boolean } ): Promise => { const { data, error } = await client.GET( "/apiKey/v2/test-targets/{testTargetId}/test-reports/{testReportId}", @@ -197,7 +197,7 @@ export const getTestReport = async ( testReportId: options.testReportId, }, }, - }, + } ); handleError(error); @@ -244,7 +244,7 @@ export const registerLocation = async (options: { password: options.password, }, }, - }, + } ); handleError(error); @@ -269,7 +269,7 @@ export const unregisterLocation = async (options: { body: { name: options.name, }, - }, + } ); handleError(error); @@ -282,7 +282,7 @@ export const unregisterLocation = async (options: { console.log( "Unregistration result:", - response.success ? "Success" : "Failed", + response.success ? "Success" : "Failed" ); }; @@ -316,7 +316,7 @@ export const createEnvironment = async ( basicAuthPassword?: string; privateLocationName?: string; testAccountOtpInitializerKey?: string; - }, + } ): Promise => { const { data, error } = await client.POST( "/apiKey/v2/test-targets/{testTargetId}/environments", @@ -339,7 +339,7 @@ export const createEnvironment = async ( privateLocationName: options.privateLocationName, additionalHeaderFields: options.additionalHeaderFields, }, - }, + } ); handleError(error); @@ -369,7 +369,7 @@ export const updateEnvironment = async ( basicAuthPassword?: string; privateLocationName?: string; testAccountOtpInitializerKey?: string; - }, + } ): Promise => { const { data, error } = await client.PATCH( "/apiKey/v2/test-targets/{testTargetId}/environments/{environmentId}", @@ -394,7 +394,7 @@ export const updateEnvironment = async ( }, privateLocationName: options.privateLocationName, }, - }, + } ); handleError(error); @@ -427,7 +427,7 @@ export const deleteEnvironment = async (options: { environmentId: options.environmentId, }, }, - }, + } ); handleError(error); @@ -441,7 +441,7 @@ export const deleteEnvironment = async (options: { }; export const getNotifications = async ( - options: getNotificationsParams & { json?: boolean }, + options: getNotificationsParams & { json?: boolean } ): Promise => { const { data, error } = await client.GET( "/apiKey/v2/test-targets/{testTargetId}/notifications", @@ -451,7 +451,7 @@ export const getNotifications = async ( testTargetId: options.testTargetId, }, }, - }, + } ); handleError(error); @@ -482,8 +482,9 @@ export const getNotifications = async ( }; export const getTestCase = async ( - options: getTestCaseParams & { json?: boolean }, + options: getTestCaseParams & { json?: boolean } ): Promise => { + console.log(options); const { data, error } = await client.GET( "/apiKey/v2/test-targets/{testTargetId}/test-cases/{testCaseId}", { @@ -493,7 +494,7 @@ export const getTestCase = async ( testCaseId: options.testCaseId, }, }, - }, + } ); handleError(error); @@ -541,7 +542,7 @@ export const getTestCase = async ( }; export const createDiscovery = async ( - options: createDiscoveryBody & { json?: boolean; testTargetId: string }, + options: createDiscoveryBody & { json?: boolean; testTargetId: string } ): Promise => { const requestBody = { name: options.name, @@ -567,7 +568,7 @@ export const createDiscovery = async ( }, }, body: requestBody, - }, + } ); handleError(error); @@ -606,7 +607,7 @@ export const getPlaywrightConfig = async (options: { }, }, parseAs: "text", - }, + } ); handleError(error); @@ -642,7 +643,7 @@ export const getPlaywrightCode = async (options: { executionUrl: options.executionUrl, }, }, - }, + } ); handleError(error); @@ -671,7 +672,7 @@ export const getTestCases = async (options: { testTargetId: options.testTargetId, }, }, - }, + } ); handleError(error); From ba8b62ffa02af7c6ed3df34a859f0989e32aaf40 Mon Sep 17 00:00:00 2001 From: Fabio <161820267+fabiomaienschein@users.noreply.github.com> Date: Thu, 24 Jul 2025 13:07:24 +0200 Subject: [PATCH 4/4] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 446dd92..3a2de97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@octomind/octomind", - "version": "1.0.4", + "version": "1.0.5", "description": "a command line client for octomind apis", "main": "./dist/index.js", "packageManager": "pnpm@10.13.1",