From 15582f010c5b64e06758b69ebbfb32f93ffc3f65 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Mon, 6 Oct 2025 14:50:47 +0500 Subject: [PATCH 01/56] mobile: add note tests --- apps/mobile/e2e/tests/note.e2e.ts | 43 +++++++++++++++++++ apps/mobile/e2e/tests/utils.ts | 9 ++-- .../editor-mobile/src/components/title.tsx | 1 + 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/apps/mobile/e2e/tests/note.e2e.ts b/apps/mobile/e2e/tests/note.e2e.ts index 5682b5274..947c1e585 100644 --- a/apps/mobile/e2e/tests/note.e2e.ts +++ b/apps/mobile/e2e/tests/note.e2e.ts @@ -34,6 +34,49 @@ describe("NOTE TESTS", () => { .run(); }); + it("Note history is created", async () => { + await TestBuilder.create() + .prepare() + .createNote("Test note", "This is a test note") + .waitAndTapById(notesnook.listitem.menu) + .wait() + .waitAndTapById("icon-history") + .isNotVisibleByText("No note history available for this device.") + .run(); + }); + + it("Duplicate note", async () => { + await TestBuilder.create() + .prepare() + .createNote("Test note", "This is a test note") + .waitAndTapById(notesnook.listitem.menu) + .wait() + .waitAndTapById("icon-duplicate") + .isVisibleByText("Test note (Copy)") + .run(); + }); + + it("Archive a note", async () => { + await TestBuilder.create() + .prepare() + .createNote("Test note") + .saveResult() + .waitAndTapById(notesnook.listitem.menu) + .wait(500) + .waitAndTapById("icon-archive") + .pressBack() + .navigate("Archive") + .isVisibleByText("Test note") + .waitAndTapById(notesnook.listitem.menu) + .wait(500) + .waitAndTapById("icon-archive") + .pressBack() + .isNotVisibleByText("Test note") + .navigate("Notes") + .isVisibleByText("Test note") + .run(); + }); + it("Notes properties should show", async () => { await TestBuilder.create() .prepare() diff --git a/apps/mobile/e2e/tests/utils.ts b/apps/mobile/e2e/tests/utils.ts index d7c549261..f32ce2a05 100644 --- a/apps/mobile/e2e/tests/utils.ts +++ b/apps/mobile/e2e/tests/utils.ts @@ -91,14 +91,17 @@ const Tests = { await _device.pressBack(); await _device.pressBack(); }, - async createNote(_title?: string, _body?: string) { - let title = _title || "Test note description that "; + async createNote(title?: string, _body?: string) { let body = _body || "Test note description that is very long and should not fit in text."; await Tests.fromId(notesnook.buttons.add).tap(); + if (title) { + await web().element(by.web.id("editor-title")).focus(); + await web().element(by.web.id("editor-title")).typeText(title, false); + } await expect(web().element(by.web.className("ProseMirror"))).toExist(); - // await web().element(by.web.className("ProseMirror")).tap(); + await web().element(by.web.className("ProseMirror")).focus(); await web().element(by.web.className("ProseMirror")).typeText(body, true); await Tests.exitEditor(); await Tests.fromText(body).isVisible(); diff --git a/packages/editor-mobile/src/components/title.tsx b/packages/editor-mobile/src/components/title.tsx index 6dd6675b7..085ad3baf 100644 --- a/packages/editor-mobile/src/components/title.tsx +++ b/packages/editor-mobile/src/components/title.tsx @@ -107,6 +107,7 @@ function Title({