mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
tests: pin & favorite
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
const {beforeEach} = require('detox');
|
||||
const detox = require('detox');
|
||||
const {beforeAll, test, describe} = require('jest-circus');
|
||||
const {notesnook} = require('../test.ids');
|
||||
const {
|
||||
LaunchApp,
|
||||
@@ -11,12 +8,39 @@ const {
|
||||
tapByText,
|
||||
elementByText,
|
||||
createNote,
|
||||
prepare
|
||||
prepare,
|
||||
visibleById
|
||||
} = require('./misc.e2e');
|
||||
|
||||
describe('Basic tests', () => {
|
||||
it('Favorite and unfavorite a note', async () => {
|
||||
await prepare();
|
||||
let note = await createNote();
|
||||
await tapById(notesnook.listitem.menu);
|
||||
await tapById('icon-Favorite');
|
||||
await visibleById('icon-star');
|
||||
await navigate('Favorites');
|
||||
await visibleByText(note.body);
|
||||
await tapById(notesnook.listitem.menu);
|
||||
await tapById('icon-Favorite');
|
||||
await expect(element(by.text(note.body))).not.toBeVisible();
|
||||
await navigate('Notes');
|
||||
});
|
||||
|
||||
it('Pin and upin a note', async () => {
|
||||
await prepare();
|
||||
await createNote();
|
||||
await tapById(notesnook.listitem.menu);
|
||||
await tapById('icon-Pin');
|
||||
await visibleByText('Pinned');
|
||||
await visibleById('icon-pinned');
|
||||
await tapById(notesnook.listitem.menu);
|
||||
await tapById('icon-Pin');
|
||||
expect(element(by.id('icon-pinned'))).not.toBeVisible();
|
||||
});
|
||||
|
||||
it('App should launch successfully & hide welcome screen', async () => {
|
||||
await LaunchApp();
|
||||
await prepare();
|
||||
});
|
||||
|
||||
it('Basic navigation should work', async () => {
|
||||
|
||||
@@ -51,6 +51,8 @@ export async function createNote() {
|
||||
await tapById(notesnook.editor.back);
|
||||
await sleep(500);
|
||||
await expect(element(by.text(body))).toBeVisible();
|
||||
|
||||
return {title,body};
|
||||
}
|
||||
|
||||
export async function navigate(screen) {
|
||||
@@ -60,7 +62,16 @@ export async function navigate(screen) {
|
||||
await elementByText(screen).tap();
|
||||
}
|
||||
|
||||
const testvars = {
|
||||
isFirstTest:true
|
||||
}
|
||||
|
||||
export async function prepare() {
|
||||
if (testvars.isFirstTest) {
|
||||
console.log("Launching App Directly without reset");
|
||||
testvars.isFirstTest = false;
|
||||
return await LaunchApp();
|
||||
}
|
||||
await device.reverseTcpPort(8081);
|
||||
await device.uninstallApp();
|
||||
await device.installApp();
|
||||
|
||||
@@ -189,6 +189,7 @@ const NoteItem = ({item, isTrash, tags, dateBy = 'dateCreated'}) => {
|
||||
|
||||
{item.pinned ? (
|
||||
<Icon
|
||||
testID="icon-pinned"
|
||||
name="pin-outline"
|
||||
size={SIZE.sm}
|
||||
style={{
|
||||
@@ -213,6 +214,7 @@ const NoteItem = ({item, isTrash, tags, dateBy = 'dateCreated'}) => {
|
||||
|
||||
{item.favorite ? (
|
||||
<Icon
|
||||
testID="icon-star"
|
||||
name="star"
|
||||
size={SIZE.md}
|
||||
style={{
|
||||
|
||||
Reference in New Issue
Block a user