Skip to content

Commit

Permalink
Merge pull request #6849 from LedgerHQ/support/B2CQA_Detox_fix_flakiness
Browse files Browse the repository at this point in the history
[B2CQA][Detox] Reduce NTFGallery et WebView testing flakiness
  • Loading branch information
abdurrahman-ledger committed May 16, 2024
2 parents 7869330 + 954a91b commit 8a065af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 9 additions & 4 deletions apps/ledger-live-mobile/e2e/models/discover/getDevicePage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { web, by } from "detox";
import { getElementById, tapByElement } from "../../helpers";
import { getElementById, isAndroid, tapByElement } from "../../helpers";

export default class GetDevicePage {
buyNanoButton = () => getElementById("getDevice-buy-button");
Expand All @@ -9,8 +9,13 @@ export default class GetDevicePage {
}

async expectBuyNanoWebPage() {
const url = await web.element(by.web.id("__next")).getCurrentUrl();
const expectedUrl = "https://shop.ledger.com/";
expect(url).toContain(expectedUrl);
// Webview testing is flaky on Android
if (!isAndroid()) {
const url = await web.element(by.web.id("__next")).getCurrentUrl();
const expectedUrl = "https://shop.ledger.com/";
expect(url).toContain(expectedUrl);
} else {
console.warn("Skipping webview check on Android");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import FiltersIcon from "~/icons/Filters";
import { ScreenName } from "~/const";
import WalletTabSafeAreaView from "../../WalletTab/WalletTabSafeAreaView";
import { withDiscreetMode } from "~/context/DiscreetModeContext";
import Config from "react-native-config";

const RefreshableCollapsibleHeaderFlatList = globalSyncRefreshControl<FlatListProps<ProtoNFT>>(
CollapsibleHeaderFlatList,
Expand Down Expand Up @@ -81,6 +82,9 @@ const NftList = ({ data, hasNextPage, fetchNextPage, isLoading }: Props) => {
],
};

const Fade_In_Down = Config.MOCK ? undefined : FadeInDown;
const Fade_Out_Down = Config.MOCK ? undefined : FadeOutDown;

const renderItem = useCallback(
({ item, index }: { item: ProtoNFT; index: number; count?: number }) => (
<Flex
Expand Down Expand Up @@ -127,7 +131,7 @@ const NftList = ({ data, hasNextPage, fetchNextPage, isLoading }: Props) => {
<WalletTabSafeAreaView edges={["left", "right"]}>
<Animated.View>
{!multiSelectModeEnabled && (
<Animated.View entering={FadeInDown}>
<Animated.View entering={Fade_In_Down}>
<StyledFilterBar
width="100%"
flexDirection="row"
Expand Down Expand Up @@ -205,7 +209,7 @@ const NftList = ({ data, hasNextPage, fetchNextPage, isLoading }: Props) => {
{data.length > 12 ? <ScrollToTopButton /> : null}
<Animated.View>
{multiSelectModeEnabled && (
<Animated.View entering={FadeInDown} exiting={FadeOutDown}>
<Animated.View entering={Fade_In_Down} exiting={Fade_Out_Down}>
<BackgroundGradient {...gradient} />

<ButtonsContainer width="100%" justifyContent={"space-between"}>
Expand Down

0 comments on commit 8a065af

Please sign in to comment.