Skip to content

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

fix tests not passing

ammarahm-edb6984121fdf9
diff --git a/apps/mobile/e2e/test.ids.js b/apps/mobile/e2e/test.ids.js
index 63cc4958c..880eb564f 100644
--- a/apps/mobile/e2e/test.ids.js
+++ b/apps/mobile/e2e/test.ids.js
@@ -1,34 +1,35 @@
export const notesnook = {
ids: {
default: {
- root: '1',
- menu: '2',
+ root: 'root_1',
+ menu: 'menu_2',
dialog: {
- yes: '3',
- no: '4',
+ yes: 'yes_3',
+ no: 'no_4',
},
- editor: '5',
+ editor: 'editor_5',
header: {
buttons: {
- left: '6',
- right: '7',
+ left: 'left_6',
+ right: 'right_7',
+ back:'back_13'
},
},
},
dialogs: {
notebook: {
inputs: {
- title: '8',
- description: '9',
- topic: '10',
+ title: 'title_8',
+ description: 'description_9',
+ topic: 'topic_10',
},
buttons: {
- add: '11',
+ add: 'add_11',
},
},
},
menu: {
- nightmode:"12"
+ nightmode:"night_12"
}
},
};
diff --git a/apps/mobile/e2e/tests/misc.e2e.js b/apps/mobile/e2e/tests/misc.e2e.js
index 3d2222a13..bf575d8c9 100644
--- a/apps/mobile/e2e/tests/misc.e2e.js
+++ b/apps/mobile/e2e/tests/misc.e2e.js
@@ -8,14 +8,19 @@ it('App initialization', async () => {
it('Drawer Navigation', async () => {
let menu = element(by.id(notesnook.ids.default.header.buttons.left));
await menu.tap();
- await element(by.text('Notebooks')).tap();
+ await sleep(100)
+ await element(by.text('Notebooks')).tap();
menu.tap();
+ await sleep(100)
await element(by.text('Favorites')).tap();
menu.tap();
+ await sleep(100)
await element(by.text('Trash')).tap();
menu.tap();
+ await sleep(100)
await element(by.text('Tags')).tap();
menu.tap();
+ await sleep(100)
await element(by.text('Settings')).tap();
});
@@ -23,9 +28,13 @@ it('Drawer Navigation', async () => {
it('Dark Mode', async () => {
let menu = element(by.id(notesnook.ids.default.header.buttons.left));
menu.tap();
+ await sleep(100)
let nightmode = element(by.id(notesnook.ids.menu.nightmode))
+ await sleep(100)
await nightmode.tap();
- await nightmode.tap();
+ await sleep(100)
+ await nightmode.tap();
+ await sleep(100)
menu.tap();
});
diff --git a/apps/mobile/e2e/tests/notes.e2e.js b/apps/mobile/e2e/tests/notes.e2e.js
index e69de29bb..10882187d 100644
--- a/apps/mobile/e2e/tests/notes.e2e.js
+++ b/apps/mobile/e2e/tests/notes.e2e.js
@@ -0,0 +1,13 @@
+const { notesnook } = require("../test.ids");
+const { sleep } = require("./utils.test");
+
+
+it('Take a new note', async () => {
+ await element(by.text('Add your First Note')).tap();
+ await sleep(100)
+ const editor = element(by.id(notesnook.ids.default.editor));
+ await sleep(100)
+ await editor.typeText('This is the text of **the note. which is working');
+ await sleep(100)
+ await element(by.id(notesnook.ids.default.header.buttons.back)).tap();
+ });
\ No newline at end of file
diff --git a/apps/mobile/e2e/tests/utils.test.js b/apps/mobile/e2e/tests/utils.test.js
index 270f7e866..31ff5595b 100644
--- a/apps/mobile/e2e/tests/utils.test.js
+++ b/apps/mobile/e2e/tests/utils.test.js
@@ -1,2 +1,4 @@
export const sleep = (duration) =>
-new Promise((resolve) => setTimeout(() => resolve(), duration));
\ No newline at end of file
+new Promise((resolve) => setTimeout(() => resolve(), duration));
+
+//"\\.e2e\\.js$",
\ No newline at end of file
diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.js
index 1e65c8fbc..0140b3b52 100644
--- a/apps/mobile/src/views/Editor/EditorHeader.js
+++ b/apps/mobile/src/views/Editor/EditorHeader.js
@@ -2,6 +2,7 @@ import React, {useEffect} from 'react';
import {BackHandler, Keyboard, Platform, View} from 'react-native';
import RNExitApp from 'react-native-exit-app';
import {useSafeAreaInsets} from 'react-native-safe-area-context';
+import { notesnook } from '../../../e2e/test.ids';
import {ActionIcon} from '../../components/ActionIcon';
import {
ActionSheetEvent,
@@ -179,7 +180,7 @@ const EditorHeader = () => {
}}>
{DDS.isLargeTablet() && !fullscreen ? null : (
<ActionIcon
- testID="editor_back_key"
+ testID={notesnook.ids.default.header.buttons.back}
name="arrow-left"
color={colors.heading}
onPress={_onBackPress}