Skip to content

Commit

Permalink
Fix e2e flakiness / errors (#6084)
Browse files Browse the repository at this point in the history
* fix

* test

* revert

* @walmat related fixes

* @walmat related fixes

* okay disabling the test again, the experimental flag didnt fix it

* okay disabling the test again, the experimental flag didnt fix it

* fix disabled NFTs in testing and rely on remote config for prod

* .
  • Loading branch information
BrodyHughes authored and greg-schrammel committed Sep 11, 2024
1 parent 96dfd8b commit 9feb469
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 29 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/macstadium-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ jobs:
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-

# Detox iOS e2e tests
- name: Run iOS e2e tests with retry
- name: Modify env and build app in release mode
run: |
sed -i'' -e "s/IS_TESTING=false/IS_TESTING=true/" .env && rm -f .env-e
yarn detox build --configuration ios.sim.release
./scripts/run-retry-tests.sh 3
- name: Detox iOS e2e tests
run: |
./scripts/run-retry-tests.sh 3
9 changes: 5 additions & 4 deletions e2e/9_swaps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ describe('Swap Sheet Interaction Flow', () => {
it('Should open swap screen with 50% inputAmount for inputAsset', async () => {
await device.disableSynchronization();
await tap('swap-button');
await delayTime('long');
await delayTime('very-long');

await swipeUntilVisible('token-to-buy-dai-1', 'token-to-buy-list', 'up', 100);
await swipe('token-to-buy-list', 'up', 'slow', 0.1);
// flaky
// await swipeUntilVisible('token-to-buy-dai-1', 'token-to-buy-list', 'up', 100);
await swipe('token-to-buy-list', 'up', 'slow', 0.2);

await tap('token-to-buy-dai-1');
await delayTime('medium');
await delayTime('very-long');

const swapInput = await fetchElementAttributes('swap-asset-input');

Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
],
},
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|react-native-keyboard-area|imgix-core-js|react-native-payments|@react-native-firebase|@react-native(-community)?|react-native-reanimated)/)',
'node_modules/(?!((jest-)?react-native|react-native-keyboard-area|imgix-core-js|react-native-payments|@react-native-firebase|@react-native(-community)?|react-native-reanimated|react-native-linear-gradient)/)',
],
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as i18n from '@/languages';
import { TokenFamilyHeaderHeight } from './NFTLoadingSkeleton';
import { MINTS, NFTS_ENABLED, useExperimentalFlag } from '@/config';
import { useRemoteConfig } from '@/model/remoteConfig';
import { IS_TEST } from '@/env';
import { useMints } from '@/resources/mints';
import { useAccountSettings } from '@/hooks';
import { GestureHandlerButton } from '@/__swaps__/screens/Swap/components/GestureHandlerButton';
Expand Down Expand Up @@ -66,8 +65,8 @@ export function NFTEmptyState() {
data: { featuredMint },
} = useMints({ walletAddress: accountAddress });

const nftsEnabled = (useExperimentalFlag(NFTS_ENABLED) || nfts_enabled) && !IS_TEST;
const mintsEnabled = (useExperimentalFlag(MINTS) || mints_enabled) && !IS_TEST;
const nftsEnabled = useExperimentalFlag(NFTS_ENABLED) || nfts_enabled;
const mintsEnabled = useExperimentalFlag(MINTS) || mints_enabled;

if (!nftsEnabled) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { opacity } from '@/__swaps__/utils/swaps';
import { deviceUtils } from '@/utils';
import { NFTS_ENABLED, useExperimentalFlag } from '@/config';
import { useRemoteConfig } from '@/model/remoteConfig';
import { IS_TEST } from '@/env';

export const TokenFamilyHeaderHeight = 50;

