fix(webui): use file-type icons in file change activity
This commit is contained in:
1 parent
d076e4ef13
commit
8de03ac0a2
8 files changed
+132
-68
No files matched your search
@@ -162,7 +162,7 @@ describe("AgentActivityCluster", () => {
|
||||
expect(screen.getByText(`Reading file ${path}`)).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("Using Blender, --json --background scene.blend")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("Opening example.com, Browserbase")).toBeInTheDocument();
|
||||
expect(screen.getByText("Edited")).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Edited", exact: true })).toBeInTheDocument();
|
||||
expect(screen.getByTestId("activity-file-reference")).toHaveTextContent(path);
|
||||
|
||||
await act(async () => setAppLanguage("zh-CN"));
|
||||
@@ -171,7 +171,7 @@ describe("AgentActivityCluster", () => {
|
||||
expect(screen.getByText(`正在读取文件 ${path}`)).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("正在使用 Blender, --json --background scene.blend")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("正在打开 example.com, Browserbase")).toBeInTheDocument();
|
||||
expect(screen.getByText("编辑")).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "编辑", exact: true })).toBeInTheDocument();
|
||||
expect(screen.getByTestId("activity-file-reference")).toHaveTextContent(path);
|
||||
|
||||
await act(async () => setAppLanguage("ja"));
|
||||
@@ -180,8 +180,9 @@ describe("AgentActivityCluster", () => {
|
||||
expect(screen.getByText(`${path} ファイルを読み取り中`)).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("Blender を使用中, --json --background scene.blend")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("example.com 開いています, Browserbase")).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "編集", exact: true })).toBeInTheDocument();
|
||||
expect(screen.getByTestId("activity-file-reference").closest('[data-testid="activity-step"]'))
|
||||
.toHaveTextContent(`${path} 編集`);
|
||||
.toHaveAttribute("aria-label", `${path} 編集`);
|
||||
});
|
||||
|
||||
it("loads deferred trace details only after completed activity is expanded", async () => {
|
||||
@@ -535,7 +536,7 @@ describe("AgentActivityCluster", () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
assertBetween(screen.getByText("Editing"));
|
||||
assertBetween(screen.getByRole("img", { name: "Editing", exact: true }));
|
||||
|
||||
rerender(
|
||||
<AgentActivityCluster
|
||||
@@ -545,7 +546,7 @@ describe("AgentActivityCluster", () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
assertBetween(screen.getByText("Edited"));
|
||||
assertBetween(screen.getByRole("img", { name: "Edited", exact: true }));
|
||||
});
|
||||
|
||||
it.each(["diff", "collapsed_diff"] as const)(
|
||||
@@ -676,7 +677,7 @@ describe("AgentActivityCluster", () => {
|
||||
expect(screen.getByTestId("file-edit-diff")).toBeInTheDocument();
|
||||
expect(screen.getByText("return <Old />;")).toBeInTheDocument();
|
||||
expect(screen.getByText("return <New />;")).toBeInTheDocument();
|
||||
expect(screen.getByText("Edited")).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Edited", exact: true })).toBeInTheDocument();
|
||||
expect(screen.getByTestId("activity-file-reference")).toHaveTextContent("src/app.tsx");
|
||||
expect(screen.getAllByTestId("activity-diff-pair")).toHaveLength(1);
|
||||
|
||||
@@ -684,7 +685,7 @@ describe("AgentActivityCluster", () => {
|
||||
writeLocalPreferences({ ...DEFAULT_LOCAL_PREFS, fileEditDisplayMode: "summary" });
|
||||
});
|
||||
expect(screen.queryByTestId("file-edit-diff")).not.toBeInTheDocument();
|
||||
expect(screen.getByText("Edited")).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Edited", exact: true })).toBeInTheDocument();
|
||||
|
||||
act(() => {
|
||||
writeLocalPreferences({ ...DEFAULT_LOCAL_PREFS, fileEditDisplayMode: "diff" });
|
||||
@@ -977,9 +978,10 @@ describe("AgentActivityCluster", () => {
|
||||
hasBodyBelow={false}
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByText("Created")).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Created", exact: true }).querySelector("svg"))
|
||||
.toHaveClass("lucide-file-text");
|
||||
expect(screen.getByLabelText("Created tmp.txt")).toBeInTheDocument();
|
||||
expect(screen.queryByText("Edited")).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("img", { name: "Edited", exact: true })).not.toBeInTheDocument();
|
||||
expect(screen.getByTestId("activity-file-reference")).toHaveTextContent("tmp.txt");
|
||||
expect(!!screen.queryByTestId("file-edit-diff")).toBe(hasDiff);
|
||||
} finally {
|
||||
@@ -1015,8 +1017,9 @@ describe("AgentActivityCluster", () => {
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: /^Worked/ }));
|
||||
|
||||
expect(screen.getByText("Deleted")).toBeInTheDocument();
|
||||
expect(screen.queryByText("Edited")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Deleted", exact: true }).querySelector("svg"))
|
||||
.toHaveClass("lucide-file-code2");
|
||||
expect(screen.queryByRole("img", { name: "Edited", exact: true })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders file-only edits without a redundant disclosure", () => {
|
||||
@@ -1048,8 +1051,11 @@ describe("AgentActivityCluster", () => {
|
||||
|
||||
expect(screen.queryByRole("button", { name: /edited app\.tsx/i })).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId("agent-activity-content")).not.toBeInTheDocument();
|
||||
expect(screen.getByText("Edited")).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Edited", exact: true })).toBeInTheDocument();
|
||||
expect(screen.queryByTestId("activity-header-file-reference")).not.toBeInTheDocument();
|
||||
const marker = screen.getByRole("img", { name: "Edited", exact: true });
|
||||
expect(marker.querySelector("svg")).toHaveClass("lucide-file-code2");
|
||||
expect(marker.closest('[data-testid="activity-step"]')?.querySelectorAll("svg")).toHaveLength(1);
|
||||
expect(screen.getByTestId("activity-file-reference")).toHaveTextContent("src/app.tsx");
|
||||
expect(screen.getByText("+12")).toBeInTheDocument();
|
||||
expect(screen.getByText("-3")).toBeInTheDocument();
|
||||
@@ -1798,7 +1804,7 @@ describe("AgentActivityCluster", () => {
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: /^Worked/ }));
|
||||
|
||||
expect(screen.getByText("Edited")).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Edited", exact: true })).toBeInTheDocument();
|
||||
expect(screen.queryByText("+0")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("-0")).not.toBeInTheDocument();
|
||||
});
|
||||
@@ -1893,7 +1899,7 @@ describe("AgentActivityCluster", () => {
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: /^Worked/ }));
|
||||
|
||||
const row = screen.getByText("Could not edit").closest('[data-testid="activity-step"]');
|
||||
const row = screen.getByRole("img", { name: "Could not edit", exact: true }).closest('[data-testid="activity-step"]');
|
||||
expect(row).toBeInTheDocument();
|
||||
expect(row).not.toHaveAttribute("title");
|
||||
expect(screen.queryByText("Target text was not found in angry-birds.html.")).not.toBeInTheDocument();
|
||||
@@ -1927,7 +1933,7 @@ describe("AgentActivityCluster", () => {
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: /^Worked/ }));
|
||||
|
||||
const row = screen.getByText("Could not edit").closest('[data-testid="activity-step"]');
|
||||
const row = screen.getByRole("img", { name: "Could not edit", exact: true }).closest('[data-testid="activity-step"]');
|
||||
expect(row).toBeInTheDocument();
|
||||
expect(row).not.toHaveAttribute("title");
|
||||
expect(screen.queryByText("No permission to change this location.")).not.toBeInTheDocument();
|
||||
@@ -2008,7 +2014,7 @@ describe("AgentActivityCluster", () => {
|
||||
const fileRefs = screen.getAllByTestId("activity-file-reference");
|
||||
expect(fileRefs).toHaveLength(3);
|
||||
expect(fileRefs.every((ref) => ref.textContent?.includes("minecraft-fps/index.html"))).toBe(true);
|
||||
const failedRow = screen.getByText("Could not edit").closest(
|
||||
const failedRow = screen.getByRole("img", { name: "Could not edit", exact: true }).closest(
|
||||
'[data-testid="activity-step"]',
|
||||
);
|
||||
expect(failedRow).toBeInTheDocument();
|
||||
@@ -2066,8 +2072,8 @@ describe("AgentActivityCluster", () => {
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: /^Worked/ }));
|
||||
|
||||
expect(screen.getByText("Edited")).toBeInTheDocument();
|
||||
expect(screen.getByText("Could not edit")).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Edited", exact: true })).toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Could not edit", exact: true })).toBeInTheDocument();
|
||||
expect(screen.getAllByTestId("activity-file-reference")).toHaveLength(2);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user