Skip to content

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

mobile: pass e2e tests

Ammar Ahmed83887db77a1c
diff --git a/apps/mobile/e2e/tests/notebook.e2e.js b/apps/mobile/e2e/tests/notebook.e2e.js
index bcaac8aad..eb3b3909d 100644
--- a/apps/mobile/e2e/tests/notebook.e2e.js
+++ b/apps/mobile/e2e/tests/notebook.e2e.js
@@ -30,36 +30,10 @@ import {
elementByText,
sleep,
notVisibleByText,
- visibleById
+ visibleById,
+ createNotebook
} from "./utils";
-export async function createNotebook(
- title = "Notebook 1",
- description = true,
- topic = true,
- topicCount = 1
-) {
- await tapByText("Add your first notebook");
- await elementById(notesnook.ids.dialogs.notebook.inputs.title).typeText(
- title
- );
- if (description) {
- await elementById(
- 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 sleep(500);
-}
-
// async function addTopic(title = "Topic") {
// await tapById(notesnook.buttons.add);
// await elementById("input-title").typeText(title);
diff --git a/apps/mobile/e2e/tests/sort.e2e.js b/apps/mobile/e2e/tests/sort.e2e.js
index 9059a4c25..7f74bf3c3 100644
--- a/apps/mobile/e2e/tests/sort.e2e.js
+++ b/apps/mobile/e2e/tests/sort.e2e.js
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { notesnook } from "../test.ids";
-import { createNotebook } from "./notebook.e2e";
import {
tapById,
visibleByText,
@@ -27,7 +26,8 @@ import {
tapByText,
notVisibleByText,
sleep,
- navigate
+ navigate,
+ createNotebook
} from "./utils";
async function sortBy(sorting, elementText = "Default") {
diff --git a/apps/mobile/e2e/tests/utils.js b/apps/mobile/e2e/tests/utils.js
index cc49e949a..b76f73528 100644
--- a/apps/mobile/e2e/tests/utils.js
+++ b/apps/mobile/e2e/tests/utils.js
@@ -129,8 +129,36 @@ async function matchSnapshot(element, name) {
});
}
+async function createNotebook(
+ title = "Notebook 1",
+ description = true,
+ topic = true,
+ topicCount = 1
+) {
+ await tapByText("Add your first notebook");
+ await elementById(notesnook.ids.dialogs.notebook.inputs.title).typeText(
+ title
+ );
+ if (description) {
+ await elementById(
+ 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 sleep(500);
+}
+
export {
matchSnapshot,
+ createNotebook,
prepare,
LaunchApp,
createNote,