Skip to content

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

update tests

ammarahm-ed3886e7753ec6
diff --git a/apps/mobile/.detoxrc.json b/apps/mobile/.detoxrc.json
index b068f9403..d22299c81 100644
--- a/apps/mobile/.detoxrc.json
+++ b/apps/mobile/.detoxrc.json
@@ -23,7 +23,8 @@
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.attached",
"device": {
- "adbName": "LMG710ULM3d3678f0"
+ "adbName": "192.168.10.3:5555",
+ "adbNameAlt":"LMG710ULM3d3678f0"
}
},
"android.dev.release": {
diff --git a/apps/mobile/e2e/tests/favorites.e2e.js b/apps/mobile/e2e/tests/favorites.e2e.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/apps/mobile/e2e/tests/index.e2e.js b/apps/mobile/e2e/tests/index.e2e.js
index 8cebf3cce..5e30d0c80 100644
--- a/apps/mobile/e2e/tests/index.e2e.js
+++ b/apps/mobile/e2e/tests/index.e2e.js
@@ -1,5 +1,6 @@
+const {beforeEach} = require('detox');
const detox = require('detox');
-const {beforeAll, test} = require('jest-circus');
+const {beforeAll, test, describe} = require('jest-circus');
const {notesnook} = require('../test.ids');
const {
LaunchApp,
@@ -8,13 +9,10 @@ const {
elementById,
visibleByText,
tapByText,
- elementByText
+ elementByText,
+ createNote,
+ prepare
} = require('./misc.e2e');
-const {sleep} = require('./utils.test');
-
-beforeAll(async () => {
- await device.launchApp();
-});
describe('Basic tests', () => {
it('App should launch successfully & hide welcome screen', async () => {
@@ -22,7 +20,7 @@ describe('Basic tests', () => {
});
it('Basic navigation should work', async () => {
- await sleep(500);
+ await prepare();
await navigate('Notebooks');
await navigate('Favorites');
await navigate('Trash');
@@ -32,40 +30,34 @@ describe('Basic tests', () => {
await navigate('Notes');
});
- it('Create 3 notes', async () => {
- let numOfnotes = 3;
-
- for (let i = 0; i < numOfnotes; i++) {
- let title = 'Test note description that ';
- let body =
- 'Test note description that is very long and should not fit in text.' +
- i;
-
- await tapById(notesnook.buttons.add);
- await elementById(notesnook.editor.id).tap({
- x: 15,
- y: 15
- });
- await elementById(notesnook.editor.id).typeText(body);
- await tapById(notesnook.editor.back);
- await expect(elementByText(title).atIndex(0)).toBeVisible();
- }
+ it('Create a note in editor', async () => {
+ await prepare();
+ await createNote();
});
it('Open and close a note', async () => {
+ await prepare();
+ await createNote();
await tapById(notesnook.ids.note.get(1));
await tapById(notesnook.editor.back);
+ });
+ it('Export note dialog should show', async () => {
+ await prepare();
+ await createNote();
+ await tapById(notesnook.listitem.menu);
+ await tapById('icon-Export');
+ await visibleByText('PDF');
});
it('Delete & restore a note', async () => {
+ await LaunchApp();
+ await createNote();
await tapById(notesnook.listitem.menu);
- await tapById("icon-Delete");
+ await tapById('icon-Delete');
await tapById(notesnook.toast.button);
- await visibleByText("Test note description that is very long and should not fit in text.2");
+ await visibleByText(
+ 'Test note description that is very long and should not fit in text.'
+ );
});
-
-
-
-
});
diff --git a/apps/mobile/e2e/tests/misc.e2e.js b/apps/mobile/e2e/tests/misc.e2e.js
index e7f63226e..8bcfbbb17 100644
--- a/apps/mobile/e2e/tests/misc.e2e.js
+++ b/apps/mobile/e2e/tests/misc.e2e.js
@@ -18,7 +18,7 @@ export function elementById(id) {
}
export function elementByText(text) {
- return element(by.text(text)).atIndex(0)
+ return element(by.text(text)).atIndex(0);
}
export async function tapById(id) {
@@ -37,9 +37,33 @@ export async function visibleById(id) {
await expect(elementById(id)).toBeVisible();
}
+export async function createNote() {
+ let title = 'Test note description that ';
+ let body =
+ 'Test note description that is very long and should not fit in text.';
+
+ await tapById(notesnook.buttons.add);
+ await elementById(notesnook.editor.id).tap({
+ x: 15,
+ y: 15
+ });
+ await elementById(notesnook.editor.id).typeText(body);
+ await tapById(notesnook.editor.back);
+ await sleep(500);
+ await expect(element(by.text(body))).toBeVisible();
+}
+
export async function navigate(screen) {
let menu = elementById(notesnook.ids.default.header.buttons.left);
await menu.tap();
await sleep(100);
await elementByText(screen).tap();
}
+
+export async function prepare() {
+ await device.reverseTcpPort(8081);
+ await device.uninstallApp();
+ await device.installApp();
+ await device.launchApp({newInstance: true});
+ await LaunchApp();
+}
diff --git a/apps/mobile/e2e/tests/notebooks.e2e.js b/apps/mobile/e2e/tests/notebooks.e2e.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/apps/mobile/e2e/tests/notes.e2e.js b/apps/mobile/e2e/tests/notes.e2e.js
deleted file mode 100644
index d768a8774..000000000
--- a/apps/mobile/e2e/tests/notes.e2e.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const {notesnook} = require('../test.ids');
-const {sleep} = require('./utils.test');
-
-async function makeNote() {
- await element(by.text('Add your First Note')).tap();
- await sleep(100);
- const editor = element(by.id(notesnook.editor.id));
- 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();
-}
-
-async function deleteNote() {
- await sleep(300);
- await element(by.id(notesnook.ids.note.menu)).tap();
- await sleep(100);
- const deleteBtn = element(by.id('icon-' + 'Delete'));
- await sleep(100);
- await deleteBtn.tap();
- await sleep(100);
-}
-
-it('Take a new note', async () => {
- await makeNote();
-});
-
-it('Delete a note', async () => {
- await deleteNote();
-});
diff --git a/apps/mobile/e2e/tests/pins.e2e.js b/apps/mobile/e2e/tests/pins.e2e.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/apps/mobile/e2e/tests/tags.e2e.js b/apps/mobile/e2e/tests/tags.e2e.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/apps/mobile/e2e/tests/topics.e2e.js b/apps/mobile/e2e/tests/topics.e2e.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/apps/mobile/e2e/tests/trash.e2e.js b/apps/mobile/e2e/tests/trash.e2e.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/apps/mobile/e2e/tests/user.e2e.js b/apps/mobile/e2e/tests/user.e2e.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/apps/mobile/e2e/tests/vault.e2e.js b/apps/mobile/e2e/tests/vault.e2e.js
deleted file mode 100644
index e69de29bb..000000000