mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-25 07:59:48 +01:00
mobile: enable testing in debug build
This commit is contained in:
committed by
Abdullah Atta
parent
c540cb0fe4
commit
ea2bc359cb
@@ -7,6 +7,8 @@ import { globalSetup } from "detox/runners/jest";
|
||||
|
||||
export default async function customGlobalSetup() {
|
||||
const config = await resolveConfig();
|
||||
//@ts-ignore
|
||||
globalThis["DEBUG_MODE"] = config.configurationName;
|
||||
if (config.device.type === "android.emulator") {
|
||||
await downloadTestButlerAPK();
|
||||
}
|
||||
|
||||
@@ -18,14 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { authenticator } from "otplib";
|
||||
import {
|
||||
elementById,
|
||||
openSideMenu,
|
||||
prepare,
|
||||
sleep,
|
||||
tapByText,
|
||||
visibleByText
|
||||
} from "./utils";
|
||||
import { Tests } from "./utils";
|
||||
|
||||
import dotenv from "dotenv";
|
||||
import path from "path";
|
||||
@@ -42,16 +35,17 @@ const USER = {
|
||||
};
|
||||
|
||||
async function login() {
|
||||
await tapByText("Login to sync your notes.");
|
||||
await elementById("input.email").typeText(USER.login.email);
|
||||
await tapByText("Login");
|
||||
await sleep(3000);
|
||||
await elementById("input.totp").typeText(
|
||||
authenticator.generate(USER.login.totpSecret)
|
||||
await Tests.fromText("Login to encrypt and sync notes").tap();
|
||||
await Tests.fromId("input.email").element.typeText(USER.login.email!);
|
||||
await Tests.fromText("Continue").tap();
|
||||
await Tests.sleep(3000);
|
||||
await Tests.fromId("input.totp").element.typeText(
|
||||
authenticator.generate(USER.login.totpSecret!)
|
||||
);
|
||||
await sleep(3000);
|
||||
await elementById("input.password").typeText(USER.login.password);
|
||||
await elementById("input.password").tapReturnKey();
|
||||
await Tests.fromText("Next").tap();
|
||||
await Tests.sleep(3000);
|
||||
await Tests.fromId("input.password").element.typeText(USER.login.password!);
|
||||
await Tests.fromId("input.password").element.tapReturnKey();
|
||||
}
|
||||
|
||||
// async function deleteAccount() {
|
||||
@@ -74,12 +68,10 @@ async function login() {
|
||||
// }
|
||||
|
||||
describe("AUTH", () => {
|
||||
it.skip("Login", async () => {
|
||||
await prepare();
|
||||
await openSideMenu();
|
||||
it("Login", async () => {
|
||||
await Tests.prepare();
|
||||
await login();
|
||||
await sleep(10000);
|
||||
await openSideMenu();
|
||||
await visibleByText("Tap here to sync your notes.");
|
||||
await Tests.sleep(10000);
|
||||
await Tests.fromText("Login to encrypt and sync notes").isNotVisible();
|
||||
});
|
||||
});
|
||||
@@ -21,6 +21,20 @@ import { notesnook } from "../test.ids";
|
||||
import { Tests } from "./utils";
|
||||
|
||||
describe("Tags", () => {
|
||||
it("Create a tag", async () => {
|
||||
await Tests.prepare();
|
||||
await Tests.openSideMenu();
|
||||
await Tests.fromId("tab-tags").waitAndTap();
|
||||
|
||||
await Tests.fromText("No tags").isVisible();
|
||||
await Tests.fromId("sidebar-add-button").waitAndTap();
|
||||
|
||||
await Tests.fromId("input-value").element.typeText("testtag");
|
||||
|
||||
await Tests.fromText("Add").waitAndTap();
|
||||
await Tests.fromText("testtag").isVisible();
|
||||
});
|
||||
|
||||
it("Tag a note", async () => {
|
||||
await Tests.prepare();
|
||||
let note = await Tests.createNote();
|
||||
|
||||
@@ -74,7 +74,8 @@ const Tests = {
|
||||
awaitLaunch: async () => {
|
||||
await waitFor(element(by.id(notesnook.ids.default.root)))
|
||||
.toBeVisible()
|
||||
.withTimeout(500);
|
||||
//@ts-ignore
|
||||
.withTimeout(globalThis["DEBUG_MODE"] ? 4000 : 500);
|
||||
},
|
||||
sleep: (duration: number) => {
|
||||
return new Promise((resolve) =>
|
||||
|
||||
@@ -22,9 +22,10 @@ import {
|
||||
import {
|
||||
messages as $pseudo
|
||||
} from "@notesnook/intl/dist/locales/$pseudo-LOCALE.json";
|
||||
import Config from "react-native-config";
|
||||
|
||||
i18n.load({
|
||||
en: __DEV__ ? $pseudo : $en
|
||||
en: __DEV__ && Config.isTesting !== "true" ? $pseudo : $en
|
||||
});
|
||||
setI18nGlobal(i18n);
|
||||
i18n.activate("en");
|
||||
|
||||
Reference in New Issue
Block a user