From f437df2a836d10dd49b0238006aaeb255a74e598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=99=BD=E5=8F=94?= <11794527+absfan@user.noreply.gitee.com> Date: Fri, 30 Oct 2026 11:47:20 +0800 Subject: [PATCH] feat: simplify DSH tool navigation and remove account onboarding --- .../2026-10-30-dsh-native-integration.md | 4 ++- .../2026-10-30-dsh-native-integration.md | 10 ++++++ docs/user/dsh-ai-supervision.md | 8 +++-- integration/dsh/start.mjs | 4 +++ integration/dsh/task-plugin/client.js | 23 +++++++++++++ .../trial_task_center/ui/main_window.py | 31 ++++++++++++++---- .../trial_task_center/ui/styles.py | 4 +++ tests/ui/test_dsh_native_menu.py | 13 +++++--- tools/accept_dsh_desktop.py | 32 +++++++++---------- tools/verify_dsh_native_ui.mjs | 30 ++++++++--------- 10 files changed, 109 insertions(+), 50 deletions(-) diff --git a/docs/superpowers/specs/2026-10-30-dsh-native-integration.md b/docs/superpowers/specs/2026-10-30-dsh-native-integration.md index 49cd5e0..51d9928 100644 --- a/docs/superpowers/specs/2026-10-30-dsh-native-integration.md +++ b/docs/superpowers/specs/2026-10-30-dsh-native-integration.md @@ -4,10 +4,12 @@ ## 组合 -固定 `@deepseek-ai/dsh@0.2.1-rc.5`,保留官方前端产物不变。主窗口增加工具菜单和 `QStackedWidget`,按需创建 `QWebEngineView`;任务页保持原有控件、任务选择和执行状态。由所属 `QProcess` 启动独立 profile,提供只监听回环地址的 Harness 服务。只有所属进程输出的、同一回环 origin 的启动地址可进入嵌入页面。 +固定 `@deepseek-ai/dsh@0.2.1-rc.5`,保留官方前端产物不变。主窗口顶部提供左侧“任务中心”、右侧“DSH助手”两个常驻单击入口,以选中态标记当前页;通过 `QStackedWidget` 切换,按需创建 `QWebEngineView`。任务页保持原有控件、任务选择和执行状态。由所属 `QProcess` 启动独立 profile,提供只监听回环地址的 Harness 服务。只有所属进程输出的、同一回环 origin 的启动地址可进入嵌入页面。 任务专用插件通过官方 slot API 改产品名称,并注册官方右侧停靠栏 tab。官方会话、编辑器、主题、SVG、悬停动画、模型面板及布局直接使用上游实现。任务上下文由 Python 白名单快照原子写入应用数据目录;Host 插件的固定读取工具和登录校验后的 HTTP 路由读取该文件。文件路径由启动器决定,不接受模型提供路径。 +禁用上游账户界面、账户后端、账户模型提供方、模型配置引导及产品反馈插件。保留主工具配置的模型选择器,并通过原生设置插槽增加“工具设置”入口和“DSH工具”说明;首页显示异常分析、规则内处理与执行监管提示。移除用户账户流程不改变本机 HTTP 认证及 Origin 校验。 + ## 能力 只启用 `dx-task` preset,模型只注册 `dx_task_snapshot`。通用工具、终端、文件浏览、插件管理、Agent 配方编辑等相关界面与工具条目禁用。全局单调 guard 拒绝其他工具,避免配置意外扩大执行能力。 diff --git a/docs/testing/2026-10-30-dsh-native-integration.md b/docs/testing/2026-10-30-dsh-native-integration.md index 0844fca..d5aa3a8 100644 --- a/docs/testing/2026-10-30-dsh-native-integration.md +++ b/docs/testing/2026-10-30-dsh-native-integration.md @@ -51,3 +51,13 @@ python tools/accept_dsh_desktop.py --output '<验收目录>' --provider-config " ## 范围 真实 API 的完整对话使用默认 V4.1 模型;另一模型验证了目录注册。验收任务处于草稿状态,不启动 CAD、不修改工程,不把该结果解释为实际工程修复成功。此次完成源码运行验证与打包配置回归,未构建发布 EXE。 + +## 后续调整:工具入口与账户移除 + +按用户反馈,将顶部下拉菜单改为左侧“任务中心”、右侧“DSH助手”两个常驻单击入口,并标记当前页。移除上游账户界面、账户后端、账户模型提供方、产品反馈和模型配置引导插件;通过原生设置插槽提供“工具设置”入口和“DSH工具”说明,保留聊天、主工具模型选择和 SVG 动画。本机请求认证继续启用。 + +重新执行同一 Python 回归命令:`49 passed in 51.69s`;CLI 真实内核检查 `status: passed`,快照、禁止工具、请求认证与无效动作检查均通过。 + +重新执行真实 API 桌面验收,使用独立全新数据目录,新增检查通过:无需点击关闭任何账户或首次引导弹窗;工具设置单击打开且没有账户入口;顶部左右入口各单击一次即可切页,选中态正确,原会话与草稿保留。默认模型完整流式回复及 `dx_task_snapshot` 审计成功,退出正常且没有未捕获异常。页面仍检测到 22 个 SVG、1 个 CSS 动画与 1 个 SVG 动画。 + +本轮证据目录:`C:/Users/ABS_Windows/.codex/visualizations/2026/10/30/01a18a4c-fe37-7e12-b79d-be24a38dba29/dsh-tool-navigation/`。包含 `desktop-report.json`、`report.json`、`task-center.png`、`dsh-in-tool.png`、`dsh-tool-home.png`、`dsh-tool-settings.png` 与动画帧截图。 diff --git a/docs/user/dsh-ai-supervision.md b/docs/user/dsh-ai-supervision.md index b7725f2..f80673c 100644 --- a/docs/user/dsh-ai-supervision.md +++ b/docs/user/dsh-ai-supervision.md @@ -2,11 +2,13 @@ ## 在工具中使用 -在主工具选择 **工具 → DSH助手**,或按 `Ctrl+Shift+D`。选择 **工具 → 任务中心** 返回原任务列表;再次进入助手时保留同一个网页、会话和未发送草稿。右侧“任务监管”读取主工具当前选中的任务。 +主工具顶部固定显示左右两个入口:左侧 **任务中心**,右侧 **DSH助手**,单击直接切换,无需展开菜单。助手也可按 `Ctrl+Shift+D` 打开;切回任务中心再进入助手时保留同一个网页、会话和未发送草稿。右侧“任务监管”读取主工具当前选中的任务。 这里直接运行 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的官方前端与运行时,固定 npm 版本 `0.2.1-rc.5`,通过 Qt WebEngine 嵌入主窗口。官方三栏框架、原生 SVG、鲸鱼悬停动画、输入编辑器、模型选择、侧栏与停靠交互均由上游代码提供。项目增加任务监管插件和“DSH助手”名称,不再使用 Qt 控件重画聊天页面。上游许可见 `licenses/DeepSeek-Harness-MIT.txt`。 -模型可通过官方界面的模型设置配置;也支持启动进程的 `DSH_API_BASE`、`DSH_MODEL`、`DSH_API_KEY`。未配置模型时可查看任务上下文和操作面板,不能获得真实模型回复。 +不显示上游账户登录、注册、充值和首次产品引导,也不注册其账户模型提供方。左下角 **工具设置** 单击打开原生设置页中的“DSH工具”说明;首页提示和任务监管面板围绕器件替换任务。输入框下方仍可选择主工具已经配置的模型。 + +模型由本机保存的主工具配置加载;也支持启动进程的 `DSH_API_BASE`、`DSH_MODEL`、`DSH_API_KEY`。未配置模型时可查看任务上下文和操作面板,不能获得真实模型回复。 本机已接入测试端点 `https://wecom-test.skyworth-cloud.cn/v1/`,注册 `skyworth-deepseek-v4-flash-0731` 和 `skyworth-deepseek-v4.1-flash`,默认使用后者。本机配置位于任务中心数据目录的 `dsh/provider.json`,密钥以 Windows DPAPI 加密保存为 `dsh/provider-key.dpapi`,启动时自动加载;不写入仓库或 Windows 用户环境变量。 @@ -33,7 +35,7 @@ node tools/verify_dsh_runtime.mjs python tools/accept_dsh_desktop.py ``` -CLI 验证启动真实官方内核,检查工具与 preset 名单,实际读取快照、执行禁止工具探针,并测试登录、跨任务与过期动作边界。桌面验收启动真实主工具,用 Qt 鼠标事件点击任务和菜单,用 Chromium Input 事件操作官方页面,核对任务刷新、会话、侧栏、SVG 动画、模型选择、草稿保留、取消确认和正常退出。验收只使用独立测试数据,不启动 CAD 或修改用户工程;未配置模型的验收不计为真实模型回复验证。 +CLI 验证启动真实官方内核,检查工具与 preset 名单,实际读取快照、执行禁止工具探针,并测试本机请求认证、跨任务与过期动作边界。桌面验收启动真实主工具,用 Qt 鼠标事件单击左右导航,用 Chromium Input 事件操作官方页面,核对全新数据下无账户或引导弹窗、工具设置、任务刷新、会话、侧栏、SVG 动画、模型选择、草稿保留、取消确认和正常退出。验收只使用独立测试数据,不启动 CAD 或修改用户工程;未配置模型的验收不计为真实模型回复验证。 已配置本机模型时,可执行真实 API 桌面验收: diff --git a/integration/dsh/start.mjs b/integration/dsh/start.mjs index abb5a92..0ec437d 100644 --- a/integration/dsh/start.mjs +++ b/integration/dsh/start.mjs @@ -24,6 +24,10 @@ export const DISABLED = [ 'persistent-bash','persistent-pwsh','skill-filesystem','harness-dev-context', 'session-title-llm','desktop-product-telemetry','product-analytics','session-telemetry-otel', 'cordis-inspect-providers','ui-deliverables','workspace-changes','entry-customization', + // This embedded tool uses its application-owned API configuration, without + // upstream accounts, billing, credential onboarding or product feedback. + 'ui-settings-account','account-controller','deepseek-account','llm-deepseek-account', + 'ui-settings-models','ui-message-feedback','message-feedback','command-feedback', ]; export function overlay() { diff --git a/integration/dsh/task-plugin/client.js b/integration/dsh/task-plugin/client.js index 318f443..9987a24 100644 --- a/integration/dsh/task-plugin/client.js +++ b/integration/dsh/task-plugin/client.js @@ -1,6 +1,25 @@ window.__ModuleLoader__.load({id:'@dx/dsh-task',factory:require=>{ const React=require('react'),h=React.createElement; + const {IconSettingsOutlineMedium}=require('@deepseek-ai/dsh-client-ui-primitives'); const names={observe:'待命',draft:'待配置',configuring:'待配置',running:'执行中',paused:'已暂停',completed:'已完成',blocked:'已阻断',uncertain:'待核验',failed:'失败'}; + function ToolSettings(){ + return h('div',{'data-testid':'dx-tool-settings-panel',style:{lineHeight:1.9}}, + h('h2',null,'DSH工具'), + h('p',null,'面向 DxDesigner 器件替换任务的异常分析与执行监管。直接使用当前任务上下文,无需另外登录。'), + h('h3',null,'工作方式'), + h('p',null,'在顶部切换任务中心和 DSH助手。会话、任务选择和未发送草稿会保留。'), + h('h3',null,'任务能力'), + h('ul',null,...['读取当前任务快照并分析异常','刷新任务上下文','确认后准备失败项重试','确认后在安全边界暂停'].map(text=>h('li',{key:text},text))), + h('h3',null,'模型与数据'), + h('p',null,'使用主工具配置的模型,在输入框下方选择。会话保存在本机任务中心数据目录。'), + h('p',null,'工程修改与执行核验由任务中心完成。模型不直接访问工程文件或执行命令。')); + } + function SettingsLauncher({wide,openSettings}){ + return h('button',{'data-testid':'dx-tool-settings',type:'button','aria-label':'工具设置',onClick:()=>openSettings(), + style:{display:'flex',alignItems:'center',gap:8,width:wide?'100%':36,height:38,padding:wide?'0 10px':8, + border:0,borderRadius:10,background:'transparent',color:'var(--dsw-alias-label-primary)',cursor:'pointer',font:'inherit'}}, + h(IconSettingsOutlineMedium,{size:18}),wide&&'工具设置'); + } function TaskPanel(){ const[data,setData]=React.useState(null),[notice,setNotice]=React.useState(''); React.useEffect(()=>{ @@ -31,6 +50,10 @@ window.__ModuleLoader__.load({id:'@dx/dsh-task',factory:require=>{ section('监管记录',(data?.events||[]).join('\n')||'等待任务事件')); } return{inject:['slots','sidebarRightTabs','sidebarRight','uiSession'],apply(ctx){ + ctx.slots.inject('settings.launcher',()=>ctx.slots.register({name:'settings.launcher',priority:-10},SettingsLauncher)); + ctx.slots.inject('settings.section',()=>ctx.slots.register({name:'settings.section',id:'dx-tool',order:-100,label:()=>'DSH工具'},ToolSettings)); + ctx.slots.inject('conversation.hero.options',()=>ctx.slots.register({name:'conversation.hero.options',id:'dx-tool-hint'}, + ()=>h('p',{style:{fontSize:13,color:'var(--dsw-alias-label-secondary)',textAlign:'center',margin:'4px 0 12px'}},'任务异常分析 · 规则内处理 · 执行监管'))); ctx.sidebarRightTabs.register({id:'@dx/dsh-task',kind:'dx-task',priority:'extension',title:()=>'任务监管',guide:[{id:'dx-task',order:0,title:()=>'任务监管',description:()=>'当前任务与受控操作'}]}); ctx.slots.inject('sidebar.right.pane.tab',()=>ctx.slots.register({name:'sidebar.right.pane.tab',key:'@dx/dsh-task'},TaskPanel)); ctx.slots.inject('sidebar.brand.name',()=>ctx.slots.register({name:'sidebar.brand.name',priority:-10},()=>h('span',null,'DSH助手'))); diff --git a/src/dx_productivity/trial_task_center/ui/main_window.py b/src/dx_productivity/trial_task_center/ui/main_window.py index e97994a..a6a9312 100644 --- a/src/dx_productivity/trial_task_center/ui/main_window.py +++ b/src/dx_productivity/trial_task_center/ui/main_window.py @@ -5,9 +5,9 @@ from ..stop_control import StopControl from shiboken6 import isValid import time from PySide6.QtCore import QElapsedTimer, QSettings, QSignalBlocker, QThreadPool, QTimer, Qt -from PySide6.QtGui import QAction +from PySide6.QtGui import QAction, QActionGroup from PySide6.QtWidgets import (QApplication, QCheckBox, QDialog, QFileDialog, QHBoxLayout, QMainWindow, QMessageBox, - QPushButton, QLabel, QSplitter, QStackedWidget, QTabWidget, QVBoxLayout, QWidget) + QPushButton, QLabel, QSizePolicy, QSplitter, QStackedWidget, QTabWidget, QToolButton, QVBoxLayout, QWidget) from ..errors import TaskCenterError from ..models import TaskStatus from ..version import VERSION @@ -36,14 +36,29 @@ class TrialTaskCenterWindow(QMainWindow): self._dsh = DshSupervisor(DshServiceAdapter(service).execute) self._dsh_view = None self._dsh_stopping = False - tools_menu = self.menuBar().addMenu('工具(&T)') - self.task_center_action = QAction('任务中心(&C)', self) + self.task_center_action = QAction('任务中心', self) self.task_center_action.triggered.connect(lambda: self.content_stack.setCurrentIndex(0)) - tools_menu.addAction(self.task_center_action) - self.dsh_action = QAction('DSH助手(&D)', self) + self.dsh_action = QAction('DSH助手', self) self.dsh_action.setShortcut('Ctrl+Shift+D') self.dsh_action.triggered.connect(self._open_dsh) - tools_menu.addAction(self.dsh_action) + self._navigation_actions = QActionGroup(self) + self._navigation_actions.setExclusive(True) + navigation = QWidget(objectName='toolNavigation') + navigation_layout = QHBoxLayout(navigation) + navigation_layout.setContentsMargins(12, 6, 12, 6) + navigation_layout.setSpacing(8) + for name, action in (('task_center_navigation', self.task_center_action), ('dsh_navigation', self.dsh_action)): + action.setCheckable(True) + self._navigation_actions.addAction(action) + self.addAction(action) + button = QToolButton(navigation) + button.setObjectName(name) + button.setDefaultAction(action) + button.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed) + navigation_layout.addWidget(button, 1) + setattr(self, name, button) + self.task_center_action.setChecked(True) + self.setMenuWidget(navigation) self._close_plan_confirmer = close_plan_confirmer or self._confirm_close_plans self._close_pending = False self._close_saving = False @@ -186,6 +201,8 @@ class TrialTaskCenterWindow(QMainWindow): layout.addWidget(self.workspace_splitter) self.content_stack = QStackedWidget() self.content_stack.addWidget(container) + self.content_stack.currentChanged.connect(lambda index: ( + self.task_center_action if index == 0 else self.dsh_action).setChecked(True)) self.setCentralWidget(self.content_stack) self._reset_layout() diff --git a/src/dx_productivity/trial_task_center/ui/styles.py b/src/dx_productivity/trial_task_center/ui/styles.py index 7a406ee..13deaa4 100644 --- a/src/dx_productivity/trial_task_center/ui/styles.py +++ b/src/dx_productivity/trial_task_center/ui/styles.py @@ -35,6 +35,10 @@ QSplitter::handle { background: #bccbd8; border: 1px solid #e7edf2; } QSplitter::handle:hover { background: #83abc9; } QToolButton { background: #ffffff; border: 1px solid #aebdca; border-radius: 4px; padding: 4px 7px; } QToolButton:hover { background: #edf4fa; } +QWidget#toolNavigation { background: #ffffff; border-bottom: 1px solid #e1e5ea; } +QWidget#toolNavigation QToolButton { min-height: 32px; border: 0; border-radius: 7px; padding: 2px 18px; color: #637083; } +QWidget#toolNavigation QToolButton:checked { background: #edf3ff; color: #2864d7; font-weight: 600; } +QWidget#toolNavigation QToolButton:hover { background: #f0f4fa; } QLabel#statusLabel { color: #49616f; } QTextEdit { padding: 5px; font-family: Consolas, "Courier New", monospace; } """ diff --git a/tests/ui/test_dsh_native_menu.py b/tests/ui/test_dsh_native_menu.py index 5939b50..14b3b65 100644 --- a/tests/ui/test_dsh_native_menu.py +++ b/tests/ui/test_dsh_native_menu.py @@ -1,4 +1,4 @@ -from PySide6.QtCore import Signal +from PySide6.QtCore import Signal, Qt from PySide6.QtWidgets import QWidget @@ -21,18 +21,21 @@ class HarnessView(QWidget): pass -def test_menu_opens_embedded_harness_and_returns_without_losing_task(ui, monkeypatch): +def test_direct_navigation_opens_harness_and_returns_without_losing_task(ui, monkeypatch, qtbot): window = ui.window monkeypatch.setattr(type(window), '_create_dsh_view', lambda self: HarnessView(self), raising=False) task_id = window._task_id - window.dsh_action.trigger() + qtbot.mouseClick(window.dsh_navigation, Qt.MouseButton.LeftButton) assert window.content_stack.currentWidget() is window._dsh_view assert window._dsh_view.binds[-1].task_id == task_id assert window._dsh_view.starts == 1 - window.task_center_action.trigger() + assert window.dsh_navigation.isChecked() + assert window.task_center_navigation.geometry().right() < window.dsh_navigation.geometry().left() + qtbot.mouseClick(window.task_center_navigation, Qt.MouseButton.LeftButton) assert window.content_stack.currentIndex() == 0 assert window._task_id == task_id - window.dsh_action.trigger() + assert window.task_center_navigation.isChecked() + qtbot.mouseClick(window.dsh_navigation, Qt.MouseButton.LeftButton) assert window._dsh_view.starts == 1 diff --git a/tools/accept_dsh_desktop.py b/tools/accept_dsh_desktop.py index c093b69..4f24aab 100644 --- a/tools/accept_dsh_desktop.py +++ b/tools/accept_dsh_desktop.py @@ -1,4 +1,4 @@ -"""Click the real task-center menus, then test its embedded official page.""" +"""Click the real task-center navigation, then test its embedded official page.""" from __future__ import annotations import argparse @@ -44,17 +44,14 @@ def main(): window = TrialTaskCenterWindow(service) window.resize(1380, 860) - def click_menu(action): + def click_navigation(action): window.activateWindow() - bar = window.menuBar() - top = bar.actions()[0] - menu = top.menu() - QTest.mouseClick(bar, Qt.MouseButton.LeftButton, pos=bar.actionGeometry(top).center()) - QApplication.processEvents() - if not menu.isVisible(): - raise AssertionError('The tool menu did not open after mouse click') - QTest.mouseClick(menu, Qt.MouseButton.LeftButton, pos=menu.actionGeometry(action).center()) + button = window.dsh_navigation if action is window.dsh_action else window.task_center_navigation + assert button.isVisible() and button.defaultAction() is action + assert window.task_center_navigation.geometry().right() < window.dsh_navigation.geometry().left() + QTest.mouseClick(button, Qt.MouseButton.LeftButton) QApplication.processEvents() + assert button.isChecked() def failed(error): report.update(status='failed', error=type(error).__name__ + ': ' + str(error)) @@ -80,9 +77,10 @@ def main(): pos=window.task_list.list.visualItemRect(item).center()) state['phase'] = 'menu' elif state['phase'] == 'menu' and window._context is not None and not window._loading: - click_menu(window.dsh_action) + window.grab().save(str(output / 'task-center.png')) + click_navigation(window.dsh_action) assert window.content_stack.currentWidget() is window._dsh_view - report['checks'].append('clicked task row and Tools > DSH assistant in the real main window') + report['checks'].append('clicked task row and opened DSH with one click on the right navigation item') state['phase'] = 'ready' elif state['phase'] == 'ready' and window._dsh_view._started: command = ['node', str(REPO / 'tools/verify_dsh_native_ui.mjs'), str(output), str(args.port), '--confirm-cancel'] @@ -96,17 +94,17 @@ def main(): if state['child'].returncode: raise RuntimeError(stderr.decode('utf8', 'replace')) report['web'] = json.loads((output / 'report.json').read_text(encoding='utf8')) - click_menu(window.task_center_action) + click_navigation(window.task_center_action) assert window.content_stack.currentIndex() == 0 - click_menu(window.dsh_action) + click_navigation(window.dsh_action) assert window.content_stack.currentWidget() is window._dsh_view - report['checks'].append('clicked back to task center and returned to the same native page') + report['checks'].append('clicked left navigation for task center and right navigation for the same native page') state['phase'] = 'check-preserved' def preserved(text): if '请分析当前任务' not in (text or ''): - failed(AssertionError('Composer draft was lost when switching tool menus')) + failed(AssertionError('Composer draft was lost when switching navigation items')) return - report['checks'].append('native composer draft survived tool-menu navigation') + report['checks'].append('native composer draft survived direct navigation') window.grab().save(str(output / 'dsh-in-tool.png')) report['status'] = 'passed' (output / 'desktop-report.json').write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding='utf8') diff --git a/tools/verify_dsh_native_ui.mjs b/tools/verify_dsh_native_ui.mjs index 148322b..530ebe5 100644 --- a/tools/verify_dsh_native_ui.mjs +++ b/tools/verify_dsh_native_ui.mjs @@ -14,25 +14,8 @@ async function wait(expression,timeout=15000) { while(Date.now()setTimeout(r,100));} throw Error('UI condition timed out: '+expression); } -async function dismissOnboarding() { - const end=Date.now()+12000; - let quiet=Date.now(); - while(Date.now()e.textContent.trim()==='继续'),start:document.body.innerText.includes('开始使用')})`); - if(modal.preview) { - await c.click(`[...document.querySelectorAll('button')].find(e=>e.textContent.trim()==='继续')`); - quiet=Date.now(); - }else if(modal.start) { - await c.click(`[...document.querySelectorAll('button[aria-label="关闭"]')].at(-1)`); - quiet=Date.now(); - }else if(Date.now()-quiet>1000) return; - await new Promise(resolve=>setTimeout(resolve,150)); - } - throw Error('The native onboarding dialog could not be dismissed'); -} try { await wait(`!!document.querySelector('svg[class*="fish"]')`,45000); - await dismissOnboarding(); for(let attempt=0;attempt<10 && !await c.evaluate(`document.body.innerText.includes('DSH助手')`);attempt++) { if(await c.evaluate(`!!document.querySelector('button[aria-label="打开侧边栏"]')`)) await c.click(`document.querySelector('button[aria-label="打开侧边栏"]')`); @@ -41,6 +24,19 @@ try { await wait(`document.body.innerText.includes('DSH助手')`); await wait(`!!document.querySelector('[data-testid="dx-task-panel"]')`); report.checks.push('official frontend and native right dock loaded'); + assert.equal(await c.evaluate(`!!document.querySelector('[role="dialog"],[data-desktop-onboarding]')`),false,'Fresh launch must not show account or product onboarding'); + const accountEntries=`[...document.querySelectorAll('button,a')].filter(e=>/^(登录|登入|注册|账户|账号|充值|开始使用|Sign in|Log in|Account)$/.test(e.textContent.trim()))`; + assert.equal(await c.evaluate(`${accountEntries}.length`),0); + report.checks.push('fresh profile opens without login, account or product onboarding'); + await c.click(`document.querySelector('[data-testid="dx-tool-settings"]')`); + await wait(`!!document.querySelector('[data-testid="dx-tool-settings-panel"]')`); + assert.equal(await c.evaluate(`${accountEntries}.length`),0); + report.checks.push('one click opens native tool settings with DSH capabilities and no account entry'); + await c.screenshot(path.join(output,'dsh-tool-settings.png')); + await c.call('Input.dispatchKeyEvent',{type:'keyDown',key:'Escape',code:'Escape'}); + await c.call('Input.dispatchKeyEvent',{type:'keyUp',key:'Escape',code:'Escape'}); + await wait(`!document.querySelector('[data-testid="dx-tool-settings-panel"]')`); + await c.screenshot(path.join(output,'dsh-tool-home.png')); const context=await c.evaluate(`fetch('/dx/context').then(r=>r.json())`); assert.ok(context.task_id,'Select a task in the task center before running this test.'); report.checks.push('current task received from task center');