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