* fix(ci): skip unrelated required checks cleanly Matrix jobs had to start no-op runners to preserve interpolated required-check names. Static named jobs let GitHub report genuine skipped conclusions while keeping those names stable. * fix(ci): gate changes to install patching script * fix(ci): route cross-package test contracts narrowly * fix(ci): keep routed contracts merge-blocking * fix(server): exclude nested test utilities from builds * fix(ci): cover app-owned native and browser domains * refactor(ci): align tests with runtime domains Own browser specs, desktop specs, and Electron-only app code by stable directories so PR routing does not depend on filename conventions. Keep desktop integration coverage inside the required desktop check. * fix(ci): keep routing and desktop suites isolated The routing regression must run before dependency installation, and desktop Vitest must not collect Playwright-owned specs. * fix(ci): isolate desktop e2e runtime * perf(test): isolate Playwright workers * perf(test): parallelize Playwright within specs * fix(test): keep Playwright file scheduling * fix(test): share dynamic Metro fixture * fix(test): preserve own-host restart fixtures * fix(ci): preserve routed contracts after rebase * Stabilize Playwright wheel-scroll assertions
102 lines
3.1 KiB
TypeScript
102 lines
3.1 KiB
TypeScript
import { expect, test, type Page } from "../support/fixtures";
|
|
|
|
const modifier = process.platform === "darwin" ? "Meta" : "Control";
|
|
|
|
async function pressFocusModeShortcut(page: Page) {
|
|
await page.keyboard.press(`${modifier}+Shift+F`);
|
|
}
|
|
|
|
async function pressSettingsShortcut(page: Page) {
|
|
await page.keyboard.press(`${modifier}+Comma`);
|
|
}
|
|
|
|
async function pressRightSidebarShortcut(page: Page) {
|
|
await page.keyboard.press(`${modifier}+E`);
|
|
}
|
|
|
|
async function returnToWorkspace(page: Page, workspaceUrl: string) {
|
|
await page.goto(workspaceUrl);
|
|
}
|
|
|
|
async function blurActiveElement(page: Page) {
|
|
await page.evaluate(() => (document.activeElement as HTMLElement | null)?.blur());
|
|
}
|
|
|
|
function exitFocusModeButton(page: Page) {
|
|
return page.getByRole("button", { name: "Exit focus mode" });
|
|
}
|
|
|
|
async function enterFocusMode(page: Page) {
|
|
await blurActiveElement(page);
|
|
await pressFocusModeShortcut(page);
|
|
await expect(exitFocusModeButton(page)).toBeVisible();
|
|
}
|
|
|
|
test("sidebar shortcuts exit focus mode and execute their action", async ({
|
|
page,
|
|
withWorkspace,
|
|
}) => {
|
|
const workspace = await withWorkspace({ prefix: "focus-mode-sidebar-shortcut-" });
|
|
await workspace.navigateTo();
|
|
await enterFocusMode(page);
|
|
|
|
await pressRightSidebarShortcut(page);
|
|
|
|
await expect(exitFocusModeButton(page)).toHaveCount(0);
|
|
await expect(page.getByText("Changes", { exact: true })).toBeVisible();
|
|
});
|
|
|
|
test("sidebar shortcuts outside a workspace preserve its focus mode", async ({
|
|
page,
|
|
withWorkspace,
|
|
}) => {
|
|
const workspace = await withWorkspace({ prefix: "focus-mode-sidebar-boundary-" });
|
|
await workspace.navigateTo();
|
|
await enterFocusMode(page);
|
|
const workspaceUrl = page.url();
|
|
|
|
await pressSettingsShortcut(page);
|
|
await expect(page.getByRole("navigation", { name: "Settings" })).toBeVisible();
|
|
|
|
await pressRightSidebarShortcut(page);
|
|
await returnToWorkspace(page, workspaceUrl);
|
|
|
|
await expect(exitFocusModeButton(page)).toBeVisible();
|
|
});
|
|
|
|
test("focus mode only applies to the active workspace screen", async ({ page, withWorkspace }) => {
|
|
const workspace = await withWorkspace({ prefix: "focus-mode-boundary-" });
|
|
await workspace.navigateTo();
|
|
const exitFocusMode = exitFocusModeButton(page);
|
|
const settingsButton = page.getByRole("button", { name: "Settings", exact: true });
|
|
const settingsSidebar = page.getByRole("navigation", { name: "Settings" });
|
|
|
|
await expect(settingsButton).toBeVisible();
|
|
await expect(exitFocusMode).toHaveCount(0);
|
|
|
|
await blurActiveElement(page);
|
|
await pressFocusModeShortcut(page);
|
|
|
|
await expect(exitFocusMode).toBeVisible();
|
|
await expect(settingsButton).toHaveCount(0);
|
|
const workspaceUrl = page.url();
|
|
|
|
await pressSettingsShortcut(page);
|
|
|
|
await expect(settingsSidebar).toBeVisible();
|
|
await expect(exitFocusMode).toHaveCount(0);
|
|
|
|
await page.reload();
|
|
await expect(settingsSidebar).toBeVisible();
|
|
await expect(exitFocusMode).toHaveCount(0);
|
|
|
|
await pressFocusModeShortcut(page);
|
|
await returnToWorkspace(page, workspaceUrl);
|
|
|
|
await expect(exitFocusMode).toBeVisible();
|
|
await exitFocusMode.click();
|
|
|
|
await expect(exitFocusMode).toHaveCount(0);
|
|
await expect(settingsButton).toBeVisible();
|
|
});
|