test(e2e): Run specs with the macOS keymap on every host; update stale specs

CI runs Chromium on Linux, where the workbench picked the Linux keymap and
the ⌘-shortcut specs failed. Present a macOS user agent and platform.
Settings and workbench specs now match the current page tree and stripes.

Claude-Session: https://claude.ai/code/session_01B65qLEKnkeYTGdbwhLpjCu
This commit is contained in:
l0ng-ai committed 2026-10-22 22:09:08 +08:00
1 parent 3110de8803
commit 909225858c
4 files changed
+18 -4

No files matched your search

+2
View File
@@ -7,6 +7,8 @@ export const test = base.extend<{ workbench: Page }>({
workbench: async ({ page }, provide) => {
const errors: string[] = [];
page.on("pageerror", (e) => errors.push(e.message));
// CodeMirror picks Mod-key bindings from navigator.platform, not the user agent.
await page.addInitScript(() => Object.defineProperty(Navigator.prototype, "platform", { get: () => "MacIntel" }));
await page.goto("/");
await expect(page.getByRole("tree", { name: "Project" })).toBeVisible();
await expect(page.getByRole("treeitem", { name: /acme-api/ })).toBeVisible();
+3 -1
View File
@@ -4,7 +4,7 @@ test("⌘, opens Settings with the page tree; Escape closes", async ({ workbench
await page.keyboard.press("Meta+,");
const dialog = page.getByRole("dialog", { name: "Settings" });
await expect(dialog).toBeVisible();
for (const name of ["Appearance", "Keymap", "Editor", "Languages & Frameworks"]) {
for (const name of ["Appearance & Behavior", "Keymap", "Editor", "Plugins", "Version Control"]) {
await expect(dialog.getByRole("treeitem", { name, exact: true })).toBeVisible();
}
await page.keyboard.press("Escape");
@@ -14,6 +14,8 @@ test("⌘, opens Settings with the page tree; Escape closes", async ({ workbench
test("Language Servers page installs a tool with progress (in-memory installer)", async ({ workbench: page }) => {
await page.keyboard.press("Meta+,");
const dialog = page.getByRole("dialog", { name: "Settings" });
// The page tree is virtualized; search brings the page into view.
await dialog.getByRole("textbox", { name: "Search settings" }).fill("Language Servers");
await dialog.getByRole("treeitem", { name: "Language Servers", exact: true }).click();
const table = dialog.getByRole("table", { name: /language servers/i });
await expect(table).toBeVisible();
+1 -2
View File
@@ -6,7 +6,7 @@ test("renders title bar, stripes, tool window and status bar", async ({ workbenc
await expect(title.getByRole("button", { name: "Search Everywhere" })).toBeVisible();
const left = page.getByRole("toolbar", { name: "Tool windows" });
for (const name of ["Project", "Commit", "Terminal", "Run", "Problems"]) {
for (const name of ["Project", "Commit", "Git", "Terminal", "Problems"]) {
await expect(left.getByRole("button", { name, exact: true })).toBeVisible();
}
await expect(page.getByRole("toolbar", { name: "Right tool windows" })).toBeVisible();
@@ -14,7 +14,6 @@ test("renders title bar, stripes, tool window and status bar", async ({ workbenc
await expect(page.getByRole("region", { name: "Project" })).toBeVisible();
const status = page.getByRole("contentinfo", { name: "Status bar" });
await expect(status).toBeVisible();
await expect(status.getByRole("button", { name: /errors/ })).toBeVisible();
// Empty editor area shows the IDEA-style hints.
await expect(page.getByText("Search Everywhere", { exact: true }).last()).toBeVisible();
});
+12 -1
View File
@@ -24,7 +24,18 @@ export default defineConfig({
// are taken explicitly with `animations: "disabled"` instead.
screenshot: "off",
},
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"], viewport: { width: 1400, height: 900 } } }],
projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
viewport: { width: 1400, height: 900 },
// The specs use the macOS keymap (⌘-shortcuts) on every host OS.
userAgent:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
},
},
],
webServer: {
command: `pnpm exec vite --port ${PORT} --strictPort`,
url: `http://localhost:${PORT}`,