mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-05 07:54:38 +00:00
* feat(usage): stream reports for live agent accounts Resolve account scope from the running harness environment without invoking lifecycle hooks. Keep the client aggregate result while delivering report updates as each fetch settles; the app presentation follows separately. * fix(usage): retain account scope for open agent sessions Capture the launch environment once per session, independently of lazy child-process startup or exit. Use a session UUID for registry identity. Update remaining global discovery fixtures to the scoped SDK contract. * test(usage): update browser fixtures for scoped report streams * feat(usage): let a usage card show window rows without pins UsageCard takes a required pinnable prop. When false, a window row is a plain bar: no Pressable, hover highlight, or pin glyph. The settings Usage list passes true. * feat(usage): show the agent's usage in the context window popover Reports stream into the query cache as each update arrives, for the host list and for a new per-agent query keyed by agent. The context window popover fetches its agent's reports while open and renders one unpinnable card per report as it lands, a loading sentence before the first, the request error as a sentence, and nothing on hosts without usage reports. * feat(usage): hide the Refresh button on popover usage cards UsageCard takes a required refreshable prop. The popover passes false because its content takes no pointer events, so the button could not be pressed; the card then shows its freshness inline. The settings Usage list keeps the button. * feat(usage): make the sidebar Usage summary opt-in The sidebar Usage item starts hidden on every layout, not only on compact ones, so resolveSidebarNavItems drops its compact input. While the summary is off, the Usage list renders window rows without pins; saved pins stay in preferences and return when it is turned on. Specs that read the summary now turn it on first. * docs(glossary): describe the popover usage card and the opt-in sidebar summary * fix(usage): show a popover request error without retrying A daemon error for an agent's usage, such as an unknown agent, does not heal on retry, and reopening the popover fetches again. Retrying held the loading sentence for about seven seconds before the error. * test(usage): cover agent usage in the context window popover The usage fixture records agentId, streams reports held behind promises, and can switch host support between reloads. The meter spec walks loading, streaming, a report problem, a request error and a host without usage reports, on desktop and compact in both themes. * fix(usage): keep the plain context window tooltip on hosts without usage The popover widened to fit usage cards on every host. Hosts that cannot report usage now keep the tooltip's default padding and width, as before, and mount no usage section. * fix(usage): let a report's Refresh replace it in the agent's list too Refresh wrote the refreshed report only into the host's list, so a card rendered from an agent's list kept the old report. Both lists now sit under one host key and Refresh replaces the report in each that holds it. * feat(usage): open the context window details in a sheet on compact screens Wide screens keep the tooltip. On compact screens pressing the meter opens a content-sized bottom sheet titled Context window. Both render one ContextWindowDetails body; only the sheet's usage cards have Refresh, since the tooltip cannot be pressed. Pins stay off in both. * test(usage): cover the compact context window sheet On the compact viewport the meter opens the sheet; its cards have Refresh, a Refresh replaces the card, and Close dismisses the sheet. The glossary names the sheet. * feat(ui): give tooltips and the context window sheet accessible roles Tooltip content is role=tooltip, and the context window sheet is a dialog named Context window, so assistive tech and tests find them by role. The agent usage message drops its test ID; it is found by its text. * test(usage): reshape the context window and Usage switch specs as journeys The context window spec runs one tooltip journey and one sheet journey per theme, with no layout branches. Its fixture script, meter actions and report builders move to a context-window helper, and it finds the meter, tooltip, sheet and Refresh buttons by role. The theme comes from the system colour scheme. The Usage switch test uses named helpers for the Usage icon and the Summary in sidebar switch. * fix(usage): say an agent's usage request failed instead of showing older reports A failed request keeps whatever reports the query held: those from an earlier open, or those that streamed in before the failure. The context window details showed them as if they were the agent's current usage. The request error now wins over held reports. * test(usage): let a fixture clean up the context window spec's agent The tooltip and sheet tests no longer wrap their steps in try/finally; a spec-local fixture seeds the agent and removes it after the test. * fix(usage): keep a refreshed report when the list it is in finishes Pressing Refresh on one card while another source was still streaming put the pre-refresh report back: the finished list replaced the query's data with the copies the request had fetched when it started. A report now keeps whichever copy was fetched later, both when a streamed copy arrives and when the finished list replaces the streamed one. * fix(usage): show only the login a resumed agent runs under now An agent resumed under another login keeps its ID, so its usage query kept the previous login's reports: reopening the context window showed them while the new login's reports loaded, then both side by side until the request finished. The agent's usage is now dropped as soon as its tooltip or sheet closes, so each open loads the login the agent runs under at that moment. * fix(usage): stop a closed agent usage request from writing reports Closing the context window details cancels the agent's usage request and drops reports still on their way, so reopening after a resume under another login sends a new request instead of joining the old one.
240 lines
9.2 KiB
TypeScript
240 lines
9.2 KiB
TypeScript
import { expect, test } from "../support/fixtures";
|
|
import { openAddProjectFlow, addProjectFlow } from "../support/helpers/add-project-flow";
|
|
import { installUsageReportsFixture } from "../support/helpers/usage-reports";
|
|
import {
|
|
claudeAndCodexReports,
|
|
expectPinnedUsage,
|
|
openCompactSidebar,
|
|
} from "../support/helpers/usage-sidebar-item";
|
|
import { gotoAppShell } from "../support/helpers/app";
|
|
import { SHOWCASE_PLUGIN_ID, installSidebarPlugins } from "../support/helpers/plugin-sidebar-items";
|
|
import {
|
|
expectFooterIconRow,
|
|
expectFooterSeparator,
|
|
hoverFooterAddProject,
|
|
footerScreenshot,
|
|
expectFooterItemHidden,
|
|
expectFooterOrder,
|
|
expectFooterSettingsKeys,
|
|
expectSidebarItemHidden,
|
|
expectSidebarNavSettingsOrder,
|
|
expectSidebarNavSettingsRow,
|
|
expectSidebarOrder,
|
|
expectStoredSidebarNav,
|
|
leaveSettings,
|
|
moveFooterItemUp,
|
|
moveSidebarNavItemUp,
|
|
openSidebarNavSettings,
|
|
seedSidebarFooterPreferences,
|
|
seedSidebarNavPreferences,
|
|
setFooterItemVisible,
|
|
setSidebarNavItemVisible,
|
|
} from "../support/helpers/sidebar-nav-settings";
|
|
|
|
test("fixed footer line keeps its five icons, Help and Settings at the end", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
await installUsageReportsFixture(page, { lists: [() => claudeAndCodexReports()] });
|
|
await seedSidebarFooterPreferences(page, [
|
|
{ key: "add-project", visible: false },
|
|
{ key: "usage", visible: true },
|
|
]);
|
|
await page.setViewportSize({ width: 1440, height: 900 });
|
|
await gotoAppShell(page);
|
|
await expectPinnedUsage(page, ["31% 5h", "54% wk", "7% 5h", "12% wk"]);
|
|
await expectFooterIconRow(page);
|
|
await expectFooterSeparator(page, true);
|
|
await footerScreenshot(page, "footer-desktop-with-rows");
|
|
await hoverFooterAddProject(page);
|
|
await footerScreenshot(page, "footer-desktop-add-project-tooltip");
|
|
await openAddProjectFlow(page);
|
|
await page.keyboard.press("Escape");
|
|
await expect(addProjectFlow(page)).toBeHidden();
|
|
await openSidebarNavSettings(page);
|
|
await expectFooterSettingsKeys(page, ["usage"]);
|
|
await setFooterItemVisible(page, "usage", false);
|
|
await leaveSettings(page);
|
|
await expectFooterSeparator(page, false);
|
|
await expectFooterIconRow(page);
|
|
await footerScreenshot(page, "footer-desktop-without-rows");
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
await openCompactSidebar(page);
|
|
await expectFooterSeparator(page, false);
|
|
await expectFooterIconRow(page);
|
|
await footerScreenshot(page, "footer-compact-without-rows");
|
|
await page.locator('[data-testid="sidebar-add-project"]:visible').hover();
|
|
await expect(page.getByTestId("sidebar-add-project-tooltip")).toHaveCount(0);
|
|
await footerScreenshot(page, "footer-compact-add-project-hover");
|
|
await openAddProjectFlow(page);
|
|
await page.keyboard.press("Escape");
|
|
await expect(addProjectFlow(page)).toBeHidden();
|
|
await page.setViewportSize({ width: 1440, height: 900 });
|
|
await openSidebarNavSettings(page);
|
|
await setFooterItemVisible(page, "usage", true);
|
|
await leaveSettings(page);
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
await openCompactSidebar(page);
|
|
await expectFooterSeparator(page, true);
|
|
await expectFooterIconRow(page);
|
|
await footerScreenshot(page, "footer-compact-with-rows");
|
|
});
|
|
|
|
test.describe("Sidebar items in Appearance settings", () => {
|
|
test("owner reorders and hides top-level sidebar items", async ({ page }) => {
|
|
await gotoAppShell(page);
|
|
|
|
await test.step("the sidebar starts in the default order", async () => {
|
|
await expectSidebarOrder(page, ["new-workspace", "history", "search", "schedules"]);
|
|
});
|
|
|
|
await test.step("the Sidebar section lists every item in the same order", async () => {
|
|
await openSidebarNavSettings(page);
|
|
// The section explains itself through the header's info tooltip, not a paragraph.
|
|
await expect(page.getByTestId("sidebar-nav-section-header-info")).toHaveAccessibleName(
|
|
"About Header",
|
|
);
|
|
await expectSidebarNavSettingsOrder(page, [
|
|
"new-workspace",
|
|
"history",
|
|
"search",
|
|
"schedules",
|
|
]);
|
|
await expectSidebarNavSettingsRow(page, {
|
|
key: "history",
|
|
label: "History",
|
|
visible: true,
|
|
});
|
|
// Items with a keyboard shortcut badge it next to their name. Chords render
|
|
// with Ctrl off macOS, which is what the browser project runs on.
|
|
await expect(
|
|
page.getByTestId("sidebar-nav-item-new-workspace").getByText("Ctrl+N", { exact: true }),
|
|
).toBeVisible();
|
|
});
|
|
|
|
await test.step("moving Schedules up twice lifts it above History", async () => {
|
|
await moveSidebarNavItemUp(page, "schedules");
|
|
await expectSidebarNavSettingsOrder(page, [
|
|
"new-workspace",
|
|
"history",
|
|
"schedules",
|
|
"search",
|
|
]);
|
|
await moveSidebarNavItemUp(page, "schedules");
|
|
await expectSidebarNavSettingsOrder(page, [
|
|
"new-workspace",
|
|
"schedules",
|
|
"history",
|
|
"search",
|
|
]);
|
|
|
|
await leaveSettings(page);
|
|
await expectSidebarOrder(page, ["new-workspace", "schedules", "history", "search"]);
|
|
});
|
|
|
|
await test.step("turning History off removes it from the sidebar", async () => {
|
|
await openSidebarNavSettings(page);
|
|
await setSidebarNavItemVisible(page, "history", false);
|
|
await expectStoredSidebarNav(page, [
|
|
{ key: "new-workspace", visible: true },
|
|
{ key: "schedules", visible: true },
|
|
{ key: "history", visible: false },
|
|
{ key: "search", visible: true },
|
|
]);
|
|
|
|
await leaveSettings(page);
|
|
await expectSidebarItemHidden(page, "history");
|
|
await expectSidebarOrder(page, ["new-workspace", "schedules", "search"]);
|
|
});
|
|
|
|
await test.step("the sidebar keeps that shape across a reload", async () => {
|
|
await page.reload();
|
|
await expectSidebarItemHidden(page, "history");
|
|
await expectSidebarOrder(page, ["new-workspace", "schedules", "search"]);
|
|
});
|
|
});
|
|
|
|
test("renders no top-level items when every one is turned off", async ({ page }) => {
|
|
await seedSidebarNavPreferences(page, [
|
|
{ key: "new-workspace", visible: false },
|
|
{ key: "history", visible: false },
|
|
{ key: "search", visible: false },
|
|
{ key: "schedules", visible: false },
|
|
]);
|
|
await gotoAppShell(page);
|
|
|
|
// The sidebar itself still renders; only its top-level nav items are gone.
|
|
await expect(page.locator('[data-testid="sidebar-settings"]:visible')).toBeVisible({
|
|
timeout: 30_000,
|
|
});
|
|
await expectSidebarItemHidden(page, "new-workspace");
|
|
await expectSidebarItemHidden(page, "history");
|
|
await expectSidebarItemHidden(page, "search");
|
|
await expectSidebarItemHidden(page, "schedules");
|
|
});
|
|
});
|
|
|
|
test.describe("Sidebar footer rows in Appearance settings", () => {
|
|
const syncKey = `plugin:${SHOWCASE_PLUGIN_ID}:sync`;
|
|
const brokenKey = `plugin:${SHOWCASE_PLUGIN_ID}:broken`;
|
|
let cleanup: () => Promise<void>;
|
|
|
|
test.beforeEach(async () => {
|
|
({ cleanup } = await installSidebarPlugins());
|
|
});
|
|
|
|
test.afterEach(async () => {
|
|
await cleanup();
|
|
});
|
|
|
|
test("owner reorders and hides footer rows; the icon row stays fixed", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
// The Usage item shows only with summary data.
|
|
await installUsageReportsFixture(page, { lists: [() => claudeAndCodexReports()] });
|
|
// Keys for the fixed footer icon buttons are ignored.
|
|
await seedSidebarFooterPreferences(page, [
|
|
{ key: "usage", visible: true },
|
|
{ key: "help", visible: false },
|
|
{ key: "hosts", visible: false },
|
|
{ key: "import", visible: false },
|
|
]);
|
|
await gotoAppShell(page);
|
|
|
|
await test.step("the Footer card lists only the footer rows", async () => {
|
|
await openSidebarNavSettings(page);
|
|
await expect(page.getByTestId("sidebar-nav-section-footer-info")).toHaveAccessibleName(
|
|
"About Footer",
|
|
);
|
|
await expectFooterSettingsKeys(page, ["usage", syncKey, brokenKey]);
|
|
await leaveSettings(page);
|
|
await expectFooterOrder(page, ["usage", syncKey]);
|
|
await expectFooterIconRow(page);
|
|
await expectFooterSeparator(page, true);
|
|
});
|
|
|
|
await test.step("moving Sync up and hiding the Usage item changes the rows", async () => {
|
|
await openSidebarNavSettings(page);
|
|
await moveFooterItemUp(page, syncKey);
|
|
await setFooterItemVisible(page, "usage", false);
|
|
await expectFooterSettingsKeys(page, [syncKey, "usage", brokenKey]);
|
|
await leaveSettings(page);
|
|
await expectFooterItemHidden(page, "usage");
|
|
await expect(
|
|
page.locator(`[data-testid="plugin-sidebar-footer-${SHOWCASE_PLUGIN_ID}-sync"]:visible`),
|
|
).toBeVisible();
|
|
await expectFooterIconRow(page);
|
|
await expectFooterSeparator(page, true);
|
|
});
|
|
|
|
await test.step("the rows keep that shape across a reload", async () => {
|
|
await page.reload();
|
|
await expect(
|
|
page.locator(`[data-testid="plugin-sidebar-footer-${SHOWCASE_PLUGIN_ID}-sync"]:visible`),
|
|
).toBeVisible({ timeout: 30_000 });
|
|
await expectFooterItemHidden(page, "usage");
|
|
await expectFooterIconRow(page);
|
|
await expectFooterSeparator(page, true);
|
|
await openSidebarNavSettings(page);
|
|
await expectFooterSettingsKeys(page, [syncKey, "usage", brokenKey]);
|
|
});
|
|
});
|
|
});
|