test(app): allow the shared usage clock minute phase

The browser clock advances independently of daemon timestamps, and the shared ticker samples on wall-minute boundaries. Assert the bounded one-to-two-minute age and matching countdown progress instead of a single phase-dependent value.
This commit is contained in:
paseo-bot[bot]
2026-10-19 16:29:25 +02:00
parent ff6bc043e7
commit 9d8ed51fc3
+8 -4
View File
@@ -715,11 +715,15 @@ test("open usage clocks advance without refreshing or reopening", async ({ page
const card = page.getByTestId("usage-report-login-journey:account");
await expect(card.getByTestId("usage-freshness")).toHaveText("Updated just now");
await expect(card.getByText("resets 30m", { exact: false }).first()).toBeVisible();
// The shared minute clock is wall-aligned, and the daemon timestamps use real time.
// After two browser minutes the latest displayed tick is one or two minutes old.
await advanceUsageClock(page, 120_000);
await expect(card.getByTestId("usage-freshness")).toHaveText("Updated 2m ago");
await expect(card.getByText("resets 28m", { exact: false }).first()).toBeVisible();
await expect(card.getByText("runs out 28m", { exact: false })).toBeVisible();
await expect(card.getByTestId("provider-usage-balance-credits-reset")).toHaveText("resets 28m");
await expect(card.getByTestId("usage-freshness")).toHaveText(/^Updated [12]m ago$/);
await expect(card.getByText(/resets (28|29)m/).first()).toBeVisible();
await expect(card.getByText(/runs out (28|29)m/)).toBeVisible();
await expect(card.getByTestId("provider-usage-balance-credits-reset")).toHaveText(
/^resets (28|29)m$/,
);
} finally {
await login.cleanup();
}