A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
desktop: launch app with `--hidden` flag for tests
Abdullah Atta2288b946ad75
diff --git a/apps/desktop/__tests__/electron-test/utils.ts b/apps/desktop/__tests__/electron-test/utils.tsindex 6c6114259..a73c5ad4e 100644--- a/apps/desktop/__tests__/electron-test/utils.ts+++ b/apps/desktop/__tests__/electron-test/utils.ts@@ -42,6 +42,7 @@ export interface AppContext {export interface TestOptions {version: string;+ args?: string[];config?: Record<string, unknown>;}@@ -72,7 +73,8 @@ export async function buildAndLaunchApp(const { app } = await launchApp(executablePath,userDataDir,- options?.version+ options?.version,+ options?.args);const ctx: AppContext = {app,@@ -82,7 +84,8 @@ export async function buildAndLaunchApp(const { app } = await launchApp(executablePath,userDataDir,- options?.version+ options?.version,+ options?.args);ctx.app = app;ctx.userDataDir = userDataDir;@@ -94,11 +97,12 @@ export async function buildAndLaunchApp(async function launchApp(executablePath: string,userDataDir: string,- version?: string+ version?: string,+ args: string[] = []) {const app = await electron.launch({executablePath,- args: IS_DEBUG ? [] : ["--hidden"],+ args: IS_DEBUG ? [...args] : ["--hidden", ...args],baseURL: "https://app.notesnook.com",acceptDownloads: true,env: {diff --git a/apps/desktop/__tests__/launch.test.ts b/apps/desktop/__tests__/launch.test.tsindex 5abcb14f4..f58152434 100644--- a/apps/desktop/__tests__/launch.test.ts+++ b/apps/desktop/__tests__/launch.test.ts@@ -24,10 +24,10 @@ async function getMainWindowState(app: ElectronApplication) {return await app.evaluate((window) => {const { BrowserWindow } = window;const mainWindow = BrowserWindow.getAllWindows()[0];-+ if (!mainWindow) throw new Error("Main window not found");return {- isMinimized: mainWindow?.isMinimized() ?? false,- isVisible: mainWindow?.isVisible() ?? false+ isMinimized: mainWindow.isMinimized(),+ isVisible: mainWindow.isVisible()};});}@@ -42,6 +42,7 @@ test("hidden launch minimizes when tray is disabled", async ({}) => {const app = await launchElectronApp({version: options.version,+ args: ["--hidden"],config: {desktopSettings: {minimizeToSystemTray: false,@@ -63,6 +64,7 @@ test("hidden launch does not minimize when close-to-tray is enabled", async ({}) => {const app = await launchElectronApp({version: options.version,+ args: ["--hidden"],config: {desktopSettings: {minimizeToSystemTray: false,