tests: pass tests for vault, tag, notes

This commit is contained in:
ammarahm-ed
2022-08-10 11:15:56 +05:00
parent e6a4f861bc
commit 41d70e6ebe
14 changed files with 30 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

@@ -8,7 +8,8 @@ const {
visibleById,
notVisibleById,
sleep,
exitEditor
exitEditor,
tapByText
} = require('./utils');
describe('NOTE TESTS', () => {
@@ -103,7 +104,10 @@ describe('NOTE TESTS', () => {
await createNote();
await tapById(notesnook.listitem.menu);
await tapById('icon-Delete');
await tapById(notesnook.toast.button);
await navigate('Trash');
await tapById(notesnook.listitem.menu);
await tapByText('Restore note');
await device.pressBack();
await visibleByText('Test note description that is very long and should not fit in text.');
});
});

View File

@@ -27,20 +27,19 @@ describe('Sort & filter', () => {
await sleep(300);
await tapByText('Note 1');
await sleep(500);
await elementById(notesnook.editor.id).tap({
x: 40,
y: 100
});
await elementById(notesnook.editor.id).typeText(' hello');
await tapById(notesnook.editor.back);
await sleep(500);
let webview = web(by.id(notesnook.editor.id));
await expect(webview.element(by.web.className('ProseMirror'))).toExist();
await webview.element(by.web.className('ProseMirror')).tap();
await webview.element(by.web.className('ProseMirror')).typeText('Edited ', true);
await device.pressBack();
await device.pressBack();
await sortBy('Date created');
await tapById(notesnook.listitem.menu);
await visibleByText('Note 2');
await device.pressBack();
await sortBy('Date edited');
await tapById(notesnook.listitem.menu);
await visibleByText('Note 1 hello');
await visibleByText('Edited Note 1');
await device.pressBack();
});

View File

@@ -75,6 +75,7 @@ describe('Tags', () => {
await device.pressBack();
await navigate('Tags');
await tapById(notesnook.ids.tag.menu);
await sleep(500);
await tapByText('Rename tag');
await sleep(500);
await elementById('input-value').clearText();

View File

@@ -10,7 +10,8 @@ const {
expectBitmapsToBeEqual,
matchSnapshot,
notVisibleById,
navigate
navigate,
openSideMenu
} = require('./utils');
const { sleep } = require('./utils');
@@ -48,7 +49,7 @@ async function openLockedNote(pwd) {
async function goToPrivacySecuritySettings() {
await navigate('Settings');
await tapByText('Privacy & security');
await tapByText('Vault');
}
describe('VAULT', () => {
@@ -72,8 +73,8 @@ describe('VAULT', () => {
await elementById(notesnook.ids.dialogs.vault.pwd).typeText('1234');
await elementById(notesnook.ids.dialogs.vault.changePwd).typeText('2362');
await tapByText('Change');
await sleep(100);
await navigate('Notes');
await device.pressBack();
await device.pressBack();
await openLockedNote('2362');
});
@@ -87,7 +88,8 @@ describe('VAULT', () => {
await tapByText('Delete');
await sleep(500);
await visibleByText('Create vault');
await navigate('Notes');
await device.pressBack();
await device.pressBack();
await visibleById(notesnook.listitem.menu);
});
@@ -102,7 +104,8 @@ describe('VAULT', () => {
await tapByText('Delete');
await sleep(500);
await visibleByText('Create vault');
await navigate('Notes');
await device.pressBack();
await device.pressBack();
await notVisibleById(notesnook.listitem.menu);
});

View File

@@ -2,6 +2,7 @@ import Clipboard from '@react-native-clipboard/clipboard';
import EventManager from '@streetwriters/notesnook-core/utils/event-manager';
import { RefObject } from 'react';
import ActionSheet from 'react-native-actions-sheet';
import { Config } from 'react-native-config';
import {
eHideToast,
eOnNoteEdited,
@@ -9,6 +10,7 @@ import {
eOpenVaultDialog,
eShowToast
} from '../utils/events';
const eventManager = new EventManager();
export const eSubscribeEvent = (eventName: string, action?: (data: any) => void) => {
@@ -107,16 +109,18 @@ export const ToastEvent = {
duration = 3000,
func,
actionText
}: ShowToastEvent) =>
}: ShowToastEvent) => {
if (Config.isTesting) return;
eSendEvent(eShowToast, {
heading: heading,
message: message,
type: type,
context: context,
duration: duration,
duration: 3000,
func: func,
actionText: actionText
}),
});
},
hide: () => eSendEvent(eHideToast),
error: (e: Error, title?: string, context?: 'global' | 'local') => {
ToastEvent.show({