Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
test(web): isolate friend requests and prepare image sharing (#949)
Gener2c7a6d31a792
diff --git a/src/web/src/test/e2e-ui/51-share-image-assets.spec.ts b/src/web/src/test/e2e-ui/51-share-image-assets.spec.tsindex bfed64c47..fccea60e4 100644--- a/src/web/src/test/e2e-ui/51-share-image-assets.spec.ts+++ b/src/web/src/test/e2e-ui/51-share-image-assets.spec.ts@@ -902,6 +902,8 @@ test("avatar failure is deterministic while content-image failure is atomic andelse await avatarRoute.continue()})await reloadWithUnavailableImage(page, route, page.getByTestId(tid.message(avatarMessage.id)).locator('[data-slot="avatar-image"]'))+ await expect(page.getByTestId(tid.message(contentMessage.id))).toBeVisible()+ await expect(page.getByTestId(tid.messageScroller).locator("[data-message-list-content]")).toHaveAttribute("data-read-position-ready", "true")let dialog = await openShareDialog(page, avatarMessage.id)let card = await waitForReady(dialog)const fallback = card.locator("[data-share-identity-fallback=beam]")diff --git a/src/web/src/test/e2e-ui/56-inbox-friend-requests.spec.ts b/src/web/src/test/e2e-ui/56-inbox-friend-requests.spec.tsindex 1436960eb..e9454e113 100644--- a/src/web/src/test/e2e-ui/56-inbox-friend-requests.spec.ts+++ b/src/web/src/test/e2e-ui/56-inbox-friend-requests.spec.ts@@ -1,16 +1,6 @@import type { Locator, Page } from "@playwright/test"-import { expect, test, userId, userName } from "./_fixtures/community-fixture"+import { expect, test } from "./_fixtures/case-fixture"import { GEOMETRY_EPSILON, gotoAfterUserWsAuth, waitForElementMotion } from "./_fixtures/actions"-import {- seedCancelFriendRequest,- seedChannel,- seedDm,- seedDmMessage,- seedJoinServer,- seedMessage,- seedPendingFriendRequest,- seedServer,-} from "./_fixtures/seed"import { tid } from "./_fixtures/testids"async function expectInboxUnreadCount(page: Page) {@@ -79,16 +69,21 @@ async function expectExactRect().toEqual({ width: size, height: size })}-test.describe.serial("actionable Inbox friend requests", () => {+test.describe("actionable Inbox friend requests", () => {test.setTimeout(120_000)- test("fans out live, survives opening, and owns the Friends New URL", async ({ asUser }) => {+ test("fans out live, survives opening, and owns the Friends New URL", async ({ caseActors }) => {+ const actors = await caseActors(["alice", "bob"])+ const { asUser, userId } = actors+ const { seedPendingFriendRequest, seedCancelFriendRequest } = actors.seed+const bob = await asUser("bob")await bob.page.setViewportSize({ width: 1280, height: 900 })await clearMessageInbox(bob.page)await gotoAfterUserWsAuth(bob.page, "/c/me/friends")const friendshipId = await seedPendingFriendRequest("alice", "bob", userId("bob"))+ actors.onCleanup(() => seedCancelFriendRequest("alice", friendshipId))try {await expect(bob.page.getByTestId(tid.friendsShortcutBadge)).toHaveText("1")await expect(bob.page.getByTestId(tid.friendsNewBadge)).toHaveText("1")@@ -141,7 +136,20 @@ test.describe.serial("actionable Inbox friend requests", () => {}})- test("keeps requests above DM/server unread and Mark all is message-only", async ({ asUser }) => {+ test("keeps requests above DM/server unread and Mark all is message-only", async ({ caseActors }) => {+ const actors = await caseActors(["alice", "bob", "carol"])+ const { asUser, userId } = actors+ const {+ seedServer,+ seedChannel,+ seedJoinServer,+ seedDm,+ seedMessage,+ seedDmMessage,+ seedPendingFriendRequest,+ seedCancelFriendRequest,+ } = actors.seed+const stamp = Date.now()const serverName = `Friend request mix ${stamp}`const serverId = await seedServer("alice", serverName)@@ -153,6 +161,7 @@ test.describe.serial("actionable Inbox friend requests", () => {await clearMessageInbox(bob.page)await gotoAfterUserWsAuth(bob.page, "/c/me/friends")const friendshipId = await seedPendingFriendRequest("carol", "bob", userId("bob"))+ actors.onCleanup(() => seedCancelFriendRequest("carol", friendshipId))try {await seedMessage("alice", channelId, `Friend request channel unread ${stamp}`)await seedDmMessage("alice", dmId, `Friend request DM unread ${stamp}`)@@ -188,15 +197,25 @@ test.describe.serial("actionable Inbox friend requests", () => {}})- test("a failed action keeps its keyed row while another request remains usable", async ({ asUser }) => {+ test("a failed action keeps its keyed row while another request remains usable", async ({ caseActors }) => {+ const actors = await caseActors(["alice", "bob", "carol"])+ const { asUser, userId } = actors+ const { seedPendingFriendRequest, seedCancelFriendRequest } = actors.seed+const firstId = await seedPendingFriendRequest("alice", "bob", userId("bob"))+ actors.onCleanup(() => seedCancelFriendRequest("alice", firstId))const secondId = await seedPendingFriendRequest("carol", "bob", userId("bob"))+ actors.onCleanup(() => seedCancelFriendRequest("carol", secondId))const bob = await asUser("bob")let releaseFailure!: () => voidlet markFirstAttempt!: () => voidconst failureGate = new Promise<void>((resolve) => { releaseFailure = resolve })const firstAttempt = new Promise<void>((resolve) => { markFirstAttempt = resolve })let attempts = 0+ actors.onCleanup(async () => {+ if (!bob.page.isClosed()) await bob.page.unroute(`**/api/community/friends/${firstId}/accept`)+ })+ actors.onCleanup(async () => { releaseFailure() })await bob.page.route(`**/api/community/friends/${firstId}/accept`, async (route) => {attempts += 1if (attempts === 1) {@@ -250,10 +269,17 @@ test.describe.serial("actionable Inbox friend requests", () => {await bob.page.getByRole("link", { name: "Friends", exact: true }).click()const accepted = await bob.page.request.get("/api/community/friends/accepted")expect(accepted.ok()).toBe(true)- const acceptedBody = await accepted.json() as { friends: Array<{ userId: string; name: string }> }+ const acceptedBody = await accepted.json() as {+ friends: Array<{ userId: string; name: string; discriminator: string }>+ }const alice = acceptedBody.friends.find((friend) => friend.userId === userId("alice"))expect(alice).toBeDefined()- await expect(bob.page.getByText(alice!.name, { exact: true }).first()).toBeVisible()+ const allFriends = bob.page.getByRole("tabpanel", { name: "All", exact: true })+ .getByText("All friends — 1", { exact: true }).locator("..")+ await expect(allFriends).toHaveCount(1)+ const aliceRow = allFriends.getByRole("button", { name: `${alice!.name}#${alice!.discriminator}`, exact: true })+ await expect(aliceRow).toHaveCount(1)+ await expect(aliceRow).toBeVisible()} finally {releaseFailure()await bob.page.unroute(`**/api/community/friends/${firstId}/accept`)@@ -262,10 +288,16 @@ test.describe.serial("actionable Inbox friend requests", () => {}})- test("reconnect reconciles a request cancelled while its event was missed", async ({ asUser }) => {+ test("reconnect reconciles a request cancelled while its event was missed", async ({ caseActors }) => {+ const actors = await caseActors(["bob", "dave"])+ const { asUser, userId } = actors+ const { seedPendingFriendRequest, seedCancelFriendRequest } = actors.seed+const bob = await asUser("bob")+ actors.onCleanup(() => bob.context.setOffline(false))await gotoAfterUserWsAuth(bob.page, "/c/me/friends")const friendshipId = await seedPendingFriendRequest("dave", "bob", userId("bob"))+ actors.onCleanup(() => seedCancelFriendRequest("dave", friendshipId))const row = bob.page.getByTestId(tid.inboxFriendRequest(friendshipId))try {@@ -282,7 +314,17 @@ test.describe.serial("actionable Inbox friend requests", () => {}})- test("mobile actions keep 44px targets, readable labels, focus, and row-local busy state", async ({ asUser }) => {+ test("mobile actions keep 44px targets, readable labels, focus, and row-local busy state", async ({ caseActors }) => {+ const actors = await caseActors(["alice", "bob"])+ const { asUser, userId } = actors+ const {+ seedServer,+ seedChannel,+ seedJoinServer,+ seedPendingFriendRequest,+ seedCancelFriendRequest,+ } = actors.seed+const stamp = Date.now()const serverId = await seedServer("alice", `Friend request mobile ${stamp}`)await seedChannel("alice", serverId, `friend-mobile-${stamp}`)@@ -295,6 +337,7 @@ test.describe.serial("actionable Inbox friend requests", () => {await expect(inboxTrigger).toBeVisible()const startingUrl = bob.page.url()const friendshipId = await seedPendingFriendRequest("alice", "bob", userId("bob"))+ actors.onCleanup(() => seedCancelFriendRequest("alice", friendshipId))try {await inboxTrigger.click()@@ -329,16 +372,34 @@ test.describe.serial("actionable Inbox friend requests", () => {}})- test("locks 390px navigation and retry targets plus 640px action geometry on both surfaces", async ({ asUser }) => {+ test("locks 390px navigation and retry targets plus 640px action geometry on both surfaces", async ({ caseActors }) => {+ const actors = await caseActors(["alice", "bob", "carol"])+ const { asUser, userId, userName } = actors+ const {+ seedServer,+ seedChannel,+ seedJoinServer,+ seedPendingFriendRequest,+ seedCancelFriendRequest,+ } = actors.seed+const stamp = Date.now()const serverId = await seedServer("alice", `Friend request geometry ${stamp}`)await seedChannel("alice", serverId, `friend-geometry-${stamp}`)await seedJoinServer("alice", "bob", serverId)const inboxRequestId = await seedPendingFriendRequest("alice", "bob", userId("bob"))+ actors.onCleanup(() => seedCancelFriendRequest("alice", inboxRequestId))const friendsRequestId = await seedPendingFriendRequest("carol", "bob", userId("bob"))+ actors.onCleanup(() => seedCancelFriendRequest("carol", friendsRequestId))const bob = await asUser("bob")const inboxAcceptPath = `/api/community/friends/${inboxRequestId}/accept`const friendsAcceptPath = `/api/community/friends/${friendsRequestId}/accept`+ actors.onCleanup(async () => {+ if (!bob.page.isClosed()) await bob.page.unroute(`**${inboxAcceptPath}`)+ })+ actors.onCleanup(async () => {+ if (!bob.page.isClosed()) await bob.page.unroute(`**${friendsAcceptPath}`)+ })await bob.page.route(`**${inboxAcceptPath}`, async (route) => {await route.fulfill({ status: 503, json: { error: "forced inbox geometry retry" } })})