Skip to content

Commit

Permalink
test: workaround for iOS RN75 incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
abdurrahman-ledger committed Dec 11, 2024
1 parent b3987c5 commit daf397f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions apps/ledger-live-mobile/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions apps/ledger-live-mobile/e2e/specs/onboardingReadOnly.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit daf397f

Please sign in to comment.