fix(webui): round Codex speed controls to match the reasoning slider (#6703)

This commit is contained in:
chengyongru authored and GitHub committed 2026-11-18 16:44:27 +08:00
1 parent 74d070f699
commit 7e04670461
2 files changed
+26 -10

No files matched your search

+19 -3
View File
@@ -1,4 +1,15 @@
import { expect, test } from "@playwright/test";
import { expect, test, type Locator } from "@playwright/test";
async function expectSpeedCircle(button: Locator, track: { y: number; height: number }) {
const face = button.locator(":scope > [aria-hidden]");
await expect(face).toHaveCSS("corner-shape", /^(round|superellipse\(1\))$/);
const { y, width, height } = (await face.boundingBox())!;
expect(height).toBe(track.height);
expect(width).toBe(height);
expect(y).toBeCloseTo(track.y, 0);
expect(await face.evaluate((element) => Number.parseFloat(getComputedStyle(element).borderTopLeftRadius))).toBeGreaterThanOrEqual(height / 2);
await expect(button).toHaveCSS("background-color", "rgba(0, 0, 0, 0)");
}
for (const width of [390, 1280]) {
test(`current-chat model options preserve the compact preset menu at ${width}px`, async ({ page }, testInfo) => {
@@ -29,6 +40,7 @@ for (const width of [390, 1280]) {
const thumb = (await dialog.locator(".reasoning-effort-thumb").boundingBox())!;
expect(track.height).toBe(20);
expect(thumb.height).toBe(24);
await expectSpeedCircle(fast, track);
const stops = await dialog.locator(".reasoning-effort-tick").evaluateAll((elements) =>
elements.map((element) => element.getBoundingClientRect().x),
);
@@ -84,9 +96,9 @@ test("Temporary Chats do not expose model option controls", async ({ page }) =>
await expect(page.getByRole("button", { name: "Fast", exact: true })).toHaveCount(0);
});
test("reselecting medium and choosing Ultrafast sends and remembers both concrete values", async ({ page }) => {
test("reselecting medium and choosing Ultrafast sends and remembers both concrete values", async ({ page }, testInfo) => {
await page.setViewportSize({ width: 320, height: 800 });
await page.goto("/browser/fixture.html?case=model-options&ultrafast");
await page.goto("/browser/fixture.html?case=model-options&ultrafast&dark");
const open = page.getByRole("button", { name: "Default", exact: true });
await open.click();
const dialog = page.getByRole("dialog", { name: "Switch model", exact: true });
@@ -134,9 +146,13 @@ test("reselecting medium and choosing Ultrafast sends and remembers both concret
await ultrafast.click();
await expect(ultrafast).toHaveAttribute("aria-pressed", "true");
await expect(fast).toHaveAttribute("aria-pressed", "false");
const track = (await dialog.locator(".reasoning-effort-track").boundingBox())!;
await expectSpeedCircle(fast, track);
await expectSpeedCircle(ultrafast, track);
expect(await speeds.evaluate((group) => [...group.querySelectorAll("button")].every((button) =>
button.scrollWidth <= button.clientWidth + 1 && button.offsetWidth >= 44 && button.offsetHeight >= 44,
))).toBe(true);
await dialog.locator(".model-options-row").screenshot({ path: testInfo.outputPath("model-options-ultrafast-320.png") });
await dialog.press("Escape");
await page.getByLabel("Message input").fill("Test this speed");
await page.getByRole("button", { name: "Send message", exact: true }).click();