mobile: add note tests

This commit is contained in:
Ammar Ahmed
2025-10-06 14:50:47 +05:00
parent 110534edec
commit 15582f010c
3 changed files with 50 additions and 3 deletions

View File

@@ -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()

View File

@@ -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();

View File

@@ -107,6 +107,7 @@ function Title({
<textarea
ref={titleRef}
className={styles.titleBar}
id="editor-title"
rows={1}
contentEditable={!readonly}
disabled={readonly}