feat(e2e): add sidechain task modal interactions to session detail capture

- Implemented a new capture case for the "sidechain-task-modal" in the session detail E2E tests.
- Added data-testid attributes to the SidechainConversationModal for improved test targeting.
- Enhanced the GitController to handle errors gracefully when fetching branches and commits, returning an empty response on failure.
This commit is contained in:
d-kimsuon
2025-10-18 17:33:58 +09:00
parent 1d49361bca
commit 90e260f11e
3 changed files with 45 additions and 6 deletions

View File

@@ -86,5 +86,22 @@ export const sessionDetailCapture = defineCapture({
}
},
},
{
name: "sidechain-task-modal",
setup: async (page) => {
const sidechainTaskButton = page
.locator('[data-testid="sidechain-task-button"]')
.first();
if (await sidechainTaskButton.isVisible()) {
await sidechainTaskButton.click();
await page.waitForTimeout(1000);
// モーダルが開いたことを確認
const modal = page.locator('[data-testid="sidechain-task-modal"]');
await modal.waitFor({ state: "visible", timeout: 3000 });
}
},
},
],
});

View File

@@ -67,6 +67,7 @@ export const SidechainConversationModal: FC<
variant="outline"
size="sm"
className="w-full mb-3 items-center justify-start"
data-testid="sidechain-task-button"
>
<div className="flex items-center gap-2 overflow-hidden">
<Eye className="h-4 w-4 flex-shrink-0" />
@@ -76,7 +77,10 @@ export const SidechainConversationModal: FC<
</div>
</Button>
</DialogTrigger>
<DialogContent className="w-[95vw] md:w-[90vw] max-h-[80vh] overflow-hidden flex flex-col px-2 md:px-8">
<DialogContent
className="w-[95vw] md:w-[90vw] max-h-[80vh] overflow-hidden flex flex-col px-2 md:px-8"
data-testid="sidechain-task-modal"
>
<DialogHeader>
<DialogTitle>
{title.length > 100 ? `${title.slice(0, 100)}...` : title}

View File

@@ -1,4 +1,4 @@
import { Context, Effect, Layer } from "effect";
import { Context, Effect, Either, Layer } from "effect";
import type { ControllerResponse } from "../../../lib/effect/toEffectResponse";
import type { InferEffect } from "../../../lib/effect/types";
import { ProjectRepository } from "../../project/infrastructure/ProjectRepository";
@@ -23,9 +23,19 @@ const LayerImpl = Effect.gen(function* () {
}
const projectPath = project.meta.projectPath;
const branches = yield* gitService.getBranches(projectPath);
const branches = yield* Effect.either(
gitService.getBranches(projectPath),
);
if (Either.isLeft(branches)) {
return {
response: [],
status: 200,
} as const satisfies ControllerResponse;
}
return {
response: branches,
response: branches.right,
status: 200,
} as const satisfies ControllerResponse;
});
@@ -45,9 +55,17 @@ const LayerImpl = Effect.gen(function* () {
const projectPath = project.meta.projectPath;
const commits = yield* gitService.getCommits(projectPath);
const commits = yield* Effect.either(gitService.getCommits(projectPath));
if (Either.isLeft(commits)) {
return {
response: [],
status: 200,
} as const satisfies ControllerResponse;
}
return {
response: commits,
response: commits.right,
status: 200,
} as const satisfies ControllerResponse;
});