BlueWallet/tests/e2e/setup.js
pietro909 e37c4a693c
Some checks are pending
Build Release and Upload to TestFlight (iOS) / build (push) Waiting to run
Build Release and Upload to TestFlight (iOS) / testflight-upload (push) Blocked by required conditions
BuildReleaseApk / buildReleaseApk (push) Waiting to run
BuildReleaseApk / browserstack (push) Blocked by required conditions
OPS: upgrade Arkade SDKs and harden Ark wallet integration (#8585)
2026-06-01 15:22:17 +01:00

35 lines
1.3 KiB
JavaScript

/* eslint-env jest */
/* global device */
// Detox's iOS network synchronization waits on all in-flight NSURLSession
// requests before considering the app idle. The Arkade SDK's indexer opens
// a long-lived SSE-style stream (`expo/fetch` →
// /v1/indexer/script/subscription/<id>) that never completes during the
// test's lifetime, so every action would time out waiting for idle.
//
// Tell Detox to ignore that endpoint. The blacklist is process-scoped on
// iOS, so we re-apply it after every launchApp.
const URL_BLACKLIST = ['.*arkade\\.computer/v1/indexer/script/subscription.*', '.*groundcontrol-bluewallet\\.herokuapp\\.com.*'];
beforeAll(async () => {
if (typeof device === 'undefined' || !device?.launchApp) return;
const originalLaunchApp = device.launchApp.bind(device);
device.launchApp = async (...args) => {
const result = await originalLaunchApp(...args);
try {
await device.setURLBlacklist(URL_BLACKLIST);
} catch (e) {
console.log('[detox-setup] setURLBlacklist after launchApp failed:', e?.message ?? e);
}
return result;
};
// Detox auto-launches the app before the first beforeAll; cover that launch too.
try {
await device.setURLBlacklist(URL_BLACKLIST);
} catch (e) {
console.log('[detox-setup] initial setURLBlacklist failed:', e?.message ?? e);
}
});