* add user settings * fix user setting * migrate dict settings * migrate hotkeys * fix hotkey setting * update library settings * migrate gpt Engine * use user setting key enum * migrate openai * migrate more settings * migrate whisper config * migrate whisper * refactor * clean up * migrate profile * migrate recorder config * refactor * refactor * fix e2e * add api status * fix e2e * fix app init * fetch apiUrl before fetch user * update stt engine enums * update enums * update enums * refactor login flow * Fix warning * Login from remembered users * fix e2e * refactor * add unauthorized alert * feat: 🎸 dict import update (#1040) * rectified. according to Issues. * issue #1025 * feat: add Vietnamese language to support (#1043) * feat: add vietnamese language to support * fix: update Vietnamese language name to native form --------- Co-authored-by: Ryan <trongdv@coccoc.com> * upgrade deps * update locales --------- Co-authored-by: divisey <18656007202@163.com> Co-authored-by: xiaolai <lixiaolai@gmail.com> Co-authored-by: ryan <69750456+ryangwn@users.noreply.github.com> Co-authored-by: Ryan <trongdv@coccoc.com>
89 lines
2.3 KiB
TypeScript
89 lines
2.3 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import {
|
|
clickMenuItemById,
|
|
findLatestBuild,
|
|
ipcMainCallFirstListener,
|
|
ipcRendererCallFirstListener,
|
|
parseElectronApp,
|
|
ipcMainInvokeHandler,
|
|
ipcRendererInvoke,
|
|
} from "electron-playwright-helpers";
|
|
import { ElectronApplication, Page, _electron as electron } from "playwright";
|
|
import path from "path";
|
|
import fs from "fs-extra";
|
|
|
|
declare global {
|
|
interface Window {
|
|
__ENJOY_APP__: any;
|
|
}
|
|
}
|
|
|
|
let electronApp: ElectronApplication;
|
|
let page: Page;
|
|
const resultDir = path.join(process.cwd(), "test-results");
|
|
|
|
test.beforeAll(async () => {
|
|
// find the latest build in the out directory
|
|
const latestBuild = findLatestBuild();
|
|
console.log(`Latest build: ${latestBuild}`);
|
|
|
|
// parse the directory and find paths and other info
|
|
const appInfo = parseElectronApp(latestBuild);
|
|
// set the CI environment variable to true
|
|
process.env.CI = "e2e";
|
|
|
|
fs.ensureDirSync(resultDir);
|
|
process.env.SETTINGS_PATH = resultDir;
|
|
process.env.LIBRARY_PATH = resultDir;
|
|
|
|
electronApp = await electron.launch({
|
|
args: [appInfo.main],
|
|
executablePath: appInfo.executable,
|
|
});
|
|
console.log("Electron app launched");
|
|
|
|
page = await electronApp.firstWindow();
|
|
const filename = page.url()?.split("/").pop();
|
|
console.info(`Window opened: ${filename}`);
|
|
|
|
// capture errors
|
|
page.on("pageerror", (error) => {
|
|
console.error(error);
|
|
});
|
|
// capture console messages
|
|
page.on("console", (msg) => {
|
|
console.info(msg.text());
|
|
});
|
|
});
|
|
|
|
test.afterAll(async () => {
|
|
await electronApp.close();
|
|
});
|
|
|
|
test("validate whisper command", async () => {
|
|
const res = await page.evaluate(() => {
|
|
return window.__ENJOY_APP__.whisper.check();
|
|
});
|
|
console.info(res.log);
|
|
expect(res.success).toBeTruthy();
|
|
});
|
|
|
|
test("valid ffmpeg command", async () => {
|
|
const res = await page.evaluate(() => {
|
|
return window.__ENJOY_APP__.ffmpeg.check();
|
|
});
|
|
expect(res).toBeTruthy();
|
|
});
|
|
|
|
test("validate echogarden align command", async () => {
|
|
const res = await page.evaluate(() => {
|
|
return window.__ENJOY_APP__.echogarden.check();
|
|
});
|
|
expect(res).toBeTruthy();
|
|
});
|
|
|
|
test("should setup default library path", async () => {
|
|
const settings = fs.readJsonSync(path.join(resultDir, "settings.json"));
|
|
expect(settings.library).not.toBeNull();
|
|
});
|