From ae6ff228f86f42d5203050c99bcb99cdce3a4626 Mon Sep 17 00:00:00 2001 From: Logan Johnson Date: Fri, 11 Sep 2026 15:32:46 -0400 Subject: [PATCH] test(desktop): pin mention undo and status expiry smoke behavior Keep two desktop smoke specs pinned to the behavior the app actually ships so the suite stops failing on an assertion the product never implemented and on a real-time expiry race. - persistent-agent-audience.spec.ts: after undoing the automatic mention of an agent, a manual remention from the mention menu must not reinstate the excluded audience address. Observe the old address exit before the manual selection and keep it absent after, with the outgoing message going to exactly that agent. Only the explicit "Automatically mention" action reinstates the address, which then persists across sends with the draft retained. - profile-custom-emoji-status.spec.ts: install the page clock before navigation, read the seed time inside the page, and give the seeded status a five-minute expiry, then fast-forward 301 seconds so the real expiration timer fires mid-dialog deterministically. Establish a live, dirty dialog baseline first; every post-expiry recovery assertion is unchanged. Test-only: no production, helper, or config changes. Local dependency provisioning is network-policy blocked, so these specs run first in normal CI. Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Signed-off-by: Logan Johnson --- .../e2e/persistent-agent-audience.spec.ts | 24 +++++++++++++++---- .../e2e/profile-custom-emoji-status.spec.ts | 19 +++++++++++++-- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/desktop/tests/e2e/persistent-agent-audience.spec.ts b/desktop/tests/e2e/persistent-agent-audience.spec.ts index d1174132c74..94731ed4d54 100644 --- a/desktop/tests/e2e/persistent-agent-audience.spec.ts +++ b/desktop/tests/e2e/persistent-agent-audience.spec.ts @@ -534,7 +534,7 @@ test("primary+Shift+M favors the most recently mentioned eligible agent", async await expect(input).toHaveText("@Vogue draft text"); }); -test("the mention button opens settings and can undo an address", async ({ +test("the mention button preserves manual rementions after undo until explicitly readdressed", async ({ page, }) => { await installAudienceFixtures(page); @@ -601,25 +601,39 @@ test("the mention button opens settings and can undo an address", async ({ await expect( composer.getByRole("button", { name: "Mention someone" }), ).toBeVisible(); + const avatar = composer.getByTestId(`composer-address-lock-${AGENT_A}`); + // Observe the old address exit before testing the manual selection. + await expect(avatar).toHaveCount(0); await input.fill(""); await menu .getByRole("button", { name: "Mention Morgarita", exact: true }) .click(); await expect(input).toHaveText("@Morgarita "); - await expect( - composer.getByTestId(`composer-address-lock-${AGENT_A}`), - ).toBeVisible(); + await expect(avatar).toHaveCount(0); await input.type("later"); await input.press("Enter"); await expect(input).toHaveText(""); await expect .poll(() => readOutgoingMentionPubkeys(page, "@Morgarita later")) - .toContain(AGENT_A); + .toEqual([AGENT_A]); await expect( composer.getByTestId(`composer-address-lock-${AGENT_A}`), ).toHaveCount(0); + + // Only the explicit automatic action reinstates the excluded address. + await automaticallyMention(composer, "Morgarita"); + await expect(avatar).toBeVisible(); + await input.type("explicit recovery"); + await input.press("Enter"); + await expect + .poll(() => + readOutgoingMentionPubkeys(page, "@Morgarita explicit recovery"), + ) + .toEqual([AGENT_A]); + await expect(input).toHaveText("@Morgarita "); + await expect(avatar).toBeVisible(); }); test("always-mentioned agents remain selected without replaying their animation while Enter-send resolves", async ({ diff --git a/desktop/tests/e2e/profile-custom-emoji-status.spec.ts b/desktop/tests/e2e/profile-custom-emoji-status.spec.ts index 09060ec39ee..cc1dca3fa81 100644 --- a/desktop/tests/e2e/profile-custom-emoji-status.spec.ts +++ b/desktop/tests/e2e/profile-custom-emoji-status.spec.ts @@ -196,17 +196,32 @@ test("set status dialog uses the desktop modal with shared status choices", asyn test("keeps an open status draft when the saved status expires", async ({ page, }) => { + await page.clock.install(); await page.goto("/"); - const nowSeconds = Math.floor(Date.now() / 1_000); + const nowSeconds = await page.evaluate(() => Math.floor(Date.now() / 1_000)); await seedMockStatus(page, { text: "Original draft", emoji: "📝", - expiresAt: nowSeconds + 2, + expiresAt: nowSeconds + 5 * 60, createdAt: nowSeconds, }); await page.getByTestId("profile-popover-set-status").click(); const dialog = page.getByTestId("set-status-dialog"); + await expect(dialog.getByTestId("set-status-input")).toHaveValue( + "Original draft", + ); + await expect(page.getByTestId("sidebar-profile-user-status")).toBeVisible(); + await expect(dialog.getByText("Quick statuses", { exact: true })).toHaveCount( + 0, + ); + await expect(dialog.getByTestId("set-status-clear")).toBeVisible(); await dialog.getByTestId("set-status-input").fill("Unsaved draft"); + await expect(dialog.getByLabel("Save status")).toBeEnabled(); + await expect(dialog.getByRole("alert")).toHaveCount(0); + + // Expire the saved status only after the open dialog has a live, dirty + // baseline. Run the real expiration timer rather than racing dialog setup. + await page.clock.fastForward(301_000); await expect(page.getByTestId("sidebar-profile-user-status")).toHaveCount(0, { timeout: 5_000, });