Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(desktop-app): r1-h1 drive the narrow-drawer e2e via the real dock affordance
Diego Zacarias19b656192399
diff --git a/desktop-app/test/e2e-playwright/chat-drawer-narrow-flyouts.test.ts b/desktop-app/test/e2e-playwright/chat-drawer-narrow-flyouts.test.tsindex c16d76e33..d662b05ab 100644--- a/desktop-app/test/e2e-playwright/chat-drawer-narrow-flyouts.test.ts+++ b/desktop-app/test/e2e-playwright/chat-drawer-narrow-flyouts.test.ts@@ -2,20 +2,25 @@//// Real-layout guard for the narrow chat DRAWER (min width 340px): the composer// reference submenu (.composer-reference-submenu) and the agent selector menu-// (.agent-title-selector-menu, incl. its nested submenu) must render fully and be-// operable, not cropped by the drawer's overflow-clipping ancestors or occluded-// by the native embed that paints to the drawer's left. The unit suite runs under-// jsdom (no layout), so this is the only lane that can assert actual on-screen-// rects. It needs the live external-rest-api + a docked chat drawer, so it runs-// only via `npm run test:e2e:playwright` against a cluster port-forward — it is-// NOT part of the vitest unit suite.+// (.agent-title-selector-menu, incl. its nested submenu) must render fully and+// stay CONFINED to the drawer — not cropped by the drawer's overflow-clipping+// ancestors, and not spilling past the drawer's right edge over the tab content+// to its left (on the apps route that content is the native embed). The unit+// suite runs under jsdom (no layout), so this is the only lane that can assert+// actual on-screen rects. It needs the live external-rest-api + a docked chat+// drawer, so it runs only via `npm run test:e2e:playwright` against a cluster+// port-forward — it is NOT part of the vitest unit suite.//-// NOTE (unrun): the "dock a chat into the drawer" step below depends on the-// packaged app's docked-drawer entry flow, which cannot be validated here without-// a live cluster. Confirm the dock affordance (the `dock-chat-drawer` testid used-// below) against the real harness before relying on this spec; the assertions-// themselves are harness-independent.+// Dock flow: the chat drawer is only available over a NON-chat tab (App.tsx+// `drawerAvailable`; on a chat tab the chat IS the content and the toggle is an+// inert placeholder). So we open a chat with the agent, switch to the Files tab+// — which keeps the active `selectedAgent` (only the chat/agents routes clear+// it, useNavigationController.handleNavSelect), so the real header toggle+// (`chat-drawer-toggle`, HeaderActions) renders — and click it. That docks the+// active conversation into `.chat-drawer` (App.tsx `openChatDrawer`). The+// assertions themselves are harness-independent.import { expect, test } from './fixtures.js'+import { openResourcesNavItem } from './navigationHelpers.js'import { enterChatllmChat as enterAgentChat } from './workflowAgentChatTools.js'const DRAWER = '.chat-drawer'@@ -57,13 +62,23 @@ test.describe('narrow chat drawer flyouts', () => {test('composer submenu and agent menu render fully inside the 340px drawer', async ({appPage,}) => {+ // Open a chat so an agent + conversation is active. On a chat tab the chat+ // IS the content, so the drawer is not available here yet.await enterAgentChat(appPage)- // Dock the active conversation into the right-side chat drawer. Replace with- // the harness's real dock affordance if this id differs.- const dockButton = appPage.locator('[data-testid="dock-chat-drawer"]')- if (await dockButton.count()) {- await dockButton.first().click()- }++ // Switch to the Files tab: a non-chat tab where `drawerAvailable` is true, so+ // the real header toggle renders. Navigating to Files keeps the active agent+ // (only the chat/agents routes clear `selectedAgent`), so docking below+ // surfaces the conversation opened above rather than a blank drawer.+ await openResourcesNavItem(appPage, 'nav-files')++ // Dock the active conversation into the right-side chat drawer via the real+ // header toggle. `toBeVisible()` fails if the affordance is absent — no+ // silent no-op — so the spec can never green without actually reaching the+ // drawer.+ const drawerToggle = appPage.getByTestId('chat-drawer-toggle')+ await expect(drawerToggle).toBeVisible()+ await drawerToggle.click()await expect(appPage.locator(DRAWER)).toBeVisible()await shrinkDrawerToMinimum(appPage)@@ -87,7 +102,8 @@ test.describe('narrow chat drawer flyouts', () => {await expect(submenu).toBeVisible()const submenuRect = await rectOf(appPage, '.composer-reference-submenu')// Fully on screen: within the viewport and to the right of the drawer's left- // edge (so it is off the embed that sits to the drawer's left).+ // edge (so it is off the content that sits to the drawer's left; on the apps+ // route that content is the native embed).expect(submenuRect.left).toBeGreaterThanOrEqual(0)expect(submenuRect.right).toBeLessThanOrEqual(viewportWidth)expect(submenuRect.left).toBeGreaterThanOrEqual(drawerRect.left - 1)@@ -101,12 +117,20 @@ test.describe('narrow chat drawer flyouts', () => {expect(menuRect.left).toBeGreaterThanOrEqual(0)expect(menuRect.right).toBeLessThanOrEqual(viewportWidth)- // Expand a row's sections submenu; confined, it must stay within the menu.+ // Expand a row's sections submenu; confined, it must stay within the drawer.await appPage.locator('.agent-title-selector-row-dots').first().click()const nested = appPage.locator('.agent-title-selector-submenu')await expect(nested).toBeVisible()const nestedRect = await rectOf(appPage, '.agent-title-selector-submenu')- expect(nestedRect.left).toBeGreaterThanOrEqual(0)- expect(nestedRect.right).toBeLessThanOrEqual(viewportWidth)+ // Confined to the DRAWER, not merely the viewport. Bounding the nested+ // submenu to the drawer's horizontal rect is what distinguishes a+ // drawer-bounded flyout from a viewport-bounded one — the useFlyoutPosition+ // regression where the portaled submenu clamped to the viewport and spilled+ // past the drawer's LEFT edge onto the content to its left. The left bound+ // is the real discriminant: the right-docked drawer sits at the viewport's+ // right edge, so the right bound nearly coincides with viewport width and+ // barely constrains. 1px tolerance on each edge for sub-pixel rounding.+ expect(nestedRect.left).toBeGreaterThanOrEqual(drawerRect.left - 1)+ expect(nestedRect.right).toBeLessThanOrEqual(drawerRect.right + 1)})})