Files
notesnook/apps/mobile/e2e/globalSetup.ts

32 lines
970 B
TypeScript
Raw Normal View History

2024-11-11 18:44:28 +05:00
import { execSync } from "child_process";
2025-10-28 12:00:38 +05:00
//@ts-ignore
2024-11-11 18:44:28 +05:00
import { pathExists, ensureDir } from "fs-extra";
import { resolveConfig } from "detox/internals";
import { globalSetup } from "detox/runners/jest";
export default async function customGlobalSetup() {
const config = await resolveConfig();
2025-02-17 14:45:04 +05:00
//@ts-ignore
globalThis["DEBUG_MODE"] = config.configurationName;
2024-11-11 18:44:28 +05:00
if (config.device.type === "android.emulator") {
await downloadTestButlerAPK();
}
await globalSetup();
}
async function downloadTestButlerAPK() {
const version = "2.2.1";
const artifactUrl = `https://repo1.maven.org/maven2/com/linkedin/testbutler/test-butler-app/${version}/test-butler-app-${version}.apk`;
const filePath = `cache/test-butler-app.apk`;
await ensureDir("cache");
if (!(await pathExists(filePath))) {
console.log(`\nDownloading Test-Butler APK v${version}...`);
execSync(`curl -f -o ${filePath} ${artifactUrl}`);
}
}
module.exports = customGlobalSetup;