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: add tests for #9942
Abdullah Attabb30336f5caf
diff --git a/apps/desktop/__tests__/electron-test/utils.ts b/apps/desktop/__tests__/electron-test/utils.tsindex e4d3544e0..6c6114259 100644--- a/apps/desktop/__tests__/electron-test/utils.ts+++ b/apps/desktop/__tests__/electron-test/utils.ts@@ -154,6 +154,7 @@ export async function buildApp(version?: string) {stdio: IS_DEBUG ? "inherit" : "ignore",env: {...process.env,+ CSC_IDENTITY_AUTO_DISCOVERY: "false",NOTESNOOK_STAGING: "true",NN_PRODUCT_NAME: productName,NN_APP_ID: `com.notesnook.test.${productName}`,diff --git a/apps/desktop/__tests__/launch.test.ts b/apps/desktop/__tests__/launch.test.tsindex 266f54fdf..5abcb14f4 100644--- a/apps/desktop/__tests__/launch.test.ts+++ b/apps/desktop/__tests__/launch.test.ts@@ -17,7 +17,63 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { test } from "@nn/test";+import { test, expect } from "@nn/test";+import type { ElectronApplication } from "@playwright/test";++async function getMainWindowState(app: ElectronApplication) {+ return await app.evaluate((window) => {+ const { BrowserWindow } = window;+ const mainWindow = BrowserWindow.getAllWindows()[0];++ return {+ isMinimized: mainWindow?.isMinimized() ?? false,+ isVisible: mainWindow?.isVisible() ?? false+ };+ });+}+test("make sure app loads", async ({ page }) => {await page.waitForSelector(".ProseMirror");});++test("hidden launch minimizes when tray is disabled", async ({+ launchElectronApp,+ options+}) => {+ const app = await launchElectronApp({+ version: options.version,+ config: {+ desktopSettings: {+ minimizeToSystemTray: false,+ closeToSystemTray: false+ }+ }+ });++ const page = await app.firstWindow();+ await page.waitForSelector(".ProseMirror");++ const state = await getMainWindowState(app);+ expect(state.isMinimized).toBe(true);+});++test("hidden launch does not minimize when close-to-tray is enabled", async ({+ launchElectronApp,+ options+}) => {+ const app = await launchElectronApp({+ version: options.version,+ config: {+ desktopSettings: {+ minimizeToSystemTray: false,+ closeToSystemTray: true+ }+ }+ });++ const page = await app.firstWindow();+ await page.waitForSelector(".ProseMirror");++ const state = await getMainWindowState(app);+ expect(state.isMinimized).toBe(false);+});