fix tests not passing

This commit is contained in:
ammarahm-ed
2020-11-30 21:49:59 +05:00
parent 6206b3403f
commit b6984121fd
5 changed files with 42 additions and 16 deletions

View File

@@ -1,34 +1,35 @@
export const notesnook = {
ids: {
default: {
root: '1',
menu: '2',
root: 'root_1',
menu: 'menu_2',
dialog: {
yes: '3',
no: '4',
yes: 'yes_3',
no: 'no_4',
},
editor: '5',
editor: 'editor_5',
header: {
buttons: {
left: '6',
right: '7',
left: 'left_6',
right: 'right_7',
back:'back_13'
},
},
},
dialogs: {
notebook: {
inputs: {
title: '8',
description: '9',
topic: '10',
title: 'title_8',
description: 'description_9',
topic: 'topic_10',
},
buttons: {
add: '11',
add: 'add_11',
},
},
},
menu: {
nightmode:"12"
nightmode:"night_12"
}
},
};

View File

@@ -8,14 +8,19 @@ it('App initialization', async () => {
it('Drawer Navigation', async () => {
let menu = element(by.id(notesnook.ids.default.header.buttons.left));
await menu.tap();
await element(by.text('Notebooks')).tap();
await sleep(100)
await element(by.text('Notebooks')).tap();
menu.tap();
await sleep(100)
await element(by.text('Favorites')).tap();
menu.tap();
await sleep(100)
await element(by.text('Trash')).tap();
menu.tap();
await sleep(100)
await element(by.text('Tags')).tap();
menu.tap();
await sleep(100)
await element(by.text('Settings')).tap();
});
@@ -23,9 +28,13 @@ it('Drawer Navigation', async () => {
it('Dark Mode', async () => {
let menu = element(by.id(notesnook.ids.default.header.buttons.left));
menu.tap();
await sleep(100)
let nightmode = element(by.id(notesnook.ids.menu.nightmode))
await sleep(100)
await nightmode.tap();
await nightmode.tap();
await sleep(100)
await nightmode.tap();
await sleep(100)
menu.tap();
});

View File

@@ -0,0 +1,13 @@
const { notesnook } = require("../test.ids");
const { sleep } = require("./utils.test");
it('Take a new note', async () => {
await element(by.text('Add your First Note')).tap();
await sleep(100)
const editor = element(by.id(notesnook.ids.default.editor));
await sleep(100)
await editor.typeText('This is the text of **the note. which is working');
await sleep(100)
await element(by.id(notesnook.ids.default.header.buttons.back)).tap();
});

View File

@@ -1,2 +1,4 @@
export const sleep = (duration) =>
new Promise((resolve) => setTimeout(() => resolve(), duration));
new Promise((resolve) => setTimeout(() => resolve(), duration));
//"\\.e2e\\.js$",

View File

@@ -2,6 +2,7 @@ import React, {useEffect} from 'react';
import {BackHandler, Keyboard, Platform, View} from 'react-native';
import RNExitApp from 'react-native-exit-app';
import {useSafeAreaInsets} from 'react-native-safe-area-context';
import { notesnook } from '../../../e2e/test.ids';
import {ActionIcon} from '../../components/ActionIcon';
import {
ActionSheetEvent,
@@ -179,7 +180,7 @@ const EditorHeader = () => {
}}>
{DDS.isLargeTablet() && !fullscreen ? null : (
<ActionIcon
testID="editor_back_key"
testID={notesnook.ids.default.header.buttons.back}
name="arrow-left"
color={colors.heading}
onPress={_onBackPress}