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
web: fix backup tests
Abdullah Atta5a540362c025
diff --git a/apps/web/__e2e__/backups.test.ts b/apps/web/__e2e__/backups.test.tsindex 7bb5c2259..b5de80d6b 100644--- a/apps/web/__e2e__/backups.test.ts+++ b/apps/web/__e2e__/backups.test.ts@@ -16,7 +16,7 @@ GNU General Public License for more details.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, Browser, expect } from "@playwright/test";+import { test, expect } from "@playwright/test";import { AppModel } from "./models/app.model";import { NOTE, USER } from "./utils";@@ -26,25 +26,25 @@ test("create a backup", async ({ page }) => {const notes = await app.goToNotes();await notes.createNote(NOTE);const settings = await app.goToSettings();+const backup = await settings.createBackup();+expect(backup.length > 0).toBeTruthy();});-test.setTimeout(45 * 1000);test("restore a backup", async ({ page }) => {const app = new AppModel(page);await app.goto();-const settings = await app.goToSettings();- await settings.restoreData("backup.nnbackup", USER.CURRENT.password);++ await settings.restoreData("backup.nnbackup");+const notes = await app.goToNotes();- expect(await notes.isEmpty()).toBeTruthy();+ expect(await notes.isEmpty()).toBeFalsy();const notebooks = await app.goToNotebooks();- expect(await notebooks.isEmpty()).toBeTruthy();- const favotites = await app.goToFavorites();- expect(await favotites.isEmpty()).toBeTruthy();+ expect(await notebooks.isEmpty()).toBeFalsy();const tags = await app.goToTags();- expect(await tags.isEmpty()).toBeTruthy();+ expect(await tags.isEmpty()).toBeFalsy();});test("create an encrypted backup", async ({ page }) => {@@ -52,6 +52,7 @@ test("create an encrypted backup", async ({ page }) => {await app.auth.goto();await app.auth.login(USER.CURRENT);const settings = await app.goToSettings();+const backup = await settings.createBackup(USER.CURRENT.password);expect(backup.length > 0).toBeTruthy();@@ -60,15 +61,12 @@ test("create an encrypted backup", async ({ page }) => {test("restore an encrypted backup", async ({ page }) => {const app = new AppModel(page);await app.goto();-const settings = await app.goToSettings();+await settings.restoreData("encrypted.nnbackup", USER.CURRENT.password);+const notes = await app.goToNotes();- expect(await notes.isEmpty()).toBeTruthy();+ expect(await notes.isEmpty()).toBeFalsy();const notebooks = await app.goToNotebooks();- expect(await notebooks.isEmpty()).toBeTruthy();- const favotites = await app.goToFavorites();- expect(await favotites.isEmpty()).toBeTruthy();- const tags = await app.goToTags();- expect(await tags.isEmpty()).toBeTruthy();+ expect(await notebooks.isEmpty()).toBeFalsy();});diff --git a/apps/web/__e2e__/models/settings-view.model.ts b/apps/web/__e2e__/models/settings-view.model.tsindex a79d416e6..b457245f8 100644--- a/apps/web/__e2e__/models/settings-view.model.ts+++ b/apps/web/__e2e__/models/settings-view.model.ts@@ -76,7 +76,7 @@ export class SettingsViewModel {return await downloadAndReadFile(this.page, this.backupData, "utf-8");}- async restoreData(filename: string, password: string | undefined) {+ async restoreData(filename: string, password?: string) {await this.backupRestoreContainer.click();await this.restoreBackup.click();await uploadFile(this.page, this.restoreBackup, filename);