mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-25 10:42:45 +00:00
test(heartbeats): start expiry after visibility
This commit is contained in:
@@ -51,13 +51,14 @@ test("an agent heartbeat stays visible and keeps its workspace running", async (
|
||||
await expectWorkspaceDone(page);
|
||||
await captureHeartbeatEvidence(page, testInfo, "heartbeat-removed-workspace-done");
|
||||
|
||||
const expiringHeartbeat = await scenario.createHeartbeat({
|
||||
name: "Temporary watch",
|
||||
expiresAt: new Date(Date.now() + 20_000).toISOString(),
|
||||
});
|
||||
const expiringHeartbeat = await scenario.createHeartbeat({ name: "Temporary watch" });
|
||||
await expectWorkspaceRunning(page);
|
||||
await page.getByRole("button", { name: "1 heartbeat" }).click();
|
||||
await expectHeartbeatVisible(page, expiringHeartbeat);
|
||||
await scenario.setHeartbeatExpiry(
|
||||
expiringHeartbeat.id,
|
||||
new Date(Date.now() + 20_000).toISOString(),
|
||||
);
|
||||
await expect(page.getByRole("button", { name: "1 heartbeat" })).toHaveCount(0, {
|
||||
timeout: 30_000,
|
||||
});
|
||||
|
||||
@@ -14,6 +14,10 @@ interface HeartbeatScheduleClient {
|
||||
}): Promise<{ schedule: ScheduleSummary | null; error: string | null }>;
|
||||
scheduleDelete(input: { id: string }): Promise<{ error: string | null }>;
|
||||
scheduleList(): Promise<{ schedules: ScheduleSummary[]; error: string | null }>;
|
||||
scheduleUpdate(input: {
|
||||
id: string;
|
||||
expiresAt: string;
|
||||
}): Promise<{ schedule: ScheduleSummary | null; error: string | null }>;
|
||||
}
|
||||
|
||||
export interface SeededHeartbeat {
|
||||
@@ -27,6 +31,7 @@ export interface AgentHeartbeatScenario {
|
||||
parent: { id: string; title: string };
|
||||
child: { id: string; title: string };
|
||||
createHeartbeat(input?: { name?: string; expiresAt?: string }): Promise<SeededHeartbeat>;
|
||||
setHeartbeatExpiry(id: string, expiresAt: string): Promise<void>;
|
||||
readWorkspaceStatus(): Promise<string | null>;
|
||||
readHeartbeatExists(id: string): Promise<boolean>;
|
||||
readAgentStatuses(): Promise<Record<string, string>>;
|
||||
@@ -75,6 +80,12 @@ export async function seedAgentWithHeartbeat(): Promise<AgentHeartbeatScenario>
|
||||
heartbeatIds.add(created.schedule.id);
|
||||
return { id: created.schedule.id, name, cadence: "Every 15 minutes" };
|
||||
},
|
||||
setHeartbeatExpiry: async (id, expiresAt) => {
|
||||
const updated = await scheduleClient.scheduleUpdate({ id, expiresAt });
|
||||
if (!updated.schedule) {
|
||||
throw new Error(updated.error ?? "Failed to update heartbeat expiry");
|
||||
}
|
||||
},
|
||||
readWorkspaceStatus: async () => {
|
||||
const result = await workspace.client.fetchWorkspaces();
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user