2022-08-30 16:13:11 +05:00
|
|
|
/* This file is part of the Notesnook project (https://notesnook.com/)
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2022 Streetwriters (Private) Limited
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-08-27 15:23:11 +05:00
|
|
|
import {
|
2022-04-01 00:53:37 +05:00
|
|
|
tapByText,
|
|
|
|
|
prepare,
|
|
|
|
|
openSideMenu,
|
|
|
|
|
elementById,
|
2022-08-27 15:23:11 +05:00
|
|
|
visibleByText,
|
|
|
|
|
sleep
|
|
|
|
|
} from "./utils";
|
2022-04-01 00:53:37 +05:00
|
|
|
|
2022-04-03 15:06:18 +05:00
|
|
|
const credentials = {
|
2022-08-26 16:19:39 +05:00
|
|
|
username: "testaccount1@notesnook.com",
|
|
|
|
|
password: "testaccount@123"
|
2022-04-03 15:06:18 +05:00
|
|
|
};
|
|
|
|
|
|
2022-08-09 16:40:02 +05:00
|
|
|
async function login() {
|
2022-08-26 16:19:39 +05:00
|
|
|
await tapByText("Login to sync your notes.");
|
|
|
|
|
await elementById("input.email").typeText(credentials.username);
|
|
|
|
|
await elementById("input.password").typeText(credentials.password);
|
|
|
|
|
await elementById("input.password").tapReturnKey();
|
2022-08-09 16:40:02 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function deleteAccount() {
|
2022-08-26 16:19:39 +05:00
|
|
|
await tapByText("Account Settings");
|
2022-08-09 16:40:02 +05:00
|
|
|
await sleep(2000);
|
2022-08-26 16:19:39 +05:00
|
|
|
await tapByText("Delete account");
|
|
|
|
|
await elementById("input-value").typeText(credentials.password);
|
|
|
|
|
await tapByText("Delete");
|
2022-08-09 16:40:02 +05:00
|
|
|
await sleep(5000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function signup() {
|
2022-08-26 16:19:39 +05:00
|
|
|
await tapByText("Login to sync your notes.");
|
2022-08-09 16:40:02 +05:00
|
|
|
await sleep(500);
|
2022-08-27 15:23:11 +05:00
|
|
|
await tapByText("Don't have an account? Sign up");
|
2022-08-26 16:19:39 +05:00
|
|
|
await elementById("input.email").typeText(credentials.username);
|
|
|
|
|
await elementById("input.password").typeText(credentials.password);
|
|
|
|
|
await elementById("input.confirmPassword").typeText(credentials.password);
|
|
|
|
|
await elementById("input.confirmPassword").tapReturnKey();
|
2022-08-09 16:40:02 +05:00
|
|
|
}
|
|
|
|
|
|
2022-08-26 16:19:39 +05:00
|
|
|
describe("AUTH", () => {
|
|
|
|
|
it("Sign up", async () => {
|
2022-04-03 15:06:18 +05:00
|
|
|
await prepare();
|
|
|
|
|
await openSideMenu();
|
2022-08-09 16:40:02 +05:00
|
|
|
await signup();
|
2022-04-03 15:06:18 +05:00
|
|
|
await sleep(5000);
|
|
|
|
|
await device.pressBack();
|
2022-08-09 16:40:02 +05:00
|
|
|
await sleep(5000);
|
|
|
|
|
await openSideMenu();
|
2022-08-26 16:19:39 +05:00
|
|
|
await visibleByText("Tap here to sync your notes.");
|
2022-04-03 15:06:18 +05:00
|
|
|
});
|
|
|
|
|
|
2022-08-26 16:19:39 +05:00
|
|
|
it("Login to account", async () => {
|
2022-04-01 00:53:37 +05:00
|
|
|
await prepare();
|
|
|
|
|
await openSideMenu();
|
2022-08-09 16:40:02 +05:00
|
|
|
await login();
|
|
|
|
|
await sleep(10000);
|
|
|
|
|
await openSideMenu();
|
2022-08-26 16:19:39 +05:00
|
|
|
await visibleByText("Tap here to sync your notes.");
|
2022-04-01 00:53:37 +05:00
|
|
|
});
|
2022-04-03 15:06:18 +05:00
|
|
|
|
2022-08-26 16:19:39 +05:00
|
|
|
it("Delete account", async () => {
|
2022-04-03 15:06:18 +05:00
|
|
|
await prepare();
|
|
|
|
|
await openSideMenu();
|
2022-08-09 16:40:02 +05:00
|
|
|
await login();
|
|
|
|
|
await sleep(15000);
|
|
|
|
|
await openSideMenu();
|
2022-08-26 16:19:39 +05:00
|
|
|
await tapByText("Settings");
|
2022-04-03 15:06:18 +05:00
|
|
|
await sleep(1000);
|
2022-08-09 16:40:02 +05:00
|
|
|
await deleteAccount();
|
2022-04-03 15:06:18 +05:00
|
|
|
});
|
2022-04-01 00:53:37 +05:00
|
|
|
});
|