@firstpick/pi-package-webui 0.11.1 → 0.11.2
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/DEVELOPMENT.md +151 -12
- package/README.md +34 -6
- package/TECHNICAL.md +75 -8
- package/bin/pi-webui.mjs +5390 -11423
- package/index.ts +10 -3
- package/lib/component-update-state.mjs +2 -2
- package/lib/git-workflow-preference-values.mjs +122 -0
- package/lib/git-workflow-preferences.mjs +35 -563
- package/lib/package-updates.mjs +260 -0
- package/lib/rpc-supervisor-client.mjs +8 -4
- package/lib/server/app-runners.mjs +1667 -0
- package/lib/server/codex-fast-mode.mjs +161 -0
- package/lib/server/conversation-mode.mjs +218 -0
- package/lib/server/conversation-voice.mjs +318 -0
- package/lib/server/extension-ui-requests.mjs +114 -0
- package/lib/server/git-generation.mjs +459 -0
- package/lib/server/git-mutations.mjs +1827 -0
- package/lib/server/git-reads.mjs +608 -0
- package/lib/server/git-worktree-sessions.mjs +408 -0
- package/lib/server/helper-requests.mjs +82 -0
- package/lib/server/no-project-workspaces.mjs +103 -0
- package/lib/server/rpc-transports.mjs +394 -0
- package/lib/server/settings-store.mjs +544 -0
- package/lib/server/sse-delivery.mjs +138 -0
- package/lib/server/workspace-files.mjs +563 -0
- package/lib/update/supervisor.mjs +4 -0
- package/lib/webui-workspaces.mjs +2 -0
- package/package.json +4 -4
- package/public/activity-agents-controller.mjs +269 -0
- package/public/activity-events-controller.mjs +236 -0
- package/public/activity-intercom-controller.mjs +627 -0
- package/public/activity-queue-controller.mjs +534 -0
- package/public/activity-todo-view.mjs +89 -0
- package/public/activity-usage-controller.mjs +589 -0
- package/public/app.js +3761 -3886
- package/public/conversation-overview.css +84 -0
- package/public/conversation-overview.mjs +193 -0
- package/public/draft-conversations.mjs +135 -0
- package/public/focused-composer-controls.css +111 -0
- package/public/focused-composer-controls.mjs +143 -0
- package/public/focused-composer-disclosure.mjs +223 -0
- package/public/focused-shell-adapter.css +264 -0
- package/public/focused-shell-adapter.mjs +257 -0
- package/public/index.html +137 -80
- package/public/model-catalog-order.mjs +63 -0
- package/public/platform-event-stream.mjs +64 -0
- package/public/project-artifact-controller.mjs +218 -0
- package/public/project-file-viewer-controller.mjs +383 -0
- package/public/project-git-tools-controller.mjs +181 -0
- package/public/project-runners-controller.mjs +220 -0
- package/public/service-worker.js +52 -1
- package/public/session-attention-scheduler.mjs +182 -0
- package/public/session-composer-store.mjs +56 -0
- package/public/session-context.mjs +51 -0
- package/public/session-extension-requests.mjs +63 -0
- package/public/session-shelf-state.mjs +151 -0
- package/public/session-shelves.css +171 -0
- package/public/session-shelves.mjs +95 -0
- package/public/settings-navigation-controller.mjs +249 -0
- package/public/settings-navigation.css +61 -0
- package/public/settings-resource-controller.mjs +232 -0
- package/public/settings-workspace.css +19 -0
- package/public/settings-workspace.mjs +175 -0
- package/public/shell-actions.mjs +87 -0
- package/public/shell-attention-inbox.css +72 -0
- package/public/shell-attention-inbox.mjs +198 -0
- package/public/shell-context-actions.css +61 -0
- package/public/shell-context-actions.mjs +168 -0
- package/public/shell-inspector-resize.mjs +124 -0
- package/public/shell-navigation-resize.mjs +107 -0
- package/public/shell-navigation.mjs +127 -0
- package/public/shell-preferences.mjs +108 -0
- package/public/shell-surfaces.mjs +99 -0
- package/public/shell-tools-launcher.css +97 -0
- package/public/shell-tools-launcher.mjs +222 -0
- package/public/shell-view-host.mjs +115 -0
- package/public/shell-workspace.css +266 -0
- package/public/shell-workspace.mjs +402 -0
- package/public/sidebar-update-menu.css +190 -0
- package/public/sidebar-update-menu.mjs +512 -0
- package/public/styles.css +320 -169
- package/public/subagent-launch-slot-state.mjs +2 -2
- package/public/themed-selects.css +156 -0
- package/public/workspace-choices.mjs +104 -0
- package/tests/activity-agents-controller.test.mjs +652 -0
- package/tests/activity-events-controller.test.mjs +511 -0
- package/tests/app-runner-terminal-static.test.mjs +3 -3
- package/tests/append-system-http.test.mjs +7 -6
- package/tests/append-system-selector-static.test.mjs +6 -6
- package/tests/aur-review-widget-static.test.mjs +11 -3
- package/tests/boot-failure-diagnostics.test.mjs +8 -3
- package/tests/browser/activity-intercom-controller.spec.mjs +457 -0
- package/tests/browser/activity-navigation-integration.spec.mjs +45 -0
- package/tests/browser/activity-owner-integration.spec.mjs +201 -0
- package/tests/browser/activity-queue-controller.spec.mjs +405 -0
- package/tests/browser/activity-section-picker.spec.mjs +294 -0
- package/tests/browser/activity-todo-view.spec.mjs +60 -0
- package/tests/browser/activity-usage-controller.spec.mjs +416 -0
- package/tests/browser/compact-layout-integration.spec.mjs +58 -0
- package/tests/browser/composer-action-grid-reorder.spec.mjs +16 -0
- package/tests/browser/composer-disclosure.spec.mjs +389 -0
- package/tests/browser/composer-toolbar-polish.spec.mjs +343 -0
- package/tests/browser/control-deck-component-updates.spec.mjs +5 -14
- package/tests/browser/control-deck-side-panels.spec.mjs +27 -12
- package/tests/browser/control-visibility.spec.mjs +5 -0
- package/tests/browser/controls-layout.spec.mjs +21 -2
- package/tests/browser/conversation-overview.spec.mjs +251 -0
- package/tests/browser/draft-conversations.spec.mjs +276 -0
- package/tests/browser/empty-startup-fixture.mjs +135 -0
- package/tests/browser/empty-startup.spec.mjs +282 -0
- package/tests/browser/events-tree-context-menu.spec.mjs +1 -0
- package/tests/browser/focused-composer-more.spec.mjs +127 -0
- package/tests/browser/focused-model-shortcuts.spec.mjs +120 -0
- package/tests/browser/focused-navigation-fixture.mjs +32 -0
- package/tests/browser/focused-project-activity.spec.mjs +111 -0
- package/tests/browser/focused-shell-integration.spec.mjs +208 -0
- package/tests/browser/folder-picker-layout-fixture.mjs +13 -0
- package/tests/browser/folder-picker-layout.spec.mjs +302 -0
- package/tests/browser/footer-model-advanced-layout.spec.mjs +27 -14
- package/tests/browser/git-setup-cancel.spec.mjs +251 -0
- package/tests/browser/guided-git-fallback.spec.mjs +40 -21
- package/tests/browser/inspector-header.spec.mjs +221 -0
- package/tests/browser/inspector-overview-integration.spec.mjs +104 -0
- package/tests/browser/inspector-resize.spec.mjs +227 -0
- package/tests/browser/inspector-topic-overflow.spec.mjs +56 -0
- package/tests/browser/interaction-action-discovery.spec.mjs +332 -0
- package/tests/browser/interaction-attention-inbox.spec.mjs +364 -0
- package/tests/browser/interaction-attention-integration.spec.mjs +53 -0
- package/tests/browser/interaction-composer-controls.spec.mjs +267 -0
- package/tests/browser/interaction-composer-integration.spec.mjs +175 -0
- package/tests/browser/interaction-continuity.spec.mjs +50 -26
- package/tests/browser/interaction-model-picker.spec.mjs +86 -0
- package/tests/browser/last-terminal-close.spec.mjs +280 -0
- package/tests/browser/mobile-foundation.spec.mjs +172 -20
- package/tests/browser/model-catalog-groups.spec.mjs +104 -0
- package/tests/browser/more-row-menus.spec.mjs +258 -0
- package/tests/browser/new-tab-hit-target.spec.mjs +228 -0
- package/tests/browser/no-project-conversation.spec.mjs +113 -0
- package/tests/browser/optimistic-prompt.spec.mjs +3 -0
- package/tests/browser/overhaul-w7-accessibility.spec.mjs +227 -0
- package/tests/browser/overhaul-w7-capabilities.spec.mjs +298 -0
- package/tests/browser/overhaul-w7-companions.spec.mjs +290 -0
- package/tests/browser/overhaul-w7-focus-repairs.spec.mjs +210 -0
- package/tests/browser/overhaul-w7-layout-repairs.spec.mjs +183 -0
- package/tests/browser/overhaul-w7-parent-repairs.spec.mjs +97 -0
- package/tests/browser/overhaul-w7-pwa.spec.mjs +247 -0
- package/tests/browser/overhaul-w7-responsive.spec.mjs +450 -0
- package/tests/browser/overhaul-w7-update.spec.mjs +215 -0
- package/tests/browser/overhaul-w7-zoom.spec.mjs +243 -0
- package/tests/browser/overview-agent-ownership.spec.mjs +45 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +3 -0
- package/tests/browser/project-artifact-controller.spec.mjs +324 -0
- package/tests/browser/project-artifact-integration.spec.mjs +103 -0
- package/tests/browser/project-file-buffer-integration.spec.mjs +230 -0
- package/tests/browser/project-git-tools-integration.spec.mjs +369 -0
- package/tests/browser/session-fixture.mjs +118 -0
- package/tests/browser/session-ownership.spec.mjs +175 -0
- package/tests/browser/session-shelves-integration.spec.mjs +219 -0
- package/tests/browser/session-shelves.spec.mjs +340 -0
- package/tests/browser/session-sidebar-resize.spec.mjs +138 -0
- package/tests/browser/session-summary.spec.mjs +17 -12
- package/tests/browser/settings-complete-home.spec.mjs +463 -0
- package/tests/browser/settings-entrypoint.spec.mjs +104 -0
- package/tests/browser/settings-navigation-controller.spec.mjs +383 -0
- package/tests/browser/settings-navigation-integration.spec.mjs +348 -0
- package/tests/browser/settings-resource-lifetime.spec.mjs +349 -0
- package/tests/browser/settings-workspace-integration.spec.mjs +132 -0
- package/tests/browser/shell-ownership.spec.mjs +398 -0
- package/tests/browser/shell-rollout-fixture.mjs +259 -0
- package/tests/browser/shell-rollout.spec.mjs +357 -0
- package/tests/browser/shell-tools-launcher.spec.mjs +260 -0
- package/tests/browser/shell-workspace.spec.mjs +433 -0
- package/tests/browser/side-panel-section-reorder.spec.mjs +3 -1
- package/tests/browser/sidebar-floating-tooltips.spec.mjs +37 -0
- package/tests/browser/sidebar-update-integration.spec.mjs +277 -0
- package/tests/browser/sidebar-update-menu.spec.mjs +402 -0
- package/tests/browser/sidebar-update-progress.spec.mjs +472 -0
- package/tests/browser/stream-output-isolation.spec.mjs +6 -3
- package/tests/browser/themed-selects.spec.mjs +297 -0
- package/tests/browser/thread-start-flow.spec.mjs +481 -0
- package/tests/browser/ui-polish-activity-controls.spec.mjs +177 -0
- package/tests/browser/ui-polish-features.spec.mjs +85 -0
- package/tests/browser/ui-polish-file-header.spec.mjs +43 -0
- package/tests/browser/ui-polish-local-git.spec.mjs +183 -0
- package/tests/browser/ui-polish-mobile-recovery.spec.mjs +36 -0
- package/tests/browser/ui-polish-navigation.spec.mjs +127 -0
- package/tests/browser/ui-polish-session-actions.spec.mjs +282 -0
- package/tests/browser/user-noticeable-fixes.spec.mjs +10 -3
- package/tests/browser/windows-drive-parent.spec.mjs +4 -2
- package/tests/browser/workspace-draft-selection.spec.mjs +266 -0
- package/tests/codex-fast-mode-static.test.mjs +16 -11
- package/tests/codex-speed-mode-browser-state.test.mjs +6 -3
- package/tests/codex-usage-source.test.mjs +4 -3
- package/tests/component-update-api-static.test.mjs +2 -2
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-deck-component-updates-static.test.mjs +9 -4
- package/tests/control-visibility-static.test.mjs +3 -3
- package/tests/controls-layout-static.test.mjs +5 -5
- package/tests/conversation-overview-adapter.test.mjs +100 -0
- package/tests/document-artifact-static.test.mjs +2 -1
- package/tests/draft-conversations.test.mjs +205 -0
- package/tests/empty-startup-launcher.test.mjs +197 -0
- package/tests/events-tree-context-menu-static.test.mjs +22 -18
- package/tests/fake-pi-session-ownership.test.mjs +302 -0
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/feature-system-prompt-optional-feature-static.test.mjs +1 -1
- package/tests/file-viewer-image-static.test.mjs +15 -11
- package/tests/file-viewer-search-static.test.mjs +5 -5
- package/tests/fixtures/fake-pi.mjs +41 -9
- package/tests/footer-provider-usage-visual-static.test.mjs +7 -6
- package/tests/foreground-transcript-catch-up-static.test.mjs +7 -4
- package/tests/git-footer-context-menu-static.test.mjs +1 -1
- package/tests/git-panel-file-preview-static.test.mjs +41 -48
- package/tests/git-panel-live-updates-static.test.mjs +2 -1
- package/tests/git-workflow-dispatch.test.mjs +66 -0
- package/tests/git-workflow-preferences.test.mjs +9 -1
- package/tests/guided-git-activation-static.test.mjs +14 -11
- package/tests/guided-git-fallback-ui-static.test.mjs +8 -5
- package/tests/guided-git-message-reliability-static.test.mjs +10 -6
- package/tests/guided-git-publication-backend-static.test.mjs +16 -11
- package/tests/http-endpoints-harness.test.mjs +21 -9
- package/tests/interaction-state-stability-static.test.mjs +4 -3
- package/tests/intercom-conversation-viewer-static.test.mjs +29 -17
- package/tests/intercom-tag-layout-static.test.mjs +13 -12
- package/tests/intercom-tag-overflow-layout.test.mjs +11 -10
- package/tests/main-output-loading-static.test.mjs +4 -4
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-compact-layout.test.mjs +2 -2
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +10 -7
- package/tests/mobile-phone-experience-static.test.mjs +3 -2
- package/tests/mobile-static.test.mjs +173 -135
- package/tests/model-catalog-order.test.mjs +103 -0
- package/tests/native-parity.test.mjs +6 -4
- package/tests/native-session-choice-owner.test.mjs +102 -0
- package/tests/native-update-lifecycle.test.mjs +10 -5
- package/tests/no-project-http-harness.test.mjs +328 -0
- package/tests/no-project-navigation.test.mjs +54 -0
- package/tests/no-project-workspaces.test.mjs +77 -0
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-migration-frontend.test.mjs +4 -4
- package/tests/optional-feature-prompt-impact-static.test.mjs +3 -3
- package/tests/package-updates.test.mjs +630 -0
- package/tests/persistent-ui-layout-static.test.mjs +3 -3
- package/tests/platform-event-stream.test.mjs +253 -0
- package/tests/project-file-viewer-controller.test.mjs +652 -0
- package/tests/project-git-tools-adapter.test.mjs +103 -0
- package/tests/project-git-tools-controller.test.mjs +577 -0
- package/tests/project-runners-controller.test.mjs +453 -0
- package/tests/prompt-input-vertical-scroll-static.test.mjs +3 -3
- package/tests/prompt-routing-input-clear-static.test.mjs +2 -2
- package/tests/questionnaire-dialog.test.mjs +6 -6
- package/tests/queue-edit-reorder-static.test.mjs +48 -51
- package/tests/rpc-supervisor-host.test.mjs +4 -1
- package/tests/safety-guard-auto-review-static.test.mjs +1 -1
- package/tests/sampling-native-controls-user-flow.test.mjs +7 -1
- package/tests/server-app-runners.test.mjs +536 -0
- package/tests/server-codex-fast-mode.test.mjs +346 -0
- package/tests/server-conversation-mode.test.mjs +386 -0
- package/tests/server-conversation-voice.test.mjs +426 -0
- package/tests/server-extension-ui-requests.test.mjs +357 -0
- package/tests/server-git-generation.test.mjs +558 -0
- package/tests/server-git-mutations.test.mjs +729 -0
- package/tests/server-git-reads.test.mjs +381 -0
- package/tests/server-git-worktree-sessions.test.mjs +502 -0
- package/tests/server-helper-requests.test.mjs +364 -0
- package/tests/server-rpc-transports.test.mjs +553 -0
- package/tests/server-settings-store.test.mjs +132 -0
- package/tests/server-shell-rollout.test.mjs +478 -0
- package/tests/server-sse-delivery.test.mjs +410 -0
- package/tests/server-workspace-files.test.mjs +546 -0
- package/tests/session-attention-scheduler.test.mjs +514 -0
- package/tests/session-composer-store.test.mjs +153 -0
- package/tests/session-context.test.mjs +134 -0
- package/tests/session-extension-requests.test.mjs +193 -0
- package/tests/session-ownership-adapter.test.mjs +130 -0
- package/tests/session-sampling-ui-static.test.mjs +10 -4
- package/tests/session-send-lifetime.test.mjs +140 -0
- package/tests/session-shelf-state.test.mjs +348 -0
- package/tests/session-shelves-adapter.test.mjs +79 -0
- package/tests/session-summary-lifetime.test.mjs +54 -0
- package/tests/settings-resource-controller.test.mjs +548 -0
- package/tests/shell-action-adapter.test.mjs +169 -0
- package/tests/shell-actions.test.mjs +182 -0
- package/tests/shell-navigation.test.mjs +348 -0
- package/tests/shell-preferences.test.mjs +367 -0
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/stream-output-isolation-static.test.mjs +1 -1
- package/tests/subagent-gate-visibility.test.mjs +1 -1
- package/tests/subagent-launch-slot-state.test.mjs +2 -2
- package/tests/subagent-launch-slots-static.test.mjs +1 -1
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/subagent-reliability-integration.test.mjs +13 -30
- package/tests/syntax-highlighting-static.test.mjs +3 -3
- package/tests/tab-close-continuity-static.test.mjs +1 -1
- package/tests/tab-metadata-ordering.test.mjs +99 -0
- package/tests/terminal-cwd-grouping-static.test.mjs +2 -2
- package/tests/terminal-tab-prompt-tooltip-static.test.mjs +2 -0
- package/tests/terminal-tab-workspace-static.test.mjs +5 -4
- package/tests/terminal-tabs-resize-static.test.mjs +1 -1
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/thread-display-title.test.mjs +44 -0
- package/tests/update-api-harness.test.mjs +15 -14
- package/tests/update-tab-restore-harness.test.mjs +3 -0
- package/tests/webui-settings-locking.test.mjs +2 -2
- package/tests/windows-drive-cwd-picker-static.test.mjs +7 -9
- package/tests/workspace-choices.test.mjs +114 -0
- package/tests/workspace-save-load-static.test.mjs +7 -4
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { expect } from '@playwright/test';
|
|
2
|
+
import { test } from './empty-startup-fixture.mjs';
|
|
3
|
+
|
|
4
|
+
test.use({ viewport: { width: 1440, height: 900 }, serviceWorkers: 'block', video: 'off' });
|
|
5
|
+
|
|
6
|
+
const names = { all: 'Pi and extensions + WebUI', webui: 'WebUI only', pi: 'Pi only' };
|
|
7
|
+
const planFor = target => ({ requested: target, transactionId: `menu-${target}`, digest: 'fixture-preview-token',
|
|
8
|
+
targets: [{ id: target, installedRoot: '/fixture/installed', command: { command: target === 'webui' ? 'npm' : 'pi',
|
|
9
|
+
args: target === 'all' ? ['update', '--all'] : target === 'webui' ? ['update', '-g', '@firstpick/pi-package-webui'] : ['update'] } }], refusals: [] });
|
|
10
|
+
|
|
11
|
+
async function setup(page, fixture, { layout = 'focused', canRunUpdate = true, error = '', applyGate = null, invalidPlan = false } = {}) {
|
|
12
|
+
const requests = [], jobs = { all: null, pi: null, webui: null };
|
|
13
|
+
const respond = (route, data, status = 200) => route.fulfill({ status, contentType: 'application/json', body: JSON.stringify({ ok: true, data }) });
|
|
14
|
+
await page.route('**/api/update-status*', route => respond(route, {
|
|
15
|
+
canRunUpdate, updateInProgress: Object.values(jobs).some(job => job?.phase === 'running'), nativeJobs: jobs,
|
|
16
|
+
nativeJobDiscoveryError: '', pi: {}, webui: {},
|
|
17
|
+
}));
|
|
18
|
+
await page.route('**/api/update/plan', route => {
|
|
19
|
+
const body = route.request().postDataJSON(); requests.push({ kind: 'plan', body });
|
|
20
|
+
if (error) return route.fulfill({ status: 409, contentType: 'application/json', body: JSON.stringify({ ok: false, error }) });
|
|
21
|
+
return respond(route, { plan: invalidPlan ? { ...planFor(body.targets[0]), digest: '' } : planFor(body.targets[0]) }, 201);
|
|
22
|
+
});
|
|
23
|
+
await page.route('**/api/update/apply', async route => {
|
|
24
|
+
const body = route.request().postDataJSON(); requests.push({ kind: 'apply', body });
|
|
25
|
+
const target = body.transactionId.replace('menu-', '');
|
|
26
|
+
jobs[target] = { transactionId: body.transactionId, plan: planFor(target), phase: 'running', receipts: [] };
|
|
27
|
+
if (applyGate) await applyGate;
|
|
28
|
+
return respond(route, { transactionId: body.transactionId, phase: 'running' }, 202);
|
|
29
|
+
});
|
|
30
|
+
await page.route('**/api/update/transactions/*', route => respond(route,
|
|
31
|
+
Object.values(jobs).find(job => job?.transactionId === route.request().url().split('/').pop())));
|
|
32
|
+
await page.addInitScript(layout => localStorage.setItem('pi-webui-shell-preferences-v1', JSON.stringify({ v: 1, desktopLayout: layout })), layout);
|
|
33
|
+
await page.goto(fixture.baseURL);
|
|
34
|
+
await expect(page.locator('#emptyStartTitle')).toBeVisible();
|
|
35
|
+
if (layout === 'focused') {
|
|
36
|
+
const gear = await page.locator('.terminal-settings-button').boundingBox();
|
|
37
|
+
const update = await page.locator('#sidebarUpdateButton').boundingBox();
|
|
38
|
+
expect(Math.abs(gear.y - update.y)).toBeLessThanOrEqual(1);
|
|
39
|
+
expect(update.x).toBeGreaterThan(gear.x);
|
|
40
|
+
}
|
|
41
|
+
await page.locator('#sidebarUpdateButton').click();
|
|
42
|
+
await expect(page.getByRole('menuitem').filter({ hasText: names.all })).toBeVisible();
|
|
43
|
+
return { requests, jobs };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const target of Object.keys(names)) test(`${target} starts its discovered plan once without confirmation, then reports completion`, async ({ page, emptyStartup }, info) => {
|
|
47
|
+
const { requests, jobs } = await setup(page, emptyStartup);
|
|
48
|
+
const choice = () => page.getByRole('menuitem').filter({ hasText: names[target] });
|
|
49
|
+
await choice().click();
|
|
50
|
+
await expect(page.locator('#confirmationDialog')).toBeHidden();
|
|
51
|
+
await expect.poll(() => requests.filter(item => item.kind === 'apply').length).toBe(1);
|
|
52
|
+
expect(requests.at(-1).body).toEqual({ transactionId: `menu-${target}`, planDigest: 'fixture-preview-token' });
|
|
53
|
+
await page.locator('#sidebarUpdateButton').click();
|
|
54
|
+
await expect(choice()).toBeDisabled();
|
|
55
|
+
jobs[target] = { ...jobs[target], phase: 'success', receipts: [{ id: target, status: 'success', stdout: 'fixture completed' }] };
|
|
56
|
+
await expect(choice()).toBeEnabled({ timeout: 10_000 });
|
|
57
|
+
await expect(page.locator('.sidebar-update-menu-status').filter({ hasText: 'Update commands completed' })).toBeVisible();
|
|
58
|
+
await expect(page.locator('.sidebar-update-menu-status').filter({ hasText: 'Update commands completed' })).not.toContainText(`menu-${target}`);
|
|
59
|
+
if (target === 'all') {
|
|
60
|
+
await expect(page.getByRole('button', { name: 'Back to progress', exact: true })).toBeHidden();
|
|
61
|
+
await page.keyboard.press('Escape');
|
|
62
|
+
await page.getByRole('button', { name: 'Details', exact: true }).click();
|
|
63
|
+
await expect(page.getByLabel('Command results', { exact: true })).not.toContainText('menu-all');
|
|
64
|
+
const path = info.outputPath('sidebar-updates-completed.png');
|
|
65
|
+
await page.screenshot({ path });
|
|
66
|
+
await info.attach('Update menu with completion feedback', { path, contentType: 'image/png' });
|
|
67
|
+
}
|
|
68
|
+
expect(await emptyStartup.starts()).toEqual([]);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('missing installation feedback is visible in the menu and launches no command', async ({ page, emptyStartup }, info) => {
|
|
72
|
+
const { requests } = await setup(page, emptyStartup, { error: 'WebUI was not found in Pi or global npm installations.' });
|
|
73
|
+
await page.getByRole('menuitem').filter({ hasText: names.webui }).click();
|
|
74
|
+
await expect.poll(() => requests.length).toBe(1);
|
|
75
|
+
await page.locator('#sidebarUpdateButton').click();
|
|
76
|
+
await expect(page.locator('.sidebar-update-menu-status').filter({ hasText: 'WebUI was not found in Pi or global npm installations.' })).toBeVisible();
|
|
77
|
+
await expect(page.locator('#confirmationDialog')).toBeHidden();
|
|
78
|
+
expect(requests.every(item => item.kind === 'plan')).toBe(true);
|
|
79
|
+
const path = info.outputPath('sidebar-updates-missing.png');
|
|
80
|
+
await page.screenshot({ path });
|
|
81
|
+
await info.attach('Missing installation feedback', { path, contentType: 'image/png' });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('remote update restriction disables actions while keeping menu readable', async ({ page, emptyStartup }) => {
|
|
85
|
+
const { requests } = await setup(page, emptyStartup, { canRunUpdate: false });
|
|
86
|
+
for (const name of Object.values(names)) await expect(page.getByRole('menuitem').filter({ hasText: name })).toBeDisabled();
|
|
87
|
+
await expect(page.getByText('Updates can only be started from localhost.')).toBeVisible();
|
|
88
|
+
expect(requests).toEqual([]);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('Classic navigation retains the same update actions and keyboard dismissal', async ({ page, emptyStartup }, info) => {
|
|
92
|
+
const { requests } = await setup(page, emptyStartup, { layout: 'classic' });
|
|
93
|
+
await expect(page.locator('#sidebarUpdateButton')).not.toHaveCount(0);
|
|
94
|
+
for (const name of Object.values(names)) await expect(page.getByRole('menuitem').filter({ hasText: name })).toBeVisible();
|
|
95
|
+
const path = info.outputPath('sidebar-updates-classic.png');
|
|
96
|
+
await page.screenshot({ path });
|
|
97
|
+
await info.attach('Classic update actions', { path, contentType: 'image/png' });
|
|
98
|
+
await page.keyboard.press('Escape');
|
|
99
|
+
await expect(page.locator('#sidebarUpdateButton')).toBeFocused();
|
|
100
|
+
expect(requests).toEqual([]);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
for (const target of ['pi', 'all']) test(`${target} feedback replaces an older partial WebUI result`, async ({ page, emptyStartup }) => {
|
|
104
|
+
const { jobs } = await setup(page, emptyStartup);
|
|
105
|
+
jobs.webui = { transactionId: 'old-webui', plan: planFor('webui'), phase: 'partial',
|
|
106
|
+
receipts: [{ id: 'webui', status: 'failed', stderr: 'old WebUI output' }] };
|
|
107
|
+
await page.keyboard.press('Escape');
|
|
108
|
+
await page.locator('#sidebarUpdateButton').click();
|
|
109
|
+
await expect(page.locator('.sidebar-update-menu-status')).toContainText('Some commands completed; others failed.');
|
|
110
|
+
await page.getByRole('menuitem').filter({ hasText: names[target] }).click();
|
|
111
|
+
await page.locator('#sidebarUpdateButton').click();
|
|
112
|
+
const status = page.locator('.sidebar-update-menu-status');
|
|
113
|
+
await expect(status).toContainText(target === 'all' ? 'Pi, extensions and Web UI:' : 'Pi:');
|
|
114
|
+
await expect(status).not.toContainText(`menu-${target}`);
|
|
115
|
+
await expect(status).not.toContainText('old WebUI output');
|
|
116
|
+
jobs[target] = { ...jobs[target], phase: 'failed', receipts: [{ id: target, status: 'failed', stderr: 'new command error' }] };
|
|
117
|
+
await expect(status).toContainText('The update command failed.', { timeout: 10_000 });
|
|
118
|
+
await expect(page.getByRole('button', { name: 'Back to progress' })).toBeHidden();
|
|
119
|
+
await page.keyboard.press('Escape');
|
|
120
|
+
await page.getByRole('button', { name: 'Details', exact: true }).click();
|
|
121
|
+
await expect(page.getByLabel('Command results', { exact: true })).toContainText('new command error');
|
|
122
|
+
await expect(status).not.toContainText('old WebUI output');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
for (const outcome of ['unchanged', 'failed']) test(`persistent progress starts before apply responds and reports ${outcome}`, async ({ page, emptyStartup }, info) => {
|
|
126
|
+
let releaseApply;
|
|
127
|
+
const applyGate = new Promise(resolve => { releaseApply = resolve; });
|
|
128
|
+
const { requests, jobs } = await setup(page, emptyStartup, { applyGate });
|
|
129
|
+
await page.getByRole('menuitem').filter({ hasText: names.webui }).click();
|
|
130
|
+
try {
|
|
131
|
+
await expect(page.locator('.sidebar-update-progress-track')).toBeVisible();
|
|
132
|
+
await expect(page.getByRole('menu', { name: 'Updates', exact: true })).toBeHidden();
|
|
133
|
+
await expect(page.locator('#sidebarUpdateButton')).toHaveAttribute('aria-busy', 'true');
|
|
134
|
+
expect(requests.filter(item => item.kind === 'apply')).toHaveLength(1);
|
|
135
|
+
} finally {
|
|
136
|
+
releaseApply();
|
|
137
|
+
}
|
|
138
|
+
const startedAt = new Date(Date.now() - 15_000).toISOString();
|
|
139
|
+
jobs.webui = { ...jobs.webui, progress: { totalSteps: 2, completedSteps: 0,
|
|
140
|
+
currentTargetId: 'webui:pi-user', startedAt, stepStartedAt: startedAt, stdout: 'Fetching package metadata', stderr: '' } };
|
|
141
|
+
await expect.poll(() => page.locator('body').innerText()).toContain('Fetching package metadata');
|
|
142
|
+
const progress = page.locator('.sidebar-update-progress-track');
|
|
143
|
+
await expect(progress).toBeVisible();
|
|
144
|
+
await expect.poll(async () => Number((await progress.getAttribute('aria-label')).match(/Estimated (\d+)/)?.[1])).toBeGreaterThan(0);
|
|
145
|
+
expect(Number((await progress.getAttribute('aria-label')).match(/Estimated (\d+)/)?.[1])).toBeLessThan(100);
|
|
146
|
+
await expect.poll(() => page.locator('body').innerText()).toMatch(/estimat/i);
|
|
147
|
+
jobs.webui.progress = { ...jobs.webui.progress, completedSteps: 1, currentTargetId: 'webui:npm-global', stepStartedAt: new Date().toISOString(), stdout: 'Checking global WebUI' };
|
|
148
|
+
await expect.poll(() => page.locator('body').innerText()).toContain('Checking global WebUI');
|
|
149
|
+
if (outcome === 'unchanged') {
|
|
150
|
+
await page.reload();
|
|
151
|
+
await expect.poll(() => page.locator('body').innerText()).toContain('Checking global WebUI');
|
|
152
|
+
await expect(page.locator('.sidebar-update-progress-track')).toBeVisible();
|
|
153
|
+
}
|
|
154
|
+
await page.screenshot({ path: info.outputPath('update-progress-running.png') });
|
|
155
|
+
jobs.webui = { ...jobs.webui, phase: outcome, restartRequired: false,
|
|
156
|
+
progress: { ...jobs.webui.progress, completedSteps: 2, currentTargetId: null },
|
|
157
|
+
receipts: [{ id: 'webui', status: outcome, stdout: outcome === 'unchanged' ? 'up to date in 1s' : '', stderr: outcome === 'failed' ? 'fixture download failed' : '' }] };
|
|
158
|
+
await expect(page.locator('.sidebar-update-progress')).toHaveAttribute('data-state', outcome);
|
|
159
|
+
await page.getByRole('button', { name: 'Details', exact: true }).click();
|
|
160
|
+
await expect(page.getByLabel('Command results', { exact: true })).toContainText(outcome === 'unchanged' ? 'up to date in 1s' : 'fixture download failed');
|
|
161
|
+
await expect(page.locator('#sidebarUpdateButton')).toHaveAttribute('aria-busy', 'false');
|
|
162
|
+
expect(requests.filter(item => item.kind === 'apply')).toHaveLength(1);
|
|
163
|
+
await page.screenshot({ path: info.outputPath(`update-progress-${outcome}.png`) });
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
for (const responseOrder of ['status-before-apply', 'status-after-apply', 'apply-error']) test(`selected job survives older status: ${responseOrder}`, async ({ page, emptyStartup }, info) => {
|
|
167
|
+
const { jobs, requests } = await setup(page, emptyStartup);
|
|
168
|
+
const oldJob = { transactionId: 'previous-webui', plan: { ...planFor('webui'), transactionId: 'previous-webui' },
|
|
169
|
+
phase: 'unchanged', receipts: [{ id: 'webui', status: 'unchanged', stdout: 'Previous run was up to date' }] };
|
|
170
|
+
jobs.webui = oldJob;
|
|
171
|
+
let releaseApply, releaseStatus;
|
|
172
|
+
const applyGate = new Promise(resolve => { releaseApply = resolve; });
|
|
173
|
+
const statusGate = new Promise(resolve => { releaseStatus = resolve; });
|
|
174
|
+
await page.route('**/api/update/apply', async route => {
|
|
175
|
+
const body = route.request().postDataJSON();
|
|
176
|
+
requests.push({ kind: 'apply', body });
|
|
177
|
+
await applyGate;
|
|
178
|
+
if (responseOrder === 'apply-error') return route.fulfill({ status: 503, json: { ok: false, error: 'Launch reply unavailable' } });
|
|
179
|
+
const startedAt = new Date().toISOString();
|
|
180
|
+
jobs.webui = { transactionId: body.transactionId, plan: planFor('webui'), phase: 'running', receipts: [],
|
|
181
|
+
progress: { startedAt, stepStartedAt: startedAt, totalSteps: 1, completedSteps: 0, currentTargetId: 'webui:npm-global', stdout: 'New command running', stderr: '' } };
|
|
182
|
+
return route.fulfill({ status: 202, json: { ok: true, data: { transactionId: body.transactionId, phase: 'running' } } });
|
|
183
|
+
});
|
|
184
|
+
await page.getByRole('menuitem').filter({ hasText: names.webui }).click();
|
|
185
|
+
const card = page.locator('.sidebar-update-progress');
|
|
186
|
+
await expect(card).toHaveAttribute('data-state', 'launching');
|
|
187
|
+
await page.getByRole('button', { name: 'Details', exact: true }).click();
|
|
188
|
+
let statusRequested = false;
|
|
189
|
+
await page.route('**/api/update-status*', async route => {
|
|
190
|
+
statusRequested = true;
|
|
191
|
+
await statusGate;
|
|
192
|
+
return route.fulfill({ json: { ok: true, data: { canRunUpdate: true, updateInProgress: false,
|
|
193
|
+
nativeJobs: { all: null, pi: null, webui: oldJob }, nativeJobDiscoveryError: '', pi: {}, webui: {} } } });
|
|
194
|
+
}, { times: 1 });
|
|
195
|
+
try {
|
|
196
|
+
const statusResponse = page.waitForResponse(response => new URL(response.url()).pathname === '/api/update-status');
|
|
197
|
+
await page.locator('#sidebarUpdateButton').click();
|
|
198
|
+
await expect.poll(() => statusRequested).toBe(true);
|
|
199
|
+
if (responseOrder === 'status-after-apply') {
|
|
200
|
+
releaseApply();
|
|
201
|
+
await expect(page.locator('.sidebar-update-menu-status')).toContainText('Step 1 of 1');
|
|
202
|
+
}
|
|
203
|
+
releaseStatus();
|
|
204
|
+
await statusResponse;
|
|
205
|
+
await page.keyboard.press('Escape');
|
|
206
|
+
await expect(card).toHaveAttribute('data-state', responseOrder === 'status-after-apply' ? 'running' : 'launching');
|
|
207
|
+
await expect(card).not.toContainText('Previous run was up to date');
|
|
208
|
+
await expect(card).toHaveAttribute('data-details', 'true');
|
|
209
|
+
releaseApply();
|
|
210
|
+
if (responseOrder === 'apply-error') {
|
|
211
|
+
await expect(card).toHaveAttribute('data-state', 'unknown');
|
|
212
|
+
await expect(card).toContainText('Launch reply unavailable');
|
|
213
|
+
} else {
|
|
214
|
+
await expect(card).toHaveAttribute('data-state', 'running');
|
|
215
|
+
await expect(card).toContainText('New command running', { timeout: 10_000 });
|
|
216
|
+
}
|
|
217
|
+
expect(requests.filter(item => item.kind === 'apply')).toEqual([{ kind: 'apply', body: { transactionId: 'menu-webui', planDigest: 'fixture-preview-token' } }]);
|
|
218
|
+
await page.screenshot({ path: info.outputPath(`${responseOrder}.png`) });
|
|
219
|
+
} finally { releaseApply(); releaseStatus(); }
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
for (const kind of ['rejected', 'invalid']) test(`${kind} discovery never applies`, async ({ page, emptyStartup }) => {
|
|
223
|
+
const { requests } = await setup(page, emptyStartup, kind === 'rejected' ? { error: 'Discovery refused' } : { invalidPlan: true });
|
|
224
|
+
await page.getByRole('menuitem').filter({ hasText: names.pi }).click();
|
|
225
|
+
await page.locator('#sidebarUpdateButton').click();
|
|
226
|
+
await expect(page.locator('.sidebar-update-menu-status')).toContainText(kind === 'rejected' ? 'Discovery refused' : 'no command was launched');
|
|
227
|
+
expect(requests.map(item => item.kind)).toEqual(['plan']);
|
|
228
|
+
await expect(page.locator('#confirmationDialog')).toBeHidden();
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test('partial EROFS is concise; Details follows the running job and preserves output safely', async ({ page, emptyStartup }, info) => {
|
|
232
|
+
const { jobs, requests } = await setup(page, emptyStartup);
|
|
233
|
+
await page.getByRole('menuitem').filter({ hasText: names.all }).click();
|
|
234
|
+
await expect.poll(() => requests.filter(item => item.kind === 'apply').length).toBe(1);
|
|
235
|
+
const startedAt = new Date().toISOString();
|
|
236
|
+
jobs.all = { ...jobs.all, plan: { ...jobs.all.plan, targets: [...jobs.all.plan.targets, ...planFor('webui').targets] },
|
|
237
|
+
receipts: [{ id: 'all', status: 'success', exitCode: 0, stdout: 'Updated disposable Pi and extensions' }],
|
|
238
|
+
progress: { totalSteps: 2, completedSteps: 1, currentTargetId: 'webui', startedAt, stepStartedAt: startedAt,
|
|
239
|
+
stdout: 'Updating disposable WebUI installation', stderr: '' } };
|
|
240
|
+
await page.getByRole('button', { name: 'Details', exact: true }).click();
|
|
241
|
+
const results = page.getByLabel('Command results', { exact: true });
|
|
242
|
+
await expect(results).toContainText('"pi" "update" "--all"');
|
|
243
|
+
await expect(results).toContainText('webui: running', { timeout: 10_000 });
|
|
244
|
+
await expect(page.getByRole('button', { name: 'Back to progress' })).toBeFocused();
|
|
245
|
+
await page.screenshot({ path: info.outputPath('running-details-back.png') });
|
|
246
|
+
jobs.all = { ...jobs.all, phase: 'partial', restartRequired: false, receipts: [
|
|
247
|
+
{ id: 'all', status: 'success', exitCode: 0, stdout: 'Updated disposable Pi and extensions' },
|
|
248
|
+
{ id: 'webui', status: 'failed', exitCode: 1, stderr: 'npm error code EROFS\nnpm error rename <img src=x onerror=alert(1)>', error: 'EROFS' },
|
|
249
|
+
] };
|
|
250
|
+
await expect(results).toContainText('webui: failed · exit 1', { timeout: 10_000 });
|
|
251
|
+
await expect(page.locator('.sidebar-update-progress')).toHaveAttribute('data-details', 'true');
|
|
252
|
+
await expect(page.locator('.sidebar-update-progress-result')).toContainText('The installation is read-only. Run the update outside the preview or sandbox.');
|
|
253
|
+
await expect(page.locator('.sidebar-update-progress img')).toHaveCount(0);
|
|
254
|
+
await expect(results).toContainText('<img src=x onerror=alert(1)>');
|
|
255
|
+
await page.screenshot({ path: info.outputPath('partial-erofs-details.png') });
|
|
256
|
+
await page.keyboard.press('Escape');
|
|
257
|
+
await expect(page.getByRole('button', { name: 'Details', exact: true })).toBeFocused();
|
|
258
|
+
const compact = page.locator('.sidebar-update-progress');
|
|
259
|
+
expect(await compact.innerText()).not.toContain('npm error rename');
|
|
260
|
+
await expect(compact.locator('.sidebar-update-progress-output')).toBeHidden();
|
|
261
|
+
await page.screenshot({ path: info.outputPath('partial-erofs-compact.png') });
|
|
262
|
+
await page.locator('#sidebarUpdateButton').click();
|
|
263
|
+
await expect(page.getByRole('button', { name: 'Back to progress' })).toBeHidden();
|
|
264
|
+
await page.keyboard.press('Escape');
|
|
265
|
+
await expect(page.getByRole('button', { name: 'Details', exact: true })).toBeVisible();
|
|
266
|
+
expect(requests.filter(item => item.kind === 'apply')).toHaveLength(1);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
test('read-only guidance requires failed command output', async ({ page, emptyStartup }) => {
|
|
270
|
+
const { jobs } = await setup(page, emptyStartup);
|
|
271
|
+
await page.getByRole('menuitem').filter({ hasText: names.pi }).click();
|
|
272
|
+
await expect.poll(() => jobs.pi?.transactionId).toBe('menu-pi');
|
|
273
|
+
jobs.pi = { ...jobs.pi, phase: 'partial', error: 'EROFS', receipts: [{ id: 'pi', status: 'success', stdout: 'EROFS warning only' }] };
|
|
274
|
+
await page.keyboard.press('Escape');
|
|
275
|
+
await expect(page.locator('.sidebar-update-progress')).toHaveAttribute('data-state', 'partial', { timeout: 10_000 });
|
|
276
|
+
await expect(page.locator('.sidebar-update-progress-result')).not.toContainText('read-only');
|
|
277
|
+
});
|