Files
workinf_Blender_Wasm/web/tests/e2e/ui-context.spec.ts
mes123456 0fe8d2bb56
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
Advance M8-M11 parity workflows
2026-08-17 04:37:07 -04:00

48 lines
2.1 KiB
TypeScript

import { expect, test } from "@playwright/test";
test("M7-13 keeps menu, modal Escape and focus return consistent", async ({ page }) => {
await page.goto("/");
await expect(page.getByTestId("engine-status")).toContainText("ready, open a .blend file", { timeout: 20_000 });
const searchTrigger = page.getByRole("button", { name: "操作搜索" });
const fileMenu = page.getByRole("button", { name: "文件", exact: true });
await page.keyboard.press("Tab");
await expect(fileMenu).toBeFocused();
await searchTrigger.focus();
await page.keyboard.press("F3");
const dialog = page.getByRole("dialog", { name: "Operator Search" });
await expect(dialog).toBeVisible();
await expect(page.getByRole("textbox", { name: "搜索操作" })).toBeFocused();
await page.keyboard.press("Tab");
await page.keyboard.press("Shift+Tab");
await expect(page.getByRole("textbox", { name: "搜索操作" })).toBeFocused();
await page.keyboard.press("Escape");
await expect(dialog).toHaveCount(0);
await expect(searchTrigger).toBeFocused();
await fileMenu.click();
const menu = page.getByRole("menu", { name: "文件" });
await expect(menu).toBeVisible();
await expect(page.getByRole("menuitem", { name: "打开" })).toBeFocused();
await page.keyboard.press("ArrowDown");
await expect(page.getByRole("menuitem", { name: "保存" })).toBeFocused();
await page.keyboard.press("End");
await expect(page.getByRole("menuitem", { name: "关闭" })).toBeFocused();
await page.keyboard.press("Home");
await expect(page.getByRole("menuitem", { name: "打开" })).toBeFocused();
await page.keyboard.press("Escape");
await expect(menu).toHaveCount(0);
await expect(fileMenu).toBeFocused();
await fileMenu.click();
await page.keyboard.press("Tab");
await expect(menu).toHaveCount(0);
await expect(fileMenu).toBeFocused();
await fileMenu.click();
await page.getByRole("button", { name: "操作搜索" }).click();
await expect(page.getByRole("menu", { name: "文件" })).toHaveCount(0);
await expect(dialog).toBeVisible();
await page.keyboard.press("Escape");
await expect(searchTrigger).toBeFocused();
});