Skip to content

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

fix(e2e): 车道就绪锚点改用核心侧栏并消除 onExit 提升告警

hairyf15f32a2415c8
diff --git a/test/e2e/plugins/dsh-tauri-pet.e2e.ts b/test/e2e/plugins/dsh-tauri-pet.e2e.ts
index 6018db7f..820e59e9 100644
--- a/test/e2e/plugins/dsh-tauri-pet.e2e.ts
+++ b/test/e2e/plugins/dsh-tauri-pet.e2e.ts
@@ -255,7 +255,7 @@ describe('L2 客户端', () => {
})
it('验证 iframe 内桌宠设置分区正常渲染且无崩溃', async () => {
- const app = await newDshPage(browser)
+ const app = await newDshPage(browser, { ready: PET_ICON })
try {
await openSettings(app.page, app.frame, app.syntheticFallbacks)
@@ -302,7 +302,7 @@ describe('L2 客户端', () => {
})
it('验证侧栏桌宠入口按钮被插入到设置触发器右侧且状态可读', async () => {
- const app = await newDshPage(browser)
+ const app = await newDshPage(browser, { ready: PET_ICON })
try {
const icon = app.frame.locator(PET_ICON).first()
await icon.waitFor({ state: 'attached', timeout: 20_000 })
diff --git a/test/e2e/plugins/dsh-tauri-ui.e2e.ts b/test/e2e/plugins/dsh-tauri-ui.e2e.ts
index 72bb3bb4..7c5d2ec9 100644
--- a/test/e2e/plugins/dsh-tauri-ui.e2e.ts
+++ b/test/e2e/plugins/dsh-tauri-ui.e2e.ts
@@ -13,10 +13,12 @@
import type { Browser } from 'playwright'
import { afterAll, beforeAll, describe, expect, inject, it } from 'vitest'
import {
+ COMPOSER_CARD,
expectNoSyntheticFallbacks,
launchDshBrowser,
newDshPage,
openSettings,
+ PET_ICON,
SETTINGS_SIDEBAR,
SETTINGS_TRIGGER,
} from '../support/browser'
@@ -76,7 +78,7 @@ describe('L2 客户端', () => {
})
it('验证设置侧栏与触发器被注入 dsh 界面', async () => {
- const app = await newDshPage(browser)
+ const app = await newDshPage(browser, { ready: PET_ICON })
try {
const triggerHost = await app.frame.evaluate(() => {
const trigger = document.querySelector('.dshp-settings-trigger')
@@ -119,7 +121,7 @@ describe('L2 客户端', () => {
})
it('验证触发器 aria-expanded 随设置侧栏开合变化', async () => {
- const app = await newDshPage(browser)
+ const app = await newDshPage(browser, { ready: SETTINGS_TRIGGER })
try {
const trigger = app.frame.locator(SETTINGS_TRIGGER).first()
expect(await trigger.getAttribute('aria-expanded'), '初始必须为 false').toBe('false')
@@ -149,7 +151,7 @@ describe('L2 客户端', () => {
})
it('[反向] 验证无可续跑轮次时主按钮不被改写为「继续任务」', async () => {
- const app = await newDshPage(browser)
+ const app = await newDshPage(browser, { ready: COMPOSER_CARD })
try {
const state = await app.frame.evaluate(() => {
const card = document.querySelector('[data-composer-card]')
@@ -175,7 +177,7 @@ describe('L2 客户端', () => {
})
it('验证空草稿下并发保护不启用发送按钮', async () => {
- const app = await newDshPage(browser)
+ const app = await newDshPage(browser, { ready: COMPOSER_CARD })
try {
const state = await app.frame.evaluate(() => {
const card = document.querySelector('[data-composer-card]')
diff --git a/test/e2e/support/browser.ts b/test/e2e/support/browser.ts
index baeef704..57009573 100644
--- a/test/e2e/support/browser.ts
+++ b/test/e2e/support/browser.ts
@@ -147,6 +147,12 @@ export function collectAppErrors(page: Page): string[] {
/**
* 在当前 browser 上新建一个内嵌 dsh 页面并等待界面可用。
+ *
+ * 默认就绪锚点取核心 dsh 的结构性槽位 `SIDEBAR`(`[data-slot="sidebar"]`),不取任何插件
+ * 注入的元素:`SETTINGS_TRIGGER` 由 `dsh-tauri-ui` 渲染、`PET_ICON` 由 `dsh-tauri-pet`
+ * 插入,在 Ubuntu CI 上都可能迟迟不出现,而它们缺席并不表示 dsh 未就绪——`SIDEBAR` 是
+ * 上游产物,也是各插件自己判定「侧栏就绪」时读取的同一个锚点。需要断言插件产物的用例
+ * 必须显式传 `{ ready: PET_ICON }` / `{ ready: SETTINGS_TRIGGER }` 等,不依赖默认值。
*/
export async function newDshPage(
browser: Browser,
@@ -174,7 +180,7 @@ export async function newDshPage(
}
await frame.waitForLoadState('domcontentloaded')
- await frame.locator(options.ready ?? PET_ICON).first().waitFor({ state: 'attached', timeout: 30_000 })
+ await frame.locator(options.ready ?? SIDEBAR).first().waitFor({ state: 'attached', timeout: 30_000 })
if (options.dismissModals ?? true) {
await dismissAppModals(page, frame, syntheticFallbacks)
diff --git a/test/e2e/support/dsh.ts b/test/e2e/support/dsh.ts
index 396013b0..cb5beadd 100644
--- a/test/e2e/support/dsh.ts
+++ b/test/e2e/support/dsh.ts
@@ -350,7 +350,7 @@ async function waitForReadyStream(child: ChildProcess, logPath: string): Promise
child.off('exit', onExit)
}
- const onExit = (code: number | null) => {
+ function onExit(code: number | null): void {
cleanup()
reject(new Error(`dsh web 提前退出(code ${code});日志:${logPath}\n${tailOf(logPath)}`))
}