- beautifului.dev 组件直连:Sidebar Nav、Tool Chips、Approval Card(抽屉化)、Streaming/Thinking、Code Block、Selection Actions、Prompt Bar、Search
22 lines
1.0 KiB
JavaScript
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)
|
|
})
|