mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
update test for checking delete & restore note
This commit is contained in:
@@ -6,6 +6,15 @@ export const notesnook = {
|
||||
buttons:{
|
||||
add:"buttons.add"
|
||||
},
|
||||
toast: {
|
||||
button:"toast.button"
|
||||
},
|
||||
listitem:{
|
||||
menu:"listitem.menu"
|
||||
},
|
||||
list:{
|
||||
id:"list.id"
|
||||
},
|
||||
ids: {
|
||||
default: {
|
||||
root: 'root',
|
||||
|
||||
@@ -13,7 +13,7 @@ const {
|
||||
const {sleep} = require('./utils.test');
|
||||
|
||||
beforeAll(async () => {
|
||||
await device.reloadReactNative();
|
||||
await device.launchApp();
|
||||
});
|
||||
|
||||
describe('Basic tests', () => {
|
||||
@@ -32,13 +32,14 @@ describe('Basic tests', () => {
|
||||
await navigate('Notes');
|
||||
});
|
||||
|
||||
it('Create 10 notes', async () => {
|
||||
let numOfnotes = 10;
|
||||
it('Create 3 notes', async () => {
|
||||
let numOfnotes = 3;
|
||||
|
||||
for (let i = 0; i < numOfnotes; i++) {
|
||||
let title = 'Test note description that ';
|
||||
let body =
|
||||
'Test note description that is very long and should not fit in text.' + i;
|
||||
'Test note description that is very long and should not fit in text.' +
|
||||
i;
|
||||
|
||||
await tapById(notesnook.buttons.add);
|
||||
await elementById(notesnook.editor.id).tap({
|
||||
@@ -49,11 +50,22 @@ describe('Basic tests', () => {
|
||||
await tapById(notesnook.editor.back);
|
||||
await expect(elementByText(title).atIndex(0)).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await tapById(notesnook.ids.note.get(1));
|
||||
await tapById(notesnook.editor.back);
|
||||
};
|
||||
it('Open and close a note', async () => {
|
||||
await tapById(notesnook.ids.note.get(1));
|
||||
await tapById(notesnook.editor.back);
|
||||
|
||||
});
|
||||
|
||||
it('Delete & restore a note', async () => {
|
||||
await tapById(notesnook.listitem.menu);
|
||||
await tapById("icon-Delete");
|
||||
await tapById(notesnook.toast.button);
|
||||
await visibleByText("Test note description that is very long and should not fit in text.2");
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import {Platform, View} from 'react-native';
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import { notesnook } from '../../../e2e/test.ids';
|
||||
import {useTracked} from '../../provider';
|
||||
import {useSettingStore, useTagStore} from '../../provider/stores';
|
||||
import {eSendEvent} from '../../services/EventManager';
|
||||
@@ -294,6 +295,7 @@ const NoteItem = ({item, isTrash, tags}) => {
|
||||
</View>
|
||||
</View>
|
||||
<ActionIcon
|
||||
testID={notesnook.listitem.menu}
|
||||
color={colors.pri}
|
||||
name="dots-horizontal"
|
||||
size={SIZE.xl}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { FlatList, RefreshControl, View } from 'react-native';
|
||||
import { notesnook } from '../../../e2e/test.ids';
|
||||
import { useTracked } from '../../provider';
|
||||
import { eSendEvent } from '../../services/EventManager';
|
||||
import Sync from '../../services/Sync';
|
||||
@@ -133,6 +134,7 @@ const SimpleList = ({
|
||||
style={styles}
|
||||
keyExtractor={_keyExtractor}
|
||||
ref={scrollRef}
|
||||
testID={notesnook.list.id}
|
||||
data={_loading ? listData.slice(0, 9) : listData}
|
||||
renderItem={renderItem}
|
||||
onScroll={_onScroll}
|
||||
|
||||
@@ -3,6 +3,7 @@ import {Keyboard, View} from 'react-native';
|
||||
import Animated, {Easing, useValue} from 'react-native-reanimated';
|
||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import { notesnook } from '../../../e2e/test.ids';
|
||||
import {useTracked} from '../../provider';
|
||||
import {DDS} from '../../services/DeviceDetection';
|
||||
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
||||
@@ -243,6 +244,7 @@ export const Toast = ({context = 'global'}) => {
|
||||
|
||||
{data.func ? (
|
||||
<Button
|
||||
testID={notesnook.toast.button}
|
||||
fontSize={SIZE.md}
|
||||
type={data.type === 'error' ? 'errorShade' : 'transparent'}
|
||||
onPress={data.func}
|
||||
|
||||
Reference in New Issue
Block a user