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
+3 -1
View File
@@ -33,7 +33,9 @@ describe('ApiTokenStore', () => {
const first = firstStore.revealToken().token
expect(first).toMatch(/^[A-Za-z0-9_-]{43}$/)
expect(fs.readFileSync(filePath, 'utf8')).not.toContain(String(first))
expect(fs.statSync(filePath).mode & 0o777).toBe(0o600)
if (process.platform !== 'win32') {
expect(fs.statSync(filePath).mode & 0o777).toBe(0o600)
}
const secondStore = new ApiTokenStore(filePath)
expect(secondStore.ensureToken()).toMatchObject({ success: true, hasToken: true })
+2 -2
View File
@@ -224,7 +224,7 @@ describe('TraceMemo app data migration', () => {
const current = new SqliteTranscriptRepository(currentPath)
expect(current.findLatest('account-a', 'message-a')?.transcript).toBe('已经转写过的文字')
current.close()
})
}, 15_000)
it('backfills voice transcripts after the original migration was already completed', async () => {
const fixture = roots()
@@ -264,7 +264,7 @@ describe('TraceMemo app data migration', () => {
)
expect(current.findLatest('account-a', 'message-a')?.transcript).toBe('补迁文字')
current.close()
})
}, 15_000)
it('does not retry a voice transcript backfill after it was marked failed', async () => {
const fixture = roots()
+7 -2
View File
@@ -99,8 +99,13 @@ describe('scheduled report scheduling', () => {
expect(validateScheduleTime('09:05')).toBe(true)
expect(validateScheduleTime('24:00')).toBe(false)
const from = new Date('2026-08-27T10:00:00+08:00')
expect(calculateNextRunAt('09:05', from)).toBe('2026-08-28T01:05:00.000Z')
expect(calculateNextRunAt('11:05', from)).toBe('2026-08-27T03:05:00.000Z')
const expectedNext = new Date(from)
expectedNext.setHours(9, 5, 0, 0)
if (expectedNext.getTime() <= from.getTime()) expectedNext.setDate(expectedNext.getDate() + 1)
expect(calculateNextRunAt('09:05', from)).toBe(expectedNext.toISOString())
const expectedSameDay = new Date(from)
expectedSameDay.setHours(11, 5, 0, 0)
expect(calculateNextRunAt('11:05', from)).toBe(expectedSameDay.toISOString())
})
it('defaults notification settings to off and persists a successful enablement', async () => {
+1
View File
@@ -19,6 +19,7 @@ describe('StickerService', () => {
beforeEach(() => {
homeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sticker-service-'))
vi.stubEnv('HOME', homeDir)
vi.stubEnv('USERPROFILE', homeDir)
})
afterEach(async () => {