Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: pass tests

Ammar Ahmed4ff051130b5b
diff --git a/apps/mobile/app/components/list-items/headers/section-header.tsx b/apps/mobile/app/components/list-items/headers/section-header.tsx
index b53e8d057..54276249c 100644
--- a/apps/mobile/app/components/list-items/headers/section-header.tsx
+++ b/apps/mobile/app/components/list-items/headers/section-header.tsx
@@ -185,6 +185,11 @@ export const SectionHeader = React.memo<
},
(prev, next) => {
if (prev.item.title !== next.item.title) return false;
+ if (prev.groupOptions?.groupBy !== next.groupOptions.groupBy) return false;
+ if (prev.groupOptions?.sortDirection !== next.groupOptions.sortDirection)
+ return false;
+ if (prev.groupOptions?.sortBy !== next.groupOptions.sortBy) return false;
+
return true;
}
);
diff --git a/apps/mobile/app/components/properties/tags.js b/apps/mobile/app/components/properties/tags.js
index b8ee852a4..59e7d4e5b 100644
--- a/apps/mobile/app/components/properties/tags.js
+++ b/apps/mobile/app/components/properties/tags.js
@@ -48,7 +48,7 @@ export const Tags = ({ item, close }) => {
>
<Button
onPress={async () => {
- ManageTagsSheet.present([item]);
+ ManageTagsSheet.present([item.id]);
}}
buttonType={{
text: colors.primary.accent
diff --git a/apps/mobile/app/components/selection-header/index.tsx b/apps/mobile/app/components/selection-header/index.tsx
index 2c9aed35d..a1c217f8a 100644
--- a/apps/mobile/app/components/selection-header/index.tsx
+++ b/apps/mobile/app/components/selection-header/index.tsx
@@ -49,11 +49,13 @@ export const SelectionHeader = React.memo(
({
items,
type,
- id
+ id,
+ renderedInRoute
}: {
items?: VirtualizedGrouping<Item>;
id?: string;
type?: ItemType;
+ renderedInRoute?: string;
}) => {
const { colors } = useThemeColors();
const selectionMode = useSelectionStore((state) => state.selectionMode);
@@ -220,8 +222,7 @@ export const SelectionHeader = React.memo(
size={SIZE.xl}
/>
- {type === "note" ||
- (type === "notebook" && focusedRouteId === "Notebooks") ? null : (
+ {type !== "note" ? null : (
<>
<IconButton
onPress={async () => {
@@ -268,19 +269,13 @@ export const SelectionHeader = React.memo(
</>
)}
- {type === "notebook" && focusedRouteId !== "Notebooks" ? (
+ {renderedInRoute === "Notebook" ? (
<IconButton
onPress={async () => {
if (selectedItemsList.length > 0) {
- const { focusedRouteId } = useNavigationStore.getState();
- if (!focusedRouteId) return;
-
- await db.notes.removeFromNotebook(
- focusedRouteId,
- ...selectedItemsList
- );
-
- updateNotebook(focusedRouteId);
+ if (!id) return;
+ await db.notes.removeFromNotebook(id, ...selectedItemsList);
+ updateNotebook(id);
Navigation.queueRoutesForUpdate();
clearSelection();
}
diff --git a/apps/mobile/app/components/sheets/add-to/notebook-item.tsx b/apps/mobile/app/components/sheets/add-to/notebook-item.tsx
index 7947e264d..8540ad2d1 100644
--- a/apps/mobile/app/components/sheets/add-to/notebook-item.tsx
+++ b/apps/mobile/app/components/sheets/add-to/notebook-item.tsx
@@ -105,7 +105,17 @@ export const NotebookItem = ({
useNotebookItemSelectionStore.setState({
multiSelect: true
});
- useNotebookItemSelectionStore.getState().markAs(item, "selected");
+ const state = useNotebookItemSelectionStore.getState();
+ useNotebookItemSelectionStore
+ .getState()
+ .markAs(
+ item,
+ !isSelected
+ ? "selected"
+ : !state.initialState[id]
+ ? undefined
+ : "deselected"
+ );
}}
testID={`add-to-notebook-item-${currentLevel}-${index}`}
onPress={onPress}
@@ -180,7 +190,7 @@ export const NotebookItem = ({
}
size={SIZE.sm}
>
- {item?.title}{" "}
+ {item?.title}
</Paragraph>
</View>
diff --git a/apps/mobile/app/components/sheets/notebook-sheet/index.tsx b/apps/mobile/app/components/sheets/notebook-sheet/index.tsx
index b9f76a749..5cc4cd168 100644
--- a/apps/mobile/app/components/sheets/notebook-sheet/index.tsx
+++ b/apps/mobile/app/components/sheets/notebook-sheet/index.tsx
@@ -348,7 +348,7 @@ export const NotebookSheet = () => {
<IconButton
name="plus"
onPress={PLACEHOLDER_DATA.action}
- testID="add-topic-button"
+ testID="add-notebook-button"
color={colors.primary.icon}
size={22}
customStyle={{
@@ -461,7 +461,7 @@ const NotebookItem = ({
selection.setEnabled(true);
selection.toggleSelection(item);
}}
- testID={`topic-sheet-item-${currentLevel}-${index}`}
+ testID={`notebook-sheet-item-${currentLevel}-${index}`}
onPress={() => {
if (!item) return;
if (selection.enabled) {
@@ -542,31 +542,40 @@ const NotebookItem = ({
}
size={SIZE.sm}
>
- {item?.title}{" "}
- {totalNotes(id) ? (
- <Paragraph size={SIZE.xs} color={colors.secondary.paragraph}>
- {totalNotes(id)}
- </Paragraph>
- ) : null}
+ {item?.title}
</Paragraph>
</View>
- <IconButton
- name="dots-horizontal"
- customStyle={{
- width: 40 * fontScale,
- height: 40 * fontScale
- }}
- testID={notesnook.ids.notebook.menu}
- onPress={() => {
- Properties.present(item);
+
+ <View
+ style={{
+ flexDirection: "row",
+ columnGap: 10,
+ alignItems: "center"
}}
- left={0}
- right={0}
- bottom={0}
- top={0}
- color={colors.primary.icon}
- size={SIZE.xl}
- />
+ >
+ {totalNotes?.(id) ? (
+ <Paragraph size={SIZE.sm} color={colors.secondary.paragraph}>
+ {totalNotes(id)}
+ </Paragraph>
+ ) : null}
+ <IconButton
+ name="dots-horizontal"
+ customStyle={{
+ width: 40 * fontScale,
+ height: 40 * fontScale
+ }}
+ testID={notesnook.ids.notebook.menu}
+ onPress={() => {
+ Properties.present(item);
+ }}
+ left={0}
+ right={0}
+ bottom={0}
+ top={0}
+ color={colors.primary.icon}
+ size={SIZE.xl}
+ />
+ </View>
</PressableButton>
{!expanded
diff --git a/apps/mobile/app/components/sheets/sort/index.js b/apps/mobile/app/components/sheets/sort/index.js
index b871843aa..d9c8274b8 100644
--- a/apps/mobile/app/components/sheets/sort/index.js
+++ b/apps/mobile/app/components/sheets/sort/index.js
@@ -42,7 +42,7 @@ const Sort = ({ type, screen }) => {
setGroupOptions(_groupOptions);
setTimeout(() => {
if (screen !== "TopicSheet") Navigation.queueRoutesForUpdate(screen);
- eSendEvent(eGroupOptionsUpdated, type);
+ eSendEvent(eGroupOptionsUpdated, groupType);
eSendEvent(refreshNotesPage);
}, 1);
};
diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx
index de6b8aece..23d865dba 100644
--- a/apps/mobile/app/hooks/use-actions.tsx
+++ b/apps/mobile/app/hooks/use-actions.tsx
@@ -70,8 +70,6 @@ export const useActions = ({
item: Note | Notebook | Reminder | Tag | Color | TrashItem;
close: () => void;
}) => {
- const clearSelection = useSelectionStore((state) => state.clearSelection);
- const setSelectedItem = useSelectionStore((state) => state.setSelectedItem);
const setMenuPins = useMenuStore((state) => state.setMenuPins);
const [isPinnedToMenu, setIsPinnedToMenu] = useState(
db.shortcuts.exists(item.id)
@@ -144,8 +142,11 @@ export const useActions = ({
async function pinItem() {
if (!item.id) return;
close();
- const type = item.type as "note" | "notebook";
- await (db as any)[`${type}s`][type](item.id)?.pin();
+ if (item.type === "note") {
+ await db.notes.pin(!item?.pinned, item.id);
+ } else if (item.type === "notebook") {
+ await db.notebooks.pin(!item?.pinned, item.id);
+ }
Navigation.queueRoutesForUpdate();
}
@@ -501,7 +502,7 @@ export const useActions = ({
async function addToFavorites() {
if (!item.id || item.type !== "note") return;
close();
- await db.notes.favorite(item.favorite, item.id);
+ await db.notes.favorite(!item.favorite, item.id);
Navigation.queueRoutesForUpdate();
}
diff --git a/apps/mobile/app/screens/editor/tiptap/commands.ts b/apps/mobile/app/screens/editor/tiptap/commands.ts
index e75349e9c..f34502cb9 100644
--- a/apps/mobile/app/screens/editor/tiptap/commands.ts
+++ b/apps/mobile/app/screens/editor/tiptap/commands.ts
@@ -168,7 +168,7 @@ typeof globalThis.statusBar !== "undefined" && statusBar.current.set({date:"",sa
setTags = async (note: Note | null | undefined) => {
if (!note) return;
- const tags = db.relations.to(note, "tag").resolved();
+ const tags = await db.relations.to(note, "tag").resolve();
await this.doAsync(`
if (typeof editorTags !== "undefined" && editorTags.current) {
editorTags.current.setTags(${JSON.stringify(
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts b/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts
index bb115bc31..eb66cd7ab 100644
--- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts
@@ -94,7 +94,7 @@ const publishNote = async (editor: useEditorType) => {
}
const currentNote = editor?.note?.current;
if (currentNote?.id) {
- const note = db.notes?.note(currentNote.id)?.data;
+ const note = await db.notes?.note(currentNote.id);
if (note?.locked) {
ToastManager.show({
heading: "Locked notes cannot be published",
@@ -113,7 +113,7 @@ const publishNote = async (editor: useEditorType) => {
const showActionsheet = async (editor: useEditorType) => {
const currentNote = editor?.note?.current;
if (currentNote?.id) {
- const note = db.notes?.note(currentNote.id)?.data;
+ const note = await db.notes?.note(currentNote.id);
if (editorState().isFocused || editorState().isFocused) {
editorState().isFocused = true;
@@ -332,7 +332,7 @@ export const useEditorEvents = (
}, [editor.editorId, onClearEditorSessionRequest, onLoadNote]);
const onMessage = useCallback(
- (event: WebViewMessageEvent) => {
+ async (event: WebViewMessageEvent) => {
const data = event.nativeEvent.data;
const editorMessage = JSON.parse(data) as EditorMessage;
@@ -397,7 +397,7 @@ export const useEditorEvents = (
});
return;
}
- ManageTagsSheet.present([editor.note.current]);
+ ManageTagsSheet.present([editor.note.current?.id]);
break;
case EventTypes.tag:
if (editorMessage.value) {
@@ -487,9 +487,9 @@ export const useEditorEvents = (
case EventTypes.previewAttachment: {
const hash = (editorMessage.value as Attachment)?.hash;
- const attachment = db.attachments?.attachment(hash);
+ const attachment = await db.attachments?.attachment(hash);
if (!attachment) return;
- if (attachment.metadata.type.startsWith("image/")) {
+ if (attachment.type.startsWith("image/")) {
eSendEvent("ImagePreview", editorMessage.value);
} else {
eSendEvent("PDFPreview", attachment);
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor.ts b/apps/mobile/app/screens/editor/tiptap/use-editor.ts
index e02d1a6d3..9f5f22f96 100644
--- a/apps/mobile/app/screens/editor/tiptap/use-editor.ts
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor.ts
@@ -454,7 +454,10 @@ export const useEditor = (
if (!currentNote.current.locked && isContentEncrypted) {
lockNoteWithVault(note);
} else if (currentNote.current.locked && isEncryptedContent(data)) {
- const decryptedContent = await db.vault?.decryptContent(data);
+ const decryptedContent = await db.vault?.decryptContent(
+ data,
+ currentNote?.current?.id
+ );
if (!decryptedContent) {
lockNoteWithVault(note);
} else {
diff --git a/apps/mobile/app/screens/notebook/index.tsx b/apps/mobile/app/screens/notebook/index.tsx
index cb333bff0..5bc0db663 100644
--- a/apps/mobile/app/screens/notebook/index.tsx
+++ b/apps/mobile/app/screens/notebook/index.tsx
@@ -122,7 +122,12 @@ const NotebookScreen = ({ route, navigation }: NavigationProps<"Notebook">) => {
return (
<>
- <SelectionHeader id={route.name} items={notes} type="note" />
+ <SelectionHeader
+ id={route.params?.item?.id}
+ items={notes}
+ type="note"
+ renderedInRoute="Notebook"
+ />
<Header
renderedInRoute={route.name}
title={params.current.item?.title}
diff --git a/apps/mobile/app/utils/functions.js b/apps/mobile/app/utils/functions.js
index c8043d60a..bd496c20b 100644
--- a/apps/mobile/app/utils/functions.js
+++ b/apps/mobile/app/utils/functions.js
@@ -62,7 +62,9 @@ async function deleteNotebook(id, deleteNotes) {
const parentId = getParentNotebookId(id);
if (deleteNotes) {
const noteRelations = await db.relations.from(notebook, "note").get();
- await db.notes.delete(...noteRelations.map((relation) => relation.toId));
+ if (noteRelations?.length) {
+ await db.notes.delete(...noteRelations.map((relation) => relation.toId));
+ }
}
const subnotebooks = await db.relations.from(notebook, "notebook").get();
for (const subnotebook of subnotebooks) {
@@ -96,6 +98,7 @@ export const deleteItems = async (items, type, context) => {
eSendEvent(eClearEditor);
} else if (type === "notebook") {
const result = await confirmDeleteAllNotes(ids, "notebook", context);
+ console.log(result);
if (!result.delete) return;
for (const id of ids) {
await deleteNotebook(id, result.deleteNotes);
diff --git a/apps/mobile/e2e/tests/note.e2e.js b/apps/mobile/e2e/tests/note.e2e.js
index 8a1997dbc..292494b1e 100644
--- a/apps/mobile/e2e/tests/note.e2e.js
+++ b/apps/mobile/e2e/tests/note.e2e.js
@@ -94,7 +94,7 @@ describe("NOTE TESTS", () => {
await prepare();
await createNote();
await tapById(notesnook.listitem.menu);
- await tapById("icon-Copy");
+ await tapById("icon-copy");
await visibleByText("Note copied to clipboard");
});
diff --git a/apps/mobile/e2e/tests/notebook.e2e.js b/apps/mobile/e2e/tests/notebook.e2e.js
index eb3b3909d..5e047413d 100644
--- a/apps/mobile/e2e/tests/notebook.e2e.js
+++ b/apps/mobile/e2e/tests/notebook.e2e.js
@@ -45,8 +45,8 @@ describe("NOTEBOOKS", () => {
it("Create a notebook with title only", async () => {
await prepare();
await navigate("Notebooks");
-
await sleep(500);
+ await tapByText("Add your first notebook");
await createNotebook("Notebook 1", false, false);
await sleep(500);
await device.pressBack();
@@ -57,8 +57,8 @@ describe("NOTEBOOKS", () => {
it("Create a notebook title & description", async () => {
await prepare();
await navigate("Notebooks");
-
await sleep(500);
+ await tapByText("Add your first notebook");
await createNotebook("Notebook 1", true, false);
await sleep(500);
await device.pressBack();
@@ -66,85 +66,129 @@ describe("NOTEBOOKS", () => {
await visibleByText("Notebook 1");
});
- it("Create a notebook with description and topics", async () => {
+ it("Create a notebook, move notes", async () => {
await prepare();
+ let note = await createNote();
await navigate("Notebooks");
await sleep(500);
- await createNotebook("Notebook 1", false, false);
+ await tapByText("Add your first notebook");
+ await createNotebook("Notebook 1", true, true);
await sleep(500);
- await device.pressBack();
+ await tapById("listitem.select");
+ await tapByText("Move selected notes");
await sleep(500);
- await visibleByText("Notebook 1");
+ await tapByText("Notebook 1");
+ await sleep(500);
+ await visibleByText(note.body);
});
- it("Create a notebook, add topic, move notes", async () => {
+ it("Add a sub notebook to a notebook", async () => {
await prepare();
- let note = await createNote();
await navigate("Notebooks");
await sleep(500);
- await createNotebook("Notebook 1", true, true);
+ await tapByText("Add your first notebook");
+ await createNotebook("Notebook 1", true, false);
await sleep(500);
- await tapByText("Topic");
+ await device.pressBack();
await sleep(500);
- await tapById("listitem.select");
- await tapByText("Move selected notes");
+ await tapByText("Notebook 1");
await sleep(500);
- await tapByText("Topic");
+ await tapById("add-notebook-button");
+ await createNotebook("Sub notebook", true, true);
await sleep(500);
- await visibleByText(note.body);
+ await device.pressBack();
+ await visibleByText("Sub notebook");
+ await tapById(notesnook.ids.notebook.menu);
+ await tapByText("Move to trash");
+ await sleep(300);
+ await tapByText("Delete");
+ await notVisibleByText("Sub notebook");
});
- it("Add new topic to notebook", async () => {
+ it("Remove a sub notebook from notebook", async () => {
await prepare();
await navigate("Notebooks");
await sleep(500);
+ await tapByText("Add your first notebook");
await createNotebook("Notebook 1", true, false);
await sleep(500);
await device.pressBack();
await sleep(500);
await tapByText("Notebook 1");
- await tapById("add-topic-button");
- await elementById("input-title").typeText("Topic");
- await tapByText("Add");
await sleep(500);
+ await tapById("add-notebook-button");
+ await createNotebook("Sub notebook", true, true);
+ await sleep(500);
+ await device.pressBack();
+ await visibleByText("Sub notebook");
+ });
+
+ it("Edit notebook", async () => {
+ await prepare();
+ await navigate("Notebooks");
+ await sleep(500);
+ await tapById(notesnook.buttons.add);
+ await createNotebook("Notebook 1", true);
+ await sleep(500);
+ await device.pressBack();
+ await tapById(notesnook.ids.notebook.menu);
+ await tapByText("Edit notebook");
+ await elementById(notesnook.ids.dialogs.notebook.inputs.title).typeText(
+ " (edited)"
+ );
+ await tapByText("Save");
+ await visibleByText("Notebook 1 (edited)");
});
- it("Edit topic", async () => {
+ it("Edit a sub notebook", async () => {
await prepare();
await navigate("Notebooks");
await sleep(500);
- await createNotebook("Notebook 1", true, true);
+ await tapById(notesnook.buttons.add);
+ await createNotebook("Notebook 1", true);
await sleep(500);
await device.pressBack();
await sleep(500);
await tapByText("Notebook 1");
- await sleep(300);
+ await sleep(500);
+ await tapById("add-notebook-button");
+ await createNotebook("Sub notebook", true, true);
+ await device.pressBack();
+ await sleep(500);
await tapById(notesnook.ids.notebook.menu);
- await tapByText("Edit topic");
- await elementById("input-title").typeText(" (edited)");
+ await tapByText("Edit notebook");
+ await sleep(500);
+ await elementById(notesnook.ids.dialogs.notebook.inputs.title).typeText(
+ " (edited)"
+ );
await tapByText("Save");
+ await sleep(500);
+ await visibleByText("Sub notebook (edited)");
});
- it("Add new note to topic", async () => {
+ it("Add a note to notebook", async () => {
await prepare();
await navigate("Notebooks");
+ await tapByText("Add your first notebook");
await sleep(500);
await createNotebook("Notebook 1", true, true);
await sleep(500);
await device.pressBack();
await sleep(500);
- await tapByText("Topic");
+ await tapByText("Notebook 1");
await createNote();
});
- it("Remove note from topic", async () => {
+ it("Remove note from Notebook", async () => {
await prepare();
await navigate("Notebooks");
+ await tapByText("Add your first notebook");
await createNotebook("Notebook 1", true, true);
await sleep(500);
await device.pressBack();
await sleep(500);
- await tapByText("Topic");
+ await tapByText("Notebook 1");
+ await sleep(500);
let note = await createNote();
await elementByText(note.body).longPress();
await tapById("select-minus");
@@ -155,56 +199,27 @@ describe("NOTEBOOKS", () => {
await prepare();
await navigate("Notebooks");
await sleep(500);
- await createNotebook("Notebook 1", true, true, 3);
+ await tapByText("Add your first notebook");
+ await createNotebook("Notebook 1", true, false);
await sleep(500);
await device.pressBack();
await sleep(500);
await navigate("Notes");
await createNote();
- console.log("ADD TO A SINGLE TOPIC");
await tapById(notesnook.listitem.menu);
await tapById("icon-notebooks");
await sleep(500);
await tapByText("Notebook 1");
- await tapByText("Topic");
await tapByText("Save");
await sleep(300);
- await visibleByText("Topic");
- console.log("MOVE FROM ONE TOPIC TO ANOTHER");
- await tapById(notesnook.listitem.menu);
- await tapById("icon-notebooks");
- await tapByText("Notebook 1");
- await tapByText("Topic 2");
- await tapByText("Save");
- await visibleByText("Topic 2");
- console.log("REMOVE FROM TOPIC");
- await tapById(notesnook.listitem.menu);
- await tapById("icon-notebooks");
- await tapByText("Notebook 1");
- await tapByText("Topic 2");
- await tapByText("Save");
- await sleep(300);
- await notVisibleByText("Topic 2");
- console.log("MOVE TO MULTIPLE TOPICS");
- await tapById(notesnook.listitem.menu);
- await tapById("icon-notebooks");
- await tapByText("Notebook 1");
- await elementByText("Topic").longPress();
- await visibleByText("Reset selection");
- await tapByText("Topic 2");
- await tapByText("Topic 3");
- await tapByText("Save");
- await sleep(300);
- await tapById(notesnook.listitem.menu);
- await visibleByText("Topic");
- await visibleByText("Topic 2");
- await visibleByText("Topic 3");
+ await visibleByText("Notebook 1");
});
- it("Edit notebook title, description and add a topic", async () => {
+ it("Edit notebook title, description", async () => {
await prepare();
await navigate("Notebooks");
await sleep(500);
+ await tapByText("Add your first notebook");
await createNotebook();
await sleep(500);
await device.pressBack();
@@ -222,22 +237,19 @@ describe("NOTEBOOKS", () => {
await elementById(
notesnook.ids.dialogs.notebook.inputs.description
).typeText("Description of Notebook 1 (Edited)");
- await elementById(notesnook.ids.dialogs.notebook.inputs.topic).typeText(
- "Topic 2"
- );
- await tapById("topic-add-button");
+
await tapByText("Save");
await sleep(500);
await visibleByText("Notebook 1 (Edited)");
await visibleByText("Description of Notebook 1 (Edited)");
- await visibleByText("Topic 2");
});
- it("Move notebook to trash", async () => {
+ it.skip("Move notebook to trash", async () => {
await prepare();
await navigate("Notebooks");
await sleep(500);
+ await tapByText("Add your first notebook");
await createNotebook("Notebook 1", false, false);
await sleep(500);
await device.pressBack();
@@ -258,9 +270,9 @@ describe("NOTEBOOKS", () => {
await navigate("Notebooks");
await sleep(500);
+ await tapByText("Add your first notebook");
await createNotebook("Notebook 1", false, true);
await sleep(500);
- await tapByText("Topic");
await tapById("listitem.select");
await tapByText("Move selected notes");
await sleep(500);
@@ -277,36 +289,12 @@ describe("NOTEBOOKS", () => {
await visibleByText(note.body);
});
- it("Move Topic to trash with notes", async () => {
- await prepare();
- let note = await createNote();
- await navigate("Notebooks");
-
- await sleep(500);
- await createNotebook("Notebook 1", false, true);
- await sleep(500);
- await tapByText("Topic");
- await tapById("listitem.select");
- await tapByText("Move selected notes");
- await sleep(500);
- await tapByText("Notebook 1");
- await tapById(notesnook.ids.notebook.menu);
- await tapByText("Delete topic");
- await sleep(2000);
- await tapByText("Move all notes in this topic to trash");
- await sleep(500);
- await tapByText("Delete");
- await device.pressBack();
- await sleep(4000);
- await navigate("Trash");
- await visibleByText(note.body);
- });
-
it("Pin notebook to side menu", async () => {
await prepare();
await navigate("Notebooks");
await sleep(500);
+ await tapByText("Add your first notebook");
await createNotebook("Notebook 1", false, false);
await sleep(500);
await device.pressBack();
@@ -318,22 +306,4 @@ describe("NOTEBOOKS", () => {
await menu.tap();
await visibleByText("Notebook 1");
});
-
- it("Pin topic to side menu", async () => {
- await prepare();
- await navigate("Notebooks");
-
- await sleep(500);
- await createNotebook("Notebook 1");
- await sleep(500);
- await device.pressBack();
- await sleep(500);
- await tapByText("Notebook 1");
- await tapById(notesnook.ids.notebook.menu);
- await tapByText("Add Shortcut");
- let menu = elementById(notesnook.ids.default.header.buttons.left);
- await menu.tap();
- await menu.tap();
- await visibleByText("Topic");
- });
});
diff --git a/apps/mobile/e2e/tests/search.e2e.js b/apps/mobile/e2e/tests/search.e2e.js
index 013a7571c..ed412c4c0 100644
--- a/apps/mobile/e2e/tests/search.e2e.js
+++ b/apps/mobile/e2e/tests/search.e2e.js
@@ -34,7 +34,7 @@ describe("Search", () => {
let note = await createNote();
await tapById("icon-search");
await sleep(300);
- await elementById("search-input").typeText("n");
+ await elementById("search-input").typeText("Test");
await sleep(1000);
await tapByText(note.body);
await sleep(1000);
diff --git a/apps/mobile/e2e/tests/sort.e2e.js b/apps/mobile/e2e/tests/sort.e2e.js
index 6b1cd8548..7d87e9410 100644
--- a/apps/mobile/e2e/tests/sort.e2e.js
+++ b/apps/mobile/e2e/tests/sort.e2e.js
@@ -107,23 +107,6 @@ describe("Sort & filter", () => {
await visibleByText("Month");
});
- it("Sort notes in topic", async () => {
- await prepare();
- await navigate("Notebooks");
- await sleep(500);
- await createNotebook("Notebook 1", true, true);
- await sleep(500);
- await device.pressBack();
- await sleep(500);
- await tapByText("Topic");
- await createNote("A", "A letter");
- await sleep(500);
- await createNote("B", "B letter");
- await sortBy("Abc");
- await sleep(300);
- await visibleByText("N");
- });
-
it("Compact mode", async () => {
await prepare();
await createNote("Note 1", "Note 1");
diff --git a/apps/mobile/e2e/tests/tag.e2e.js b/apps/mobile/e2e/tests/tag.e2e.js
index 22e9baf31..48694a2f5 100644
--- a/apps/mobile/e2e/tests/tag.e2e.js
+++ b/apps/mobile/e2e/tests/tag.e2e.js
@@ -46,7 +46,7 @@ describe("Tags", () => {
await visibleByText(note.body);
});
- it.only("Untag a note", async () => {
+ it("Untag a note", async () => {
await prepare();
await createNote();
await tapById(notesnook.listitem.menu);
diff --git a/apps/mobile/e2e/tests/utils.js b/apps/mobile/e2e/tests/utils.js
index b76f73528..c0815d82d 100644
--- a/apps/mobile/e2e/tests/utils.js
+++ b/apps/mobile/e2e/tests/utils.js
@@ -135,7 +135,6 @@ async function createNotebook(
topic = true,
topicCount = 1
) {
- await tapByText("Add your first notebook");
await elementById(notesnook.ids.dialogs.notebook.inputs.title).typeText(
title
);
@@ -144,15 +143,7 @@ async function createNotebook(
notesnook.ids.dialogs.notebook.inputs.description
).typeText(`Description of ${title}`);
}
- if (topic) {
- for (let i = 1; i <= topicCount; i++) {
- await elementById(notesnook.ids.dialogs.notebook.inputs.topic).typeText(
- i === 1 ? "Topic" : "Topic " + i
- );
- await tapById("topic-add-button");
- }
- }
- await tapByText("Save");
+ await tapByText("Add");
await sleep(500);
}
diff --git a/apps/mobile/native/babel.config.js b/apps/mobile/native/babel.config.js
index 59bf962c8..a959a559d 100644
--- a/apps/mobile/native/babel.config.js
+++ b/apps/mobile/native/babel.config.js
@@ -29,6 +29,12 @@ const configs = {
plugins: [
["@babel/plugin-transform-private-methods", { "loose": true }]
]
+ },
+ {
+ test: '../node_modules/jest-runner',
+ plugins: [
+ ["@babel/plugin-transform-private-methods", { "loose": true }]
+ ]
}
]