mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
mobile: pass tests
This commit is contained in:
committed by
Abdullah Atta
parent
97ae36dcda
commit
4ff051130b
@@ -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;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ export const Tags = ({ item, close }) => {
|
||||
>
|
||||
<Button
|
||||
onPress={async () => {
|
||||
ManageTagsSheet.present([item]);
|
||||
ManageTagsSheet.present([item.id]);
|
||||
}}
|
||||
buttonType={{
|
||||
text: colors.primary.accent
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
columnGap: 10,
|
||||
alignItems: "center"
|
||||
}}
|
||||
testID={notesnook.ids.notebook.menu}
|
||||
onPress={() => {
|
||||
Properties.present(item);
|
||||
}}
|
||||
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
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
|
||||
@@ -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 () => {
|
||||
await prepare();
|
||||
await navigate("Notebooks");
|
||||
await sleep(500);
|
||||
await createNotebook("Notebook 1", false, false);
|
||||
await sleep(500);
|
||||
await device.pressBack();
|
||||
await sleep(500);
|
||||
await visibleByText("Notebook 1");
|
||||
});
|
||||
|
||||
it("Create a notebook, add topic, move notes", async () => {
|
||||
it("Create a notebook, move notes", async () => {
|
||||
await prepare();
|
||||
let note = await createNote();
|
||||
await navigate("Notebooks");
|
||||
await sleep(500);
|
||||
await tapByText("Add your first notebook");
|
||||
await createNotebook("Notebook 1", true, true);
|
||||
await sleep(500);
|
||||
await tapByText("Topic");
|
||||
await sleep(500);
|
||||
await tapById("listitem.select");
|
||||
await tapByText("Move selected notes");
|
||||
await sleep(500);
|
||||
await tapByText("Topic");
|
||||
await tapByText("Notebook 1");
|
||||
await sleep(500);
|
||||
await visibleByText(note.body);
|
||||
});
|
||||
|
||||
it("Add new topic to notebook", async () => {
|
||||
it("Add a sub notebook to a 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");
|
||||
await tapById(notesnook.ids.notebook.menu);
|
||||
await tapByText("Move to trash");
|
||||
await sleep(300);
|
||||
await tapByText("Delete");
|
||||
await notVisibleByText("Sub notebook");
|
||||
});
|
||||
|
||||
it("Edit topic", 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 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 a sub 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 sleep(500);
|
||||
await tapByText("Notebook 1");
|
||||
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 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 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("Notebook 1");
|
||||
await sleep(300);
|
||||
await tapById(notesnook.ids.notebook.menu);
|
||||
await tapByText("Edit topic");
|
||||
await elementById("input-title").typeText(" (edited)");
|
||||
await tapByText("Save");
|
||||
});
|
||||
|
||||
it("Add new note to 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();
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 }]
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user