From 7c705123eac09788785a4577a005b0e6f226435b Mon Sep 17 00:00:00 2001 From: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@buzz.block.builderlab.xyz> Date: Mon, 3 Aug 2026 18:18:16 -0700 Subject: [PATCH] test(composer): assert asynchronous preview paste Co-authored-by: Taylor Ho Signed-off-by: Taylor Ho --- desktop/tests/e2e/messaging.spec.ts | 41 ++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/desktop/tests/e2e/messaging.spec.ts b/desktop/tests/e2e/messaging.spec.ts index 3ba70ecc67..7181cd7fe7 100644 --- a/desktop/tests/e2e/messaging.spec.ts +++ b/desktop/tests/e2e/messaging.spec.ts @@ -216,10 +216,13 @@ test.beforeEach(async ({ page }, testInfo) => { imageDataUrl: null, imageDomain: null, }, - linkPreviewMetadataDelayMs: - testInfo.title.includes("style defaults") || - testInfo.title.includes("send does not wait") || - testInfo.title.includes("attachment-sized") + linkPreviewMetadataDelayMs: testInfo.title.includes( + "loading card asynchronously", + ) + ? 10_000 + : testInfo.title.includes("style defaults") || + testInfo.title.includes("send does not wait") || + testInfo.title.includes("attachment-sized") ? 1_500 : undefined, } @@ -472,6 +475,36 @@ test("link preview style defaults to compact and Rich unfurls descriptions", asy await page.getByTestId("link-preview-style-compact").click(); }); +test("link preview paste paints the loading card asynchronously", async ({ + page, +}) => { + const previewUrl = "https://github.com/block/buzz/pull/3246?paste=async"; + await page.goto("/"); + await page.getByTestId("channel-general").click(); + const input = page.getByTestId("message-input"); + await input.focus(); + + await input.evaluate((element, url) => { + const clipboardData = new DataTransfer(); + clipboardData.setData("text/plain", url); + element.dispatchEvent( + new ClipboardEvent("paste", { + bubbles: true, + cancelable: true, + clipboardData, + }), + ); + }, previewUrl); + const composerPreview = page + .locator("[data-composer-link-previews]") + .locator('[data-link-preview="github-pull-request"]'); + await expect(input).toContainText(previewUrl, { timeout: 1_000 }); + await expect(composerPreview).toHaveAttribute("data-state", "processing", { + timeout: 1_000, + }); + await expect(page.getByTestId("send-message")).toBeEnabled(); +}); + test("completed link preview sends once and leaves the composer cleared", async ({ page, }) => {