From 0241a9fdf01d236e185e18ed41e5597f529b7e5a Mon Sep 17 00:00:00 2001 From: Fumiaki MATSUSHIMA Date: Mon, 5 Aug 2024 13:49:41 +0900 Subject: [PATCH 1/4] $ npm install @autifyhq/autify-sdk@latest --save --- package-lock.json | 60 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6023f0fd..0e8703a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "integration-test" ], "dependencies": { - "@autifyhq/autify-sdk": "^0.21.0", + "@autifyhq/autify-sdk": "^0.23.0", "@oclif/core": "^3.27.0", "@oclif/errors": "^1.3.6", "@oclif/plugin-help": "^6.2.7", @@ -133,18 +133,18 @@ "link": true }, "node_modules/@autifyhq/autify-sdk": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/@autifyhq/autify-sdk/-/autify-sdk-0.21.0.tgz", - "integrity": "sha512-9r+Gs3hbeD/bX+zRrYladu1pBS2ZRpZyo7mdErcmoBuL+VAR0X0Ep9mEybDD/7pNwRvFq5gwcLwB8UEeiG/XCQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@autifyhq/autify-sdk/-/autify-sdk-0.23.0.tgz", + "integrity": "sha512-GTLfQOwD6IWXFeM5ZUFJ546e8ev002SCtLmZ46+VVYMbng1uJajzseQN+83xsTStyFDiiaCaWs0RNCyoQAkj8Q==", "dependencies": { - "axios": "^1.6.0", - "axios-logger": "^2.7.1", - "debug": "^4.3.4", + "axios": "^1.7.2", + "axios-logger": "^2.8.1", + "debug": "^4.3.6", "form-data": "^4.0.0", - "tslib": "^2.6.2" + "tslib": "^2.6.3" }, "engines": { - "node": ">=20.11.0" + "node": ">=20.16.0" } }, "node_modules/@aws-crypto/crc32": { @@ -4724,19 +4724,19 @@ } }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.3.tgz", + "integrity": "sha512-Ar7ND9pU99eJ9GpoGQKhKf58GpUOgnzuaB7ueNQ5BMi0p+LZ5oaEnfF999fAArcTIBwXTCHAmGcHOZJaWPq9Nw==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } }, "node_modules/axios-logger": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/axios-logger/-/axios-logger-2.7.1.tgz", - "integrity": "sha512-slzf27jZuGwOoOeh3R7iV8PVMFsqkvYR39ohm5W3qg7+IM8MsMP4XV2V0Tl4PWKjPNB5UGZlzNZAeJoCn5GLDA==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/axios-logger/-/axios-logger-2.8.1.tgz", + "integrity": "sha512-Bbl7XRR/Rkxg2Owv/kRgAZ/0qf8kMPLc08LtiUcGCWV5RmoI7vHr+eee6SUc8jRi2nE5KWShziCVh35C1SBEaw==", "dependencies": { "chalk": "^4.1.0", "dateformat": "^3.0.3" @@ -14105,15 +14105,15 @@ } }, "@autifyhq/autify-sdk": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/@autifyhq/autify-sdk/-/autify-sdk-0.21.0.tgz", - "integrity": "sha512-9r+Gs3hbeD/bX+zRrYladu1pBS2ZRpZyo7mdErcmoBuL+VAR0X0Ep9mEybDD/7pNwRvFq5gwcLwB8UEeiG/XCQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@autifyhq/autify-sdk/-/autify-sdk-0.23.0.tgz", + "integrity": "sha512-GTLfQOwD6IWXFeM5ZUFJ546e8ev002SCtLmZ46+VVYMbng1uJajzseQN+83xsTStyFDiiaCaWs0RNCyoQAkj8Q==", "requires": { - "axios": "^1.6.0", - "axios-logger": "^2.7.1", - "debug": "^4.3.4", + "axios": "^1.7.2", + "axios-logger": "^2.8.1", + "debug": "^4.3.6", "form-data": "^4.0.0", - "tslib": "^2.6.2" + "tslib": "^2.6.3" } }, "@aws-crypto/crc32": { @@ -17798,19 +17798,19 @@ "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" }, "axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.3.tgz", + "integrity": "sha512-Ar7ND9pU99eJ9GpoGQKhKf58GpUOgnzuaB7ueNQ5BMi0p+LZ5oaEnfF999fAArcTIBwXTCHAmGcHOZJaWPq9Nw==", "requires": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } }, "axios-logger": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/axios-logger/-/axios-logger-2.7.1.tgz", - "integrity": "sha512-slzf27jZuGwOoOeh3R7iV8PVMFsqkvYR39ohm5W3qg7+IM8MsMP4XV2V0Tl4PWKjPNB5UGZlzNZAeJoCn5GLDA==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/axios-logger/-/axios-logger-2.8.1.tgz", + "integrity": "sha512-Bbl7XRR/Rkxg2Owv/kRgAZ/0qf8kMPLc08LtiUcGCWV5RmoI7vHr+eee6SUc8jRi2nE5KWShziCVh35C1SBEaw==", "requires": { "chalk": "^4.1.0", "dateformat": "^3.0.3" diff --git a/package.json b/package.json index c7431728..eb1308f1 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "/oclif.manifest.json" ], "dependencies": { - "@autifyhq/autify-sdk": "^0.21.0", + "@autifyhq/autify-sdk": "^0.23.0", "@oclif/core": "^3.27.0", "@oclif/errors": "^1.3.6", "@oclif/plugin-help": "^6.2.7", From a74a8cdfa12c5a78c8efa815cf9b5d025851fc19 Mon Sep 17 00:00:00 2001 From: Fumiaki MATSUSHIMA Date: Mon, 5 Aug 2024 15:04:56 +0900 Subject: [PATCH 2/4] Fix type --- src/autify/web/runTest.ts | 6 +++--- src/commands/web/test/run.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/autify/web/runTest.ts b/src/autify/web/runTest.ts index 9d09f681..2feb42bf 100644 --- a/src/autify/web/runTest.ts +++ b/src/autify/web/runTest.ts @@ -3,9 +3,9 @@ import { CLIError } from "@oclif/errors"; import { WebClient } from "@autifyhq/autify-sdk"; import { TestPlan, TestScenario } from "./parseAutifyTestUrl"; -type CapabilityOption = Parameters< - WebClient["executeScenarios"] ->[1]["capabilities"][number]; +type CapabilityOption = Awaited< + ReturnType +>["data"][number]; type CreateUrlReplacementRequest = Parameters< WebClient["createUrlReplacement"] >[1]; diff --git a/src/commands/web/test/run.ts b/src/commands/web/test/run.ts index f9d27ebb..78ea0f9e 100644 --- a/src/commands/web/test/run.ts +++ b/src/commands/web/test/run.ts @@ -126,7 +126,7 @@ export default class WebTestRun extends Command { browser: flags.browser, device: flags.device, // eslint-disable-next-line camelcase - device_type: flags["device-type"], + device_type: flags["device-type"] as any, }; const urlReplacements = this.parseUrlReplacements( flags["url-replacements"] ?? [] From 0bde8d02834f2385900cf90c045facb399acca2f Mon Sep 17 00:00:00 2001 From: Fumiaki MATSUSHIMA Date: Mon, 5 Aug 2024 15:10:41 +0900 Subject: [PATCH 3/4] Consider chars require escaping --- scripts/generate-api-commands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate-api-commands.ts b/scripts/generate-api-commands.ts index 261792c6..9e21d604 100644 --- a/scripts/generate-api-commands.ts +++ b/scripts/generate-api-commands.ts @@ -40,7 +40,7 @@ const writeCommandSource = (service: string, apiMethod: MethodDeclaration) => { [index].getCommentText(); const flagType = getFlagType(parameterType); flags.push( - ` '${name}': ${flagType}({description: '${flagDescription}', required: ${required}}),` + ` '${name}': ${flagType}({description: ${JSON.stringify(flagDescription)}, required: ${required}}),` ); const arg = `flags['${name}']`; if ( From d19b1c79b5ecc12a2ae80b1c0d5805488bcc893a Mon Sep 17 00:00:00 2001 From: Fumiaki MATSUSHIMA Date: Mon, 5 Aug 2024 15:19:18 +0900 Subject: [PATCH 4/4] $ npm run generate --- src/commands/web/api/execute-schedule.ts | 2 +- src/commands/web/api/get-credit-usage.ts | 6 +++--- src/commands/web/api/list-capabilities.ts | 21 +++++++++++++++---- .../web/api/update-test-plan-variable.ts | 2 +- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/commands/web/api/execute-schedule.ts b/src/commands/web/api/execute-schedule.ts index 7fbac1c4..181fc9df 100644 --- a/src/commands/web/api/execute-schedule.ts +++ b/src/commands/web/api/execute-schedule.ts @@ -3,7 +3,7 @@ import { getWebClient } from "../../../autify/web/getWebClient"; export default class WebApiExecuteSchedule extends Command { static description = - '"Schedule" is called as "Test Plan" now.\\ If you want to run a test plan, use this endpoint.'; + '"Schedule" is called as "Test Plan" now. If you want to run a test plan, use this endpoint.'; static examples = ["<%= config.bin %> <%= command.id %>"]; diff --git a/src/commands/web/api/get-credit-usage.ts b/src/commands/web/api/get-credit-usage.ts index 8b798872..e34ac5e7 100644 --- a/src/commands/web/api/get-credit-usage.ts +++ b/src/commands/web/api/get-credit-usage.ts @@ -3,7 +3,7 @@ import { getWebClient } from "../../../autify/web/getWebClient"; export default class WebApiGetCreditUsage extends Command { static description = - "Get the number of credits used in the project\\ \\ Notes:\\ This endpoint works only for organizations on credit-based plans. It always returns 0 for `credits_consumed` and `credit_consumption_event_count` if your organization is on a run-based plan."; + "Get the number of credits used in the project Notes: This endpoint works only for organizations on credit-based plans. It always returns 0 for `credits_consumed` and `credit_consumption_event_count` if your organization is on a run-based plan."; static examples = ["<%= config.bin %> <%= command.id %>"]; @@ -15,12 +15,12 @@ export default class WebApiGetCreditUsage extends Command { }), "date-from": Flags.string({ description: - "The date to start counting used credits from.\\ If not specified, the date will be set to 1 week ago.\\ Up to 90 days in advance can be specified. If the specified date is more than 90 days in the past, the date will be set to 90 days ago.\\ Date must follow the format YYYY-MM-DD (example: "2023-09-21").", + 'The date to start counting used credits from. If not specified, the date will be set to 1 week ago. Up to 90 days in advance can be specified. If the specified date is more than 90 days in the past, the date will be set to 90 days ago. Date must follow the format YYYY-MM-DD (example: "2023-09-21").', required: false, }), "date-to": Flags.string({ description: - "The date to end counting used credits from.\\ If not specified, the date will be set to today.\\ Date must follow the format YYYY-MM-DD (example: "2023-09-28").", + 'The date to end counting used credits from. If not specified, the date will be set to today. Date must follow the format YYYY-MM-DD (example: "2023-09-28").', required: false, }), "scenario-id": Flags.integer({ diff --git a/src/commands/web/api/list-capabilities.ts b/src/commands/web/api/list-capabilities.ts index 6742425d..29a890f5 100644 --- a/src/commands/web/api/list-capabilities.ts +++ b/src/commands/web/api/list-capabilities.ts @@ -12,13 +12,24 @@ export default class WebApiListCapabilities extends Command { "For example, 1 for the following URL: https://app.autify.com/projects/1/capabilities", required: true, }), - os: Flags.string({ description: "os name to filter", required: false }), + os: Flags.string({ + description: "os name to filter (deprecated)", + required: false, + }), + "os-type": Flags.string({ + description: "Type of the os to filter", + required: false, + }), browser: Flags.string({ - description: "browser name to filter", + description: "browser name to filter (deprecated)", + required: false, + }), + "browser-type": Flags.string({ + description: "Type of the browser to filter", required: false, }), "device-type": Flags.string({ - description: "device_type name to filter", + description: "device_type name to filter (mobile is deprecated)", required: false, }), }; @@ -30,8 +41,10 @@ export default class WebApiListCapabilities extends Command { const res = await client.listCapabilities( flags["project-id"], flags.os, + flags["os-type"] ? JSON.parse(flags["os-type"]) : undefined, flags.browser, - flags["device-type"] + flags["browser-type"] ? JSON.parse(flags["browser-type"]) : undefined, + flags["device-type"] ? JSON.parse(flags["device-type"]) : undefined ); console.log(JSON.stringify(res.data, null, 2)); } diff --git a/src/commands/web/api/update-test-plan-variable.ts b/src/commands/web/api/update-test-plan-variable.ts index 42ea3c23..abc1b1d1 100644 --- a/src/commands/web/api/update-test-plan-variable.ts +++ b/src/commands/web/api/update-test-plan-variable.ts @@ -18,7 +18,7 @@ export default class WebApiUpdateTestPlanVariable extends Command { }), "update-test-plan-variable-request": Flags.string({ description: - "The variable's new key and/or default_value's value to register", + "The variable's new key and/or default_value's value to register", required: true, }), };