mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-14 13:22:37 +00:00
* fix(ci): skip unrelated required checks cleanly Matrix jobs had to start no-op runners to preserve interpolated required-check names. Static named jobs let GitHub report genuine skipped conclusions while keeping those names stable. * fix(ci): gate changes to install patching script * fix(ci): route cross-package test contracts narrowly * fix(ci): keep routed contracts merge-blocking * fix(server): exclude nested test utilities from builds * fix(ci): cover app-owned native and browser domains * refactor(ci): align tests with runtime domains Own browser specs, desktop specs, and Electron-only app code by stable directories so PR routing does not depend on filename conventions. Keep desktop integration coverage inside the required desktop check. * fix(ci): keep routing and desktop suites isolated The routing regression must run before dependency installation, and desktop Vitest must not collect Playwright-owned specs. * fix(ci): isolate desktop e2e runtime * perf(test): isolate Playwright workers * perf(test): parallelize Playwright within specs * fix(test): keep Playwright file scheduling * fix(test): share dynamic Metro fixture * fix(test): preserve own-host restart fixtures * fix(ci): preserve routed contracts after rebase * Stabilize Playwright wheel-scroll assertions
114 lines
3.7 KiB
TypeScript
114 lines
3.7 KiB
TypeScript
import { expect, test, type Page } from "../support/fixtures";
|
|
import { expectComposerVisible } from "../support/helpers/composer";
|
|
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
|
import { installProviderUsageFixture } from "../support/helpers/provider-usage";
|
|
|
|
const MOBILE_VIEWPORT = { width: 390, height: 844 };
|
|
|
|
async function openMockAgent(page: Page) {
|
|
await page.setViewportSize(MOBILE_VIEWPORT);
|
|
const session = await seedMockAgentWorkspace({
|
|
repoPrefix: "provider-usage-tooltip-",
|
|
title: "Provider usage tooltip e2e",
|
|
initialPrompt: "emit 1 coalesced agent stream update for provider usage tooltip.",
|
|
});
|
|
await openAgentRoute(page, session);
|
|
await expectComposerVisible(page);
|
|
await expect(page.getByTestId("context-window-meter")).toBeVisible({ timeout: 30_000 });
|
|
return session;
|
|
}
|
|
|
|
test.describe("provider usage tooltip", () => {
|
|
test("fetches usage when the context tooltip opens and renders the active provider", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(180_000);
|
|
const usageFixture = await installProviderUsageFixture(page, [
|
|
{
|
|
fetchedAt: "2026-06-19T00:00:00.000Z",
|
|
providers: [
|
|
{
|
|
providerId: "mock",
|
|
displayName: "Mock provider",
|
|
status: "available",
|
|
planLabel: "Test plan",
|
|
windows: [
|
|
{
|
|
id: "session",
|
|
label: "Session",
|
|
usedPct: 42,
|
|
remainingPct: 58,
|
|
resetsAt: "2026-06-19T05:00:00.000Z",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
]);
|
|
const session = await openMockAgent(page);
|
|
try {
|
|
expect(usageFixture.requestCount()).toBe(0);
|
|
|
|
await page.getByTestId("context-window-meter").hover();
|
|
await usageFixture.waitForRequestCount(1);
|
|
|
|
await expect(page.getByText("Mock provider", { exact: true })).toBeVisible({
|
|
timeout: 10_000,
|
|
});
|
|
await expect(page.getByText("Test plan")).toBeVisible();
|
|
await expect(page.getByText("Session", { exact: true })).toBeVisible();
|
|
await expect(page.getByText("42%")).toBeVisible();
|
|
} finally {
|
|
await session.cleanup();
|
|
}
|
|
});
|
|
|
|
test("refreshes usage again each time the tooltip is shown", async ({ page }) => {
|
|
test.setTimeout(180_000);
|
|
const usageFixture = await installProviderUsageFixture(page, [
|
|
{
|
|
fetchedAt: "2026-06-19T00:00:00.000Z",
|
|
providers: [
|
|
{
|
|
providerId: "mock",
|
|
displayName: "Mock provider",
|
|
status: "available",
|
|
planLabel: "Test plan",
|
|
windows: [{ id: "session", label: "Session", usedPct: 41 }],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
fetchedAt: "2026-06-19T00:01:00.000Z",
|
|
providers: [
|
|
{
|
|
providerId: "mock",
|
|
displayName: "Mock provider",
|
|
status: "available",
|
|
planLabel: "Test plan",
|
|
windows: [{ id: "session", label: "Session", usedPct: 64 }],
|
|
},
|
|
],
|
|
},
|
|
]);
|
|
const session = await openMockAgent(page);
|
|
try {
|
|
const meter = page.getByTestId("context-window-meter");
|
|
|
|
await meter.hover();
|
|
await usageFixture.waitForRequestCount(1);
|
|
await expect(page.getByText("41%")).toBeVisible({ timeout: 10_000 });
|
|
|
|
await page.mouse.move(0, 0);
|
|
await expect(page.getByText("Mock provider", { exact: true })).toHaveCount(0);
|
|
|
|
await meter.hover();
|
|
await usageFixture.waitForRequestCount(2);
|
|
expect(usageFixture.requestCount()).toBe(2);
|
|
await expect(page.getByText("64%")).toBeVisible();
|
|
} finally {
|
|
await session.cleanup();
|
|
}
|
|
});
|
|
});
|