test: 完善 2.3.0 跨平台测试与 CI 稳定性

- 修复 Windows 与 macOS 单元测试环境差异\n- 完善组件、集成与 Electron E2E 测试\n- 修复异步等待、平台路径和环境依赖问题\n- 统一 E2E 窗口尺寸与 Visual 测试策略\n- 提升 GitHub Actions 跨平台 CI 稳定性
This commit is contained in:
Wxw-Gu
2026-09-05 10:38:41 +08:00
parent 60528ffe53
commit 1156362c3c
23 changed files with 123 additions and 119 deletions
+20 -1
View File
@@ -44,6 +44,25 @@ const zipDirectory = async (
})
}
const extractZip = (zipPath: string, extractedDir: string): void => {
if (process.platform === 'win32') {
const escapePowerShellLiteral = (value: string): string => value.replace(/'/g, "''")
execFileSync(
'powershell.exe',
[
'-NoProfile',
'-NonInteractive',
'-Command',
`Expand-Archive -LiteralPath '${escapePowerShellLiteral(zipPath)}' -DestinationPath '${escapePowerShellLiteral(extractedDir)}'`
],
{ windowsHide: true }
)
return
}
execFileSync('unzip', ['-q', zipPath, '-d', extractedDir])
}
test('EXPORT-ARCHIVE-00 shows a loading state while archive data is still loading', async ({
page
}, testInfo) => {
@@ -149,7 +168,7 @@ test('EXPORT-ARCHIVE-01 merged v2 archive is usable offline on desktop and mobil
const extractedDir = join(fixtureRoot, 'extracted')
await zipDirectory(outputDir, zipPath, '合并聊天档案')
mkdirSync(extractedDir, { recursive: true })
execFileSync('unzip', ['-q', zipPath, '-d', extractedDir])
extractZip(zipPath, extractedDir)
const offlineIndex = join(extractedDir, '合并聊天档案', 'index.html')
await page.setViewportSize({ width: 1440, height: 900 })