Skip to content

Commit 5d90571

Browse files
print push result and add --force for push (#336)
* print push result and add --force for push * readme * remove force
1 parent 7e79f27 commit 5d90571

4 files changed

Lines changed: 24 additions & 9 deletions

File tree

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This way even entityIds like environmentIds or testCaseIds will be autocompleted
4242

4343
# octomind
4444

45-
Octomind cli tool. Version: 4.2.0. Additional documentation see https://octomind.dev/docs/api-reference/
45+
Octomind cli tool. Version: 4.3.0. Additional documentation see https://octomind.dev/docs/api-reference/
4646

4747
**Usage:** `octomind [options] [command]`
4848

@@ -237,7 +237,7 @@ Execute local YAML test cases
237237
|:-------|:----------|:---------|:--------|
238238
| `-j, --json` | Output raw JSON response | No | |
239239
| `-u, --url <url>` | Url the tests should run against | Yes | |
240-
| `-c, --test-case-id [uuid]` | Id of the test case you want to run, if not provided will run all test cases in the test target | No | |
240+
| `-p, --test-case-path [string]` | Path of the test case you want to run, if not provided will run all test cases in the test target | No | |
241241
| `-e, --environment-id [uuid]` | Id of the environment you want to run against, if not provided will run all test cases against the default environment | No | |
242242
| `-t, --test-target-id [uuid]` | Id of the test target of the test case, if not provided will use the test target id from the config | No | |
243243
| `--headless` | If we should run headless without the UI of playwright and the browser | No | |
@@ -445,6 +445,7 @@ Push local YAML test cases to the test target
445445
|:-------|:----------|:---------|:--------|
446446
| `-j, --json` | Output raw JSON response | No | |
447447
| `-t, --test-target-id [id]` | Test target ID, if not provided will use the test target id from the config | No | |
448+
| `-y, --yes` | Skip confirmation prompt | No | |
448449

449450
## create-test-case
450451

@@ -459,7 +460,7 @@ Create a new test case
459460
| `-j, --json` | Output raw JSON response | No | |
460461
| `-t, --test-target-id [id]` | Test target ID, if not provided will use the test target id from the config | No | |
461462
| `-n, --name <string>` | The name of the test case you want to create | Yes | |
462-
| `-d, --dependency-path <path>` | The path of to test case you want to use as dependency | Yes | |
463+
| `-d, --dependency-path [path]` | The path of to test case you want to use as dependency | No | |
463464

464465
## edit-test-case
465466

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@octomind/octomind",
3-
"version": "4.2.0",
3+
"version": "4.3.0",
44
"description": "a command line client for octomind apis",
55
"main": "./dist/index.js",
66
"packageManager": "pnpm@10.28.0+sha512.05df71d1421f21399e053fde567cea34d446fa02c76571441bfc1c7956e98e363088982d940465fd34480d4d90a0668bc12362f8aa88000a64e83d0b0e47be48",

src/tools/sync/push.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ type PushOptions = {
2626

2727
export const push = async (
2828
options: PushOptions,
29-
): Promise<{ success: boolean; versionIds: string[] } | undefined> => {
29+
): Promise<
30+
| { success: boolean; versionIds: string[]; pushResult: "drafts" | "enabled" }
31+
| undefined
32+
> => {
3033
const testCases = readTestCasesFromDir(options.sourceDir);
3134
checkForConsistency(testCases);
3235
const context = await getGitContext();
@@ -38,9 +41,17 @@ export const push = async (
3841
};
3942

4043
if (isDefaultBranch) {
41-
return defaultPush(body, options);
44+
const pushResult = await defaultPush(body, options);
45+
if (!pushResult) {
46+
return undefined;
47+
}
48+
return { ...pushResult, pushResult: "enabled" };
4249
} else {
43-
return draftPush(body, options);
50+
const pushResult = await draftPush(body, options);
51+
if (!pushResult) {
52+
return undefined;
53+
}
54+
return { ...pushResult, pushResult: "drafts" };
4455
}
4556
};
4657

src/tools/test-targets.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ export const pullTestTarget = async (
102102
};
103103

104104
export const pushTestTarget = async (
105-
options: { testTargetId: string; yes?: boolean } & ListOptions,
105+
options: {
106+
testTargetId: string;
107+
yes?: boolean;
108+
} & ListOptions,
106109
): Promise<void> => {
107110
const localThrobber = ora("Reading local test cases").start();
108111
const sourceDir = await findOctomindFolder();
@@ -139,5 +142,5 @@ export const pushTestTarget = async (
139142
logJson(data);
140143
}
141144

142-
pushThrobber.succeed("Test cases pushed successfully");
145+
pushThrobber.succeed(`Test cases pushed as ${data?.pushResult}`);
143146
};

0 commit comments

Comments
 (0)