Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
04c59b3
edit test cases
Germandrummer92 Jan 12, 2026
9f75a38
remove logs
Germandrummer92 Jan 12, 2026
9a96e3d
folder name constant
Jan 12, 2026
bc3ef29
Merge branch 'edit-test-case' of github.com:OctoMind-dev/cli into edi…
Jan 12, 2026
2114e3e
make .octomind folder the default for push, pull, delete and edit.
Jan 12, 2026
d33c197
use octomind folder in local execution
Jan 12, 2026
cd80467
fix .octomind folder name in logs
Jan 12, 2026
8f6ada4
fix octomind folder helpers and add tests.
Jan 12, 2026
afb21b5
use early exits in deleteTestCase and add tests for local deletion.
Jan 12, 2026
34694b4
Merge pull request #317 from OctoMind-dev/require-octomind-folder
fabianboth Jan 12, 2026
d316985
remove edit feature.
Jan 12, 2026
2c0507e
remove edit tests
Jan 12, 2026
cd70a3f
add edit CLI command
Jan 12, 2026
8ff8b31
fix linting
Jan 12, 2026
d8166e8
Merge branch 'main' of github.com:OctoMind-dev/cli into edit-test-cas…
Jan 12, 2026
64b2b87
fix test case path
Jan 13, 2026
0fa502a
add open dependency, finish editing implementation
Germandrummer92 Jan 13, 2026
f6e85ce
absolute files in octomind root
Jan 13, 2026
b2f9495
Merge branch 'edit-test-case-v2' of github.com:OctoMind-dev/cli into …
Jan 13, 2026
2388cfc
working version
Germandrummer92 Jan 13, 2026
c71a7f6
throbber!
Germandrummer92 Jan 13, 2026
d305429
add cancellation, better throbber exiting
Germandrummer92 Jan 13, 2026
3a6c9a7
remove import
Germandrummer92 Jan 14, 2026
8d660d7
Relies on new draft push results, shows test results in edit view.
Jan 14, 2026
caacd59
add edit CLI command
Jan 12, 2026
bba3b53
fix linting
Germandrummer92 Jan 14, 2026
21b3a45
fix test case path
Jan 13, 2026
2526bb2
absolute files in octomind root
Jan 13, 2026
8ef9827
add open dependency, finish editing implementation
Germandrummer92 Jan 14, 2026
aadd273
working version
Germandrummer92 Jan 14, 2026
51c1b9c
throbber!
Germandrummer92 Jan 14, 2026
b3e5998
add cancellation, better throbber exiting
Germandrummer92 Jan 13, 2026
28ce002
remove import
Germandrummer92 Jan 14, 2026
d8814ab
-debugging stuff
Germandrummer92 Jan 14, 2026
8f66712
lockfile
Germandrummer92 Jan 14, 2026
f9ca737
Merge branch 'edit-test-case-v2' of github.com:OctoMind-dev/cli into …
Jan 14, 2026
3fd0d48
remove openapi.yaml
Jan 14, 2026
ff12e1c
undo debuggin apigen command
Jan 14, 2026
0404272
fix formatting
Jan 14, 2026
b281721
Merge branch 'main' of github.com:OctoMind-dev/cli into edit-test-cas…
Jan 14, 2026
ba9bdbd
fix tests
Jan 14, 2026
c93219c
add tests
Jan 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/tools/sync/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { components, paths } from "../../api";
import { ListOptions } from "../client";
import { checkForConsistency } from "./consistency";
import { getGitContext } from "./git";
import { TestTargetSyncData } from "./types";
import { SyncDataByStableId, TestTargetSyncData } from "./types";
import { readTestCasesFromDir } from "./yaml";

