Skip to content

Commit

Permalink
Merge pull request #8734 from LedgerHQ/support/qaa-396_fix_detox_test
Browse files Browse the repository at this point in the history
[QAA-396][Detox] Fix flaky manager/onboarding tests
  • Loading branch information
abdurrahman-ledger authored Dec 19, 2024
2 parents 202a351 + 93b7d47 commit eccd715
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
11 changes: 4 additions & 7 deletions apps/ledger-live-mobile/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,14 @@ function sync_delay(ms: number) {
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(element(by.id(id)))
export function waitForElementById(id: string | RegExp, timeout: number = DEFAULT_TIMEOUT) {
return waitFor(element(by.id(id)))
.toBeVisible()
.withTimeout(timeout);
}

export async function waitForElementByText(
text: string | RegExp,
timeout: number = DEFAULT_TIMEOUT,
) {
return await waitFor(element(by.text(text)))
export function waitForElementByText(text: string | RegExp, timeout: number = DEFAULT_TIMEOUT) {
return waitFor(element(by.text(text)))
.toBeVisible()
.withTimeout(timeout);
}
Expand Down
3 changes: 2 additions & 1 deletion apps/ledger-live-mobile/e2e/page/common.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default class CommonPage {
addDeviceButton = () => getElementById("connect-with-bluetooth");
scannedDeviceRow = (id: string) => `device-scanned-${id}`;
pluggedDeviceRow = (nano: DeviceUSB) => `device-item-usb|${JSON.stringify(nano)}`;
blePairingLoadingId = "ble-pairing-loading";
deviceRowRegex = /device-item-.*/;

@Step("Perform search")
Expand Down Expand Up @@ -88,8 +89,8 @@ export default class CommonPage {
await bridge.addDevicesBT(device);
await waitForElementById(this.scannedDeviceRow(device.id));
await tapById(this.scannedDeviceRow(device.id));
await waitForElementById(this.blePairingLoadingId);
await bridge.open();
await deviceAction.waitForSpinner();
await deviceAction.accessManager();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,14 @@ const BleDevicePairing = ({ deviceToPair, onPaired, onRetry }: BleDevicePairingP
<Flex width="100%" py={16} alignItems="center">
<Flex height={100} justifyContent="center">
<BoxedIcon
Icon={<InfiniteLoader color="primary.c80" size={32} mock={Config.DETOX} />}
Icon={
<InfiniteLoader
color="primary.c80"
size={32}
mock={Config.DETOX}
testID="ble-pairing-loading"
/>
}
backgroundColor={colors.opacityDefault.c05}
size={64}
variant="circle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,11 +884,9 @@ export function renderLoading({
return (
<Wrapper>
<SpinnerContainer>
<InfiniteLoader mock={Config.DETOX} />
<InfiniteLoader mock={Config.DETOX} testID="device-action-loading" />
</SpinnerContainer>
<CenteredText testID="device-action-loading">
{description ?? t("DeviceAction.loading")}
</CenteredText>
<CenteredText>{description ?? t("DeviceAction.loading")}</CenteredText>
{lockModal ? <ModalLock /> : null}
</Wrapper>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function InfiniteLoader({
size = 38,
color = "primary.c50",
mock = false,
testID = "",
...extraProps
}: Props): JSX.Element {
const rotation = useSharedValue(0);
Expand Down Expand Up @@ -59,6 +60,7 @@ export default function InfiniteLoader({
return (
<Animated.View
style={[{ display: "flex", justifyContent: "center", alignItems: "center" }, animatedStyles]}
testID={testID}
>
<Loader
size={size}
Expand Down

0 comments on commit eccd715

Please sign in to comment.