From daf397f08f4eb3eddd19a53300811e92f03a62c4 Mon Sep 17 00:00:00 2001 From: Abdurrahman SASTIM Date: Wed, 11 Dec 2024 11:29:28 +0100 Subject: [PATCH] test: workaround for iOS RN75 incompatibility --- apps/ledger-live-mobile/e2e/helpers.ts | 8 ++++++++ .../e2e/specs/onboardingReadOnly.spec.ts | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/ledger-live-mobile/e2e/helpers.ts b/apps/ledger-live-mobile/e2e/helpers.ts index bdc5d54f1eb3..a9a7c7b82350 100644 --- a/apps/ledger-live-mobile/e2e/helpers.ts +++ b/apps/ledger-live-mobile/e2e/helpers.ts @@ -26,6 +26,11 @@ const MAX_PORT = 65535; let portCounter = BASE_PORT; // Counter for generating unique ports const speculosDevices: [number, SpeculosDevice][] = []; +function sync_delay(ms: number) { + const done = new Int32Array(new SharedArrayBuffer(4)); + Atomics.wait(done, 0, 0, ms); // Wait for the specified duration +} + export async function waitForElementById(id: string | RegExp, timeout: number = DEFAULT_TIMEOUT) { return await waitFor(getElementById(id)).toBeVisible().withTimeout(timeout); } @@ -38,10 +43,12 @@ export async function waitForElementByText( } export function getElementById(id: string | RegExp, index = 0) { + if (!isAndroid()) sync_delay(200); // Issue with RN75 : QAA-370 return element(by.id(id)).atIndex(index); } export function getElementByText(text: string | RegExp, index = 0) { + if (!isAndroid()) sync_delay(200); // Issue with RN75 : QAA-370 return element(by.text(text)).atIndex(index); } @@ -90,6 +97,7 @@ async function performScroll( const scrollViewMatcher = scrollViewId ? by.id(scrollViewId) : by.type(isAndroid() ? "android.widget.ScrollView" : "RCTScrollView"); + if (!isAndroid()) sync_delay(200); // Issue with RN75 : QAA-370 await waitFor(element(elementMatcher)) .toBeVisible() .whileElement(scrollViewMatcher) diff --git a/apps/ledger-live-mobile/e2e/specs/onboardingReadOnly.spec.ts b/apps/ledger-live-mobile/e2e/specs/onboardingReadOnly.spec.ts index 42adfc7cf4ed..914b5dd85ecc 100644 --- a/apps/ledger-live-mobile/e2e/specs/onboardingReadOnly.spec.ts +++ b/apps/ledger-live-mobile/e2e/specs/onboardingReadOnly.spec.ts @@ -19,8 +19,7 @@ describe("Onboarding - Read Only", () => { $TmsLink("B2CQA-1753"); $TmsLink("B2CQA-1806"); it("goes through discover app and should see an empty portfolio page", async () => { - await device.launchApp(); - await device.reloadReactNative(); + await device.launchApp({ newInstance: true }); await app.onboarding.startOnboarding(); await app.onboarding.chooseNoLedgerYet(); await app.onboarding.chooseToExploreApp();