Skip to content

Commit a4579c0

Browse files
tellahoCarl
andcommitted
test(desktop-messages): opt into persistent mention scenarios
Co-authored-by: Carl <acda9e433d19dcd0e6b6840f7f4b98f3a56f1fab98049d444c087019e6d36560@buzz.block.builderlab.xyz> Signed-off-by: Taylor Ho <[email protected]>
1 parent 01c6091 commit a4579c0

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ async function automaticallyMention(
3131
await composer.locator("[data-mention-picker-trigger]").click();
3232
}
3333

34+
async function enableAutomaticMentionPersistence(
35+
composer: ReturnType<typeof channelComposer>,
36+
) {
37+
await composer.locator("[data-mention-picker-trigger]").click();
38+
await composer.getByTestId("mention-options-trigger").click();
39+
const toggle = composer.getByTestId("mention-keep-agents-pinned-toggle");
40+
await expect(toggle).toHaveAttribute("data-state", "unchecked");
41+
await toggle.click();
42+
await expect(toggle).toHaveAttribute("data-state", "checked");
43+
await composer.getByTestId("message-input").press("Escape");
44+
await expect(composer.getByTestId("mention-autocomplete")).toHaveCount(0);
45+
}
46+
3447
async function openGeneral(page: Page) {
3548
await page.goto(`/#/channels/${CHANNEL_ID}`, {
3649
waitUntil: "domcontentloaded",
@@ -415,6 +428,7 @@ test("a manually mentioned agent becomes selected after the message sends", asyn
415428
await openGeneral(page);
416429

417430
const composer = channelComposer(page);
431+
await enableAutomaticMentionPersistence(composer);
418432
const input = composer.getByTestId("message-input");
419433
await input.fill("@Mor");
420434
await expect(composer.getByTestId("mention-autocomplete")).toBeVisible();
@@ -464,6 +478,7 @@ test("the auto-pin toast can undo and the picker can restore the agent", async (
464478
await openGeneral(page);
465479

466480
const composer = channelComposer(page);
481+
await enableAutomaticMentionPersistence(composer);
467482
const input = composer.getByTestId("message-input");
468483
await input.fill("@Mor");
469484
await expect(composer.getByTestId("mention-autocomplete")).toBeVisible();
@@ -498,7 +513,10 @@ test("the auto-pin toast can undo and the picker can restore the agent", async (
498513
await composer.locator("[data-mention-picker-trigger]").click();
499514
await composer
500515
.getByTestId("mention-autocomplete")
501-
.getByRole("button", { name: "Mention Morgarita", exact: true })
516+
.getByRole("button", {
517+
name: "Automatically mention Morgarita",
518+
exact: true,
519+
})
502520
.click();
503521
await expect(input).toHaveText("");
504522
await expect(

0 commit comments

Comments
 (0)