Skip to content

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

e2e tests: notebook testing

ammarahm-ed2ac5b52b29fd
diff --git a/apps/mobile/e2e/tests/notebook.e2e.js b/apps/mobile/e2e/tests/notebook.e2e.js
index c92cf182e..2e2deff93 100644
--- a/apps/mobile/e2e/tests/notebook.e2e.js
+++ b/apps/mobile/e2e/tests/notebook.e2e.js
@@ -152,11 +152,65 @@ describe('NOTEBOOKS', () => {
await notVisibleById(note.title);
});
- //todo
- // add note to notebook from home
- // remove note from a notebook from add-notebook sheet
- // edit notebook title
- // edit notebook description
- // add a topic from edit-notebook sheet
- //
+ it('Add/Remove note to notebook from home', async () => {
+ await prepare();
+ await navigate('Notebooks');
+ await tapByText('Skip introduction');
+ await sleep(500);
+ await createNotebook('Notebook 1', true, true);
+ await elementById('sheet-backdrop').tap();
+ await sleep(500);
+ await navigate('Notes');
+ let note = await createNote();
+ await tapById(notesnook.listitem.menu);
+ await tapById('icon-Add to notebook');
+ await sleep(500);
+ await tapByText('Notebook 1');
+ await tapByText('Topic');
+ await visibleById('icon-check');
+ await tapByText('Topic');
+ await notVisibleById('icon-check');
+ });
+
+ it('Edit notebook title, description and add a topic', async () => {
+ await prepare();
+ await navigate('Notebooks');
+ await tapByText('Skip introduction');
+ await sleep(500);
+ await createNotebook();
+ await elementById('sheet-backdrop').tap();
+ await sleep(500);
+ await visibleByText('Notebook 1');
+ await tapById(notesnook.ids.notebook.menu);
+ await tapByText('Edit notebook');
+ await sleep(500);
+ await elementById(notesnook.ids.dialogs.notebook.inputs.title).typeText(' (Edited)');
+ await elementById(notesnook.ids.dialogs.notebook.inputs.description).clearText();
+ await elementById(notesnook.ids.dialogs.notebook.inputs.description).typeText(
+ 'Description of Notebook 1 (Edited)'
+ );
+ await elementById(notesnook.ids.dialogs.notebook.inputs.topic).typeText('Topic 2');
+ await tapById('topic-add-button');
+ await tapByText('Save changes');
+ await sleep(500);
+ await visibleByText('Notebook 1 (Edited)');
+ await visibleByText('Description of Notebook 1 (Edited)');
+ await visibleByText('Topic 2');
+ });
+
+ it('Move notebook to trash', 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('Move to trash');
+ await sleep(4000);
+ await navigate('Trash');
+ await visibleByText('Notebook 1');
+ });
});
diff --git a/apps/mobile/src/components/sheets/addto/index.js b/apps/mobile/src/components/sheets/addto/index.js
index c518a6b5c..6f4e99d4a 100644
--- a/apps/mobile/src/components/sheets/addto/index.js
+++ b/apps/mobile/src/components/sheets/addto/index.js
@@ -408,6 +408,7 @@ const MoveNoteComponent = ({ note }) => {
<Button
onPress={() => handlePress(item, index)}
icon="check"
+ testID="icon-check"
iconColor={colors.accent}
iconSize={SIZE.lg}
height={35}
diff --git a/apps/mobile/src/utils/database/index.js b/apps/mobile/src/utils/database/index.js
index 90ed733ce..65aad2740 100644
--- a/apps/mobile/src/utils/database/index.js
+++ b/apps/mobile/src/utils/database/index.js
@@ -10,20 +10,19 @@ export const db = new Database(
Platform.OS === 'ios' ? EventSource : AndroidEventSource,
filesystem
);
-
db.host(
__DEV__
? {
- // API_HOST: 'https://api.notesnook.com',
- // AUTH_HOST: 'https://auth.streetwriters.co',
- // SSE_HOST: 'https://events.streetwriters.co',
- // SUBSCRIPTIONS_HOST: 'https://subscriptions.streetwriters.co',
- // ISSUES_HOST: 'https://issues.streetwriters.co'
- API_HOST: 'http://192.168.10.29:5264',
- AUTH_HOST: 'http://192.168.10.29:8264',
- SSE_HOST: 'http://192.168.10.29:7264',
- SUBSCRIPTIONS_HOST: 'http://192.168.10.29:9264',
- ISSUES_HOST: 'http://192.168.10.29:2624'
+ API_HOST: 'https://api.notesnook.com',
+ AUTH_HOST: 'https://auth.streetwriters.co',
+ SSE_HOST: 'https://events.streetwriters.co',
+ SUBSCRIPTIONS_HOST: 'https://subscriptions.streetwriters.co',
+ ISSUES_HOST: 'https://issues.streetwriters.co'
+ // API_HOST: 'http://192.168.10.29:5264',
+ // AUTH_HOST: 'http://192.168.10.29:8264',
+ // SSE_HOST: 'http://192.168.10.29:7264',
+ // SUBSCRIPTIONS_HOST: 'http://192.168.10.29:9264',
+ // ISSUES_HOST: 'http://192.168.10.29:2624'
}
: {
API_HOST: 'https://api.notesnook.com',