mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-02 06:33:05 +00:00
* Keep relative timestamps current in agent, schedule, and import-session rows Agent list rows, schedule rows, and import-session rows formatted their "5m ago" labels once at render, so an idle row kept its first label until something else re-rendered it. They now use useTimeAgo, which rides the same shared ticker the sidebar and desktop tabs already use. Closes #4625 * Say "just now" for the whole first minute so fresh labels stay honest The shared ticker wakes once a minute, so a seconds label could only go stale. The prose and compact formatters now share one age description, and the schedule spec anchors its clock to the schedule's creation time. * Run every cleanup in the schedule relative-time spec and name its steps * Keep relative labels current with focused subscriptions * Update usage card after relative-time hook rename * Anchor import-session age spec to fixture time --------- Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
52 lines
2.2 KiB
TypeScript
52 lines
2.2 KiB
TypeScript
import { expect, test } from "../support/fixtures";
|
|
import { openCommandCenter } from "../support/helpers/command-center";
|
|
import { getServerId } from "../support/helpers/server-id";
|
|
import { seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
|
import { openAgentRoute } from "../support/helpers/mock-agent";
|
|
import { resetSeededPageState, openSessions } from "../support/helpers/archive-tab";
|
|
import { closeSidebarDisplayPreferences, openSidebarDisplayPage } from "../support/helpers/sidebar";
|
|
|
|
test("agent list age advances and command center says just now for a fresh agent", async ({
|
|
page,
|
|
}) => {
|
|
const session = await seedMockAgentWorkspace({
|
|
repoPrefix: "agent-relative-time-",
|
|
title: "Relative time agent",
|
|
});
|
|
try {
|
|
await session.client.waitForAgentUpsert(session.agentId, (agent) => agent.status === "idle");
|
|
await resetSeededPageState(page);
|
|
await page.clock.install({ time: Date.now() });
|
|
await openSessions(page);
|
|
|
|
const row = page.getByTestId(`agent-row-${getServerId()}-${session.agentId}`);
|
|
await expect(row).toContainText("just now", { timeout: 30_000 });
|
|
|
|
const commandCenter = await openCommandCenter(page);
|
|
await commandCenter.getByTestId("command-center-input").fill("Relative time agent");
|
|
const agentResult = commandCenter.getByTestId(
|
|
`command-center-agent-${getServerId()}:${session.agentId}`,
|
|
);
|
|
await expect(agentResult.getByTestId("command-center-agent-subtitle")).toContainText(
|
|
"just now",
|
|
);
|
|
await page.keyboard.press("Escape");
|
|
|
|
await page.clock.fastForward("03:00");
|
|
await expect(row).toContainText("3m ago");
|
|
|
|
await openAgentRoute(page, session);
|
|
await page.getByTestId(`workspace-tab-agent_${session.agentId}`).first().hover();
|
|
await expect(page.getByTestId(`workspace-tab-tooltip-agent_${session.agentId}`)).toContainText(
|
|
"3m ago",
|
|
);
|
|
|
|
await openSidebarDisplayPage(page, "sidebar-display-show");
|
|
await page.getByRole("menuitem", { name: "Last activity", exact: true }).click();
|
|
await closeSidebarDisplayPreferences(page);
|
|
await expect(page.getByTestId("sidebar-workspace-timestamp").first()).toHaveText("3m");
|
|
} finally {
|
|
await session.cleanup();
|
|
}
|
|
});
|