Files
openidea/e2e/pluginEndpoints.spec.ts
T
l0ng-ai d171a946fe fix(editor): Spring, endpoint, npm, Docker and plugin gutter icons join the shared icon area (#3472)
Following #3452, the remaining line-marker kinds kept a gutter column each (a Spring controller showed its mapping icons in a second column beside the run icon). Scripts and Docker/Compose targets join the run icons in the shared icon area (hidden with them), Spring mappings and endpoints follow, then plugin line markers, gutter actions and indexed mappings (now 14px like the others). Presses go to the pressed icon's source.
2026-11-15 10:31:42 +08:00

64 lines
2.8 KiB
TypeScript

import { doubleShift, expect, test } from "./fixtures";
test("plugin routes feed search, HTTP completion and the declaration gutter and disappear on removal", async ({
workbench: page,
}) => {
await page.evaluate(async () => {
const c = "/src/workbench/contributions.ts";
const b = "/src/editor/core/backend.ts";
const { registerEndpointProvider, editorService } = await import(c);
const { docBackend } = await import(b);
docBackend().files.set("/dev/acme-api/routes.txt", "route declaration\n");
docBackend().files.set("/dev/acme-api/routes.http", "GET {{host}}/pe");
(window as unknown as { removeRoutes: () => void }).removeRoutes = registerEndpointProvider({
id: "plugin:routes:test",
endpoints: async (root: string) =>
root === "/dev/acme-api"
? [
{
method: "*",
url: "/people/{id}",
framework: "Rails",
handler: "People#show",
pluginId: "routes",
controller: "Rails",
methodName: "People#show",
path: "/dev/acme-api/routes.txt",
rel: "routes.txt",
line: 0,
col: 0,
},
]
: [],
});
await editorService().openFile("/dev/acme-api/routes.txt");
});
await expect(page.locator('.cm-openidea-iconArea button[title="Open in HTTP Client"]')).toBeVisible();
await doubleShift(page);
const search = page.getByRole("dialog", { name: "Search Everywhere" });
await search.getByRole("combobox").fill("/people");
await expect(search.getByRole("option", { name: /people/ })).toBeVisible();
await page.keyboard.press("Escape");
await page.evaluate(async () => {
const path = "/src/workbench/contributions.ts";
await (await import(path)).editorService().openFile("/dev/acme-api/routes.http");
});
const content = page.locator(".cm-content").last();
await content.click();
await page.keyboard.press("Meta+End");
await page.keyboard.press("Control+Space");
await expect(page.locator(".cm-tooltip-autocomplete").getByText("/people/{{id}}", { exact: true })).toBeVisible();
await page.keyboard.press("Escape");
await doubleShift(page);
await search.getByRole("combobox").fill("/people");
await expect(search.getByRole("option", { name: /people/ })).toBeVisible();
await page.evaluate(() => (window as unknown as { removeRoutes: () => void }).removeRoutes());
await expect(search.getByRole("option", { name: /people/ })).toBeHidden();
await page.keyboard.press("Escape");
await page.evaluate(async () => {
const path = "/src/workbench/contributions.ts";
await (await import(path)).editorService().openFile("/dev/acme-api/routes.txt");
});
await expect(page.locator('.cm-openidea-iconArea button[title="Open in HTTP Client"]')).toBeHidden();
});