Skip to content

Commit 04b040e

Browse files
loganjLarry
andauthored
test(desktop): pin mention undo and status expiry smoke behavior (#7592)
🤖 ## Summary Make two desktop smoke tests reliably check existing behavior: manually mentioning an agent after turning off automatic mentions, and editing a status while the saved status expires. This changes only tests, not production UI behavior, helpers, or configuration. - **Manual mention recovery:** the old test expected a manual mention to restore the agent's automatic-mention badge. The test now checks that the badge disappears after undo and stays absent when the user manually mentions the agent, while the sent message goes to exactly that agent. Choosing **Automatically mention** explicitly restores the badge and keeps the agent's mention in the composer after sending. - **Status expiry while editing:** the old test gave the saved status two seconds to expire, racing the dialog setup. The test now controls the page clock, seeds a five-minute status, and establishes an open dialog with unsaved edits before advancing past expiry. The existing checks still require the saved status to disappear from the sidebar without losing the draft, show a future-duration warning, disable Save, and allow recovery by choosing **This week**. The two-file repair is unchanged from its previous version. This branch includes current main, including the MinIO startup fix in #7599; that infrastructure change is not part of this PR's test-only diff. ### Related issue none found ### Testing Both specs exercise the UI through the existing test fixtures. Fresh normal CI for `ae6ff228f86f42d5203050c99bcb99cdce3a4626` is pending; historical test results and review of the earlier version do not validate this combined tree. Local dependency installation was blocked by network policy in the authoring environment, so no new local pass is claimed. --------- Signed-off-by: Logan Johnson <[email protected]> Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
1 parent 83aab8c commit 04b040e

2 files changed

Lines changed: 42 additions & 10 deletions

File tree

‎desktop/tests/e2e/persistent-agent-audience.spec.ts‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ test("primary+Shift+M favors the most recently mentioned eligible agent", async
534534
await expect(input).toHaveText("@Vogue draft text");
535535
});
536536

537-
test("the mention button opens settings and can undo an address", async ({
537+
test("the mention button preserves manual rementions after undo until explicitly readdressed", async ({
538538
page,
539539
}) => {
540540
await installAudienceFixtures(page);
@@ -601,9 +601,9 @@ test("the mention button opens settings and can undo an address", async ({
601601
await expect(
602602
composer.getByRole("button", { name: "Mention someone" }),
603603
).toBeVisible();
604-
await expect(
605-
composer.getByTestId(`composer-address-lock-${AGENT_A}`),
606-
).toHaveCount(0);
604+
const avatar = composer.getByTestId(`composer-address-lock-${AGENT_A}`);
605+
// Observe the old address exit before testing the manual selection.
606+
await expect(avatar).toHaveCount(0);
607607
// Clear through editor transactions before selecting a manual mention.
608608
await input.press("ControlOrMeta+A");
609609
await input.press("Backspace");
@@ -615,19 +615,30 @@ test("the mention button opens settings and can undo an address", async ({
615615
await expect(input).toHaveText("@Morgarita ");
616616
// Explicitly opting out keeps subsequent mentions manual. The old avatar's
617617
// exit animation must not be mistaken for a newly pinned recipient.
618-
await expect(
619-
composer.getByTestId(`composer-address-lock-${AGENT_A}`),
620-
).toHaveCount(0);
618+
await expect(avatar).toHaveCount(0);
621619

622620
await input.type("later");
623621
await input.press("Enter");
624622
await expect(input).toHaveText("");
625623
await expect
626624
.poll(() => readOutgoingMentionPubkeys(page, "@Morgarita later"))
627-
.toContain(AGENT_A);
625+
.toEqual([AGENT_A]);
628626
await expect(
629627
composer.getByTestId(`composer-address-lock-${AGENT_A}`),
630628
).toHaveCount(0);
629+
630+
// Only the explicit automatic action reinstates the excluded address.
631+
await automaticallyMention(composer, "Morgarita");
632+
await expect(avatar).toBeVisible();
633+
await input.type("explicit recovery");
634+
await input.press("Enter");
635+
await expect
636+
.poll(() =>
637+
readOutgoingMentionPubkeys(page, "@Morgarita explicit recovery"),
638+
)
639+
.toEqual([AGENT_A]);
640+
await expect(input).toHaveText("@Morgarita ");
641+
await expect(avatar).toBeVisible();
631642
});
632643

633644
test("always-mentioned agents remain selected without replaying their animation while Enter-send resolves", async ({

‎desktop/tests/e2e/profile-custom-emoji-status.spec.ts‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,39 @@ test("set status dialog uses the desktop modal with shared status choices", asyn
196196
test("keeps an open status draft when the saved status expires", async ({
197197
page,
198198
}) => {
199+
await page.clock.install();
199200
await page.goto("/");
200201
await waitForMockGlobalKindSubscription(page, 30315);
201-
const nowSeconds = Math.floor(Date.now() / 1_000);
202+
const nowSeconds = await page.evaluate(() => Math.floor(Date.now() / 1_000));
202203
await seedMockStatus(page, {
203204
text: "Original draft",
204205
emoji: "📝",
205-
expiresAt: nowSeconds + 2,
206+
// Stay below the 120-second status polling backstop so a refetch cannot
207+
// hide the expired status in place of the expiration timer.
208+
expiresAt: nowSeconds + 60,
206209
createdAt: nowSeconds,
207210
});
208211
await page.getByTestId("profile-popover-set-status").click();
209212
const dialog = page.getByTestId("set-status-dialog");
213+
await expect(dialog.getByTestId("set-status-input")).toHaveValue(
214+
"Original draft",
215+
);
216+
await expect(page.getByTestId("sidebar-profile-user-status")).toBeVisible();
217+
await expect(dialog.getByText("Quick statuses", { exact: true })).toHaveCount(
218+
0,
219+
);
220+
await expect(dialog.getByTestId("set-status-clear")).toBeVisible();
210221
await dialog.getByTestId("set-status-input").fill("Unsaved draft");
222+
await expect(dialog.getByLabel("Save status")).toBeEnabled();
223+
await expect(dialog.getByRole("alert")).toHaveCount(0);
224+
225+
// Expire the saved status only after the open dialog has a live, dirty
226+
// baseline. Pause one second before the deadline so incidental renders that
227+
// also re-check expiry run while the status is still valid, then run only
228+
// the final second on a paused clock: the expiration timer must hide it.
229+
await page.clock.pauseAt((nowSeconds + 59) * 1_000);
230+
await expect(page.getByTestId("sidebar-profile-user-status")).toBeVisible();
231+
await page.clock.runFor(1_500);
211232
await expect(page.getByTestId("sidebar-profile-user-status")).toHaveCount(0, {
212233
timeout: 5_000,
213234
});

0 commit comments

Comments
 (0)