惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
量子位
博客园 - 司徒正美
V
V2EX
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
美团技术团队
N
Netflix TechBlog - Medium
L
LangChain Blog
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
A
About on SuperTechFans
Microsoft Azure Blog
Microsoft Azure Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(ui): restore provider usage pill in desktop chat comp...
harjothkhara · 2026-06-16 · via Recent Commits to openclaw:main
1+

// Real-browser proof + regression for #93041: the desktop chat composer renders the provider

2+

// usage pill from models.authStatus. Screenshots go to the ignored .artifacts/ tree.

3+

import path from "node:path";

4+

import { chromium, type Browser, type Page } from "playwright";

5+

import { afterAll, beforeAll, describe, expect, it } from "vitest";

6+

import {

7+

canRunPlaywrightChromium,

8+

installMockGateway,

9+

resolvePlaywrightChromiumExecutablePath,

10+

startControlUiE2eServer,

11+

type ControlUiE2eServer,

12+

} from "../../test-helpers/control-ui-e2e.ts";

13+14+

const chromiumExecutablePath = resolvePlaywrightChromiumExecutablePath(chromium.executablePath());

15+

const chromiumAvailable = canRunPlaywrightChromium(chromiumExecutablePath);

16+

const describeE2e = chromiumAvailable ? describe : describe.skip;

17+18+

const baseTime = 1_700_000_000_000;

19+

const artifactDir = path.resolve(process.cwd(), ".artifacts/control-ui-e2e/chat-quota-pill-93041");

20+21+

const authStatusWithUsage = {

22+

ts: baseTime,

23+

providers: [

24+

{

25+

provider: "openai",

26+

displayName: "Codex",

27+

status: "ok",

28+

profiles: [{ profileId: "codex", type: "oauth", status: "ok" }],

29+

usage: {

30+

windows: [

31+

{ label: "5h", usedPercent: 42, resetAt: baseTime + 3 * 3_600_000 },

32+

{ label: "Week", usedPercent: 71, resetAt: baseTime + 4 * 86_400_000 },

33+

],

34+

},

35+

},

36+

],

37+

};

38+39+

let browser: Browser;

40+

let server: ControlUiE2eServer;

41+42+

async function openChat(authStatus: unknown): Promise<{ page: Page; close: () => Promise<void> }> {

43+

const context = await browser.newContext({

44+

locale: "en-US",

45+

serviceWorkers: "block",

46+

viewport: { height: 900, width: 1280 },

47+

});

48+

const page = await context.newPage();

49+

page.setDefaultTimeout(15_000);

50+

await installMockGateway(page, { methodResponses: { "models.authStatus": authStatus } });

51+

await page.goto(`${server.baseUrl}chat`);

52+

return { page, close: () => context.close() };

53+

}

54+55+

describeE2e("Control UI #93041 desktop chat quota pill (mocked Gateway E2E)", () => {

56+

beforeAll(async () => {

57+

server = await startControlUiE2eServer();

58+

browser = await chromium.launch({ executablePath: chromiumExecutablePath });

59+

});

60+61+

afterAll(async () => {

62+

await browser?.close();

63+

await server?.close();

64+

});

65+66+

it("renders the provider usage pill in the desktop chat composer", async () => {

67+

const { page, close } = await openChat(authStatusWithUsage);

68+

try {

69+

const pill = page.locator('[data-chat-provider-usage="true"]');

70+

await pill.waitFor({ state: "visible" });

71+

await page.screenshot({ path: path.join(artifactDir, "01-chat-with-pill.png") });

72+

await page

73+

.locator(".agent-chat__composer-controls")

74+

.first()

75+

.screenshot({ path: path.join(artifactDir, "02-composer-controls.png") });

76+77+

const text = (await pill.textContent())?.replace(/\s+/g, " ").trim();

78+

expect(text).toContain("Usage");

79+

expect(await pill.getAttribute("href")).toBe("/usage");

80+

expect(await pill.getAttribute("title")).toContain("Codex");

81+

} finally {

82+

await close();

83+

}

84+

});

85+86+

it("shows no pill when no provider usage windows are present", async () => {

87+

const { page, close } = await openChat({ ts: baseTime, providers: [] });

88+

try {

89+

await page.locator(".agent-chat__composer-controls").first().waitFor({ state: "visible" });

90+

await page.waitForTimeout(500);

91+

expect(await page.locator('[data-chat-provider-usage="true"]').count()).toBe(0);

92+

} finally {

93+

await close();

94+

}

95+

});

96+

});