Files
notesnook/apps/mobile/e2e/tests/auth.e2e.ts

80 lines
2.5 KiB
TypeScript
Raw Permalink Normal View History

/*
This file is part of the Notesnook project (https://notesnook.com/)
2023-01-16 13:44:52 +05:00
Copyright (C) 2023 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-30 16:13:11 +05:00
2023-01-06 11:15:35 +05:00
import { authenticator } from "otplib";
import { TestBuilder } from "./utils";
2022-04-01 00:53:37 +05:00
2023-01-06 11:15:35 +05:00
import dotenv from "dotenv";
import path from "path";
dotenv.config({ path: path.join(__dirname, ".env.local") });
const USER = {
login: {
email: process.env.USER_EMAIL,
password: process.env.CURRENT_USER_PASSWORD,
key: process.env.CURRENT_USER_KEY,
totpSecret: process.env.USER_TOTP_SECRET
}
2022-04-03 15:06:18 +05:00
};
2023-01-06 11:15:35 +05:00
// async function deleteAccount() {
// await tapByText("Account Settings");
// await sleep(2000);
// await tapByText("Delete account");
// await elementById("input-value").typeText(USER.password);
// await tapByText("Delete");
// await sleep(5000);
// }
2022-08-09 16:40:02 +05:00
2023-01-06 11:15:35 +05:00
// async function signup() {
// await tapByText("Login to sync your notes.");
// await sleep(500);
// await tapByText("Don't have an account? Sign up");
// await elementById("input.email").typeText(USER.signup.email);
// await elementById("input.password").typeText(USER.signup.password);
// await elementById("input.confirmPassword").typeText(USER.signup.password);
// await elementById("input.confirmPassword").tapReturnKey();
// }
2022-08-09 16:40:02 +05:00
async function login() {
await TestBuilder.create()
.waitAndTapByText("Login to encrypt and sync notes")
.typeTextById("input.email", USER.login.email!)
.tapReturnKeyById("input.email")
.wait(3000)
.typeTextById("input.totp", authenticator.generate(USER.login.totpSecret!))
.waitAndTapByText("Next")
.wait(3000)
.typeTextById("input.password", USER.login.password!)
.tapReturnKeyById("input.password")
.run();
}
describe("AUTH", () => {
2025-02-17 14:45:04 +05:00
it("Login", async () => {
await TestBuilder.create()
.prepare()
.addStep(login)
.wait(3000)
.isNotVisibleByText("Notesnook Plans")
.run();
2022-04-01 00:53:37 +05:00
});
});