Skip to content

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

minor refactor e2e tests

ammarahm-edc24d7fc77981
diff --git a/apps/mobile/.detoxrc.json b/apps/mobile/.detoxrc.json
index c68274276..b471d8f19 100644
--- a/apps/mobile/.detoxrc.json
+++ b/apps/mobile/.detoxrc.json
@@ -18,6 +18,14 @@
"device":{
"avdName":"LMG710ULM3d3678f0"
}
- }
+ },
+ "android.emu.release": {
+ "binaryPath": "android/app/build/outputs/apk/release/app-arm64-v8a-release.apk",
+ "build": "cd android ; ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -",
+ "type": "android.emulator",
+ "device":{
+ "avdName":"LMG710ULM3d3678f0"
+ }
+ }
}
}
diff --git a/apps/mobile/e2e/config.json b/apps/mobile/e2e/config.json
index 5467a9303..3b46bde78 100644
--- a/apps/mobile/e2e/config.json
+++ b/apps/mobile/e2e/config.json
@@ -2,7 +2,9 @@
"testEnvironment": "./environment",
"testRunner": "jest-circus/runner",
"testTimeout": 120000,
- "testRegex": "\\.e2e\\.js$",
+ "testRegex": "notes.e2e.js",
"reporters": ["detox/runners/jest/streamlineReporter"],
"verbose": true
+
}
+
diff --git a/apps/mobile/e2e/test.ids.js b/apps/mobile/e2e/test.ids.js
index 880eb564f..42af90946 100644
--- a/apps/mobile/e2e/test.ids.js
+++ b/apps/mobile/e2e/test.ids.js
@@ -1,35 +1,80 @@
export const notesnook = {
ids: {
default: {
- root: 'root_1',
- menu: 'menu_2',
+ root: 'root',
+ menu: 'menu',
dialog: {
- yes: 'yes_3',
- no: 'no_4',
+ yes: 'yes',
+ no: 'no',
},
- editor: 'editor_5',
+ editor: 'editor',
header: {
buttons: {
- left: 'left_6',
- right: 'right_7',
- back:'back_13'
+ left: 'left',
+ right: 'right',
+ back: 'back',
},
},
+ actionsheetBackdrop: 'backdrop',
+ loginToSync: 'login_to_sync',
+ addBtn: 'btn-add-item',
},
dialogs: {
notebook: {
inputs: {
- title: 'title_8',
- description: 'description_9',
- topic: 'topic_10',
+ title: 'title',
+ description: 'description',
+ topic: 'topic',
},
buttons: {
- add: 'add_11',
+ add: 'add',
},
},
+ export: {
+ pdf: 'pdf',
+ text: 'text',
+ md: 'md',
+ html: 'html',
+ },
+ vault: {
+ changePwd: 'change_pwd',
+ pwd: 'pwd',
+ confirmPwd: 'pwd',
+ pwdAlt: 'pwd_alt',
+ fingerprint: 'fingerprint',
+ },
+ sortBy: {
+ order: 'orderby',
+ default: 'btn-default',
+ alphabetical: 'btn-alphabetical',
+ year: 'btn-year',
+ week: 'btn-week',
+ month: 'btn-month',
+ },
+ addTo: {
+ addNotebook: 'input-addNotebook',
+ addTopic: 'input-addTopic',
+ btnNotebook: 'btn-addNotebook',
+ btnTopic: 'btn-addTopic',
+ },
+ actionsheet: {
+ delete: 'icon-Delete',
+ hashtagInput: 'hashtag_input',
+ export: 'icon-Export',
+ addTo: 'icon-Add to',
+ pin: 'item_pin',
+ pinMenu: 'item_pin_menu',
+ favorite: 'note_favorite',
+ vault: 'vault_btn',
+ copy: 'icon-Copy',
+ sync: 'btn-sync-now',
+ },
},
menu: {
- nightmode:"night_12"
- }
+ nightmode: 'night',
+ },
+ note: {
+ menu: 'note_menu',
+ },
},
};
diff --git a/apps/mobile/e2e/tests/notes.e2e.js b/apps/mobile/e2e/tests/notes.e2e.js
index 10882187d..be8378706 100644
--- a/apps/mobile/e2e/tests/notes.e2e.js
+++ b/apps/mobile/e2e/tests/notes.e2e.js
@@ -1,13 +1,30 @@
-const { notesnook } = require("../test.ids");
-const { sleep } = require("./utils.test");
+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.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();
+}
+
+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 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
+ await makeNote();
+});
+
+it('Delete a note', async () => {
+ await deleteNote();
+});