Skip to content

Commit

Permalink
Revert "Brody/swap v2 e2e (#5915)" (#5987)
Browse files Browse the repository at this point in the history
This reverts commit a38f633.
  • Loading branch information
walmat authored Aug 6, 2024
1 parent 7e4d246 commit fdcdd09
Show file tree
Hide file tree
Showing 23 changed files with 100 additions and 326 deletions.
14 changes: 6 additions & 8 deletions e2e/3_homeScreen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import {
checkIfExists,
checkIfExistsByText,
swipe,
waitAndTap,
afterAllcleanApp,
tap,
delayTime,
} from './helpers';

const RAINBOW_TEST_WALLET = 'rainbowtestwallet.eth';
Expand Down Expand Up @@ -42,20 +41,19 @@ describe('Home Screen', () => {
});

it('tapping "Swap" opens the swap screen', async () => {
await tap('swap-button');
await delayTime('long');
await waitAndTap('swap-button');
await checkIfExists('swap-screen');
await swipe('swap-screen', 'down', 'fast');
await swipe('swap-screen', 'down', 'slow');
});

it('tapping "Send" opens the send screen', async () => {
await tap('send-button');
await waitAndTap('send-button');
await checkIfVisible('send-asset-form-field');
await swipe('send-asset-form-field', 'down', 'fast');
await swipe('send-asset-form-field', 'down');
});

it('tapping "Copy" shows copy address toast', async () => {
await tap('receive-button');
await waitAndTap('receive-button');
await checkIfVisible('address-copied-toast');
});
});
143 changes: 0 additions & 143 deletions e2e/9_swaps.spec.ts

This file was deleted.

13 changes: 1 addition & 12 deletions e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { JsonRpcProvider } from '@ethersproject/providers';
import { Wallet } from '@ethersproject/wallet';
import { expect, device, element, by, waitFor } from 'detox';
import { parseEther } from '@ethersproject/units';
import { IosElementAttributes, AndroidElementAttributes } from 'detox/detox';

const TESTING_WALLET = '0x3637f053D542E6D00Eee42D656dD7C59Fa33a62F';
const TESTING_WALLET = '0x3Cb462CDC5F809aeD0558FBEe151eD5dC3D3f608';

const DEFAULT_TIMEOUT = 20_000;
const android = device.getPlatform() === 'android';
Expand Down Expand Up @@ -71,16 +70,6 @@ export async function tap(elementId: string | RegExp) {
}
}

interface CustomElementAttributes {
elements: Array<IosElementAttributes | AndroidElementAttributes>;
}

type ElementAttributes = IosElementAttributes & AndroidElementAttributes & CustomElementAttributes;

export const fetchElementAttributes = async (testId: string): Promise<ElementAttributes> => {
return (await element(by.id(testId)).getAttributes()) as ElementAttributes;
};

