Files
inkreach-agent/apps/desktop/scripts/debug-collapse.cjs
T
Rick Ye a5951849c8 v0.6.0: beautifului 整合 + 会话/工作区/队列/权限/命令/附件全链路
- beautifului.dev 组件直连:Sidebar Nav、Tool Chips、Approval Card(抽屉化)、Streaming/Thinking、Code Block、Selection Actions、Prompt Bar、Search
2026-09-06 09:57:14 +08:00

22 lines
1.0 KiB
JavaScript

// 验证侧栏折叠交互
const { app, BrowserWindow } = require('electron')
app.commandLine.appendSwitch('disable-gpu')
app.commandLine.appendSwitch('disable-software-rasterizer')
app.whenReady().then(async () => {
const win = new BrowserWindow({ width: 1280, height: 900, show: false, webPreferences: { offscreen: true } })
await win.loadURL('http://127.0.0.1:4173/')
await new Promise((r) => setTimeout(r, 1200))
const found = await win.webContents.executeJavaScript(`document.querySelector('[aria-label="折叠侧栏"]') ? 'found' : 'NOT-FOUND'`)
console.log('collapse btn:', found)
await win.webContents.executeJavaScript(`document.querySelector('[aria-label="折叠侧栏"]').click()`)
await new Promise((r) => setTimeout(r, 600))
console.log(
'after click: collapsed=',
await win.webContents.executeJavaScript(`document.querySelector('aside')?.getAttribute('data-sidebar-collapsed')`),
'width=',
await win.webContents.executeJavaScript(`document.querySelector('aside')?.style.width`)
)
app.exit(0)
})