feat: enforce task title length limit (#2134)
This commit is contained in:
@@ -4,17 +4,24 @@ import path from "node:path";
|
||||
import { test, expect } from "../../fixtures/test-base";
|
||||
import { makeGitEnv } from "../../helpers/git-helper";
|
||||
|
||||
function expectedRemoteTitle(title: string): string {
|
||||
const characters = Array.from(title);
|
||||
return characters.length <= 60 ? title : `${characters.slice(0, 59).join("")}…`;
|
||||
}
|
||||
|
||||
test.describe("GitHub PR task launcher", () => {
|
||||
test("opens the create task dialog in Remote mode when the matching repo is a stale task worktree", async ({
|
||||
testPage,
|
||||
apiClient,
|
||||
seedData,
|
||||
backend,
|
||||
prCapture,
|
||||
}) => {
|
||||
const owner = "staleorg";
|
||||
const repo = "stalerepo";
|
||||
const prNumber = 1567;
|
||||
const prTitle = "Remote fallback PR";
|
||||
const prTitle =
|
||||
"Remote fallback PR with a title long enough to verify the task title ceiling is applied";
|
||||
const prURL = `https://github.com/${owner}/${repo}/pull/${prNumber}`;
|
||||
|
||||
await apiClient.mockGitHubReset();
|
||||
@@ -61,7 +68,9 @@ test.describe("GitHub PR task launcher", () => {
|
||||
await row.getByTestId("pr-start-task-trigger").click();
|
||||
await testPage.locator('[data-testid="pr-start-task-preset"][data-preset-id="review"]').click();
|
||||
|
||||
await expect(testPage.getByTestId("task-title-input")).toHaveValue(`Review: ${prTitle}`);
|
||||
const titleInput = testPage.getByTestId("task-title-input");
|
||||
await expect(titleInput).toHaveValue(expectedRemoteTitle(`Review: ${prTitle}`));
|
||||
await expect(titleInput).not.toHaveAttribute("maxlength");
|
||||
await expect(testPage.getByTestId("source-mode-remote")).toHaveAttribute(
|
||||
"aria-checked",
|
||||
"true",
|
||||
@@ -74,5 +83,8 @@ test.describe("GitHub PR task launcher", () => {
|
||||
`pull/${prNumber}`,
|
||||
);
|
||||
await expect(testPage.getByTestId("repo-chip")).toHaveCount(0);
|
||||
await prCapture.screenshot("desktop-task-title-limit", {
|
||||
caption: "Desktop remote PR task title truncated to the 60-character limit",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user