Expand Down Expand Up @@ -49,7 +48,7 @@ const NFTItem = () => {

const NFTLoadingSkeleton = ({ items = 5 }) => {
const { nfts_enabled } = useRemoteConfig();
const nftsEnabled = (useExperimentalFlag(NFTS_ENABLED) || nfts_enabled) && !IS_TEST;
const nftsEnabled = useExperimentalFlag(NFTS_ENABLED) || nfts_enabled;

if (!nftsEnabled) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { NftCollectionSortCriterion } from '@/graphql/__generated__/arc';
import useNftSort from '@/hooks/useNFTsSortBy';
import { useRemoteConfig } from '@/model/remoteConfig';
import { NFTS_ENABLED, useExperimentalFlag } from '@/config';
import { IS_TEST } from '@/env';

const TokenFamilyHeaderHeight = 48;

Expand Down Expand Up @@ -34,7 +33,7 @@ const getMenuItemIcon = (value: NftCollectionSortCriterion) => {

const CollectiblesHeader = () => {
const { nfts_enabled } = useRemoteConfig();
const nftsEnabled = (useExperimentalFlag(NFTS_ENABLED) || nfts_enabled) && !IS_TEST;
const nftsEnabled = useExperimentalFlag(NFTS_ENABLED) || nfts_enabled;
const { nftSort, updateNFTSort } = useNftSort();

if (!nftsEnabled) return null;
Expand Down
7 changes: 1 addition & 6 deletions src/components/asset-list/RecyclerAssetList2/WrappedNFT.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import React, { useCallback, useMemo } from 'react';
import {
// @ts-ignore
IS_TESTING,
} from 'react-native-dotenv';
import { UniqueTokenCard } from '../../unique-token';
import { Box, BoxProps } from '@/design-system';
import { UniqueAsset } from '@/entities';
Expand All @@ -11,7 +7,6 @@ import { useNavigation } from '@/navigation';
import Routes from '@/navigation/routesNames';
import { useRemoteConfig } from '@/model/remoteConfig';
import { NFTS_ENABLED, useExperimentalFlag } from '@/config';
import { IS_TEST } from '@/env';

export default React.memo(function WrappedNFT({
onPress,
Expand All @@ -25,7 +20,7 @@ export default React.memo(function WrappedNFT({
externalAddress?: string;
}) {
const { nfts_enabled } = useRemoteConfig();
const nftsEnabled = (useExperimentalFlag(NFTS_ENABLED) || nfts_enabled) && !IS_TEST;
const nftsEnabled = useExperimentalFlag(NFTS_ENABLED) || nfts_enabled;

const assetCollectible = useCollectible(uniqueId, externalAddress);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useLatestCallback, useOpenFamilies } from '@/hooks';
import { ThemeContextProps } from '@/theme';
import { useRemoteConfig } from '@/model/remoteConfig';
import { NFTS_ENABLED, useExperimentalFlag } from '@/config';
import { IS_TEST } from '@/env';

type Props = {
name: string;
Expand All @@ -16,7 +15,7 @@ type Props = {

export default React.memo(function WrappedTokenFamilyHeader({ name, total, image, theme, testID }: Props) {
const { nfts_enabled } = useRemoteConfig();
const nftsEnabled = (useExperimentalFlag(NFTS_ENABLED) || nfts_enabled) && !IS_TEST;
const nftsEnabled = useExperimentalFlag(NFTS_ENABLED) || nfts_enabled;

const { openFamilies, updateOpenFamilies } = useOpenFamilies();
const isFamilyOpen = openFamilies[name];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Dimension, Layout, LayoutManager, LayoutProvider } from 'recyclerlistvi
import ViewDimensions from './ViewDimensions';
import { BaseCellType, CellType } from './ViewTypes';
import { deviceUtils } from '@/utils';
import { getRemoteConfig, RainbowConfig } from '@/model/remoteConfig';
import { NFTS_ENABLED, REMOTE_CARDS, useExperimentalFlag } from '@/config';
import { RainbowConfig } from '@/model/remoteConfig';
import { NFTS_ENABLED, REMOTE_CARDS } from '@/config';
import { useContext } from 'react';
import { RainbowContextType } from '@/helpers/RainbowContext';
import { IS_TEST } from '@/env';
Expand Down Expand Up @@ -50,8 +50,8 @@ const getLayoutProvider = ({
experimentalConfig: ReturnType<typeof useContext<RainbowContextType>>['config'];
remoteConfig: RainbowConfig;
}) => {
const remoteCardsEnabled = (remoteConfig.remote_cards_enabled || experimentalConfig[REMOTE_CARDS]) && !IS_TEST;
const nftsEnabled = (remoteConfig.nfts_enabled || experimentalConfig[NFTS_ENABLED]) && !IS_TEST;
const remoteCardsEnabled = remoteConfig.remote_cards_enabled || experimentalConfig[REMOTE_CARDS];
const nftsEnabled = remoteConfig.nfts_enabled || experimentalConfig[NFTS_ENABLED];

const indicesToOverride = [];
for (let i = 0; i < briefSectionsData.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/config/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const defaultConfig: Record<string, ExperimentalValue> = {
[ETH_REWARDS]: { settings: true, value: false },
[DEGEN_MODE]: { settings: true, value: false },
[FEATURED_RESULTS]: { settings: true, value: false },
[NFTS_ENABLED]: { settings: true, value: false },
[NFTS_ENABLED]: { settings: true, value: !!IS_TEST },
};

const storageKey = 'config';
Expand Down

0 comments on commit 9feb469

Please sign in to comment.