@firstpick/pi-package-webui 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/lib/ui-layout-settings.mjs +37 -6
- package/package.json +1 -1
- package/public/app.js +499 -6
- package/public/index.html +33 -26
- package/public/service-worker.js +1 -1
- package/public/stream-output-controller.mjs +31 -2
- package/public/styles.css +27 -2
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/control-deck-side-panels.spec.mjs +42 -0
- package/tests/browser/control-visibility.spec.mjs +396 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +9 -9
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-deck-side-panels-static.test.mjs +3 -1
- package/tests/control-visibility-static.test.mjs +294 -0
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/file-viewer-image-static.test.mjs +3 -3
- package/tests/fixtures/streaming-workloads.mjs +131 -0
- package/tests/git-workflow-preferences.test.mjs +2 -2
- package/tests/http-endpoints-harness.test.mjs +4 -4
- package/tests/intercom-conversation-viewer-static.test.mjs +4 -4
- package/tests/main-output-loading-static.test.mjs +3 -3
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +3 -3
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +3 -3
- package/tests/open-issue-wizard-static.test.mjs +2 -2
- package/tests/persistent-ui-layout-static.test.mjs +6 -6
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/stream-output-isolation-static.test.mjs +7 -0
- package/tests/stream-output-workloads.test.mjs +239 -0
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/syntax-highlighting-static.test.mjs +3 -3
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/ui-layout-settings.test.mjs +54 -7
- package/tests/webui-settings-locking.test.mjs +3 -3
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { createServer } from "node:net";
|
|
4
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { expect, test } from "@playwright/test";
|
|
10
|
+
|
|
11
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
12
|
+
const serverScript = join(root, "bin", "pi-webui.mjs");
|
|
13
|
+
const fakePi = join(root, "tests", "fixtures", "fake-pi.mjs");
|
|
14
|
+
const HIDDEN_IDS_KEY = "pi-webui-control-visibility-hidden-ids-v1";
|
|
15
|
+
const MENU_SELECTOR = "#visibilityContextMenu";
|
|
16
|
+
|
|
17
|
+
let child;
|
|
18
|
+
let baseURL;
|
|
19
|
+
let port;
|
|
20
|
+
let tempRoot;
|
|
21
|
+
let settingsFile;
|
|
22
|
+
let output = "";
|
|
23
|
+
|
|
24
|
+
async function freePort() {
|
|
25
|
+
const server = createServer();
|
|
26
|
+
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
27
|
+
const { port } = server.address();
|
|
28
|
+
await new Promise((resolve) => server.close(resolve));
|
|
29
|
+
return port;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function startServer() {
|
|
33
|
+
child = spawn(process.execPath, [serverScript, "--cwd", tempRoot, "--host", "127.0.0.1", "--port", String(port), "--pi", fakePi], {
|
|
34
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
35
|
+
env: {
|
|
36
|
+
...process.env,
|
|
37
|
+
PI_WEBUI_RPC_SUPERVISOR: "0",
|
|
38
|
+
PI_CODING_AGENT_DIR: join(tempRoot, "agent"),
|
|
39
|
+
PI_WEBUI_SETTINGS_FILE: settingsFile,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
child.stdout.on("data", (chunk) => { output += String(chunk); });
|
|
43
|
+
child.stderr.on("data", (chunk) => { output += String(chunk); });
|
|
44
|
+
for (let attempt = 0; attempt < 100; attempt += 1) {
|
|
45
|
+
if (child.exitCode !== null) break;
|
|
46
|
+
try {
|
|
47
|
+
const response = await fetch(`${baseURL}/api/health`, { signal: AbortSignal.timeout(500) });
|
|
48
|
+
if (response.ok) return;
|
|
49
|
+
} catch {
|
|
50
|
+
// Wait for the fixture server to start.
|
|
51
|
+
}
|
|
52
|
+
await delay(100);
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`Pi Web UI did not start:\n${output}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function stopServer() {
|
|
58
|
+
const stoppingChild = child;
|
|
59
|
+
if (!stoppingChild || stoppingChild.exitCode !== null) return;
|
|
60
|
+
const exited = new Promise((resolve) => stoppingChild.once("exit", resolve));
|
|
61
|
+
stoppingChild.kill("SIGTERM");
|
|
62
|
+
await Promise.race([
|
|
63
|
+
exited,
|
|
64
|
+
delay(5_000).then(() => {
|
|
65
|
+
if (stoppingChild.exitCode === null) stoppingChild.kill("SIGKILL");
|
|
66
|
+
return exited;
|
|
67
|
+
}),
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function hiddenIdsOnDisk() {
|
|
72
|
+
for (let attempt = 0; attempt < 40; attempt += 1) {
|
|
73
|
+
try {
|
|
74
|
+
const settings = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
75
|
+
const hiddenIds = settings?.uiLayout?.controlVisibility?.hiddenIds;
|
|
76
|
+
if (hiddenIds !== undefined) return Array.isArray(hiddenIds) ? hiddenIds : hiddenIds;
|
|
77
|
+
} catch {
|
|
78
|
+
// The settings file may be replaced atomically during the write.
|
|
79
|
+
}
|
|
80
|
+
await delay(100);
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function hiddenIdsInLocal(page) {
|
|
86
|
+
return page.evaluate((key) => JSON.parse(localStorage.getItem(key) || "null"), HIDDEN_IDS_KEY);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function openAreaMenu(page) {
|
|
90
|
+
// Dispatch on marked header padding so responsive Control Deck overlays do
|
|
91
|
+
// not make the empty-area recovery path flaky in the browser harness.
|
|
92
|
+
await page.locator('.side-panel-header[data-visibility-region="control-deck"]').evaluate((element) => {
|
|
93
|
+
const rect = element.getBoundingClientRect();
|
|
94
|
+
element.dispatchEvent(new MouseEvent("contextmenu", {
|
|
95
|
+
bubbles: true,
|
|
96
|
+
cancelable: true,
|
|
97
|
+
button: 2,
|
|
98
|
+
clientX: rect.left + 4,
|
|
99
|
+
clientY: rect.top + 4,
|
|
100
|
+
}));
|
|
101
|
+
});
|
|
102
|
+
return page.locator(MENU_SELECTOR);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function dispatchAreaMenuAt(page, clientX, clientY) {
|
|
106
|
+
await page.locator(".composer-row").evaluate((element, point) => {
|
|
107
|
+
element.dispatchEvent(new MouseEvent("contextmenu", {
|
|
108
|
+
bubbles: true,
|
|
109
|
+
cancelable: true,
|
|
110
|
+
button: 2,
|
|
111
|
+
clientX: point.clientX,
|
|
112
|
+
clientY: point.clientY,
|
|
113
|
+
}));
|
|
114
|
+
}, { clientX, clientY });
|
|
115
|
+
return page.locator(MENU_SELECTOR);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async function suppressUnrelatedOverlays(page) {
|
|
119
|
+
await page.addStyleTag({ content: "#optionalFeatureMigrationSurface, #updateNotification { display: none !important; }" });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
test.describe.configure({ mode: "serial" });
|
|
123
|
+
|
|
124
|
+
test.beforeAll(async () => {
|
|
125
|
+
tempRoot = await mkdtemp(join(tmpdir(), "pi-webui-control-visibility-"));
|
|
126
|
+
settingsFile = join(tempRoot, "settings.json");
|
|
127
|
+
await writeFile(settingsFile, "{}", "utf8");
|
|
128
|
+
await mkdir(join(tempRoot, "agent"), { recursive: true });
|
|
129
|
+
port = await freePort();
|
|
130
|
+
baseURL = `http://127.0.0.1:${port}`;
|
|
131
|
+
await startServer();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test.afterAll(async () => {
|
|
135
|
+
await stopServer();
|
|
136
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test("grouped area menu, direct hide, recovery, persistence, gating, Send exclusion, keyboard", async ({ page }) => {
|
|
140
|
+
await page.goto(baseURL, { waitUntil: "domcontentloaded" });
|
|
141
|
+
await suppressUnrelatedOverlays(page);
|
|
142
|
+
await expect(page.locator("#sendButton")).toBeVisible();
|
|
143
|
+
|
|
144
|
+
// Seed a saved grid so visibility changes must project a dense visible layout.
|
|
145
|
+
await page.evaluate(() => {
|
|
146
|
+
localStorage.setItem("pi-webui-composer-action-layout-v2", JSON.stringify({
|
|
147
|
+
version: 2,
|
|
148
|
+
columns: 4,
|
|
149
|
+
positions: { new: 0, compact: 1, options: 3, send: 6 },
|
|
150
|
+
}));
|
|
151
|
+
});
|
|
152
|
+
await page.reload({ waitUntil: "domcontentloaded" });
|
|
153
|
+
await suppressUnrelatedOverlays(page);
|
|
154
|
+
const optionsAction = page.locator('[data-composer-action-id="options"]');
|
|
155
|
+
const newAction = page.locator('[data-composer-action-id="new"]');
|
|
156
|
+
await expect.poll(() => optionsAction.evaluate((element) => Number(element.style.getPropertyValue("--composer-action-grid-column")))).toBeGreaterThan(1);
|
|
157
|
+
await expect.poll(() => newAction.evaluate((element) => Number(element.style.getPropertyValue("--composer-action-grid-column")))).toBeGreaterThan(0);
|
|
158
|
+
const initialOptionsColumn = Number(await optionsAction.evaluate((element) => element.style.getPropertyValue("--composer-action-grid-column")));
|
|
159
|
+
const initialNewColumn = Number(await newAction.evaluate((element) => element.style.getPropertyValue("--composer-action-grid-column")));
|
|
160
|
+
|
|
161
|
+
// Send and editable controls are not region-menu proxies.
|
|
162
|
+
const menu = page.locator(MENU_SELECTOR);
|
|
163
|
+
await page.locator("#sendButton").click({ button: "right" });
|
|
164
|
+
await expect(menu).toBeHidden();
|
|
165
|
+
await page.locator("#promptInput").click({ button: "right" });
|
|
166
|
+
await expect(menu).toBeHidden();
|
|
167
|
+
|
|
168
|
+
// Open submenu contents keep their specialized context behavior even though
|
|
169
|
+
// their registered composer wrapper is an ancestor.
|
|
170
|
+
await page.locator("#optionsMenuButton").click();
|
|
171
|
+
await expect(page.locator("#optionsMenu")).toBeVisible();
|
|
172
|
+
await page.locator("#optionsSettingsButton").click({ button: "right" });
|
|
173
|
+
await expect(menu).toBeHidden();
|
|
174
|
+
await page.keyboard.press("Escape");
|
|
175
|
+
|
|
176
|
+
// Empty marked area opens the complete grouped catalog.
|
|
177
|
+
await openAreaMenu(page);
|
|
178
|
+
await expect(menu).toBeVisible();
|
|
179
|
+
const checkboxes = menu.locator('[role="menuitemcheckbox"]');
|
|
180
|
+
await expect(checkboxes).toHaveCount(24);
|
|
181
|
+
await expect.poll(async () => checkboxes.evaluateAll((items) => items.map((item) => item.getAttribute("aria-checked")))).toEqual(Array(24).fill("true"));
|
|
182
|
+
await expect(menu.getByRole("menuitem", { name: "Show all" })).toHaveCount(1);
|
|
183
|
+
await expect(menu.getByRole("menuitem", { name: "Reset defaults" })).toHaveCount(1);
|
|
184
|
+
await expect(menu.locator('[data-visibility-menu-toggle="composer.send"]')).toHaveCount(0);
|
|
185
|
+
await page.keyboard.press("Escape");
|
|
186
|
+
await expect(menu).toBeHidden();
|
|
187
|
+
// Non-focusable region hosts restore focus to the prompt fallback on Escape.
|
|
188
|
+
await expect(page.locator("#promptInput")).toBeFocused();
|
|
189
|
+
|
|
190
|
+
// Direct hide applies immediately and reflows the sparse composer grid.
|
|
191
|
+
await page.locator("#newSessionButton").click({ button: "right" });
|
|
192
|
+
await expect(menu).toContainText("Hide New");
|
|
193
|
+
await menu.locator('[data-visibility-menu-action="hide"]').click();
|
|
194
|
+
await expect(page.locator("#newSessionButton")).toHaveClass(/webui-user-hidden/);
|
|
195
|
+
await expect(page.locator("#promptInput")).toBeFocused();
|
|
196
|
+
await expect.poll(() => optionsAction.evaluate((element) => Number(element.style.getPropertyValue("--composer-action-grid-column")))).toBeLessThan(initialOptionsColumn);
|
|
197
|
+
assert.ok(Number(await optionsAction.evaluate((element) => element.style.getPropertyValue("--composer-action-grid-column"))) > 0, "repacked actions should keep a positive dense slot");
|
|
198
|
+
assert.deepEqual(await hiddenIdsInLocal(page), ["composer.new"], "direct hide should persist locally first");
|
|
199
|
+
await expect.poll(async () => (await hiddenIdsOnDisk())?.slice?.().sort?.()).toEqual(["composer.new"]);
|
|
200
|
+
|
|
201
|
+
// Runtime capability gating remains authoritative when preferences show all.
|
|
202
|
+
const gitButton = page.locator('[data-composer-action-id="git"]');
|
|
203
|
+
await openAreaMenu(page);
|
|
204
|
+
assert.ok(await gitButton.evaluate((element) => element.hidden), "capability-hidden controls keep the hidden attribute");
|
|
205
|
+
await menu.getByRole("menuitem", { name: "Show all" }).click();
|
|
206
|
+
await expect(page.locator("#newSessionButton")).not.toHaveClass(/webui-user-hidden/);
|
|
207
|
+
// Un-hiding must schedule a restore that returns actions to their saved slots.
|
|
208
|
+
await expect.poll(() => newAction.evaluate((element) => Number(element.style.getPropertyValue("--composer-action-grid-column")))).toBe(initialNewColumn);
|
|
209
|
+
await expect.poll(() => optionsAction.evaluate((element) => Number(element.style.getPropertyValue("--composer-action-grid-column")))).toBe(initialOptionsColumn);
|
|
210
|
+
assert.deepEqual(await hiddenIdsInLocal(page), [], "Show all should persist an explicit empty list");
|
|
211
|
+
assert.ok(await gitButton.evaluate((element) => element.hidden), "Show all must not clear runtime hidden gating");
|
|
212
|
+
|
|
213
|
+
// Reset defaults is distinct from Show all: null vs [].
|
|
214
|
+
await openAreaMenu(page);
|
|
215
|
+
await menu.getByRole("menuitem", { name: "Reset defaults" }).click();
|
|
216
|
+
assert.equal(await hiddenIdsInLocal(page), null, "Reset defaults should clear hiddenIds to null");
|
|
217
|
+
await expect.poll(hiddenIdsOnDisk).toBe(null);
|
|
218
|
+
|
|
219
|
+
// Shift+F10 supports complete menu navigation and restores surviving focus.
|
|
220
|
+
await page.locator("#attachButton").focus();
|
|
221
|
+
await page.keyboard.press("Shift+F10");
|
|
222
|
+
await expect(menu).toBeVisible();
|
|
223
|
+
await page.keyboard.press("End");
|
|
224
|
+
await expect(menu.getByRole("menuitem", { name: "Reset defaults" })).toBeFocused();
|
|
225
|
+
await page.keyboard.press("Home");
|
|
226
|
+
await expect(menu.getByRole("menuitem", { name: "Hide Attach files" })).toBeFocused();
|
|
227
|
+
await page.keyboard.press("ArrowDown");
|
|
228
|
+
await page.keyboard.press("ArrowUp");
|
|
229
|
+
await page.keyboard.press("Escape");
|
|
230
|
+
await expect(menu).toBeHidden();
|
|
231
|
+
await expect(page.locator("#attachButton")).toBeFocused();
|
|
232
|
+
|
|
233
|
+
// The Context Menu key plus Enter performs direct hide. A hidden trigger
|
|
234
|
+
// returns focus to the safe prompt fallback.
|
|
235
|
+
await page.keyboard.press("ContextMenu");
|
|
236
|
+
await expect(menu).toBeVisible();
|
|
237
|
+
await page.keyboard.press("Enter");
|
|
238
|
+
await expect(page.locator("#attachButton")).toHaveClass(/webui-user-hidden/);
|
|
239
|
+
await expect(page.locator("#promptInput")).toBeFocused();
|
|
240
|
+
await expect.poll(hiddenIdsOnDisk).toEqual(["input.attach-files"]);
|
|
241
|
+
|
|
242
|
+
// Prove reload recovery comes from durable settings rather than only cache.
|
|
243
|
+
await page.evaluate((key) => localStorage.removeItem(key), HIDDEN_IDS_KEY);
|
|
244
|
+
await page.reload({ waitUntil: "domcontentloaded" });
|
|
245
|
+
await suppressUnrelatedOverlays(page);
|
|
246
|
+
await expect(page.locator("#attachButton")).toHaveClass(/webui-user-hidden/);
|
|
247
|
+
await expect(page.locator("#sendButton")).toBeVisible();
|
|
248
|
+
|
|
249
|
+
// Area recovery remains available and tag categories toggle independently.
|
|
250
|
+
await openAreaMenu(page);
|
|
251
|
+
const attachToggle = menu.locator('[data-visibility-menu-toggle="input.attach-files"]');
|
|
252
|
+
await expect(attachToggle).toHaveAttribute("aria-checked", "false");
|
|
253
|
+
await attachToggle.click();
|
|
254
|
+
await expect(attachToggle).toHaveAttribute("aria-checked", "true");
|
|
255
|
+
await expect(page.locator("#attachButton")).not.toHaveClass(/webui-user-hidden/);
|
|
256
|
+
const tagsToggle = menu.locator('[data-visibility-menu-toggle="tag.skills"]');
|
|
257
|
+
await tagsToggle.click();
|
|
258
|
+
await expect(page.locator("#sessionSkillTags")).toHaveClass(/webui-user-hidden/);
|
|
259
|
+
assert.deepEqual(await hiddenIdsInLocal(page), ["tag.skills"], "each tag category toggles independently");
|
|
260
|
+
await page.locator("#promptInput").click();
|
|
261
|
+
await expect(menu).toBeHidden();
|
|
262
|
+
|
|
263
|
+
// Coordinates beyond the viewport are clamped into the visible page.
|
|
264
|
+
const viewport = page.viewportSize();
|
|
265
|
+
await dispatchAreaMenuAt(page, viewport.width + 500, viewport.height + 500);
|
|
266
|
+
await expect(menu).toBeVisible();
|
|
267
|
+
const bounds = await menu.boundingBox();
|
|
268
|
+
assert.ok(bounds.x >= 0 && bounds.y >= 0, "menu should not overflow the top or left viewport edges");
|
|
269
|
+
assert.ok(bounds.x + bounds.width <= viewport.width && bounds.y + bounds.height <= viewport.height, "menu should remain inside the viewport");
|
|
270
|
+
await page.keyboard.press("Escape");
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
test("keyboard-only recovery from Send after every catalog item is hidden", async ({ page }) => {
|
|
274
|
+
await page.goto(baseURL, { waitUntil: "domcontentloaded" });
|
|
275
|
+
await suppressUnrelatedOverlays(page);
|
|
276
|
+
const menu = page.locator(MENU_SELECTOR);
|
|
277
|
+
await expect(page.locator("#sendButton")).toHaveAttribute("aria-keyshortcuts", /Shift\+F10/);
|
|
278
|
+
|
|
279
|
+
// Hide every catalog item through the grouped area menu (setup may use the
|
|
280
|
+
// pointer; only the recovery below must be keyboard-only).
|
|
281
|
+
await openAreaMenu(page);
|
|
282
|
+
await expect(menu).toBeVisible();
|
|
283
|
+
const checkboxes = menu.locator('[role="menuitemcheckbox"]');
|
|
284
|
+
await expect(checkboxes).toHaveCount(24);
|
|
285
|
+
for (let index = 0; index < 24; index += 1) {
|
|
286
|
+
const item = checkboxes.nth(index);
|
|
287
|
+
// Hiding controls can shift the layout and legitimately auto-dismiss the
|
|
288
|
+
// menu on the resulting scroll, so drive the same click handler directly.
|
|
289
|
+
if ((await item.getAttribute("aria-checked")) === "true") await item.dispatchEvent("click");
|
|
290
|
+
}
|
|
291
|
+
await expect.poll(async () => checkboxes.evaluateAll((items) => items.map((item) => item.getAttribute("aria-checked")))).toEqual(Array(24).fill("false"));
|
|
292
|
+
await expect.poll(async () => (await hiddenIdsInLocal(page))?.length).toBe(24);
|
|
293
|
+
if (!(await menu.isHidden())) await page.keyboard.press("Escape");
|
|
294
|
+
await expect(page.locator("#attachButton")).toHaveClass(/webui-user-hidden/);
|
|
295
|
+
await expect(page.locator("#newSessionButton")).toHaveClass(/webui-user-hidden/);
|
|
296
|
+
await expect(page.locator("#sendButton")).toBeVisible();
|
|
297
|
+
|
|
298
|
+
// Keyboard-only recovery: the Context Menu key on Send opens the grouped
|
|
299
|
+
// menu even though no optional control remains visible.
|
|
300
|
+
await page.locator("#sendButton").focus();
|
|
301
|
+
await page.keyboard.press("ContextMenu");
|
|
302
|
+
await expect(menu).toBeVisible();
|
|
303
|
+
await expect(menu.locator('[role="menuitemcheckbox"]')).toHaveCount(24);
|
|
304
|
+
await page.keyboard.press("Escape");
|
|
305
|
+
await expect(menu).toBeHidden();
|
|
306
|
+
await expect(page.locator("#sendButton")).toBeFocused();
|
|
307
|
+
|
|
308
|
+
// Shift+F10 opens the same menu; activate Show all without touching the pointer.
|
|
309
|
+
await page.keyboard.press("Shift+F10");
|
|
310
|
+
await expect(menu).toBeVisible();
|
|
311
|
+
await page.keyboard.press("End");
|
|
312
|
+
await expect(menu.getByRole("menuitem", { name: "Reset defaults" })).toBeFocused();
|
|
313
|
+
await page.keyboard.press("ArrowUp");
|
|
314
|
+
await expect(menu.getByRole("menuitem", { name: "Show all" })).toBeFocused();
|
|
315
|
+
await page.keyboard.press("Enter");
|
|
316
|
+
await expect(menu).toBeHidden();
|
|
317
|
+
await expect(page.locator("#sendButton")).toBeFocused();
|
|
318
|
+
|
|
319
|
+
// Every catalog item is restored and the explicit show-all state persists.
|
|
320
|
+
assert.deepEqual(await hiddenIdsInLocal(page), [], "Show all should persist an explicit empty list");
|
|
321
|
+
await expect(page.locator("#attachButton")).not.toHaveClass(/webui-user-hidden/);
|
|
322
|
+
await expect(page.locator("#newSessionButton")).not.toHaveClass(/webui-user-hidden/);
|
|
323
|
+
await expect(page.locator("#sessionSkillTags")).not.toHaveClass(/webui-user-hidden/);
|
|
324
|
+
await openAreaMenu(page);
|
|
325
|
+
await expect.poll(async () => checkboxes.evaluateAll((items) => items.map((item) => item.getAttribute("aria-checked")))).toEqual(Array(24).fill("true"));
|
|
326
|
+
await page.keyboard.press("Escape");
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
test("pending visibility mutation survives same-origin cache adoption and rewrites the cache after acknowledgment", async ({ browser }) => {
|
|
330
|
+
const context = await browser.newContext();
|
|
331
|
+
const page1 = await context.newPage();
|
|
332
|
+
const page2 = await context.newPage();
|
|
333
|
+
try {
|
|
334
|
+
await page1.goto(baseURL, { waitUntil: "domcontentloaded" });
|
|
335
|
+
await suppressUnrelatedOverlays(page1);
|
|
336
|
+
await page2.goto(baseURL, { waitUntil: "domcontentloaded" });
|
|
337
|
+
await suppressUnrelatedOverlays(page2);
|
|
338
|
+
|
|
339
|
+
// Hold page1's first layout PUT so its visibility mutation stays dirty.
|
|
340
|
+
let heldRoute = null;
|
|
341
|
+
await page1.route("**/api/interface-preferences", async (route) => {
|
|
342
|
+
if (route.request().method() === "PUT" && !heldRoute) {
|
|
343
|
+
heldRoute = route;
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
await route.continue();
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// Page 1 hides Attach files; the save is intercepted before acknowledgment.
|
|
350
|
+
await page1.locator("#attachButton").click({ button: "right" });
|
|
351
|
+
await page1.locator(MENU_SELECTOR).locator('[data-visibility-menu-action="hide"]').click();
|
|
352
|
+
await expect(page1.locator("#attachButton")).toHaveClass(/webui-user-hidden/);
|
|
353
|
+
await expect.poll(() => heldRoute !== null, { message: "page 1's visibility PUT should be held" }).toBe(true);
|
|
354
|
+
|
|
355
|
+
// Page 2 adopts page 1's cache, then hides a tag category and saves
|
|
356
|
+
// successfully; its cache write fires a same-origin storage event in page 1.
|
|
357
|
+
await openAreaMenu(page2);
|
|
358
|
+
await page2.locator(MENU_SELECTOR).locator('[data-visibility-menu-toggle="tag.skills"]').click();
|
|
359
|
+
await page2.keyboard.press("Escape");
|
|
360
|
+
await expect.poll(async () => hiddenIdsInLocal(page2)).toEqual(["input.attach-files", "tag.skills"]);
|
|
361
|
+
await expect.poll(hiddenIdsOnDisk).toEqual(["input.attach-files", "tag.skills"]);
|
|
362
|
+
|
|
363
|
+
// Page 1 keeps showing its own pending mutation instead of adopting the
|
|
364
|
+
// incoming cache: Attach stays hidden and skill tags stay visible. The
|
|
365
|
+
// grouped menu must use that same dirty set, not the overwritten cache.
|
|
366
|
+
await delay(500);
|
|
367
|
+
await expect(page1.locator("#attachButton")).toHaveClass(/webui-user-hidden/);
|
|
368
|
+
await expect(page1.locator("#sessionSkillTags")).not.toHaveClass(/webui-user-hidden/);
|
|
369
|
+
const page1Menu = await openAreaMenu(page1);
|
|
370
|
+
await expect(page1Menu.locator('[data-visibility-menu-toggle="input.attach-files"]')).toHaveAttribute("aria-checked", "false");
|
|
371
|
+
await expect(page1Menu.locator('[data-visibility-menu-toggle="tag.skills"]')).toHaveAttribute("aria-checked", "true");
|
|
372
|
+
await page1Menu.locator('[data-visibility-menu-toggle="tag.skills"]').click();
|
|
373
|
+
await expect(page1.locator("#sessionSkillTags")).toHaveClass(/webui-user-hidden/);
|
|
374
|
+
await page1.keyboard.press("Escape");
|
|
375
|
+
await expect.poll(async () => hiddenIdsInLocal(page1)).toEqual(["input.attach-files", "tag.skills"]);
|
|
376
|
+
|
|
377
|
+
// Release the held write. The stale revision retries once; after the
|
|
378
|
+
// acknowledged PUT page 1 rewrites its value into the same-origin cache.
|
|
379
|
+
await heldRoute.continue();
|
|
380
|
+
await expect.poll(hiddenIdsOnDisk).toEqual(["input.attach-files", "tag.skills"]);
|
|
381
|
+
await expect.poll(async () => hiddenIdsInLocal(page1)).toEqual(["input.attach-files", "tag.skills"]);
|
|
382
|
+
await expect(page1.locator("#attachButton")).toHaveClass(/webui-user-hidden/);
|
|
383
|
+
await expect(page1.locator("#sessionSkillTags")).toHaveClass(/webui-user-hidden/);
|
|
384
|
+
|
|
385
|
+
// Page 2 adopts the acknowledged value through the storage event and the
|
|
386
|
+
// pending journal no longer holds a visibility mutation in either tab.
|
|
387
|
+
await expect.poll(async () => page2.locator("#sessionSkillTags").evaluate((element) => element.classList.contains("webui-user-hidden"))).toBe(true);
|
|
388
|
+
await expect(page2.locator("#attachButton")).toHaveClass(/webui-user-hidden/);
|
|
389
|
+
await expect.poll(async () => page1.evaluate(() => Object.entries(localStorage)
|
|
390
|
+
.filter(([key]) => key.startsWith("pi-webui-ui-layout-pending"))
|
|
391
|
+
.filter(([, raw]) => { try { return JSON.parse(raw)?.field === "controlVisibility"; } catch { return false; } })
|
|
392
|
+
.map(([key]) => key))).toEqual([]);
|
|
393
|
+
} finally {
|
|
394
|
+
await context.close();
|
|
395
|
+
}
|
|
396
|
+
});
|
|
@@ -114,7 +114,7 @@ async function seedStaleServerLayout() {
|
|
|
114
114
|
sidePanelWidth: 352,
|
|
115
115
|
expectedLayoutRevision: current.data.layoutRevision,
|
|
116
116
|
layout: {
|
|
117
|
-
version:
|
|
117
|
+
version: 3,
|
|
118
118
|
sidePanel: {
|
|
119
119
|
placement: "right",
|
|
120
120
|
sectionLayout: { order: ["git", "files", "controls"], leftSectionIds: [] },
|
|
@@ -528,7 +528,7 @@ test("returning browsers adopt authoritative Control Deck state without echo wri
|
|
|
528
528
|
body: {
|
|
529
529
|
expectedLayoutRevision: current.data.layoutRevision,
|
|
530
530
|
layout: {
|
|
531
|
-
version:
|
|
531
|
+
version: 3,
|
|
532
532
|
sidePanel: {
|
|
533
533
|
placement: "right",
|
|
534
534
|
sectionLayout: { order: serverSideOrder, leftSectionIds: [] },
|
|
@@ -585,7 +585,7 @@ test("failed layout writes remain pending across reload and later synchronize",
|
|
|
585
585
|
method: "PUT",
|
|
586
586
|
body: {
|
|
587
587
|
expectedLayoutRevision: current.data.layoutRevision,
|
|
588
|
-
layout: { version:
|
|
588
|
+
layout: { version: 3, composerActions: { order: ["send", "new"], grid: null } },
|
|
589
589
|
},
|
|
590
590
|
});
|
|
591
591
|
|
|
@@ -628,7 +628,7 @@ test("conflict retry updates only the changed Control Deck subfield", async ({ b
|
|
|
628
628
|
body: {
|
|
629
629
|
expectedLayoutRevision: current.data.layoutRevision,
|
|
630
630
|
layout: {
|
|
631
|
-
version:
|
|
631
|
+
version: 3,
|
|
632
632
|
sidePanel: {
|
|
633
633
|
placement: "right",
|
|
634
634
|
sectionLayout: { order: initialOrder, leftSectionIds: [] },
|
|
@@ -672,7 +672,7 @@ test("one tab cannot erase another tab's failed pending journal", async ({ brows
|
|
|
672
672
|
body: {
|
|
673
673
|
expectedLayoutRevision: current.data.layoutRevision,
|
|
674
674
|
layout: {
|
|
675
|
-
version:
|
|
675
|
+
version: 3,
|
|
676
676
|
sidePanel: {
|
|
677
677
|
placement: "right",
|
|
678
678
|
sectionLayout: { order: ["files", "controls", "git"], leftSectionIds: [] },
|
|
@@ -732,7 +732,7 @@ test("in-flight sibling acknowledgement clears only the acknowledged subfield",
|
|
|
732
732
|
body: {
|
|
733
733
|
expectedLayoutRevision: current.data.layoutRevision,
|
|
734
734
|
layout: {
|
|
735
|
-
version:
|
|
735
|
+
version: 3,
|
|
736
736
|
sidePanel: {
|
|
737
737
|
placement: "right",
|
|
738
738
|
sectionLayout: { order: initialOrder, leftSectionIds: [] },
|
|
@@ -816,7 +816,7 @@ test("same-origin sibling placement adoption cannot overwrite a dirty section la
|
|
|
816
816
|
body: {
|
|
817
817
|
expectedLayoutRevision: current.data.layoutRevision,
|
|
818
818
|
layout: {
|
|
819
|
-
version:
|
|
819
|
+
version: 3,
|
|
820
820
|
sidePanel: {
|
|
821
821
|
placement: "right",
|
|
822
822
|
sectionLayout: { order: initialOrder, leftSectionIds: [] },
|
|
@@ -874,7 +874,7 @@ test("seeded v3 Control Deck journal recovers legacy fields without widening par
|
|
|
874
874
|
body: {
|
|
875
875
|
expectedLayoutRevision: current.data.layoutRevision,
|
|
876
876
|
layout: {
|
|
877
|
-
version:
|
|
877
|
+
version: 3,
|
|
878
878
|
sidePanel: {
|
|
879
879
|
placement: "right",
|
|
880
880
|
sectionLayout: { order: ["controls", "files", "git"], leftSectionIds: [] },
|
|
@@ -926,7 +926,7 @@ test("a delayed GET cannot regress the revision acknowledged by a newer PUT", as
|
|
|
926
926
|
body: {
|
|
927
927
|
expectedLayoutRevision: current.data.layoutRevision,
|
|
928
928
|
layout: {
|
|
929
|
-
version:
|
|
929
|
+
version: 3,
|
|
930
930
|
sidePanel: {
|
|
931
931
|
placement: "right",
|
|
932
932
|
sectionLayout: { order: ["files", "controls", "git"], leftSectionIds: [] },
|
|
@@ -55,7 +55,7 @@ assert.match(app, /statusKey === CODEX_FAST_MODE_STATUS_KEY[\s\S]*?applyCodexFas
|
|
|
55
55
|
assert.match(technical, /## Normal and compact output[\s\S]*?select \*\*Compact\*\*[\s\S]*?`compact-v1`/, "technical reference should document Compact mode with the stable identifier");
|
|
56
56
|
assert.match(development, /### Codex subscription Fast mode[\s\S]*?service_tier: "priority"[\s\S]*?1\.5× faster[\s\S]*?2× Standard credits[\s\S]*?2\.5×/, "development guide should document Fast-mode integration and cost semantics");
|
|
57
57
|
// Intent preserved: browser-asset changes must advance the coherent cache tuple.
|
|
58
|
-
assert.match(serviceWorker, /pi-webui-pwa-
|
|
59
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
58
|
+
assert.match(serviceWorker, /pi-webui-pwa-v115/, "PWA cache identity should be bumped for changed browser assets");
|
|
59
|
+
assert.match(html, /data-app-src="\/app\.js\?v=150"/, "browser module URL should be cache-busted for Fast-mode wiring");
|
|
60
60
|
|
|
61
61
|
console.log("codex-fast-mode-static.test.mjs passed");
|
|
@@ -56,8 +56,8 @@ assert.match(app, /function initializeComposerActionOrdering\(\)[\s\S]*MutationO
|
|
|
56
56
|
assert.match(app, /event\.key === COMPOSER_ACTION_ORDER_STORAGE_KEY\) restoreComposerActionOrder\(\)[\s\S]*event\.key === COMPOSER_ACTION_LAYOUT_STORAGE_KEY\) restoreComposerActionSlotLayout\(\)/, "other tabs should apply persisted composer order and sparse-layout changes");
|
|
57
57
|
assert.match(app, /initializeComposerActionOrdering\(\);[\s\S]*restoreSidePanelSectionOrder\(\);/, "composer ordering should initialize during guarded app startup");
|
|
58
58
|
|
|
59
|
-
assert.match(html, /styles\.css\?v=
|
|
60
|
-
assert.match(html, /app\.js\?v=
|
|
61
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
59
|
+
assert.match(html, /styles\.css\?v=129/, "changed composer styles should advance the stylesheet revision");
|
|
60
|
+
assert.match(html, /app\.js\?v=150/, "changed composer behavior should advance the app revision");
|
|
61
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "changed browser assets should advance the PWA cache identity");
|
|
62
62
|
|
|
63
63
|
console.log("composer-action-grid-reorder-static.test.mjs passed");
|
|
@@ -23,7 +23,7 @@ assert.match(html, /<div class="workspace-column">[\s\S]*<section class="chat-pa
|
|
|
23
23
|
assert.match(html, /<option value="left">Sidebar<\/option>/);
|
|
24
24
|
assert.match(html, /id="controlDeckPlacementSelect"[\s\S]*<option value="right">Right<\/option>[\s\S]*<option value="left">Left<\/option>[\s\S]*<option value="both">Both<\/option>/);
|
|
25
25
|
|
|
26
|
-
assert.match(app, /const UI_LAYOUT_SCHEMA_VERSION =
|
|
26
|
+
assert.match(app, /const UI_LAYOUT_SCHEMA_VERSION = 3;/);
|
|
27
27
|
assert.match(app, /const UI_LAYOUT_SIDE_PANEL_FIELDS = \["placement", "sectionLayout", "collapsedSectionIds", "hiddenSectionIds", "collapsedPanels", "panelWidths"\]/);
|
|
28
28
|
assert.match(app, /const CONTROL_DECK_LAYOUT_STORAGE_KEY = "pi-webui-control-deck-layout-v2"/);
|
|
29
29
|
assert.match(app, /function controlDeckSectionRecords\(\)[\s\S]*document\.querySelectorAll\("\[data-side-panel-section\]"\)/);
|
|
@@ -63,6 +63,8 @@ assert.match(css, /body\.terminal-tabs-left \.chat-search-bar[\s\S]*body\.termin
|
|
|
63
63
|
assert.match(css, /body\.terminal-tabs-left\.terminal-tabs-sidebar-start \.chat-panel[\s\S]*grid-template-columns:\s*minmax\(13rem, var\(--terminal-tabs-sidebar-width\)\) minmax\(0, 1fr\)/);
|
|
64
64
|
assert.match(css, /body\.terminal-tabs-left\.terminal-tabs-sidebar-start \.terminal-tabs-shell[\s\S]*grid-column:\s*1/);
|
|
65
65
|
assert.match(css, /body\.terminal-tabs-left\.terminal-tabs-sidebar-start \.chat[\s\S]*grid-column:\s*2/);
|
|
66
|
+
assert.match(css, /body\.embedded-split \.layout,[\s\S]*body\.embedded-split:not\(\.control-deck-left\):not\(\.control-deck-both\) \.layout \{[\s\S]*grid-template-columns:\s*minmax\(0, 1fr\);/, "embedded split terminals should override the more specific default Control Deck columns");
|
|
67
|
+
assert.match(css, /body\.embedded-split \.chat-panel,\s*body\.embedded-split\.terminal-tabs-left \.chat-panel \{[\s\S]*display:\s*flex;[\s\S]*flex-direction:\s*column;[\s\S]*overflow:\s*hidden;/, "embedded split terminals should ignore the saved sidebar grid at every iframe width");
|
|
66
68
|
assert.match(css, /\.workspace-column[\s\S]*body\.terminal-split-open \.workspace-column[\s\S]*body\.file-viewer-open \.workspace-column[\s\S]*body\.terminal-split-open\.file-viewer-open \.workspace-column/);
|
|
67
69
|
|
|
68
70
|
console.log("control-deck-side-panels-static.test.mjs passed");
|