mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
tests: make note creation tests pass
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"testRunner": "jest-circus/runner",
|
"testRunner": "jest-circus/runner",
|
||||||
"setupFilesAfterEnv": ["./setup.ts"],
|
"setupFilesAfterEnv": ["./setup.ts"],
|
||||||
"testTimeout": 120000,
|
"testTimeout": 120000,
|
||||||
"testRegex": "index\\.e2e\\.js$",
|
"testRegex": "\\.e2e\\.js$",
|
||||||
"reporters": ["detox/runners/jest/streamlineReporter"],
|
"reporters": ["detox/runners/jest/streamlineReporter"],
|
||||||
"verbose": true
|
"verbose": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ const credentials = {
|
|||||||
describe('AUTH', () => {
|
describe('AUTH', () => {
|
||||||
it('Sign up', async () => {
|
it('Sign up', async () => {
|
||||||
await prepare();
|
await prepare();
|
||||||
|
|
||||||
await openSideMenu();
|
await openSideMenu();
|
||||||
await tapByText('Login to sync your notes.');
|
await tapByText('Login to sync your notes.');
|
||||||
await sleep(500);
|
await sleep(500);
|
||||||
@@ -42,7 +41,7 @@ describe('AUTH', () => {
|
|||||||
await visibleByText('Tap here to sync your notes.');
|
await visibleByText('Tap here to sync your notes.');
|
||||||
});
|
});
|
||||||
|
|
||||||
it.only('Delete account', async () => {
|
it('Delete account', async () => {
|
||||||
await prepare();
|
await prepare();
|
||||||
await openSideMenu();
|
await openSideMenu();
|
||||||
await tapByText('Login to sync your notes.');
|
await tapByText('Login to sync your notes.');
|
||||||
@@ -50,7 +49,6 @@ describe('AUTH', () => {
|
|||||||
await elementById('input.password').typeText(credentials.password);
|
await elementById('input.password').typeText(credentials.password);
|
||||||
await elementById('input.password').tapReturnKey();
|
await elementById('input.password').tapReturnKey();
|
||||||
await sleep(5000);
|
await sleep(5000);
|
||||||
|
|
||||||
await tapByText('Settings');
|
await tapByText('Settings');
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
await elementById('scrollview').scrollToIndex(6);
|
await elementById('scrollview').scrollToIndex(6);
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
const { notesnook } = require('../test.ids');
|
const { navigate, tapByText, prepare, sleep } = require('./utils');
|
||||||
const { navigate, tapByText, prepare } = require('./utils');
|
|
||||||
const { sleep } = require('./utils');
|
|
||||||
|
|
||||||
describe('APP LAUNCH AND NAVIGATION', () => {
|
describe('APP LAUNCH AND NAVIGATION', () => {
|
||||||
it('App should launch successfully & hide welcome screen', async () => {
|
it('App should launch successfully & hide welcome screen', async () => {
|
||||||
|
|||||||
@@ -7,12 +7,9 @@ const {
|
|||||||
prepare,
|
prepare,
|
||||||
visibleById,
|
visibleById,
|
||||||
notVisibleById,
|
notVisibleById,
|
||||||
elementById,
|
sleep,
|
||||||
tapByText,
|
exitEditor
|
||||||
matchSnapshot,
|
|
||||||
elementByText
|
|
||||||
} = require('./utils');
|
} = require('./utils');
|
||||||
const { sleep } = require('./utils');
|
|
||||||
|
|
||||||
describe('NOTE TESTS', () => {
|
describe('NOTE TESTS', () => {
|
||||||
it('Create a note in editor', async () => {
|
it('Create a note in editor', async () => {
|
||||||
@@ -24,7 +21,7 @@ describe('NOTE TESTS', () => {
|
|||||||
await prepare();
|
await prepare();
|
||||||
await createNote();
|
await createNote();
|
||||||
await tapById(notesnook.ids.note.get(1));
|
await tapById(notesnook.ids.note.get(1));
|
||||||
await tapById(notesnook.editor.back);
|
await exitEditor();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Notes properties should show', async () => {
|
it('Notes properties should show', async () => {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const { notesnook } = require('../test.ids');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { expect: jestExpect } = require('@jest/globals');
|
const { expect: jestExpect } = require('@jest/globals');
|
||||||
const { toMatchImageSnapshot } = require('jest-image-snapshot');
|
const { toMatchImageSnapshot } = require('jest-image-snapshot');
|
||||||
|
const detox = require('detox');
|
||||||
jestExpect.extend({ toMatchImageSnapshot });
|
jestExpect.extend({ toMatchImageSnapshot });
|
||||||
|
|
||||||
const sleep = duration =>
|
const sleep = duration =>
|
||||||
@@ -13,17 +14,8 @@ const sleep = duration =>
|
|||||||
);
|
);
|
||||||
|
|
||||||
async function LaunchApp() {
|
async function LaunchApp() {
|
||||||
await expect(element(by.id('notesnook.splashscreen'))).toBeVisible();
|
await expect(element(by.id(notesnook.ids.default.root))).toBeVisible();
|
||||||
await sleep(500);
|
await sleep(500);
|
||||||
await element(by.text('Get started')).tap();
|
|
||||||
await sleep(500);
|
|
||||||
await element(by.text('Next')).tap();
|
|
||||||
|
|
||||||
await sleep(500);
|
|
||||||
await element(by.text('Create your account')).tap();
|
|
||||||
await sleep(500);
|
|
||||||
await element(by.text('Skip for now')).tap();
|
|
||||||
await sleep(300);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function elementById(id) {
|
function elementById(id) {
|
||||||
@@ -58,18 +50,21 @@ async function notVisibleByText(text) {
|
|||||||
await expect(elementByText(text)).not.toBeVisible();
|
await expect(elementByText(text)).not.toBeVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function exitEditor() {
|
||||||
|
await detox.device.pressBack();
|
||||||
|
await detox.device.pressBack();
|
||||||
|
}
|
||||||
|
|
||||||
async function createNote(_title, _body) {
|
async function createNote(_title, _body) {
|
||||||
let title = _title || 'Test note description that ';
|
let title = _title || 'Test note description that ';
|
||||||
let body = _body || 'Test note description that is very long and should not fit in text.';
|
let body = _body || 'Test note description that is very long and should not fit in text.';
|
||||||
|
|
||||||
await tapById(notesnook.buttons.add);
|
await tapById(notesnook.buttons.add);
|
||||||
await elementById(notesnook.editor.id).tap({
|
let webview = web(by.id(notesnook.editor.id));
|
||||||
x: 15,
|
await expect(webview.element(by.web.className('ProseMirror'))).toExist();
|
||||||
y: 15
|
await webview.element(by.web.className('ProseMirror')).tap();
|
||||||
});
|
await webview.element(by.web.className('ProseMirror')).typeText(body, true);
|
||||||
await elementById(notesnook.editor.id).typeText(body);
|
await exitEditor();
|
||||||
await tapById(notesnook.editor.back);
|
|
||||||
await sleep(500);
|
|
||||||
await expect(element(by.text(body))).toBeVisible();
|
await expect(element(by.text(body))).toBeVisible();
|
||||||
|
|
||||||
return { title, body };
|
return { title, body };
|
||||||
@@ -127,5 +122,6 @@ module.exports = {
|
|||||||
tapByText,
|
tapByText,
|
||||||
elementByText,
|
elementByText,
|
||||||
elementById,
|
elementById,
|
||||||
sleep
|
sleep,
|
||||||
|
exitEditor
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
import { Dimensions } from 'react-native';
|
import { Dimensions } from 'react-native';
|
||||||
|
import Config from 'react-native-config';
|
||||||
import { FileType } from 'react-native-scoped-storage';
|
import { FileType } from 'react-native-scoped-storage';
|
||||||
import create, { State } from 'zustand';
|
import create, { State } from 'zustand';
|
||||||
import { ACCENT } from '../utils/color-scheme';
|
import { ACCENT } from '../utils/color-scheme';
|
||||||
@@ -93,7 +94,7 @@ export const useSettingStore = create<SettingStore>((set, get) => ({
|
|||||||
reduceAnimations: false,
|
reduceAnimations: false,
|
||||||
rateApp: false,
|
rateApp: false,
|
||||||
migrated: false,
|
migrated: false,
|
||||||
introCompleted: false,
|
introCompleted: Config.isTesting ? true : false,
|
||||||
nextBackupRequestTime: undefined,
|
nextBackupRequestTime: undefined,
|
||||||
lastBackupDate: undefined,
|
lastBackupDate: undefined,
|
||||||
userEmailConfirmed: false,
|
userEmailConfirmed: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user