From 1847f5e43525d982b2869febda44bc2ac8751037 Mon Sep 17 00:00:00 2001 From: glary-bot Date: Sun, 4 Oct 2026 23:45:22 +0000 Subject: [PATCH] test(agent): harden PM-1954 composer regression test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing case asserted the posted content equalled the typed text, but attachments are inlined as @[Image: ...] references, so it failed against its own fix. Assert the text is contained, that all 36 references and all 36 attachment refs survive the send, and that a wheel over the capped chip area actually scrolls it — an overflow-hidden cap would hide the overflow instead of making it reachable, and passes every other assertion here. --- .../agentComposerManyAttachments.spec.ts | 58 ++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/browser_tests/tests/agent/agentComposerManyAttachments.spec.ts b/browser_tests/tests/agent/agentComposerManyAttachments.spec.ts index 365b752e19e..6a2d0780b61 100644 --- a/browser_tests/tests/agent/agentComposerManyAttachments.spec.ts +++ b/browser_tests/tests/agent/agentComposerManyAttachments.spec.ts @@ -1,9 +1,26 @@ import { expect } from '@playwright/test' -import { agentTest as test } from '@e2e/tests/agent/agentPanelMocks' import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute' +import { agentTest as test } from '@e2e/tests/agent/agentPanelMocks' // Regression for https://linear.app/comfyorg/issue/PM-1954 +// +// `composer-asset-section` grew without bound inside a panel that is a +// fixed-height `overflow-hidden` column, so attaching dozens of images drove +// the composer taller than the panel and left the action row — and the Send +// button on it — clipped below the panel's bottom edge with nothing scrollable +// to reach it. Enter was then the only way to send, so both halves of the +// report ("can't find Send" and "Enter won't send") are asserted together. +const ATTACHMENT_COUNT = 36 + +function pngAttachments(count: number) { + return Array.from({ length: count }, (_, index) => ({ + name: `attachment-${String(index + 1).padStart(2, '0')}.png`, + mimeType: 'image/png', + buffer: Buffer.from('image') + })) +} + test.describe( 'Agent composer with many attachments', { tag: ['@cloud', '@agent', '@ui'] }, @@ -26,23 +43,38 @@ test.describe( await agentPanel.selectWorkflow() await agentPanel.composer.fill('Use these images') - await agentPanel.fileInput.setInputFiles( - Array.from({ length: 36 }, (_, index) => ({ - name: `attachment-${String(index + 1).padStart(2, '0')}.png`, - mimeType: 'image/png', - buffer: Buffer.from('image') - })) - ) - await expect(agentPanel.attachmentChips).toHaveCount(36) - await expect(agentPanel.sendButton).toBeInViewport({ ratio: 1 }) + await agentPanel.fileInput.setInputFiles(pngAttachments(ATTACHMENT_COUNT)) + await expect(agentPanel.attachmentChips).toHaveCount(ATTACHMENT_COUNT) + + // Enabled proves the uploads settled; in viewport proves the action row + // survived the chips rather than being clipped past the panel. await expect(agentPanel.sendButton).toBeEnabled() + await expect(agentPanel.sendButton).toBeInViewport({ ratio: 1 }) + + // Capping the chips' height only helps if the user can still reach the + // ones it pushes out of sight, which a wheel over the section proves and + // an `overflow-hidden` cap would not. + await agentPanel.composerAssetSection.hover() + await page.mouse.wheel(0, 400) + await expect + .poll(() => + agentPanel.composerAssetSection.evaluate( + (element) => element.scrollTop + ) + ) + .toBeGreaterThan(0) await agentPanel.composer.press('Enter') await expect.poll(() => postedMessages).toHaveLength(1) - expect(JSON.parse(postedMessages[0])).toMatchObject({ - content: 'Use these images' - }) + const { content, attachments } = JSON.parse(postedMessages[0]) + expect(content).toContain('Use these images') + // The backend consumes `attachments`, so capping the chips' height must + // not drop the off-screen ones from either the text or that list. + expect([ + ...content.matchAll(/@\[Image: (attachment-\d+\.png)\]/g) + ]).toHaveLength(ATTACHMENT_COUNT) + expect(attachments).toHaveLength(ATTACHMENT_COUNT) }) } )