A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
add e2e tests
ammarahm-ed30c8b107240a
diff --git a/apps/mobile/e2e/tests/note.e2e.js b/apps/mobile/e2e/tests/note.e2e.jsindex 542598095..16c83d7d7 100644--- a/apps/mobile/e2e/tests/note.e2e.js+++ b/apps/mobile/e2e/tests/note.e2e.js@@ -1,5 +1,14 @@const { notesnook } = require('../test.ids');-const { navigate, tapById, visibleByText, createNote, prepare, visibleById } = require('./utils');+const {+ navigate,+ tapById,+ visibleByText,+ createNote,+ prepare,+ visibleById,+ notVisibleById,+ elementById+} = require('./utils');const { sleep } = require('./utils');describe('NOTE TESTS', () => {@@ -75,6 +84,20 @@ describe('NOTE TESTS', () => {await visibleByText('PDF');});+ it('Assign colors to a note', async () => {+ await prepare();+ let note = await createNote();+ await tapById(notesnook.listitem.menu);+ await tapById(notesnook.ids.dialogs.actionsheet.color('red'));+ await visibleById('icon-check');+ await tapById(notesnook.ids.dialogs.actionsheet.color('red'));+ await notVisibleById('icon-check');+ await tapById(notesnook.ids.dialogs.actionsheet.color('green'));+ await device.pressBack();+ await navigate('Green');+ await visibleByText(note.body);+ });+it('Delete & restore a note', async () => {await prepare();await createNote();diff --git a/apps/mobile/e2e/tests/notebook.e2e.js b/apps/mobile/e2e/tests/notebook.e2e.jsindex 2e2deff93..ede10dee8 100644--- a/apps/mobile/e2e/tests/notebook.e2e.js+++ b/apps/mobile/e2e/tests/notebook.e2e.js@@ -213,4 +213,37 @@ describe('NOTEBOOKS', () => {await navigate('Trash');await visibleByText('Notebook 1');});++ it('Pin notebook to side menu', async () => {+ await prepare();+ await navigate('Notebooks');+ await tapByText('Skip introduction');+ await sleep(500);+ await createNotebook('Notebook 1', false, false);+ await elementById('sheet-backdrop').tap();+ await sleep(500);+ await visibleByText('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 visibleByText('Notebook 1');+ });++ it('Pin topic to side menu', async () => {+ await prepare();+ await navigate('Notebooks');+ await tapByText('Skip introduction');+ await sleep(500);+ await createNotebook('Notebook 1');+ await elementById('sheet-backdrop').tap();+ 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');+ });});diff --git a/apps/mobile/e2e/tests/tag.e2e.js b/apps/mobile/e2e/tests/tag.e2e.jsnew file mode 100644index 000000000..d25354a24--- /dev/null+++ b/apps/mobile/e2e/tests/tag.e2e.js@@ -0,0 +1,85 @@+const { notesnook } = require('../test.ids');+const {+ navigate,+ tapById,+ visibleByText,+ createNote,+ prepare,+ visibleById,+ notVisibleById,+ elementById,+ tapByText,+ notVisibleByText+} = require('./utils');+const { sleep } = require('./utils');++describe('Tags', () => {+ it('Tag a note', async () => {+ await prepare();+ let note = await createNote();+ await tapById(notesnook.listitem.menu);+ await tapByText('Add tags');+ await elementById('tag-input').typeText('testtag');+ await tapByText(`Add "#testtag"`);+ await visibleByText('#testtag');+ await device.pressBack();+ await device.pressBack();+ await navigate('Tags');+ await tapByText('#testtag');+ await visibleByText(note.body);+ });++ it('Untag a note', async () => {+ await prepare();+ let note = await createNote();+ await tapById(notesnook.listitem.menu);+ await tapByText('Add tags');+ await elementById('tag-input').typeText('testtag');+ await tapByText(`Add "#testtag"`);+ await visibleByText('#testtag');+ await tapByText('#testtag');+ await device.pressBack();+ await device.pressBack();+ await notVisibleByText('#testtag');+ await navigate('Tags');+ await notVisibleByText('#testtag');+ });++ it('Creat shortcut of a tag', async () => {+ await prepare();+ let note = await createNote();+ await tapById(notesnook.listitem.menu);+ await tapByText('Add tags');+ await elementById('tag-input').typeText('testtag');+ await tapByText(`Add "#testtag"`);+ await visibleByText('#testtag');+ await device.pressBack();+ await device.pressBack();+ await navigate('Tags');+ await tapById(notesnook.ids.tag.menu);+ await tapByText('Add Shortcut');+ let menu = elementById(notesnook.ids.default.header.buttons.left);+ await menu.tap();+ await visibleByText('#testtag');+ });++ it('Rename a tag', async () => {+ await prepare();+ let note = await createNote();+ await tapById(notesnook.listitem.menu);+ await tapByText('Add tags');+ await elementById('tag-input').typeText('testtag');+ await tapByText(`Add "#testtag"`);+ await visibleByText('#testtag');+ await device.pressBack();+ await device.pressBack();+ await navigate('Tags');+ await tapById(notesnook.ids.tag.menu);+ await tapByText('Rename tag');+ await sleep(500);+ await elementById('input-value').clearText();+ await elementById('input-value').typeText('testtag_edited');+ await tapByText('Save');+ await visibleByText('#testtag_edited');+ });+});diff --git a/apps/mobile/e2e/tests/utils.js b/apps/mobile/e2e/tests/utils.jsindex 3378a31d4..057ee4115 100644--- a/apps/mobile/e2e/tests/utils.js+++ b/apps/mobile/e2e/tests/utils.js@@ -51,6 +51,10 @@ export async function notVisibleById(id) {await expect(elementById(id)).not.toBeVisible();}+export async function notVisibleByText(text) {+ await expect(elementByText(text)).not.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.';diff --git a/apps/mobile/src/components/dialog/index.js b/apps/mobile/src/components/dialog/index.jsindex 331d29f25..89e85b336 100644--- a/apps/mobile/src/components/dialog/index.js+++ b/apps/mobile/src/components/dialog/index.js@@ -122,6 +122,7 @@ export const Dialog = ({ context = 'global' }) => {onChangeText={value => {setInputValue(value);}}+ testID="input-value"secureTextEntry={dialogInfo.secureTextEntry}//defaultValue={dialogInfo.defaultValue}onSubmit={onPressPositive}diff --git a/apps/mobile/src/components/properties/colortags.js b/apps/mobile/src/components/properties/colortags.jsindex d0ed388d0..f90440a93 100644--- a/apps/mobile/src/components/properties/colortags.js+++ b/apps/mobile/src/components/properties/colortags.js@@ -58,7 +58,7 @@ export const ColorTags = ({ item, close }) => {}}>{note.color?.toLowerCase() === color.name ? (- <Icon name="check" color="white" size={SIZE.lg} />+ <Icon testID="icon-check" name="check" color="white" size={SIZE.lg} />) : null}</PressableButton>);diff --git a/apps/mobile/src/components/sheets/managetags/index.js b/apps/mobile/src/components/sheets/managetags/index.jsindex 203eb203b..83ff5c705 100644--- a/apps/mobile/src/components/sheets/managetags/index.js+++ b/apps/mobile/src/components/sheets/managetags/index.js@@ -147,6 +147,7 @@ const ManageTagsSheet = () => {color: colors.accent,size: SIZE.lg}}+ testID="tag-input"fwdRef={inputRef}autoCapitalize="none"onChangeText={v => {