Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions desktop/tests/e2e/persistent-agent-audience.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 ({
Expand Down
19 changes: 17 additions & 2 deletions desktop/tests/e2e/profile-custom-emoji-status.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
Loading