@firstpick/pi-package-webui 0.9.2 → 0.9.4
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 +14 -8
- package/bin/pi-webui.mjs +256 -39
- package/index.ts +266 -1
- package/lib/git-workflow-preferences.mjs +8 -25
- package/lib/intercom-conversations.mjs +491 -0
- package/lib/intercom-transcript-filter.mjs +99 -0
- package/lib/resource-selection.mjs +140 -0
- package/package.json +2 -2
- package/public/app.js +1061 -119
- package/public/index.html +31 -6
- package/public/service-worker.js +2 -1
- package/public/stream-output-controller.mjs +15 -0
- package/public/styles.css +426 -1
- package/public/syntax-highlight.mjs +622 -0
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/interaction-continuity.spec.mjs +34 -0
- package/tests/browser/intercom-conversation-viewer.spec.mjs +357 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +61 -0
- package/tests/browser/resource-profiles.spec.mjs +200 -0
- package/tests/browser/subagent-observability.spec.mjs +29 -0
- package/tests/codex-fast-mode-static.test.mjs +7 -6
- package/tests/common-options-submenus-interaction-static.test.mjs +2 -0
- package/tests/common-options-submenus-markup-static.test.mjs +1 -0
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/composer-skill-tag-layout.test.mjs +32 -2
- package/tests/control-deck-component-updates-static.test.mjs +4 -0
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/fast-mode-client-static.test.mjs +2 -2
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/feature-system-prompt-optional-feature-static.test.mjs +5 -5
- package/tests/file-viewer-image-static.test.mjs +69 -0
- package/tests/fixtures/fake-pi.mjs +105 -6
- package/tests/foreground-transcript-catch-up-static.test.mjs +1 -1
- package/tests/git-panel-file-preview-static.test.mjs +5 -5
- package/tests/git-panel-live-updates-static.test.mjs +3 -3
- package/tests/git-workflow-preferences.test.mjs +4 -4
- package/tests/http-endpoints-harness.test.mjs +124 -2
- package/tests/intercom-conversation-viewer-static.test.mjs +106 -0
- package/tests/intercom-conversations-http.test.mjs +252 -0
- package/tests/intercom-conversations.test.mjs +374 -0
- package/tests/intercom-main-transcript-suppression-static.test.mjs +52 -0
- package/tests/intercom-tag-layout-static.test.mjs +46 -0
- package/tests/intercom-transcript-filter.test.mjs +98 -0
- package/tests/main-output-loading-static.test.mjs +59 -0
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-compact-layout.test.mjs +2 -3
- package/tests/mobile-continuity-tablet-static.test.mjs +6 -6
- 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 +66 -42
- package/tests/native-parity.test.mjs +8 -7
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-migration-frontend.test.mjs +5 -5
- package/tests/optional-feature-resource-setup-static.test.mjs +29 -0
- package/tests/persistent-ui-layout-static.test.mjs +3 -3
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/remote-auth-settings-harness.test.mjs +1 -1
- package/tests/resource-defaults-helper.test.mjs +60 -6
- package/tests/resource-selection.test.mjs +114 -0
- package/tests/resource-tui-extension.test.mjs +23 -0
- 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-controller.test.mjs +8 -0
- package/tests/stream-output-isolation-static.test.mjs +2 -2
- package/tests/streaming-ui-coupling.test.mjs +5 -0
- package/tests/subagent-gate-visibility.test.mjs +1 -1
- package/tests/subagent-launch-slots.test.mjs +1 -1
- package/tests/subagent-observability-static.test.mjs +5 -3
- package/tests/subagent-reliability-integration.test.mjs +23 -1
- package/tests/subagent-workflow-section-static.test.mjs +67 -0
- package/tests/subagents-helper.test.mjs +313 -1
- package/tests/syntax-highlight.test.mjs +235 -0
- package/tests/syntax-highlighting-static.test.mjs +84 -0
- package/tests/terminal-cwd-grouping-static.test.mjs +22 -0
- package/tests/theme-customizer-static.test.mjs +5 -5
- package/tests/thinking-format-parser.test.mjs +64 -0
- package/tests/webui-settings-locking.test.mjs +1 -1
- package/webui-rpc-helper.mjs +417 -74
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { createServer } from "node:net";
|
|
4
|
+
import { chmod, mkdir, mkdtemp, 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 { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import { expect, test } from "@playwright/test";
|
|
11
|
+
|
|
12
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
13
|
+
const serverScript = join(root, "bin", "pi-webui.mjs");
|
|
14
|
+
const fakePi = join(root, "tests", "fixtures", "fake-pi.mjs");
|
|
15
|
+
const longPeerId = "peer-browser-long-layout";
|
|
16
|
+
const longPeerName = "An Exceptionally Long Browser Peer Name That Must Be Visually Truncated";
|
|
17
|
+
const expectedConversationCount = 32;
|
|
18
|
+
|
|
19
|
+
async function freePort() {
|
|
20
|
+
const server = createServer();
|
|
21
|
+
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
22
|
+
const { port } = server.address();
|
|
23
|
+
await new Promise((resolve) => server.close(resolve));
|
|
24
|
+
return port;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let child;
|
|
28
|
+
let baseURL;
|
|
29
|
+
let tempRoot;
|
|
30
|
+
let manager;
|
|
31
|
+
let output = "";
|
|
32
|
+
|
|
33
|
+
async function waitForServer() {
|
|
34
|
+
for (let attempt = 0; attempt < 100; attempt += 1) {
|
|
35
|
+
if (child.exitCode !== null) break;
|
|
36
|
+
try {
|
|
37
|
+
const response = await fetch(`${baseURL}/api/health`, { signal: AbortSignal.timeout(500) });
|
|
38
|
+
if (response.ok) return;
|
|
39
|
+
} catch {
|
|
40
|
+
// Wait for the isolated WebUI fixture.
|
|
41
|
+
}
|
|
42
|
+
await delay(100);
|
|
43
|
+
}
|
|
44
|
+
throw new Error(`Pi WebUI did not start:\n${output}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
test.beforeAll(async () => {
|
|
48
|
+
const port = await freePort();
|
|
49
|
+
tempRoot = await mkdtemp(join(tmpdir(), "pi-webui-intercom-viewer-"));
|
|
50
|
+
const agentDir = join(tempRoot, "agent");
|
|
51
|
+
const sessionDir = join(agentDir, "sessions");
|
|
52
|
+
const cwd = join(tempRoot, "project");
|
|
53
|
+
const settingsFile = join(tempRoot, "settings.json");
|
|
54
|
+
await mkdir(sessionDir, { recursive: true });
|
|
55
|
+
await mkdir(cwd, { recursive: true });
|
|
56
|
+
await writeFile(join(agentDir, "trust.json"), `${JSON.stringify({ [cwd]: true }, null, 2)}\n`, "utf8");
|
|
57
|
+
await writeFile(settingsFile, `${JSON.stringify({ version: 3 })}\n`, "utf8");
|
|
58
|
+
await chmod(fakePi, 0o755);
|
|
59
|
+
|
|
60
|
+
manager = SessionManager.create(cwd, sessionDir);
|
|
61
|
+
manager.appendCustomMessageEntry("intercom_message", "rendered prose must stay hidden", true, {
|
|
62
|
+
from: { id: "peer-browser", name: "Browser Peer", cwd: "/private/peer/path" },
|
|
63
|
+
message: {
|
|
64
|
+
id: "browser-in-1",
|
|
65
|
+
timestamp: 1_700_000_000_000,
|
|
66
|
+
content: { text: "Hello from the peer", attachments: [{ name: "secret.txt", content: "BROWSER_ATTACHMENT_SECRET" }] },
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
manager.appendCustomEntry("intercom_sent", {
|
|
70
|
+
to: "Browser Peer",
|
|
71
|
+
message: { text: "Hello from the local agent", replyTo: "browser-in-1" },
|
|
72
|
+
messageId: "browser-out-1",
|
|
73
|
+
timestamp: 1_700_000_001_000,
|
|
74
|
+
});
|
|
75
|
+
for (const peer of [
|
|
76
|
+
{
|
|
77
|
+
id: longPeerId,
|
|
78
|
+
name: longPeerName,
|
|
79
|
+
messageId: "browser-layout-long",
|
|
80
|
+
timestamp: 1_699_999_999_000,
|
|
81
|
+
text: "Long-label conversation selected correctly",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "peer-browser-layout-alpha",
|
|
85
|
+
name: "Layout Peer Alpha",
|
|
86
|
+
messageId: "browser-layout-alpha",
|
|
87
|
+
timestamp: 1_699_999_998_000,
|
|
88
|
+
text: "Alpha layout fixture",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "peer-browser-layout-beta",
|
|
92
|
+
name: "Layout Peer Beta",
|
|
93
|
+
messageId: "browser-layout-beta",
|
|
94
|
+
timestamp: 1_699_999_997_000,
|
|
95
|
+
text: "Beta layout fixture",
|
|
96
|
+
},
|
|
97
|
+
...Array.from({ length: 28 }, (_, index) => ({
|
|
98
|
+
id: `peer-browser-dense-${String(index + 1).padStart(2, "0")}`,
|
|
99
|
+
name: `Dense Layout Peer ${String(index + 1).padStart(2, "0")}`,
|
|
100
|
+
messageId: `browser-layout-dense-${String(index + 1).padStart(2, "0")}`,
|
|
101
|
+
timestamp: 1_699_999_996_000 - index * 1_000,
|
|
102
|
+
text: `Dense layout fixture ${index + 1}`,
|
|
103
|
+
})),
|
|
104
|
+
]) {
|
|
105
|
+
manager.appendCustomMessageEntry("intercom_message", `rendered prose for ${peer.id} must stay hidden`, true, {
|
|
106
|
+
from: { id: peer.id, name: peer.name },
|
|
107
|
+
message: { id: peer.messageId, timestamp: peer.timestamp, content: { text: peer.text } },
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
manager.appendMessage({
|
|
111
|
+
role: "assistant",
|
|
112
|
+
content: [{ type: "text", text: "ordinary assistant output must stay outside the conversation" }],
|
|
113
|
+
api: "openai-responses",
|
|
114
|
+
provider: "fake",
|
|
115
|
+
model: "fake-model",
|
|
116
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 } },
|
|
117
|
+
stopReason: "stop",
|
|
118
|
+
timestamp: 1_700_000_001_500,
|
|
119
|
+
});
|
|
120
|
+
const sessionFile = manager.getSessionFile();
|
|
121
|
+
assert.ok(sessionFile, "the browser fixture needs a persisted session");
|
|
122
|
+
|
|
123
|
+
baseURL = `http://127.0.0.1:${port}`;
|
|
124
|
+
child = spawn(process.execPath, [serverScript, "--cwd", cwd, "--host", "127.0.0.1", "--port", String(port), "--pi", fakePi], {
|
|
125
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
126
|
+
env: {
|
|
127
|
+
...process.env,
|
|
128
|
+
PI_WEBUI_RPC_SUPERVISOR: "0",
|
|
129
|
+
PI_CODING_AGENT_DIR: agentDir,
|
|
130
|
+
PI_WEBUI_SETTINGS_FILE: settingsFile,
|
|
131
|
+
FAKE_PI_CONTINUITY_MODE: "1",
|
|
132
|
+
FAKE_PI_CONTINUITY_SESSION_FILE: sessionFile,
|
|
133
|
+
FAKE_PI_INTERCOM_LIVE: "1",
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
child.stdout.on("data", (chunk) => { output += String(chunk); });
|
|
137
|
+
child.stderr.on("data", (chunk) => { output += String(chunk); });
|
|
138
|
+
await waitForServer();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test.afterAll(async () => {
|
|
142
|
+
if (child?.exitCode === null) child.kill("SIGTERM");
|
|
143
|
+
if (child && child.exitCode === null) await new Promise((resolve) => child.once("exit", resolve));
|
|
144
|
+
await rm(tempRoot, { recursive: true, force: true }).catch(() => {});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test("the 32-conversation dense grid stays contained and opens the correct truncated conversation", async ({ page }) => {
|
|
148
|
+
await page.setViewportSize({ width: 900, height: 760 });
|
|
149
|
+
await page.goto(baseURL);
|
|
150
|
+
const container = page.locator("#intercomConversationTags");
|
|
151
|
+
const tags = container.locator(":scope > .composer-intercom-tag");
|
|
152
|
+
const longTag = tags.filter({ hasText: longPeerName });
|
|
153
|
+
const longLabel = longTag.locator(".composer-intercom-tag-label");
|
|
154
|
+
|
|
155
|
+
await expect(tags).toHaveCount(expectedConversationCount);
|
|
156
|
+
await expect(container).toHaveClass(/\bdense\b/);
|
|
157
|
+
for (let index = 0; index < expectedConversationCount; index += 1) await expect(tags.nth(index)).toBeVisible();
|
|
158
|
+
|
|
159
|
+
const layout = await container.evaluate((element) => {
|
|
160
|
+
const containerRect = element.getBoundingClientRect();
|
|
161
|
+
const tagRects = [...element.querySelectorAll(":scope > .composer-intercom-tag")].map((tag) => tag.getBoundingClientRect());
|
|
162
|
+
return {
|
|
163
|
+
clientWidth: element.clientWidth,
|
|
164
|
+
scrollWidth: element.scrollWidth,
|
|
165
|
+
rootFontSize: Number.parseFloat(getComputedStyle(document.documentElement).fontSize),
|
|
166
|
+
widths: tagRects.map((rect) => rect.width),
|
|
167
|
+
rowTops: [...new Set(tagRects.map((rect) => Math.round(rect.top)))],
|
|
168
|
+
allContained: tagRects.every((rect) => rect.left >= containerRect.left - 0.5 && rect.right <= containerRect.right + 0.5),
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
assert.ok(layout.allContained, "every desktop conversation tag should remain within the tag container");
|
|
172
|
+
assert.ok(layout.clientWidth <= (17 * layout.rootFontSize) + 0.5, `the desktop conversation tag group should stay within 17rem (${layout.clientWidth}px)`);
|
|
173
|
+
assert.ok(layout.scrollWidth <= layout.clientWidth, `the desktop tag grid should not overflow horizontally (${layout.scrollWidth} > ${layout.clientWidth})`);
|
|
174
|
+
assert.ok(Math.min(...layout.widths) >= 44, `every dense desktop target should be at least 44px wide (minimum ${Math.min(...layout.widths)})`);
|
|
175
|
+
assert.ok(layout.rowTops.length > 1, "the 32-conversation desktop fixture should wrap into multiple rows");
|
|
176
|
+
|
|
177
|
+
await expect(longTag).toHaveCount(1);
|
|
178
|
+
const fullVisualLabel = await longLabel.textContent();
|
|
179
|
+
assert.ok(fullVisualLabel?.includes(longPeerName), "the long label fixture should retain its full DOM text");
|
|
180
|
+
await expect(longTag).toHaveAttribute("aria-label", `Open agent conversation ${fullVisualLabel}`);
|
|
181
|
+
await expect(longTag).toHaveAttribute("title", `${fullVisualLabel} · 1 message`);
|
|
182
|
+
const truncation = await longLabel.evaluate((element) => ({ clientWidth: element.clientWidth, scrollWidth: element.scrollWidth }));
|
|
183
|
+
assert.ok(truncation.scrollWidth > truncation.clientWidth, `the long label should be visually truncated (${truncation.scrollWidth} <= ${truncation.clientWidth})`);
|
|
184
|
+
|
|
185
|
+
await longTag.click();
|
|
186
|
+
await expect(page.locator("#intercomConversationDialog")).toBeVisible();
|
|
187
|
+
await expect(page.locator("#intercomConversationParticipants")).toContainText(`${longPeerName} (${longPeerId})`);
|
|
188
|
+
await expect(page.locator("#intercomConversationTranscript")).toContainText("Long-label conversation selected correctly");
|
|
189
|
+
await page.locator("#intercomConversationCloseButton").click();
|
|
190
|
+
await expect(longTag).toBeFocused();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test("conversation tag opens a safe chat dialog, refreshes, and restores focus", async ({ page }) => {
|
|
194
|
+
await page.goto(baseURL);
|
|
195
|
+
const tags = page.locator("#intercomConversationTags .composer-intercom-tag");
|
|
196
|
+
const tag = tags.filter({
|
|
197
|
+
has: page.locator(".composer-intercom-tag-label").filter({ hasText: /↔ Browser Peer \(peer-browser\)$/ }),
|
|
198
|
+
});
|
|
199
|
+
const dialog = page.locator("#intercomConversationDialog");
|
|
200
|
+
const transcript = page.locator("#intercomConversationTranscript");
|
|
201
|
+
const close = page.locator("#intercomConversationCloseButton");
|
|
202
|
+
|
|
203
|
+
await expect(tags).toHaveCount(expectedConversationCount);
|
|
204
|
+
await expect(tag).toHaveCount(1);
|
|
205
|
+
await expect(tag).toContainText("Browser Peer");
|
|
206
|
+
await tag.click();
|
|
207
|
+
await expect(dialog).toBeVisible();
|
|
208
|
+
await expect(close).toBeFocused();
|
|
209
|
+
await expect(page.locator("#intercomConversationParticipants")).toContainText("Browser Peer (peer-browser)");
|
|
210
|
+
await expect(transcript.locator(".intercom-conversation-message.peer")).toContainText("Hello from the peer");
|
|
211
|
+
await expect(transcript.locator(".intercom-conversation-message.local")).toContainText("Hello from the local agent");
|
|
212
|
+
await expect(transcript).not.toContainText("BROWSER_ATTACHMENT_SECRET");
|
|
213
|
+
await expect(transcript).not.toContainText("ordinary assistant output");
|
|
214
|
+
await expect(transcript).not.toContainText("/private/peer/path");
|
|
215
|
+
|
|
216
|
+
const firstMessage = transcript.locator(".intercom-conversation-message").first();
|
|
217
|
+
await firstMessage.evaluate((node) => { node.dataset.stableNodeMarker = "retained"; });
|
|
218
|
+
await expect(tag.locator(".composer-intercom-tag-count")).toHaveText("2");
|
|
219
|
+
|
|
220
|
+
const longMessage = [
|
|
221
|
+
"Arrived while the dialog was open",
|
|
222
|
+
...Array.from({ length: 90 }, (_, index) => `Live message line ${index + 1}`),
|
|
223
|
+
].join("\n");
|
|
224
|
+
manager.appendCustomMessageEntry("intercom_message", "new rendered prose must stay hidden", true, {
|
|
225
|
+
from: { id: "peer-browser", name: "Browser Peer" },
|
|
226
|
+
message: { id: "browser-in-2", timestamp: 1_700_000_002_000, content: { text: longMessage } },
|
|
227
|
+
});
|
|
228
|
+
await expect(transcript).toContainText("Arrived while the dialog was open", { timeout: 8_000 });
|
|
229
|
+
await expect(firstMessage).toHaveAttribute("data-stable-node-marker", "retained");
|
|
230
|
+
await expect(tag.locator(".composer-intercom-tag-count")).toHaveText("2", { timeout: 1_000 });
|
|
231
|
+
|
|
232
|
+
const scrollBefore = await transcript.evaluate((element) => {
|
|
233
|
+
const max = element.scrollHeight - element.clientHeight;
|
|
234
|
+
element.scrollTop = Math.floor(max / 2);
|
|
235
|
+
return { top: element.scrollTop, max };
|
|
236
|
+
});
|
|
237
|
+
assert.ok(scrollBefore.max > 100 && scrollBefore.top > 0, "the long fixture should create a meaningful scrolled-up transcript position");
|
|
238
|
+
|
|
239
|
+
manager.appendCustomMessageEntry("intercom_message", "another rendered prose message must stay hidden", true, {
|
|
240
|
+
from: { id: "peer-browser", name: "Browser Peer" },
|
|
241
|
+
message: { id: "browser-in-3", timestamp: 1_700_000_003_000, content: { text: "Arrived after the reader scrolled up" } },
|
|
242
|
+
});
|
|
243
|
+
await expect(transcript).toContainText("Arrived after the reader scrolled up", { timeout: 8_000 });
|
|
244
|
+
await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))));
|
|
245
|
+
const scrollAfter = await transcript.evaluate((element) => element.scrollTop);
|
|
246
|
+
assert.ok(Math.abs(scrollAfter - scrollBefore.top) <= 4, `live refresh should preserve the scrolled-up position (${scrollBefore.top} -> ${scrollAfter})`);
|
|
247
|
+
await expect(firstMessage).toHaveAttribute("data-stable-node-marker", "retained");
|
|
248
|
+
await expect(tag.locator(".composer-intercom-tag-count")).toHaveText("2", { timeout: 1_000 });
|
|
249
|
+
|
|
250
|
+
await close.click();
|
|
251
|
+
await expect(dialog).toBeHidden();
|
|
252
|
+
await expect(tag).toBeFocused();
|
|
253
|
+
await expect(tag.locator(".composer-intercom-tag-count")).toHaveText("4");
|
|
254
|
+
const stableTagLabel = tag.locator(".composer-intercom-tag-label");
|
|
255
|
+
await stableTagLabel.evaluate((node) => { node.dataset.stableVisualMarker = "retained"; });
|
|
256
|
+
await tag.press("Enter");
|
|
257
|
+
await expect(dialog).toBeVisible();
|
|
258
|
+
await page.keyboard.press("Escape");
|
|
259
|
+
await expect(dialog).toBeHidden();
|
|
260
|
+
await expect(tag).toBeFocused();
|
|
261
|
+
await expect(stableTagLabel).toHaveAttribute("data-stable-visual-marker", "retained");
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
test("conversation tags remain reachable through the narrow composer disclosure", async ({ page }) => {
|
|
265
|
+
await page.setViewportSize({ width: 390, height: 760 });
|
|
266
|
+
await page.goto(baseURL);
|
|
267
|
+
const more = page.locator("#composerActionsButton");
|
|
268
|
+
await expect(more).toBeVisible();
|
|
269
|
+
await more.focus();
|
|
270
|
+
await more.press("Enter");
|
|
271
|
+
const tags = page.locator("#intercomConversationTags");
|
|
272
|
+
const tagButtons = tags.locator(":scope > .composer-intercom-tag");
|
|
273
|
+
const tag = tagButtons.filter({
|
|
274
|
+
has: page.locator(".composer-intercom-tag-label").filter({ hasText: /↔ Browser Peer \(peer-browser\)$/ }),
|
|
275
|
+
});
|
|
276
|
+
await expect(tags).toBeVisible();
|
|
277
|
+
await expect(tagButtons).toHaveCount(expectedConversationCount);
|
|
278
|
+
for (let index = 0; index < expectedConversationCount; index += 1) {
|
|
279
|
+
await expect(tagButtons.nth(index)).toBeVisible();
|
|
280
|
+
await expect(tagButtons.nth(index)).toHaveCSS("min-height", "44px");
|
|
281
|
+
}
|
|
282
|
+
const layout = await tags.evaluate((element) => {
|
|
283
|
+
const containerRect = element.getBoundingClientRect();
|
|
284
|
+
const tagRects = [...element.querySelectorAll(":scope > .composer-intercom-tag")].map((button) => button.getBoundingClientRect());
|
|
285
|
+
return {
|
|
286
|
+
clientWidth: element.clientWidth,
|
|
287
|
+
scrollWidth: element.scrollWidth,
|
|
288
|
+
widths: tagRects.map((rect) => rect.width),
|
|
289
|
+
heights: tagRects.map((rect) => rect.height),
|
|
290
|
+
rowTops: [...new Set(tagRects.map((rect) => Math.round(rect.top)))],
|
|
291
|
+
allContained: tagRects.every((rect) => rect.left >= containerRect.left - 0.5 && rect.right <= containerRect.right + 0.5),
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
assert.ok(layout.allContained, "every narrow conversation tag should remain within the tag container");
|
|
295
|
+
assert.ok(layout.scrollWidth <= layout.clientWidth, `the narrow tag grid should not overflow horizontally (${layout.scrollWidth} > ${layout.clientWidth})`);
|
|
296
|
+
assert.ok(Math.min(...layout.widths) >= 44, `every narrow touch target should be at least 44px wide (minimum ${Math.min(...layout.widths)})`);
|
|
297
|
+
assert.ok(Math.min(...layout.heights) >= 44, `every narrow touch target should be at least 44px high (minimum ${Math.min(...layout.heights)})`);
|
|
298
|
+
assert.ok(layout.rowTops.length > 1, "the 32-conversation narrow fixture should wrap into multiple rows");
|
|
299
|
+
const clippedLabels = await tagButtons.locator(".composer-intercom-tag-label").evaluateAll((labels) => labels.filter((label) => label.scrollWidth > label.clientWidth).length);
|
|
300
|
+
assert.ok(clippedLabels > 0, "dense narrow labels should be allowed to truncate visually");
|
|
301
|
+
await tag.focus();
|
|
302
|
+
await tag.press("Enter");
|
|
303
|
+
await expect(page.locator("#intercomConversationDialog")).toBeVisible();
|
|
304
|
+
await expect(page.locator("#intercomConversationParticipants")).toContainText("Browser Peer (peer-browser)");
|
|
305
|
+
await expect(page.locator("#intercomConversationCloseButton")).toBeVisible();
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
test("live generic Intercom transport never reaches the main transcript or event log", async ({ page }) => {
|
|
309
|
+
await page.setViewportSize({ width: 900, height: 760 });
|
|
310
|
+
await page.goto(baseURL);
|
|
311
|
+
await page.evaluate(() => {
|
|
312
|
+
const chat = document.querySelector("#chat");
|
|
313
|
+
const eventLog = document.querySelector("#eventLog");
|
|
314
|
+
window.__intercomLiveLeaks = [];
|
|
315
|
+
const inspect = () => {
|
|
316
|
+
const chatText = chat?.textContent || "";
|
|
317
|
+
const eventText = eventLog?.textContent || "";
|
|
318
|
+
if (/LIVEINTERCOM(?:ARGUMENT|RESULT)SECRET/.test(chatText)) window.__intercomLiveLeaks.push("secret text reached main transcript");
|
|
319
|
+
if (/LIVEINTERCOM(?:ARGUMENT|RESULT)SECRET/.test(eventText)) window.__intercomLiveLeaks.push("secret text reached event log");
|
|
320
|
+
if (chat?.querySelector('[data-tool-call-id="live-intercom-call"]')) window.__intercomLiveLeaks.push("Intercom tool card reached main transcript");
|
|
321
|
+
if (eventLog?.querySelector('[data-chat-tool-call-id="live-intercom-call"]') || /tool intercom (?:started|finished)/i.test(eventText)) {
|
|
322
|
+
window.__intercomLiveLeaks.push("Intercom execution line reached event log");
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
const observer = new MutationObserver(inspect);
|
|
326
|
+
if (chat) observer.observe(chat, { childList: true, subtree: true, characterData: true });
|
|
327
|
+
if (eventLog) observer.observe(eventLog, { childList: true, subtree: true, characterData: true });
|
|
328
|
+
window.__intercomLiveObserver = observer;
|
|
329
|
+
inspect();
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
const tabsResponse = await page.request.get(`${baseURL}/api/tabs`);
|
|
333
|
+
assert.equal(tabsResponse.ok(), true, await tabsResponse.text());
|
|
334
|
+
const tabId = (await tabsResponse.json()).data?.tabs?.[0]?.id;
|
|
335
|
+
assert.ok(tabId, "the live Intercom fixture requires an active tab");
|
|
336
|
+
const promptResponse = await page.request.post(`${baseURL}/api/prompt?tab=${encodeURIComponent(tabId)}`, {
|
|
337
|
+
data: { message: "fixture modal transport live", requestId: `intercom-live-${Date.now()}` },
|
|
338
|
+
});
|
|
339
|
+
assert.equal(promptResponse.ok(), true, await promptResponse.text());
|
|
340
|
+
|
|
341
|
+
await expect(page.locator("#chat")).toContainText("LIVE NORMAL OUTPUT VISIBLE", { timeout: 8_000 });
|
|
342
|
+
await expect.poll(async () => {
|
|
343
|
+
const response = await page.request.get(`${baseURL}/api/state?tab=${encodeURIComponent(tabId)}`);
|
|
344
|
+
return (await response.json()).data?.isStreaming;
|
|
345
|
+
}, { timeout: 8_000 }).toBe(false);
|
|
346
|
+
await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))));
|
|
347
|
+
|
|
348
|
+
await expect(page.locator("#chat")).not.toContainText("LIVEINTERCOMARGUMENTSECRET");
|
|
349
|
+
await expect(page.locator("#chat")).not.toContainText("LIVEINTERCOMRESULTSECRET");
|
|
350
|
+
await expect(page.locator('#chat [data-tool-call-id="live-intercom-call"]')).toHaveCount(0);
|
|
351
|
+
await expect(page.locator("#eventLog")).not.toContainText(/tool intercom (?:started|finished)/i);
|
|
352
|
+
const leaks = await page.evaluate(() => {
|
|
353
|
+
window.__intercomLiveObserver?.disconnect();
|
|
354
|
+
return [...(window.__intercomLiveLeaks || [])];
|
|
355
|
+
});
|
|
356
|
+
assert.deepEqual(leaks, [], `live Intercom transport leaked before reconciliation: ${leaks.join(", ")}`);
|
|
357
|
+
});
|
|
@@ -274,6 +274,67 @@ test.afterAll(async () => {
|
|
|
274
274
|
await rm(tempRoot, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
|
|
275
275
|
});
|
|
276
276
|
|
|
277
|
+
test("collapsed tracked skill tags expand upward and keep hidden tags selectable", async ({ browser }) => {
|
|
278
|
+
const tabs = await serverApi("/api/tabs");
|
|
279
|
+
const tabId = tabs.data.tabs[0].id;
|
|
280
|
+
const names = [
|
|
281
|
+
"subagent-governance",
|
|
282
|
+
"feature-development-workflow",
|
|
283
|
+
"repository-explorer",
|
|
284
|
+
"accessibility-review",
|
|
285
|
+
"release-verification",
|
|
286
|
+
"browser-regression-testing",
|
|
287
|
+
"documentation-maintenance",
|
|
288
|
+
"interface-consistency-check",
|
|
289
|
+
];
|
|
290
|
+
const entries = names.map((name, index) => ({
|
|
291
|
+
name,
|
|
292
|
+
firstSeenAt: 1_000 + index,
|
|
293
|
+
lastSeenAt: 2_000 + index,
|
|
294
|
+
kinds: ["read"],
|
|
295
|
+
sources: ["browser-test"],
|
|
296
|
+
path: `/skills/${name}/SKILL.md`,
|
|
297
|
+
paths: [`/skills/${name}/SKILL.md`],
|
|
298
|
+
}));
|
|
299
|
+
const context = await browser.newContext({ viewport: { width: 820, height: 720 } });
|
|
300
|
+
await context.addInitScript(({ activeTabId, storedEntries }) => {
|
|
301
|
+
localStorage.setItem("pi-webui-skill-usage-v1", JSON.stringify({
|
|
302
|
+
version: 1,
|
|
303
|
+
tabs: { [activeTabId]: storedEntries },
|
|
304
|
+
}));
|
|
305
|
+
}, { activeTabId: tabId, storedEntries: entries });
|
|
306
|
+
const page = await context.newPage();
|
|
307
|
+
await page.goto(baseURL);
|
|
308
|
+
await suppressUnrelatedUpdateNotification(page);
|
|
309
|
+
|
|
310
|
+
const overflow = page.locator("#sessionSkillTags > button.composer-skill-tag.overflow");
|
|
311
|
+
const menu = page.locator("#sessionSkillOverflowMenu");
|
|
312
|
+
await expect(overflow).toBeVisible();
|
|
313
|
+
const hiddenCount = Number((await overflow.textContent())?.replace("+", ""));
|
|
314
|
+
assert.ok(hiddenCount > 0, "the narrow fixture should collapse at least one tracked skill");
|
|
315
|
+
|
|
316
|
+
await overflow.click();
|
|
317
|
+
await expect(overflow).toHaveAttribute("aria-expanded", "true");
|
|
318
|
+
await expect(menu).toBeVisible();
|
|
319
|
+
await expect(menu.locator("button:not([hidden])")).toHaveCount(hiddenCount);
|
|
320
|
+
const [overflowBox, menuBox] = await Promise.all([overflow.boundingBox(), menu.boundingBox()]);
|
|
321
|
+
assert.ok(overflowBox && menuBox && menuBox.y + menuBox.height <= overflowBox.y + 1, "the popup should render above the +X disclosure");
|
|
322
|
+
|
|
323
|
+
await page.keyboard.press("Escape");
|
|
324
|
+
await expect(menu).toBeHidden();
|
|
325
|
+
await expect(overflow).toBeFocused();
|
|
326
|
+
|
|
327
|
+
await overflow.click();
|
|
328
|
+
await page.locator("#promptInput").click();
|
|
329
|
+
await expect(menu).toBeHidden();
|
|
330
|
+
|
|
331
|
+
await overflow.click();
|
|
332
|
+
await menu.locator("button:not([hidden])").first().click();
|
|
333
|
+
await expect(menu).toBeHidden();
|
|
334
|
+
await expect(overflow).toHaveAttribute("aria-expanded", "false");
|
|
335
|
+
await context.close();
|
|
336
|
+
});
|
|
337
|
+
|
|
277
338
|
test("server-owned layout survives stale reads, failed writes, localStorage clear, and process restart", async ({ browser }) => {
|
|
278
339
|
test.setTimeout(90_000);
|
|
279
340
|
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { createServer } from "node:net";
|
|
4
|
+
import { mkdtemp, readFile, rm } 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
|
+
|
|
15
|
+
async function freePort() {
|
|
16
|
+
const server = createServer();
|
|
17
|
+
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
18
|
+
const { port } = server.address();
|
|
19
|
+
await new Promise((resolve) => server.close(resolve));
|
|
20
|
+
return port;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let child;
|
|
24
|
+
let baseURL;
|
|
25
|
+
let tempRoot;
|
|
26
|
+
let settingsFile;
|
|
27
|
+
let output = "";
|
|
28
|
+
|
|
29
|
+
async function installResourceCommands(page) {
|
|
30
|
+
await page.route("**/api/commands?*", async (route) => {
|
|
31
|
+
await route.fulfill({
|
|
32
|
+
status: 200,
|
|
33
|
+
contentType: "application/json",
|
|
34
|
+
body: JSON.stringify({
|
|
35
|
+
ok: true,
|
|
36
|
+
data: {
|
|
37
|
+
commands: [
|
|
38
|
+
{ name: "tools", source: "extension", description: "Configure tools" },
|
|
39
|
+
{ name: "skills", source: "extension", description: "Configure skills" },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function openResourceSetupMenu(page) {
|
|
48
|
+
await page.locator("#nativeCommandMenuButton").click();
|
|
49
|
+
await expect(page.locator("#nativeCommandMenu")).toBeVisible();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
test.beforeAll(async () => {
|
|
53
|
+
const port = await freePort();
|
|
54
|
+
tempRoot = await mkdtemp(join(tmpdir(), "pi-webui-resource-profiles-browser-"));
|
|
55
|
+
settingsFile = join(tempRoot, "settings.json");
|
|
56
|
+
baseURL = `http://127.0.0.1:${port}`;
|
|
57
|
+
child = spawn(process.execPath, [serverScript, "--cwd", tempRoot, "--host", "127.0.0.1", "--port", String(port), "--pi", fakePi], {
|
|
58
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
59
|
+
env: {
|
|
60
|
+
...process.env,
|
|
61
|
+
PI_WEBUI_RPC_SUPERVISOR: "0",
|
|
62
|
+
PI_CODING_AGENT_DIR: join(tempRoot, "agent"),
|
|
63
|
+
PI_WEBUI_SETTINGS_FILE: settingsFile,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
child.stdout.on("data", (chunk) => { output += String(chunk); });
|
|
67
|
+
child.stderr.on("data", (chunk) => { output += String(chunk); });
|
|
68
|
+
for (let attempt = 0; attempt < 80; attempt += 1) {
|
|
69
|
+
if (child.exitCode !== null) break;
|
|
70
|
+
try {
|
|
71
|
+
const response = await fetch(`${baseURL}/api/health`, { signal: AbortSignal.timeout(500) });
|
|
72
|
+
if (response.ok) return;
|
|
73
|
+
} catch {
|
|
74
|
+
// Wait for the isolated real server and fake Pi fixture.
|
|
75
|
+
}
|
|
76
|
+
await delay(100);
|
|
77
|
+
}
|
|
78
|
+
throw new Error(`Pi Web UI did not start:\n${output}`);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test.afterAll(async () => {
|
|
82
|
+
if (child?.exitCode === null) child.kill("SIGTERM");
|
|
83
|
+
if (child && child.exitCode === null) await new Promise((resolve) => child.once("exit", resolve));
|
|
84
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("the dedicated resource menu opens exact-model tools and persists then clears the profile", async ({ page }) => {
|
|
88
|
+
await installResourceCommands(page);
|
|
89
|
+
await page.setViewportSize({ width: 1280, height: 800 });
|
|
90
|
+
await page.goto(baseURL);
|
|
91
|
+
|
|
92
|
+
await expect(page.locator("#optionsToolsSetupButton, #optionsSkillsSetupButton")).toHaveCount(0);
|
|
93
|
+
await openResourceSetupMenu(page);
|
|
94
|
+
await page.locator("#nativeToolsButton").click();
|
|
95
|
+
|
|
96
|
+
await expect(page.locator("#nativeCommandDialog")).toBeVisible();
|
|
97
|
+
await expect(page.locator("#nativeCommandTitle")).toHaveText("Tools Setup");
|
|
98
|
+
const scope = page.locator(".native-resource-scope select");
|
|
99
|
+
await expect(scope).toHaveValue("session");
|
|
100
|
+
await expect(scope.locator("option")).toHaveText(["Session only", "Global default", "Model default"]);
|
|
101
|
+
await scope.selectOption("model");
|
|
102
|
+
|
|
103
|
+
const model = page.locator(".native-resource-model select");
|
|
104
|
+
await expect(model).toBeVisible();
|
|
105
|
+
await expect(model.locator("option").first()).toContainText("fake/fake-model");
|
|
106
|
+
await expect(page.locator(".native-resource-model")).toContainText("active session model is not changed");
|
|
107
|
+
|
|
108
|
+
const bashItem = page.locator(".native-selector-item").filter({ hasText: "bash" });
|
|
109
|
+
await expect(bashItem).toContainText("enabled");
|
|
110
|
+
await bashItem.click();
|
|
111
|
+
await expect(page.locator(".native-selector-item").filter({ hasText: "bash" })).toContainText("disabled");
|
|
112
|
+
|
|
113
|
+
await expect.poll(async () => {
|
|
114
|
+
try {
|
|
115
|
+
const settings = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
116
|
+
return settings.resourceDefaults?.modelProfiles?.[0]?.tools?.enabledTools || null;
|
|
117
|
+
} catch {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}).toEqual(["read"]);
|
|
121
|
+
|
|
122
|
+
await page.locator("#nativeCommandActions").getByRole("button", { name: "Use inherited defaults" }).click();
|
|
123
|
+
await expect.poll(async () => {
|
|
124
|
+
const settings = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
125
|
+
return settings.resourceDefaults?.modelProfiles || [];
|
|
126
|
+
}).toEqual([]);
|
|
127
|
+
await page.locator("#nativeCommandActions").getByRole("button", { name: "Cancel" }).click();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("Optional features exposes Skills Setup and Tools Setup on the loaded TUI command rows", async ({ page }) => {
|
|
131
|
+
await installResourceCommands(page);
|
|
132
|
+
await page.setViewportSize({ width: 1280, height: 800 });
|
|
133
|
+
await page.goto(baseURL);
|
|
134
|
+
await page.addStyleTag({ content: "#optionalFeatureMigrationSurface, #updateNotification { display: none !important; }" });
|
|
135
|
+
|
|
136
|
+
await page.locator("#sidePanelSectionToggleOptionalFeatures").click();
|
|
137
|
+
|
|
138
|
+
const questionnaireRow = page.locator(".optional-feature-row").filter({ hasText: "Native questionnaires" });
|
|
139
|
+
await expect(questionnaireRow.getByRole("button", { name: "Set up Native questionnaires" })).toHaveCount(0);
|
|
140
|
+
await expect(questionnaireRow).not.toContainText("Use Setup");
|
|
141
|
+
|
|
142
|
+
const skillsRow = page.locator(".optional-feature-row").filter({ hasText: "TUI Skills command" });
|
|
143
|
+
const skillsSetup = skillsRow.getByRole("button", { name: "Set up TUI Skills command" });
|
|
144
|
+
await expect(skillsSetup).toBeVisible();
|
|
145
|
+
await expect(skillsSetup).toHaveText("Setup");
|
|
146
|
+
await skillsSetup.click();
|
|
147
|
+
await expect(page.locator("#nativeCommandTitle")).toHaveText("Skills Setup");
|
|
148
|
+
await page.locator("#nativeCommandActions").getByRole("button", { name: "Cancel" }).click();
|
|
149
|
+
|
|
150
|
+
const toolsRow = page.locator(".optional-feature-row").filter({ hasText: "TUI Tools command" });
|
|
151
|
+
const toolsSetup = toolsRow.getByRole("button", { name: "Set up TUI Tools command" });
|
|
152
|
+
await expect(toolsSetup).toBeVisible();
|
|
153
|
+
await expect(toolsSetup).toHaveText("Setup");
|
|
154
|
+
await toolsSetup.click();
|
|
155
|
+
await expect(page.locator("#nativeCommandTitle")).toHaveText("Tools Setup");
|
|
156
|
+
await page.locator("#nativeCommandActions").getByRole("button", { name: "Cancel" }).click();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test("mobile keyboard navigation opens Skills Setup from the dedicated resource menu", async ({ browser }) => {
|
|
160
|
+
const context = await browser.newContext({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true });
|
|
161
|
+
const page = await context.newPage();
|
|
162
|
+
await installResourceCommands(page);
|
|
163
|
+
await page.goto(`${baseURL}/?mobileShell=legacy`);
|
|
164
|
+
await page.addStyleTag({ content: "#optionalFeatureMigrationSurface, #updateNotification { display: none !important; }" });
|
|
165
|
+
|
|
166
|
+
await page.locator("#composerActionsButton").focus();
|
|
167
|
+
await page.keyboard.press("Enter");
|
|
168
|
+
await expect(page.locator("#composerActionsPanel")).toBeVisible();
|
|
169
|
+
await expect(page.locator("#optionsToolsSetupButton, #optionsSkillsSetupButton")).toHaveCount(0);
|
|
170
|
+
await page.locator("#nativeCommandMenuButton").focus();
|
|
171
|
+
await page.keyboard.press("Enter");
|
|
172
|
+
await expect(page.locator("#nativeCommandMenu")).toBeVisible();
|
|
173
|
+
await page.locator("#nativeSkillsButton").focus();
|
|
174
|
+
await page.keyboard.press("Enter");
|
|
175
|
+
await expect(page.locator("#nativeCommandDialog")).toBeVisible();
|
|
176
|
+
await expect(page.locator("#nativeCommandTitle")).toHaveText("Skills Setup");
|
|
177
|
+
const skillScope = page.locator(".native-resource-scope select");
|
|
178
|
+
await expect(skillScope).toHaveValue("session");
|
|
179
|
+
const box = await page.locator("#nativeCommandDialog").boundingBox();
|
|
180
|
+
assert.ok(box && box.width <= 390 && box.height <= 844, `Skills Setup must fit the mobile viewport, got ${JSON.stringify(box)}`);
|
|
181
|
+
|
|
182
|
+
await skillScope.selectOption("model");
|
|
183
|
+
await expect(page.locator(".native-resource-model select")).toBeVisible();
|
|
184
|
+
const codeSecurity = page.locator(".native-selector-item").filter({ hasText: "code-security" });
|
|
185
|
+
await expect(codeSecurity).toHaveAttribute("aria-pressed", "true");
|
|
186
|
+
await codeSecurity.click();
|
|
187
|
+
await expect(page.locator(".native-selector-item").filter({ hasText: "code-security" })).toHaveAttribute("aria-pressed", "false");
|
|
188
|
+
await expect.poll(async () => {
|
|
189
|
+
const settings = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
190
|
+
return settings.resourceDefaults?.modelProfiles?.[0]?.skills?.enabledSkills || null;
|
|
191
|
+
}).toEqual(["repo-explorer"]);
|
|
192
|
+
|
|
193
|
+
await page.locator("#nativeCommandActions").getByRole("button", { name: "Use inherited defaults" }).click();
|
|
194
|
+
await expect.poll(async () => {
|
|
195
|
+
const settings = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
196
|
+
return settings.resourceDefaults?.modelProfiles || [];
|
|
197
|
+
}).toEqual([]);
|
|
198
|
+
|
|
199
|
+
await context.close();
|
|
200
|
+
});
|
|
@@ -85,3 +85,32 @@ test("renders canonical v2 agents and opens output through the unified selection
|
|
|
85
85
|
await expect(page.locator(".subagent-overlay-refresh-action")).toBeVisible();
|
|
86
86
|
await expect(page.locator(".subagent-overlay-cancel-action")).toBeVisible();
|
|
87
87
|
});
|
|
88
|
+
|
|
89
|
+
test("renders the workflow controller as a collapsible header with nested agents", async ({ page }) => {
|
|
90
|
+
await page.goto(baseURL);
|
|
91
|
+
await expect(page.locator("#tabBar [data-tab-id]").first()).toBeVisible();
|
|
92
|
+
const tabs = await api(page, "/api/tabs");
|
|
93
|
+
const tabId = tabs.data.tabs[0].id;
|
|
94
|
+
await api(page, `/api/prompt?tab=${encodeURIComponent(tabId)}`, { method: "POST", data: { message: "fixture subagents workflow", requestId: `workflow-${Date.now()}` } });
|
|
95
|
+
|
|
96
|
+
const sectionToggle = page.locator('[data-side-panel-section-toggle="subagents"]');
|
|
97
|
+
if (await sectionToggle.getAttribute("aria-expanded") !== "true") await sectionToggle.click();
|
|
98
|
+
const workflow = page.locator(".subagent-workflow");
|
|
99
|
+
await expect(workflow).toHaveCount(1);
|
|
100
|
+
await expect(workflow).toHaveAttribute("open", "");
|
|
101
|
+
await expect(workflow.locator(".subagent-workflow-header")).toContainText("Workflow");
|
|
102
|
+
await expect(workflow.locator(".subagent-workflow-header")).toContainText("running");
|
|
103
|
+
await expect(workflow.locator(".subagent-workflow-header")).toContainText("1 agent");
|
|
104
|
+
await expect(workflow.locator(".subagent-agent-row")).toHaveCount(1);
|
|
105
|
+
await expect(workflow.locator(".subagent-agent-name")).toHaveText("worker");
|
|
106
|
+
await expect(page.locator(".subagent-agent-list > .subagent-run")).toHaveCount(1);
|
|
107
|
+
await expect(page.locator("#subagentCountBadge")).toHaveText("1");
|
|
108
|
+
await expect(page.locator("#subagentsStatus")).toContainText("1 total");
|
|
109
|
+
await expect(page.locator("#subagentsStatus")).toContainText("1 running");
|
|
110
|
+
|
|
111
|
+
await workflow.locator(".subagent-workflow-header").click();
|
|
112
|
+
await expect(workflow).not.toHaveAttribute("open", "");
|
|
113
|
+
await expect(workflow.locator(".subagent-agent-row")).toBeHidden();
|
|
114
|
+
await page.waitForTimeout(650);
|
|
115
|
+
await expect(workflow).not.toHaveAttribute("open", "");
|
|
116
|
+
});
|