export async function waitAndTap(elementId: string | RegExp, timeout = DEFAULT_TIMEOUT) {
await delayTime('medium');
try {
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
"nuke": "./scripts/nuke.sh",
"detox:android": "detox build -c android.emu.debug && detox test -c android.emu.debug --loglevel verbose",
"detox:android:release": "detox build -c android.emu.release && detox test -c android.emu.release",
"detox:ios:build": "detox build -c ios.sim.debug | xcpretty --color ",
"detox:ios:tests": "detox test -c ios.sim.debug --maxWorkers 2 -- --bail 1",
"detox:ios": "yarn detox:ios:build && yarn detox:ios:tests",
"detox:ios:release": "detox build -c ios.sim.release && detox test -c ios.sim.release --maxWorkers 2 -- --bail 1",
"detox:ios:tests": "detox test -c ios.sim.debug --maxWorkers 3 -- --bail 1",
"detox:ios": "detox build -c ios.sim.debug | xcpretty --color && yarn detox:ios:tests",
"detox:ios:release": "detox build -c ios.sim.release && detox test -c ios.sim.release --maxWorkers 3 -- --bail 1",
"ds:install": "cd src/design-system/docs && yarn install",
"ds": "cd src/design-system/docs && yarn dev",
"fast": "yarn install && yarn setup && yarn install-pods-fast",
Expand Down
6 changes: 2 additions & 4 deletions src/__swaps__/screens/Swap/components/CoinRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ interface InputCoinRowProps {
onPress: (asset: ParsedSearchAsset | null) => void;
output?: false | undefined;
uniqueId: string;
testID?: string;
}

type PartialAsset = Pick<SearchAsset, 'address' | 'chainId' | 'colors' | 'icon_url' | 'mainnetAddress' | 'name' | 'symbol' | 'uniqueId'>;
Expand All @@ -63,12 +62,11 @@ interface OutputCoinRowProps extends PartialAsset {
output: true;
nativePriceChange?: string;
isTrending?: boolean;
testID?: string;
}

type CoinRowProps = InputCoinRowProps | OutputCoinRowProps;

export const CoinRow = memo(function CoinRow({ isFavorite, onPress, output, uniqueId, testID, ...assetProps }: CoinRowProps) {
export const CoinRow = memo(function CoinRow({ isFavorite, onPress, output, uniqueId, ...assetProps }: CoinRowProps) {
const inputAsset = userAssetsStore(state => (output ? undefined : state.getUserAsset(uniqueId)));
const outputAsset = output ? (assetProps as PartialAsset) : undefined;

Expand Down Expand Up @@ -118,7 +116,7 @@ export const CoinRow = memo(function CoinRow({ isFavorite, onPress, output, uniq
if (!address || !chainId) return null;

return (
<Box testID={testID} style={{ height: COIN_ROW_WITH_PADDING_HEIGHT, width: '100%' }}>
<Box style={{ height: COIN_ROW_WITH_PADDING_HEIGHT, width: '100%' }}>
<Columns alignVertical="center">
<Column>
<ButtonPressAnimation disallowInterruption onPress={onPressHandler} scaleTo={0.95}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { pulsingConfig, sliderConfig } from '../constants';
import { GasSettings } from '../hooks/useCustomGas';
import { useSwapEstimatedGasFee } from '../hooks/useEstimatedGasFee';
import { useSwapContext } from '../providers/swap-provider';
import { SpringConfig } from 'react-native-reanimated/lib/typescript/animation/springUtils';

type EstimatedSwapGasFeeProps = { gasSettings?: GasSettings } & Partial<
Pick<TextProps, 'align' | 'color' | 'size' | 'weight' | 'tabularNumbers'>
Expand Down Expand Up @@ -49,7 +48,7 @@ const GasFeeText = memo(function GasFeeText({
color: withTiming(isLoading.value ? zeroAmountColor : textColor, TIMING_CONFIGS.slowFadeConfig),
opacity: isLoading.value
? withRepeat(withSequence(withTiming(0.5, pulsingConfig), withTiming(1, pulsingConfig)), -1, true)
: withSpring(1, sliderConfig as SpringConfig),
: withSpring(1, sliderConfig),
}));

return (
Expand Down
42 changes: 16 additions & 26 deletions src/__swaps__/screens/Swap/components/FadeMask.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react';
import { Box, Columns, Column, globalColors } from '@/design-system';
import LinearGradient from 'react-native-linear-gradient';
import { IS_TEST } from '@/env';
import { View } from 'react-native';

export const FadeMask = ({
fadeEdgeInset = 6,
Expand All @@ -24,18 +22,14 @@ export const FadeMask = ({
<Box height="full" width={{ custom: fadeEdgeInset }} />
</Column>
<Column width="content">
{IS_TEST ? (
<Box as={View} height="full" width={{ custom: fadeWidth }} />
) : (
<Box
as={LinearGradient}
colors={['transparent', globalColors.grey100]}
end={{ x: 1, y: 0.5 }}
height="full"
start={{ x: 0, y: 0.5 }}
width={{ custom: fadeWidth }}
/>
)}
<Box
as={LinearGradient}
colors={['transparent', globalColors.grey100]}
end={{ x: 1, y: 0.5 }}
height="full"
start={{ x: 0, y: 0.5 }}
width={{ custom: fadeWidth }}
/>
</Column>
</>
) : null}
Expand All @@ -45,18 +39,14 @@ export const FadeMask = ({
{!side || side === 'right' ? (
<>
<Column width="content">
{IS_TEST ? (
<Box as={View} height="full" width={{ custom: fadeWidth }} />
) : (
<Box
as={LinearGradient}
colors={[globalColors.grey100, 'transparent']}
end={{ x: 1, y: 0.5 }}
height="full"
start={{ x: 0, y: 0.5 }}
width={{ custom: fadeWidth }}
/>
)}
<Box
as={LinearGradient}
colors={[globalColors.grey100, 'transparent']}
end={{ x: 1, y: 0.5 }}
height="full"
start={{ x: 0, y: 0.5 }}
width={{ custom: fadeWidth }}
/>
</Column>
<Column width="content">
<Box height="full" width={{ custom: fadeEdgeInset }} />
Expand Down
5 changes: 1 addition & 4 deletions src/__swaps__/screens/Swap/components/SwapActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ function SwapButton({
disabled,
opacity,
children,
testID,
}: {
asset: DerivedValue<ExtendedAnimatedAssetWithColors | null>;
borderRadius?: number;
Expand All @@ -48,7 +47,6 @@ function SwapButton({
disabled?: DerivedValue<boolean | undefined>;
opacity?: DerivedValue<number | undefined>;
children?: React.ReactNode;
testID?: string;
}) {
const { isDarkMode } = useColorMode();
const fallbackColor = useForegroundColor('label');
Expand Down Expand Up @@ -112,7 +110,6 @@ function SwapButton({
return (
<Animated.View style={buttonWrapperStyles}>
<Box
testID={testID}
as={Animated.View}
paddingHorizontal={{ custom: small ? 14 : 20 - (outline ? 2 : 0) }}
paddingLeft={small && icon ? '10px' : undefined}
Expand Down Expand Up @@ -271,7 +268,7 @@ export const SwapActionButton = ({
style={[hugContent && feedActionButtonStyles.buttonWrapper, style]}
>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<SwapButton {...props} disabled={disabled} testID={'swap-action-button'}>
<SwapButton {...props} disabled={disabled}>
{holdProgress && <HoldProgress holdProgress={holdProgress} />}
</SwapButton>
</GestureHandlerButton>
Expand Down
Loading

0 comments on commit fdcdd09

Please sign in to comment.