type ErrorResponse =
Expand Down Expand Up @@ -72,7 +72,7 @@ export const draftPush = async (
| {
success: boolean;
versionIds: string[];
versionIdByStableId: Record<string, string>;
syncDataByStableId: SyncDataByStableId;
}
| undefined
> => {
Expand Down
4 changes: 3 additions & 1 deletion src/tools/sync/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { components } from "../../api";
import { components, operations } from "../../api";

export type TestTargetSyncData = components["schemas"]["TestTargetSyncSchema"];
export type SyncTestCases = TestTargetSyncData["testCases"];
export type SyncTestCase = SyncTestCases[number];
export type ExecutionContext = components["schemas"]["ExecutionContext"];
export type SyncDataByStableId =
operations["pushTestTargetDraft"]["responses"]["200"]["content"]["application/json"]["syncDataByStableId"];
16 changes: 12 additions & 4 deletions src/tools/yamlMutations/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,21 @@ export const edit = async (options: EditOptions): Promise<void> => {
throw new Error(`Could not edit test case with id '${testCaseToEdit.id}'`);
}

const versionId = response.versionIdByStableId[testCaseToEdit.id];
if (!versionId) {
const syncData = response.syncDataByStableId[testCaseToEdit.id];
if (!syncData) {
throw new Error(`Could not edit test case with id '${testCaseToEdit.id}'`);
}
const { versionId, testResultId } = syncData;

const parsedBaseUrl = URL.parse(BASE_URL);
const localEditingUrl = `${parsedBaseUrl?.protocol}//${parsedBaseUrl?.host}/testtargets/${options.testTargetId}/testcases/${versionId}/localEdit?detailsPanelRail=steps&testTargetId=${options.testTargetId}&testCaseId=${versionId}`;
await open(localEditingUrl);
const localEditingUrl = new URL(
`${parsedBaseUrl?.protocol}//${parsedBaseUrl?.host}/testtargets/${options.testTargetId}/testcases/${versionId}/localEdit`,
);
if (testResultId) {
localEditingUrl.searchParams.set("testResultId", testResultId);
}

await open(localEditingUrl.href);

console.log(
`Navigating to local editing url, open it manually if a browser didn't open already: ${localEditingUrl}`,
Expand Down
44 changes: 40 additions & 4 deletions tests/tools/yamlMutations/edit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from "fs";

import open from "open";
import ora from "ora";
import { beforeEach, describe, expect, it, MockedObject, vi } from "vitest";
import { mock } from "vitest-mock-extended";
Expand Down Expand Up @@ -97,7 +98,7 @@ describe("edit", () => {
vi.mocked(draftPush).mockResolvedValue({
success: true,
versionIds: [],
versionIdByStableId: {},
syncDataByStableId: {},
});

await expect(
Expand All @@ -117,7 +118,7 @@ describe("edit", () => {
vi.mocked(draftPush).mockResolvedValue({
success: true,
versionIds: [],
versionIdByStableId: { "test-id": "version-123" },
syncDataByStableId: { "test-id": { versionId: "version-123" } },
});
vi.mocked(mockedClient.GET)
.mockResolvedValueOnce({
Expand Down Expand Up @@ -158,7 +159,7 @@ describe("edit", () => {
vi.mocked(draftPush).mockResolvedValue({
success: true,
versionIds: [],
versionIdByStableId: { "child-id": "version-123" },
syncDataByStableId: { "child-id": { versionId: "version-123" } },
});
vi.mocked(mockedClient.GET).mockResolvedValue({
data: { localEditingStatus: "CANCELLED" },
Expand Down Expand Up @@ -209,7 +210,7 @@ describe("edit", () => {
vi.mocked(draftPush).mockResolvedValue({
success: true,
versionIds: [],
versionIdByStableId: { "test-id": "version-123" },
syncDataByStableId: { "test-id": { versionId: "version-123" } },
});
vi.mocked(mockedClient.GET)
.mockResolvedValueOnce({
Expand All @@ -227,4 +228,39 @@ describe("edit", () => {

expect(console.log).toHaveBeenCalledWith("Edited test case successfully");
});

it.each([
{
testResultId: "result-456",
expectedUrl: expect.stringContaining("testResultId=result-456"),
},
{
testResultId: undefined,
expectedUrl: expect.not.stringContaining("testResultId"),
},
])("handles testResultId=$testResultId in URL correctly", async ({
testResultId,
expectedUrl,
}) => {
const testCase = createMockSyncTestCase({ id: "test-id" });

vi.mocked(findOctomindFolder).mockResolvedValue("/mock/.octomind");
vi.mocked(getAbsoluteFilePathInOctomindRoot).mockResolvedValue(
"/mock/.octomind/test.yaml",
);
vi.mocked(fs.readFileSync).mockReturnValue(yaml.stringify(testCase));
vi.mocked(readTestCasesFromDir).mockReturnValue([testCase]);
vi.mocked(draftPush).mockResolvedValue({
success: true,
versionIds: [],
syncDataByStableId: {
"test-id": { versionId: "version-123", testResultId },
},
});
vi.mocked(waitForLocalChangesToBeFinished).mockResolvedValue("cancelled");

await edit({ testTargetId: "someId", filePath: "test.yaml" });

expect(open).toHaveBeenCalledWith(expectedUrl);
});
});
5 changes: 3 additions & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default defineConfig({
test: {
mockReset: true,
globals: true,
environment: 'node'
}
environment: 'node',
include: ["tests/**/*.spec.ts"],
},
})