mirror of
https://github.com/block/buzz.git
synced 2026-11-27 03:31:50 +00:00
## Summary Units 6–9 and 14 of the 23–30 Oct desktop Playwright flake audit, in two commits. The specs now settle before they measure or act, and remote-owned-mentions clears its draft reliably. Everything is test-only. This is one of six PRs split from the reviewed `flakey-tests` branch (siblings below). ### Unit 6: measuring before an animation finishes Each spec now calls `waitForAnimations(page)` before measuring. - `onboarding.spec.ts:1487` (#8715, Integration shard 1; the centring check at :1545 receives 5.13): `showPage("owned")` slides content in from `translateX(48px)` over 650 ms. The spec reads its three boxes in separate `boundingBox` round trips, so they can come from different points of the slide. - `onboarding.spec.ts:2289` (main 40746677244 and 40925172215, and #8666; the spacing check at :2485 receives 4.255): the avatar dialog has a 200 ms zoom-in and a 250 ms height transition. - `projects-v3-screenshots.spec.ts:280`, at :893 (main 39643531998, 40759209995 and 40969909906, plus four runs with fractional menu-edge values): the context rail narrows from 380 to 280 px over 200 ms. ### Unit 7: `fill()` racing a caret move the app makes a frame later - `mention-recipients.spec.ts:376` and `:97` (main 40969965981 and 40969858676): edit mode focuses the end of the composer in a `requestAnimationFrame`. If that frame lands mid-`fill()`, the edit is appended instead of replacing the text. **Change:** use #8682's `replaceComposerText` at both call sites. - `workflow-local-controls.spec.ts:151` (main 40926393897 and 40957616146, and #8239): `selectVariable` restores the caret in a `requestAnimationFrame` after the spec's poll has passed. **Change:** wait two animation frames before filling. ### Unit 8: clicks that hit the wrong element - `profile.spec.ts:1128`, at :1543 (#8523): stacked Sonner success toasts intercept the pointer. **Change:** a local `pressActionRow` helper presses the five action rows with `toBeEnabled`, focus and Enter. - `config-bridge-screenshots.spec.ts:314` (main 40967147375, and #8235): `.last()` resolved while avatar fallbacks were still filling in on 200 ms timers, so it opened nadia's panel instead of Charlie's. **Change:** pick Charlie's row by its text, and check the panel's name before opening Runtime. ### Unit 9: the `createWorkflow` copies (preventive) - `navigation.spec.ts:153` (7 failures on main, none since #8681; 14 first-attempt failures in Smoke shard 7): an unscoped `getByLabel("Message text")` can fill the trigger's filter while `AnimatePresence` keeps it mounted. **Change:** wait for the step inspector, then fill inside it, as `workflows.spec` already does. The wait now lives in one `addSendMessageStep` helper in `tests/helpers/workflows.ts`, which `navigation.spec.ts` and `workflows.spec.ts` (`createWorkflow`, :716, :820) all call. - `workflow-reaction-picker.spec.ts:203-204` is left out. Its Reaction Added trigger has no control labelled "Message text". ### Unit 14 (second commit): `remote-owned-mentions.spec.ts:566` - **Run:** main 40998438103 (Smoke shard 9, job 123877347301). It passed on retry and failed 1 of the 6 attempts it got in the window. `sourceRecord()` at :673 returned thread A's draft instead of null. - **Cause:** on ProseMirror, `fill("")` selects through the DOM, then presses Delete. If ProseMirror hasn't seen the selection yet, it blocks the Delete. Navigating to B then saves A's live text as its draft. This is not a product bug: had the editor really been empty, the cleanup would have cleared A's draft. - **Change:** delete the text with one Backspace per character from the end, then wait for the composer to read empty. The guard assertions are unchanged. ### Related issue None found. Sibling #8743 also edits `navigation.spec.ts`, in a separate hunk. The two merge cleanly in either order. No open PR touches the tests changed here. #6134, #8187, #5778, #8622, #7452, #7812, #8244 and #3342 edit other tests in the same files. ### Testing Not run locally, because Playwright bogs this machine down. Flake Check will repeat the touched specs. `pnpm typecheck` and `pnpm check` pass, and biome's 3 warnings are in untouched files. Ad hoc `tsc` runs over the touched specs and the helper found the same pre-existing errors as on their `main` copies. Pushed with `git push --no-verify`, because the pre-push suites fail when the laptop is under load. ### Readiness An agent review of the combined `flakey-tests` branch (b432453af) found no blockers. `buzz-review-completed` is not added, because the human test step (AGENTS.md "Before opening a PR", step 3) hasn't happened yet. ### Siblings - #8739 ci: Hermit fetch deadline and sccache fallback - #8740 test(relay): thread_window aux-page hold and `api::media` Postgres tests - #8741 test(mobile): RunnerTests title fade and alert wait - #8742 fix(desktop): deep-linked message hold (product change) - #8743 test(desktop): four specs racing scroll settles and focus 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Matt Toohey <contact@matttoohey.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
378 lines
12 KiB
TypeScript
378 lines
12 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
import { waitForAnimations } from "../helpers/animations";
|
|
import { installMockBridge, TEST_IDENTITIES } from "../helpers/bridge";
|
|
|
|
const SHOTS = "test-results/config-bridge";
|
|
|
|
// Use well-known test pubkeys that map to distinct config surface fixtures
|
|
const GOOSE_PUBKEY = TEST_IDENTITIES.tyler.pubkey;
|
|
const PRESPAWN_PUBKEY = TEST_IDENTITIES.bob.pubkey;
|
|
const RUNTIME_OVERRIDE_PUBKEY = TEST_IDENTITIES.outsider.pubkey;
|
|
// Synthetic agent whose config surface mixes four distinct provenance origins
|
|
// (matches PUBKEY_MULTI_ORIGIN in e2eBridge buildMockConfigSurface).
|
|
const MULTI_ORIGIN_PUBKEY =
|
|
"abc1230000000000000000000000000000000000000000000000000000000def";
|
|
const BUZZ_AGENT_PUBKEY =
|
|
"b0220000000000000000000000000000000000000000000000000000000000a9";
|
|
|
|
const MANAGED_AGENTS = [
|
|
{
|
|
pubkey: GOOSE_PUBKEY,
|
|
name: "Goose Agent",
|
|
status: "running" as const,
|
|
channelNames: ["agents"],
|
|
},
|
|
{
|
|
pubkey: PRESPAWN_PUBKEY,
|
|
name: "Pre-Spawn Agent",
|
|
status: "stopped" as const,
|
|
channelNames: ["agents"],
|
|
},
|
|
{
|
|
pubkey: RUNTIME_OVERRIDE_PUBKEY,
|
|
name: "Runtime Override Agent",
|
|
status: "running" as const,
|
|
channelNames: ["agents"],
|
|
},
|
|
{
|
|
pubkey: MULTI_ORIGIN_PUBKEY,
|
|
name: "Multi-Origin Agent",
|
|
status: "running" as const,
|
|
channelNames: ["agents"],
|
|
},
|
|
];
|
|
|
|
async function waitForInvokeBridge(page: import("@playwright/test").Page) {
|
|
await page.waitForFunction(
|
|
() => {
|
|
const tauriWindow = window as Window & {
|
|
__BUZZ_E2E_INVOKE_MOCK_COMMAND__?: unknown;
|
|
__TAURI_INTERNALS__?: { invoke?: unknown };
|
|
};
|
|
return (
|
|
typeof tauriWindow.__BUZZ_E2E_INVOKE_MOCK_COMMAND__ === "function" ||
|
|
typeof tauriWindow.__TAURI_INTERNALS__?.invoke === "function"
|
|
);
|
|
},
|
|
null,
|
|
{ timeout: 5_000 },
|
|
);
|
|
}
|
|
|
|
async function invokeMockCommand(
|
|
page: import("@playwright/test").Page,
|
|
command: string,
|
|
payload?: Record<string, unknown>,
|
|
): Promise<unknown> {
|
|
await waitForInvokeBridge(page);
|
|
return page.evaluate(
|
|
async ({ command: cmd, payload: pl }) => {
|
|
const tauriWindow = window as Window & {
|
|
__BUZZ_E2E_INVOKE_MOCK_COMMAND__?: (
|
|
command: string,
|
|
payload?: Record<string, unknown>,
|
|
) => Promise<unknown>;
|
|
__TAURI_INTERNALS__?: {
|
|
invoke?: (
|
|
command: string,
|
|
payload?: Record<string, unknown>,
|
|
) => Promise<unknown>;
|
|
};
|
|
};
|
|
const invoke =
|
|
tauriWindow.__BUZZ_E2E_INVOKE_MOCK_COMMAND__ ??
|
|
tauriWindow.__TAURI_INTERNALS__?.invoke;
|
|
if (!invoke) throw new Error("Mock invoke bridge is unavailable.");
|
|
return invoke(cmd, pl);
|
|
},
|
|
{ command, payload },
|
|
);
|
|
}
|
|
|
|
async function activatePersonas(page: import("@playwright/test").Page) {
|
|
for (const id of ["builtin:fizz"]) {
|
|
await invokeMockCommand(page, "set_persona_active", { id, active: true });
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Open the #agents channel and click an agent's avatar in the message list
|
|
* to open the profile side panel, then navigate to the requested tab.
|
|
*/
|
|
async function openAgentProfileFromChannel(
|
|
page: import("@playwright/test").Page,
|
|
agentName: string,
|
|
{
|
|
anchorText = "Model",
|
|
scrollToBottom = true,
|
|
tab = "Info",
|
|
}: {
|
|
anchorText?: string;
|
|
scrollToBottom?: boolean;
|
|
tab?: "Info" | "Runtime";
|
|
} = {},
|
|
) {
|
|
await page.goto("/", { waitUntil: "domcontentloaded" });
|
|
await waitForInvokeBridge(page);
|
|
await activatePersonas(page);
|
|
|
|
// Navigate to the #agents channel
|
|
await page.getByTestId("channel-agents").click();
|
|
await expect(page.getByTestId("chat-title")).toHaveText("agents");
|
|
|
|
// Find the message row from this agent and click the avatar to open profile
|
|
const messageRow = page.getByTestId("message-row").filter({
|
|
has: page.getByText(agentName, { exact: false }),
|
|
});
|
|
await expect(messageRow.first()).toBeVisible({ timeout: 5_000 });
|
|
await messageRow.first().getByRole("button").first().click();
|
|
|
|
const panel = page.getByTestId("user-profile-panel");
|
|
await expect(panel).toBeVisible({ timeout: 10_000 });
|
|
|
|
await panel.getByRole("tab", { name: tab }).click();
|
|
|
|
const configAnchor = panel.getByText(anchorText, { exact: true }).first();
|
|
await expect(configAnchor).toBeVisible({ timeout: 10_000 });
|
|
// Scroll the panel's internal scroll container to the bottom so the
|
|
// config section content is fully visible.
|
|
await configAnchor.scrollIntoViewIfNeeded();
|
|
if (scrollToBottom) {
|
|
await panel.evaluate((el) => {
|
|
// The scrollable container is the profileBody div with overflow-y-auto.
|
|
// Find it by checking which child actually scrolls.
|
|
const scrollable =
|
|
el.querySelector("[data-radix-scroll-area-viewport]") ??
|
|
Array.from(el.querySelectorAll("*")).find(
|
|
(child) => child.scrollHeight > child.clientHeight + 10,
|
|
) ??
|
|
el;
|
|
scrollable.scrollTop = scrollable.scrollHeight;
|
|
});
|
|
}
|
|
await panel.page().waitForTimeout(200);
|
|
|
|
return panel;
|
|
}
|
|
|
|
// Settle any in-flight animations before capture.
|
|
async function settleAnimations(panel: import("@playwright/test").Locator) {
|
|
await waitForAnimations(panel.page());
|
|
}
|
|
|
|
test.describe("config bridge screenshots", () => {
|
|
test.use({ viewport: { width: 1280, height: 900 } });
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
page.on("pageerror", (err) => {
|
|
console.error(
|
|
"PAGE ERROR:",
|
|
err.message,
|
|
err.stack?.split("\n").slice(0, 5).join("\n"),
|
|
);
|
|
});
|
|
page.on("console", (msg) => {
|
|
if (msg.type() === "error") {
|
|
console.error("CONSOLE ERROR:", msg.text().slice(0, 500));
|
|
}
|
|
});
|
|
});
|
|
|
|
test("01 — folded config panel", async ({ page }) => {
|
|
await installMockBridge(page, { managedAgents: MANAGED_AGENTS });
|
|
|
|
const panel = await openAgentProfileFromChannel(page, "Goose Agent", {
|
|
scrollToBottom: false,
|
|
tab: "Runtime",
|
|
});
|
|
|
|
// The shared config panel shows only the effective value.
|
|
await expect(panel.getByText("gpt-4o", { exact: true })).toBeVisible();
|
|
await expect(panel.getByText("gpt-4o-mini", { exact: true })).toHaveCount(
|
|
0,
|
|
);
|
|
await expect(panel.getByText("Set in Buzz")).toHaveCount(0);
|
|
await settleAnimations(panel);
|
|
|
|
await panel.screenshot({ path: `${SHOTS}/01-folded-config-panel.png` });
|
|
});
|
|
|
|
test("02 — live runtime override", async ({ page }) => {
|
|
await installMockBridge(page, { managedAgents: MANAGED_AGENTS });
|
|
|
|
const panel = await openAgentProfileFromChannel(
|
|
page,
|
|
"Runtime Override Agent",
|
|
{ tab: "Runtime" },
|
|
);
|
|
|
|
// A runtime override shows only the effective live model.
|
|
await expect(
|
|
panel.getByText("claude-opus-4-20250514", { exact: true }),
|
|
).toBeVisible();
|
|
await expect(panel.getByText("gpt-4o", { exact: true })).toHaveCount(0);
|
|
await expect(
|
|
panel.getByText("Live override (this session only)"),
|
|
).toHaveCount(0);
|
|
await settleAnimations(panel);
|
|
|
|
await panel.screenshot({
|
|
path: `${SHOTS}/02-live-runtime-override.png`,
|
|
});
|
|
});
|
|
|
|
test("03 — effective values without provenance", async ({ page }) => {
|
|
await installMockBridge(page, { managedAgents: MANAGED_AGENTS });
|
|
|
|
const panel = await openAgentProfileFromChannel(
|
|
page,
|
|
"Multi-Origin Agent",
|
|
{
|
|
tab: "Runtime",
|
|
},
|
|
);
|
|
|
|
// Values from different sources use the same simple two-line hierarchy.
|
|
await expect(panel.getByText("gpt-4o", { exact: true })).toBeVisible();
|
|
await expect(panel.getByText("openai", { exact: true })).toBeVisible();
|
|
await expect(panel.getByText("auto", { exact: true })).toBeVisible();
|
|
await expect(panel.getByText(/From config file/)).toHaveCount(0);
|
|
await expect(panel.getByText(/Inherited from/)).toHaveCount(0);
|
|
await expect(panel.getByText(/From environment variable/)).toHaveCount(0);
|
|
await settleAnimations(panel);
|
|
|
|
await panel.screenshot({
|
|
path: `${SHOTS}/03-effective-values.png`,
|
|
});
|
|
});
|
|
|
|
test("04 — pre-spawn state", async ({ page }) => {
|
|
await installMockBridge(page, { managedAgents: MANAGED_AGENTS });
|
|
|
|
const panel = await openAgentProfileFromChannel(page, "Pre-Spawn Agent", {
|
|
tab: "Runtime",
|
|
});
|
|
|
|
// Unknown pre-start values stay empty rather than adding an explanatory row.
|
|
await expect(panel.getByText("Available after agent starts")).toHaveCount(
|
|
0,
|
|
);
|
|
await expect(panel.getByText("—", { exact: true })).toHaveCount(2);
|
|
await settleAnimations(panel);
|
|
|
|
await panel.screenshot({ path: `${SHOTS}/04-pre-spawn-state.png` });
|
|
});
|
|
|
|
test("05 — advanced flat list", async ({ page }) => {
|
|
await installMockBridge(page, { managedAgents: MANAGED_AGENTS });
|
|
|
|
const panel = await openAgentProfileFromChannel(page, "Goose Agent", {
|
|
anchorText: "MCP servers",
|
|
tab: "Runtime",
|
|
});
|
|
|
|
// Advanced runtime fields render directly in the profile panel's flat list,
|
|
// grouped under their own "Advanced" header.
|
|
await expect(panel.getByText("active_provider")).toBeVisible();
|
|
await expect(panel.getByText("Advanced", { exact: true })).toHaveCount(1);
|
|
// MCP servers render once each under their group label.
|
|
await expect(panel.getByText("developer", { exact: true })).toHaveCount(1);
|
|
await expect(panel.getByText("MCP servers", { exact: true })).toHaveCount(
|
|
1,
|
|
);
|
|
await settleAnimations(panel);
|
|
|
|
await panel.screenshot({ path: `${SHOTS}/05-advanced-expanded.png` });
|
|
});
|
|
|
|
test("06 — buzz-agent empty MCP servers", async ({ page }) => {
|
|
await installMockBridge(page, {
|
|
managedAgents: [
|
|
{
|
|
pubkey: BUZZ_AGENT_PUBKEY,
|
|
name: "Buzz Agent",
|
|
status: "running" as const,
|
|
channelNames: ["agents"],
|
|
},
|
|
],
|
|
});
|
|
|
|
const panel = await openAgentProfileFromChannel(page, "Buzz Agent", {
|
|
anchorText: "MCP servers",
|
|
tab: "Runtime",
|
|
});
|
|
|
|
await expect(
|
|
panel.getByText("No custom servers configured.", { exact: true }),
|
|
).toBeVisible();
|
|
await expect(panel.getByText("MCP servers", { exact: true })).toHaveCount(
|
|
1,
|
|
);
|
|
});
|
|
|
|
test("07 — profile side panel — Configuration section", async ({ page }) => {
|
|
// charlie (554cef…) is the well-known test pubkey that the mock bridge
|
|
// seeds as a bot owned by the test viewer, so isBot + isOwner + managedAgent
|
|
// are all true — the Configuration section renders in the profile panel.
|
|
await installMockBridge(page, {
|
|
managedAgents: [
|
|
{
|
|
pubkey:
|
|
"554cef57437abac34522ac2c9f0490d685b72c80478cf9f7ed6f9570ee8624ea",
|
|
name: "Charlie",
|
|
status: "running" as const,
|
|
channelNames: ["agents"],
|
|
},
|
|
],
|
|
});
|
|
await page.goto("/", { waitUntil: "domcontentloaded" });
|
|
await waitForInvokeBridge(page);
|
|
await page.getByTestId("channel-agents").click();
|
|
await expect(page.getByTestId("chat-title")).toHaveText("agents");
|
|
|
|
// Click Charlie's avatar to open the profile side panel. Pick the row by
|
|
// its text: each avatar fallback mounts on its own 200 ms timer after its
|
|
// row, so "the last row with an avatar" can still be nadia's.
|
|
await page
|
|
.getByTestId("message-row")
|
|
.filter({ hasText: "Charlie reporting in." })
|
|
.getByRole("button")
|
|
.first()
|
|
.click();
|
|
|
|
const panel = page.getByTestId("user-profile-panel");
|
|
await expect(panel).toBeVisible({ timeout: 10_000 });
|
|
await expect(panel.getByTestId("user-profile-name-row")).toContainText(
|
|
/charlie/i,
|
|
);
|
|
|
|
// Editable configuration lives inside the Runtime tab.
|
|
await panel.getByRole("tab", { name: "Runtime" }).click();
|
|
|
|
// Wait for the config section to render and scroll it into view so
|
|
// it is fully visible before capture.
|
|
const configAnchor = panel.getByText("Model").first();
|
|
await expect(configAnchor).toBeVisible({ timeout: 10_000 });
|
|
await configAnchor.scrollIntoViewIfNeeded();
|
|
// Scroll the panel's internal scroll container to the bottom so config
|
|
// fields are fully visible, not just the heading at the edge.
|
|
await panel.evaluate((el) => {
|
|
const scrollable =
|
|
el.querySelector("[data-radix-scroll-area-viewport]") ??
|
|
Array.from(el.querySelectorAll("*")).find(
|
|
(child) => child.scrollHeight > child.clientHeight + 10,
|
|
) ??
|
|
el;
|
|
scrollable.scrollTop = scrollable.scrollHeight;
|
|
});
|
|
await panel.page().waitForTimeout(200);
|
|
|
|
await settleAnimations(panel);
|
|
|
|
await panel.screenshot({
|
|
path: `${SHOTS}/06-profile-side-panel-config.png`,
|
|
});
|
|
});
|
|
});
|