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 more tests
Abdullah Attac7142e409b85
diff --git a/apps/web/__e2e__/editor.test.ts b/apps/web/__e2e__/editor.test.tsindex b3a34e6ad..8dbf0a946 100644--- a/apps/web/__e2e__/editor.test.ts+++ b/apps/web/__e2e__/editor.test.ts@@ -35,28 +35,6 @@ test("focus mode", async ({ page }) => {).toMatchSnapshot("focus-mode.jpg", { maxDiffPixelRatio: 0.01 });});-test("switch theme in focus mode", async ({ page }) => {- const app = new AppModel(page);- await app.goto();- const notes = await app.goToNotes();- await notes.createNote(NOTE);- await notes.editor.enterFocusMode();-- await notes.editor.enterDarkMode();-- expect(await notes.editor.isDarkMode()).toBeTruthy();- expect(- await page.screenshot({ fullPage: true, quality: 100, type: "jpeg" })- ).toMatchSnapshot("dark-focus-mode.jpg", { maxDiffPixelRatio: 0.01 });-- await notes.editor.exitDarkMode();-- expect(await notes.editor.isDarkMode()).toBeFalsy();- expect(- await page.screenshot({ fullPage: true, quality: 100, type: "jpeg" })- ).toMatchSnapshot("light-focus-mode.jpg", { maxDiffPixelRatio: 0.01 });-});-test("full screen in focus mode", async ({ page }) => {const app = new AppModel(page);await app.goto();diff --git a/apps/web/__e2e__/models/editor.model.ts b/apps/web/__e2e__/models/editor.model.tsindex 22bf5ff6d..776b8e053 100644--- a/apps/web/__e2e__/models/editor.model.ts+++ b/apps/web/__e2e__/models/editor.model.ts@@ -28,8 +28,6 @@ export class EditorModel {private readonly tagInput: Locator;private readonly focusModeButton: Locator;private readonly normalModeButton: Locator;- private readonly darkModeButton: Locator;- private readonly lightModeButton: Locator;private readonly enterFullscreenButton: Locator;private readonly exitFullscreenButton: Locator;private readonly wordCountText: Locator;@@ -41,14 +39,16 @@ export class EditorModel {constructor(page: Page) {this.page = page;- this.title = page.locator(getTestId("editor-title"));- this.content = page.locator(".ProseMirror");- this.tagInput = page.locator(getTestId("editor-tag-input"));- this.tags = page.locator(`${getTestId("tags")} >> ${getTestId("tag")}`);+ this.title = page.locator(".active").locator(getTestId("editor-title"));+ this.content = page.locator(".active").locator(".ProseMirror");+ this.tagInput = page+ .locator(".active")+ .locator(getTestId("editor-tag-input"));+ this.tags = page+ .locator(".active")+ .locator(`${getTestId("tags")} >> ${getTestId("tag")}`);this.focusModeButton = page.locator(getTestId("Focus mode"));this.normalModeButton = page.locator(getTestId("Normal mode"));- this.darkModeButton = page.locator(getTestId("Dark mode"));- this.lightModeButton = page.locator(getTestId("Light mode"));this.enterFullscreenButton = page.locator(getTestId("Enter fullscreen"));this.exitFullscreenButton = page.locator(getTestId("Exit fullscreen"));this.wordCountText = page.locator(getTestId("editor-word-count"));@@ -67,7 +67,7 @@ export class EditorModel {await this.page.waitForFunction(({ expected }) => {const titleInput = document.querySelector(- `[data-test-id="editor-title"]`+ `.active [data-test-id="editor-title"]`) as HTMLInputElement | null;if (titleInput)return expected !== undefined@@ -83,16 +83,20 @@ export class EditorModel {}async waitForUnloading() {- await this.page.waitForURL(/#\/notes\/create\/\d+/gm);- await this.searchButton.waitFor({ state: "hidden" });- await this.page.locator(getTestId("tags")).waitFor({ state: "hidden" });- await this.wordCountText.waitFor({ state: "hidden" });+ await this.page.waitForURL(/#\/notes\/?.+\/create/gm);+ await this.searchButton.isDisabled();+ await this.page+ .locator(".active")+ .locator(getTestId("tags"))+ .waitFor({ state: "hidden" });+ await this.dateEditedText.waitFor({ state: "hidden" });+ await this.wordCountText.waitFor();await this.waitForLoading("", "");}async waitForSaving() {await this.page.waitForURL(/#\/notes\/?.+\/edit/gm);- await this.page.locator(getTestId("tags")).waitFor();+ await this.page.locator(".active").locator(getTestId("tags")).waitFor();await this.searchButton.waitFor();await this.wordCountText.waitFor();}@@ -100,9 +104,8 @@ export class EditorModel {async isUnloaded() {return ((await this.tagInput.isHidden()) &&- (await this.darkModeButton.isHidden()) &&(await this.enterFullscreenButton.isHidden()) &&- (await this.wordCountText.isHidden())+ (await this.dateEditedText.isHidden()));}@@ -211,20 +214,6 @@ export class EditorModel {return await this.normalModeButton.isVisible();}- async enterDarkMode() {- await this.darkModeButton.click();- await this.lightModeButton.waitFor();- }-- async exitDarkMode() {- await this.lightModeButton.click();- await this.darkModeButton.waitFor();- }-- async isDarkMode() {- return await this.lightModeButton.isVisible();- }-async enterFullscreen() {await this.enterFullscreenButton.click();await this.exitFullscreenButton.waitFor();diff --git a/apps/web/__e2e__/models/note-properties.model.ts b/apps/web/__e2e__/models/note-properties.model.tsindex 1b06fc781..b6cf49bc8 100644--- a/apps/web/__e2e__/models/note-properties.model.ts+++ b/apps/web/__e2e__/models/note-properties.model.ts@@ -90,12 +90,12 @@ abstract class BaseProperties {return ((await this.noteLocator.locator(getTestId("locked")).isVisible()) &&(await this.noteLocator.locator(getTestId(`description`)).isHidden()) &&- (await (async () => {- await this.noteLocator.click();- return await this.page- .locator(getTestId("unlock-note-title"))- .isVisible();- })()) &&+ // (await (async () => {+ // await this.noteLocator.click();+ // return await this.page+ // .locator(getTestId("unlock-note-title"))+ // .isVisible();+ // })()) &&(await (async () => {await this.open();const state = await this.lockToggle.isToggled();@@ -247,7 +247,8 @@ export class NoteContextMenuModel extends BaseProperties {if (format === "html") {return content.replace(/(name="created-at" content=")(.+?)"/, '$1xxx"')- .replace(/(name="updated-at" content=")(.+?)"/, '$1xxx"');+ .replace(/(name="updated-at" content=")(.+?)"/, '$1xxx"')+ .replace(/(data-block-id=")(.+?)"/gm, '$1xxx"');}return content;}diff --git a/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-win32.txt b/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-win32.txtindex d89b3634c..443e18487 100644--- a/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-win32.txt+++ b/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-win32.txt@@ -166,6 +166,6 @@</head><body><h1>Test 1</h1>- <p data-spacing="double">This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1</p>+ <p data-block-id="xxx" data-spacing="double">This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1</p></body></html>diff --git a/apps/web/src/dialogs/backup-password-dialog.tsx b/apps/web/src/dialogs/backup-password-dialog.tsxindex 57cdcc963..ac8ec6506 100644--- a/apps/web/src/dialogs/backup-password-dialog.tsx+++ b/apps/web/src/dialogs/backup-password-dialog.tsx@@ -41,6 +41,7 @@ export default function BackupPasswordDialog(props: PromptDialogProps) {return (<DialogisOpen={true}+ testId="password-dialog"title={"Encrypted backup"}description={"Please enter the password to decrypt and restore this backup."@@ -86,7 +87,7 @@ export default function BackupPasswordDialog(props: PromptDialogProps) {<FieldrequiredautoFocus- data-test-id="dialog-key"+ data-test-id="encryption-key"label="Encryption key"type="password"id="key"@@ -96,7 +97,7 @@ export default function BackupPasswordDialog(props: PromptDialogProps) {<FieldrequiredautoFocus- data-test-id="dialog-password"+ data-test-id="password"label="Password"type="password"autoComplete="current-password"