(runDir: string)
| 109 | ); |
| 110 | |
| 111 | const run = async (runDir: string) => { |
| 112 | const home = mkdtempSync(join(tmpdir(), "executor-repro-1125-")); |
| 113 | const app = await launchDesktop(home); |
| 114 | try { |
| 115 | const page = await app.firstWindow({ timeout: 120_000 }); |
| 116 | await page.waitForLoadState("domcontentloaded"); |
| 117 | |
| 118 | // The offset is gated on this class; without it the assertions below would |
| 119 | // be meaningless, so prove it is active before trusting them. |
| 120 | const isMacDesktop = await page.evaluate(() => |
| 121 | document.documentElement.classList.contains("executor-desktop-macos"), |
| 122 | ); |
| 123 | expect(isMacDesktop, "renderer applied the macOS desktop class").toBe(true); |
| 124 | |
| 125 | // Try to shrink below the mobile breakpoint. The minWidth fix must clamp the |
| 126 | // window at 768, so the desktop can never drop into the mobile layout. We ask |
| 127 | // for 700 (the old reachable band) and assert it clamps up. |
| 128 | const clampedWidth = await app.evaluate(async ({ BrowserWindow }) => { |
| 129 | const win = BrowserWindow.getAllWindows()[0]!; |
| 130 | win.setPosition(60, 40); |
| 131 | win.setSize(700, 800); |
| 132 | win.show(); |
| 133 | win.focus(); |
| 134 | return win.getSize()[0]; |
| 135 | }); |
| 136 | expect( |
| 137 | clampedWidth, |
| 138 | `window cannot shrink below the mobile breakpoint (clamped to ${clampedWidth}px)`, |
| 139 | ).toBeGreaterThanOrEqual(MIN_WIDTH); |
| 140 | |
| 141 | const sidebar = page.locator("aside.desktop-macos-sidebar"); |
| 142 | await sidebar.waitFor({ timeout: 60_000 }); |
| 143 | await sleep(800); |
| 144 | |
| 145 | // Part 1: at the minimum width the mobile phone bar must NOT be shown, so |
| 146 | // its hamburger can never land under the lights. |
| 147 | const hamburgerVisible = await page |
| 148 | .getByRole("button", { name: "Open navigation" }) |
| 149 | .isVisible(); |
| 150 | expect(hamburgerVisible, "mobile hamburger bar is hidden on the desktop at minimum width").toBe( |
| 151 | false, |
| 152 | ); |
| 153 | const sidebarVisible = await sidebar.isVisible(); |
| 154 | expect(sidebarVisible, "desktop sidebar is visible at minimum width").toBe(true); |
| 155 | |
| 156 | await captureBoth(page, runDir, "01-sidebar-header"); |
| 157 | |
| 158 | // Part 2a: the brand wordmark clears the traffic-light cluster. |
| 159 | const header = sidebar.locator(".desktop-macos-titlebar"); |
| 160 | const brand = await box(header.locator("a").first(), "sidebar brand"); |
| 161 | expect( |
| 162 | Math.round(brand.x), |
| 163 | `sidebar brand left edge (${Math.round(brand.x)}px) clears the lights (>= ${TRAFFIC_LIGHTS_RIGHT}px)`, |
| 164 | ).toBeGreaterThanOrEqual(TRAFFIC_LIGHTS_RIGHT); |
| 165 | |
| 166 | // Part 2b: the server-connection menu sits clear of the brand (no collision |
| 167 | // with the "Beta" badge, the bug in the screenshot) and stays inside the |
| 168 | // sidebar. |
no test coverage detected