Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

feat(desktop): 配置对话框补 data-testid 与导航项 aria-current 选中态

hairyf2ec17bbc4a09
diff --git a/src/components/panel.tsx b/src/components/panel.tsx
index b45b1267..5322e88c 100644
--- a/src/components/panel.tsx
+++ b/src/components/panel.tsx
@@ -21,20 +21,24 @@ const LOG_LIMIT = 5
*/
export interface PanelHeaderProps {
title: string | ReactNode
- description: string
+ description?: string
className?: string
action?: ReactNode
+ /** 标题元素的 `data-testid`(E2E 定位用;`title` 为节点时忽略) */
+ testId?: string
}
/** 配置面板头部:标题 + 说明;className 用于叠加 sticky / 背景等定位类。 */
-function Header({ title, description, className, action }: PanelHeaderProps) {
+function Header({ title, description, className, action, testId }: PanelHeaderProps) {
return (
<div className={cn('space-y-2', className)}>
<div className="flex items-center justify-between gap-3">
- {typeof title === 'string' ? <Typography type="h4">{title}</Typography> : title}
+ {typeof title === 'string' ? <Typography type="h4" data-testid={testId}>{title}</Typography> : title}
{action}
</div>
- <Typography color="muted" type="body-sm">{description}</Typography>
+ <If cond={Boolean(description)}>
+ <Typography color="muted" type="body-sm">{description}</Typography>
+ </If>
</div>
)
}
diff --git a/src/ui/config/core.tsx b/src/ui/config/core.tsx
index 206cd866..a8c41bbd 100644
--- a/src/ui/config/core.tsx
+++ b/src/ui/config/core.tsx
@@ -297,6 +297,7 @@ export function ConfigCore() {
<Panel.Header
title={t('core.title')}
description={t('core.tooltip')}
+ testId="dsh-config-panel-title"
action={(
<Button
size="sm"
diff --git a/src/ui/config/debug.tsx b/src/ui/config/debug.tsx
index e52c140a..c3344f7a 100644
--- a/src/ui/config/debug.tsx
+++ b/src/ui/config/debug.tsx
@@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next'
import { If } from 'react-if-lite'
import { useStore } from 'valtio-define'
import { Info } from '@/components/info'
+import { Panel } from '@/components/panel'
import { queryKeys } from '@/config/query-keys'
import { useListen } from '@/hooks/use-listen'
import { store } from '@/store'
@@ -180,6 +181,7 @@ export function ConfigDebug() {
return (
<div className="space-y-3">
+ <Panel.Header title={t('config.application')} testId="dsh-config-panel-title" />
{coreBreakingHolder}
<div className="space-y-1.5">
<div className="flex items-center justify-between">
diff --git a/src/ui/config/plugin.tsx b/src/ui/config/plugin.tsx
index f2f23980..07e882d0 100644
--- a/src/ui/config/plugin.tsx
+++ b/src/ui/config/plugin.tsx
@@ -396,6 +396,7 @@ export function ConfigPlugin() {
<Panel.Header
className="sticky top-0 bg-canvas z-10 pb-3"
title={t('plugins.title')}
+ testId="dsh-config-panel-title"
action={(
<Tooltip delay={0}>
<Button
diff --git a/src/ui/config/profile.tsx b/src/ui/config/profile.tsx
index 31839af3..e685115d 100644
--- a/src/ui/config/profile.tsx
+++ b/src/ui/config/profile.tsx
@@ -246,7 +246,7 @@ export function ConfigProfile() {
return (
<div className="space-y-3">
- <Panel.Header title={t('profiles.title')} description={t('profiles.tooltip')} />
+ <Panel.Header title={t('profiles.title')} description={t('profiles.tooltip')} testId="dsh-config-panel-title" />
{/* 加载 / 失败 / 列表 */}
<Panel.Loadable loading={loading} error={error}>
diff --git a/src/ui/dialog/config.tsx b/src/ui/dialog/config.tsx
index e157e546..cca0e401 100644
--- a/src/ui/dialog/config.tsx
+++ b/src/ui/dialog/config.tsx
@@ -51,8 +51,8 @@ export function ConfigDialog(props: ConfigDialogProps) {
<Modal isOpen={disclosure.visible} onOpenChange={disclosure.cancel}>
<Modal.Backdrop>
<Modal.Container size="lg">
- <Modal.Dialog className="w-[800px] max-w-[calc(100vw-48px)] h-[min(720px,calc(100vh-96px))] pr-2.5">
- <Modal.CloseTrigger />
+ <Modal.Dialog data-testid="dsh-config-dialog" className="w-[800px] max-w-[calc(100vw-48px)] h-[min(720px,calc(100vh-96px))] pr-2.5">
+ <Modal.CloseTrigger data-testid="dsh-config-dialog-close" />
<Modal.Header className="mb-3">
<Modal.Heading>
{t('app.config')}
@@ -66,6 +66,8 @@ export function ConfigDialog(props: ConfigDialogProps) {
return (
<button
key={item.value}
+ data-testid={`dsh-config-nav-${item.value}`}
+ aria-current={isActive ? 'true' : undefined}
onClick={() => setActiveTab(item.value)}
className={cn(
'text-foreground h-[40px] rounded-md flex items-center gap-2 py-[9px] px-[16px] hover:bg-background-secondary cursor-pointer',
@@ -75,7 +77,7 @@ export function ConfigDialog(props: ConfigDialogProps) {
<item.icon className="w-5 h-5 mr-2" />
<span>{item.label}</span>
<If cond={item.value === 'plugins' && abnormalCount > 0}>
- <span className="ml-auto flex size-5 items-center justify-center rounded-full bg-danger text-[10px] font-semibold leading-none text-white">
+ <span data-testid="dsh-config-nav-plugins-badge" className="ml-auto flex size-5 items-center justify-center rounded-full bg-danger text-[10px] font-semibold leading-none text-white">
{abnormalCount}
</span>
</If>
@@ -84,7 +86,7 @@ export function ConfigDialog(props: ConfigDialogProps) {
})}
</nav>
</aside>
- <div className="flex flex-col flex-1 overflow-auto min-h-0 pr-2.5">
+ <div data-testid="dsh-config-panel-body" className="flex flex-col flex-1 overflow-auto min-h-0 pr-2.5">
<Switch value={activeTab} as="div">
<Case cond="application">
<ConfigDebug />