test(sidebar): cover channel activity headline

Seed channel-scoped observer output in the hover preview E2E so the screenshot and assertion cover the real per-agent activity headline. Align the unit expectation with the terse tool-action formatter.

Co-authored-by: Taylor Ho <taylorkmho@gmail.com>

Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
Taylor Ho
2026-08-05 17:50:08 -07:00
committed by Carl
parent 617a4ab4ff
commit d8e806ba04
2 changed files with 46 additions and 6 deletions
@@ -453,10 +453,7 @@ test("getLatestActivityHeadline prefers latest spine work and scopes by channel"
timestamp: "2026-06-14T19:00:20.000Z",
}),
];
assert.equal(
getLatestActivityHeadline(items, "chan-a"),
"Send Message · abc",
);
assert.equal(getLatestActivityHeadline(items, "chan-a"), "Sent abc");
assert.equal(getLatestActivityHeadline(items, "chan-b"), "Other channel");
assert.equal(getLatestActivityHeadline(items, "chan-missing"), null);
});
@@ -226,18 +226,61 @@ async function seedChannelActivity(
);
await page.evaluate(
({ agentPubkey, channelId }) => {
const now = Date.now();
(
window as Window & {
__BUZZ_E2E_SEED_ACTIVE_TURNS__?: (input: {
agentPubkey: string;
channelId: string;
turnId: string;
atMs?: number;
}) => void;
__BUZZ_E2E_SEED_OBSERVER_EVENTS__?: (input: {
agentPubkey: string;
events: Array<Record<string, unknown>>;
}) => void;
}
).__BUZZ_E2E_SEED_ACTIVE_TURNS__?.({
agentPubkey,
channelId,
turnId: "channel-hover-preview",
atMs: now - 92_000,
});
(
window as Window & {
__BUZZ_E2E_SEED_OBSERVER_EVENTS__?: (input: {
agentPubkey: string;
events: Array<Record<string, unknown>>;
}) => void;
}
).__BUZZ_E2E_SEED_OBSERVER_EVENTS__?.({
agentPubkey,
events: [
{
seq: now,
timestamp: new Date(now - 2_000).toISOString(),
kind: "acp_read",
agentIndex: 0,
channelId,
sessionId: "channel-hover-session",
turnId: "channel-hover-preview",
payload: {
jsonrpc: "2.0",
method: "session/update",
params: {
sessionId: "channel-hover-session",
update: {
sessionUpdate: "agent_message_chunk",
messageId: "channel-hover-message",
content: {
type: "text",
text: "Updated the channel activity preview",
},
},
},
},
},
],
});
},
{ agentPubkey: AGENT_PUBKEY, channelId: CHANNEL_GENERAL },
@@ -338,8 +381,8 @@ test.describe("channel activity hover preview", () => {
popover.getByTestId(`channel-activity-agent-${AGENT_PUBKEY}`),
).toContainText("Charlie");
await expect(
popover.getByTestId(`channel-activity-agent-${AGENT_PUBKEY}`),
).toContainText("Working");
popover.getByTestId(`channel-activity-agent-status-${AGENT_PUBKEY}`),
).toHaveText("Working · Updated the channel activity preview");
const orderedRows = popover.locator(
'[data-testid^="channel-activity-agent-"], [data-testid^="channel-activity-item-"]',
);