mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-18 16:08:55 +00:00
- New Task page: a narrower box with room for a few lines, a lighter heading, and the project, checkout and branch as one quiet line under the box. The agent shows as its icon (name and version in its tooltip); the probe line shows only when the agent fails. - Composer: one + menu for referencing a file, attaching an image and MCP servers; the MCP popover opens from it or /mcp. The current-file chip turns IDE context on and off. - Model and effort: the model button opens one searchable list of model names (pin on hover, context size above it); effort is its own picker beside the model. - Session: the status line moves under the box as one line — branch and worktree on the left, changes, context use, time and terminal on the right; "Ready" is no longer shown.
82 lines
2.9 KiB
TypeScript
82 lines
2.9 KiB
TypeScript
import type { Page } from "@playwright/test";
|
|
import { expect, test } from "./fixtures";
|
|
|
|
test.beforeEach(async ({ workbench: page }) => {
|
|
await page.evaluate(async () => {
|
|
// Load the IPC module in Vite's browser realm, not Playwright's Node process.
|
|
const ipcPath = "/src/platform/ipc.ts";
|
|
const { commands } = await import(ipcPath);
|
|
const provider = {
|
|
id: "omp",
|
|
name: "OMP",
|
|
command: "omp acp",
|
|
program: "omp",
|
|
args: ["acp"],
|
|
defaultProgram: null,
|
|
defaultArgs: [],
|
|
loginHint: null,
|
|
commandOverridden: false,
|
|
commandEditable: true,
|
|
commandReadOnlyReason: null,
|
|
installed: true,
|
|
env: {},
|
|
commands: [],
|
|
source: { kind: "custom" },
|
|
config: [],
|
|
thoughtLevels: {},
|
|
};
|
|
let installed = "18.20.0";
|
|
let cached = installed;
|
|
window.addEventListener("test:agent-upgraded", () => {
|
|
installed = "18.20.2";
|
|
});
|
|
commands.agentProviders = async () => ({ status: "ok", data: [provider] });
|
|
commands.agentProbe = async (id: string, refresh: boolean) => {
|
|
if (refresh) cached = installed;
|
|
return {
|
|
status: "ok",
|
|
data: { provider: id, name: "omp", version: cached, protocol: "ACP v1", error: null },
|
|
};
|
|
};
|
|
commands.agentRefreshModels = async () => ({
|
|
status: "ok",
|
|
data: {
|
|
provider: "omp",
|
|
config: [],
|
|
thoughtLevels: {},
|
|
refreshing: false,
|
|
refreshedAtMs: Date.now(),
|
|
retryAtMs: null,
|
|
error: null,
|
|
},
|
|
});
|
|
});
|
|
await page.getByRole("button", { name: "Agents", exact: true }).click();
|
|
await page.getByRole("button", { name: "New Agent Task", exact: true }).click();
|
|
await expectVersion(page, "18.20.0");
|
|
});
|
|
|
|
test("refreshes an upgraded agent's version on window focus without losing the draft", async ({ workbench: page }) => {
|
|
const message = page.getByRole("textbox", { name: "Message", exact: true });
|
|
await message.focus();
|
|
await page.keyboard.insertText("Keep this unsent draft");
|
|
await page.evaluate(() => {
|
|
window.dispatchEvent(new Event("test:agent-upgraded"));
|
|
window.dispatchEvent(new Event("focus"));
|
|
});
|
|
await expectVersion(page, "18.20.2");
|
|
await expect(message).toHaveText("Keep this unsent draft");
|
|
});
|
|
|
|
test("refreshes an upgraded agent's version when New Task is reopened", async ({ workbench: page }) => {
|
|
await page.getByRole("button", { name: "Close Tab", exact: true }).click();
|
|
await page.evaluate(() => window.dispatchEvent(new Event("test:agent-upgraded")));
|
|
await page.getByRole("button", { name: "New Agent Task", exact: true }).click();
|
|
await expectVersion(page, "18.20.2");
|
|
});
|
|
|
|
/** The agent picker shows its icon; its name and version are in its tooltip. */
|
|
async function expectVersion(page: Page, version: string) {
|
|
await expect(page.locator(`[data-tooltip$=" ${version}"]`).filter({ visible: true })).toHaveCount(1);
|
|
}
|