Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix e2e flakiness / errors #6084

Merged
merged 9 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading