23 lines
1.1 KiB
TypeScript
23 lines
1.1 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { _electron as electron } from 'playwright';
|
|
import { promises as fs } from 'node:fs';
|
|
import nodePath from 'node:path';
|
|
import os from 'node:os';
|
|
|
|
// 打包产物冒烟:启动 electron-builder 产出的 win-unpacked 可执行文件(FR-A0 可安装/可运行基线)
|
|
const EXE = nodePath.join(process.cwd(), 'release/win-unpacked/HunterNotes.exe');
|
|
|
|
test('packaged app launches and renders title bar', async () => {
|
|
const exists = await fs.stat(EXE).then(() => true).catch(() => false);
|
|
if (!exists) test.skip(true, 'HunterNotes.exe 未构建:先跑 pnpm --filter @hunter/desktop dist');
|
|
const tmp = await fs.mkdtemp(nodePath.join(os.tmpdir(), 'hn-pkg-'));
|
|
const app = await electron.launch({ executablePath: EXE, args: ['--user-data-dir=' + nodePath.join(tmp, 'userdata')] });
|
|
try {
|
|
const page = await app.firstWindow();
|
|
await page.waitForLoadState('domcontentloaded');
|
|
await expect(page.getByText('狩夜人笔记').first()).toBeVisible({ timeout: 15000 });
|
|
} finally {
|
|
await app.close();
|
|
}
|
|
});
|