Файли
openidea/e2e/dotnetSolutionFolders.spec.ts
T
LU XIANGRUIтаwildcatDownstairs 310d923480 feat(dotnet): show solution folders and solution items in the Project view (#7435)
Solution folders from .sln and .slnx files appear as nested nodes under the solution, holding their projects and solution items; projects outside every folder follow.

Parent folders an SLNX file only implies are created, literal slashes in legacy folder names are kept, and uppercase .SLNX extensions are accepted.

Co-authored-by: wildcatDownstairs <[email protected]>
2026-12-02 18:19:58 +08:00

71 рядки
2.7 KiB
TypeScript

/**
* Solution folders and solution items in the Project view (#7431), from a stubbed workspace model;
* `src/platform/dotnetSolutionFolders.test.ts` covers parsing `.sln` / `.slnx`.
*/
import { expect, stubDesktop, test } from "./fixtures";
const SHOTS = process.env.E2E_SHOTS;
test("nested solution folders hold projects and solution items that open in the editor", async ({
workbench: page,
}) => {
await stubDesktop(page);
await page.evaluate(async () => {
const storeModule = "/src/features/dotnet/store.ts";
const { useDotnet } = await import(/* @vite-ignore */ storeModule);
const project = (path: string, name: string) => ({
path,
name,
frameworks: ["net9.0"],
configurations: ["Debug"],
references: [],
packages: [],
test: false,
runner: "vstest",
adapter: "mstest",
trx: false,
});
useDotnet.setState({
model: {
projects: [
project("/dev/acme-api/src/libs/Core/Core.csproj", "Core"),
project("/dev/acme-api/App/App.csproj", "App"),
],
solutions: [
{
path: "/dev/acme-api/Acme.slnx",
projects: ["/dev/acme-api/src/libs/Core/Core.csproj", "/dev/acme-api/App/App.csproj"],
folders: [
{
path: ["src", "libs"],
files: ["/dev/acme-api/README.md"],
projects: ["/dev/acme-api/src/libs/Core/Core.csproj"],
},
{ path: ["src", "libs", "core"], files: [], projects: [] },
],
},
],
},
});
});
const tree = page.getByRole("tree", { name: "Project" });
await tree.getByRole("treeitem", { name: /Solution 'Acme'/ }).click();
await page.keyboard.press("ArrowRight");
for (const folder of ["src", "libs"]) {
const node = tree.getByRole("treeitem", { name: folder, exact: true }).first();
await node.click();
await page.keyboard.press("ArrowRight");
}
await expect(tree.getByRole("treeitem", { name: "core", exact: true })).toBeVisible();
await expect(tree.getByRole("treeitem", { name: "Core", exact: true })).toBeVisible();
// The project outside every folder stays at the solution's top level.
await expect(tree.getByRole("treeitem", { name: "App", exact: true })).toBeVisible();
if (SHOTS) await page.screenshot({ path: `${SHOTS}/b3-solution-folders.png`, animations: "disabled" });
// A solution item is a file node: it opens in the editor.
const item = tree.getByRole("treeitem", { name: "README.md", exact: true }).first();
await item.dblclick();
await expect(
page.getByRole("tablist", { name: "Editor tabs" }).getByRole("tab", { name: "README.md" }),
).toBeVisible();
});