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

chore: Remove old CeloGoldHistoryChart #5307

Merged
merged 20 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 17 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
137 changes: 75 additions & 62 deletions e2e/src/usecases/Assets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { generateMnemonic } from '@celo/cryptographic-utils'
import { DEFAULT_RECIPIENT_ADDRESS, SAMPLE_BACKUP_KEY } from '../utils/consts'
import { launchApp } from '../utils/retries'
import { quickOnboarding, waitForElementByIdAndTap, waitForElementId } from '../utils/utils'
import {
quickOnboarding,
waitForElementByIdAndTap,
waitForElementId,
scrollIntoView,
} from '../utils/utils'

async function validateSendFlow(tokenSymbol) {
// navigate to send amount screen to ensure the expected token symbol is pre-selected
Expand Down Expand Up @@ -34,13 +39,15 @@ export default Assets = () => {
{
tokenId: 'celo-alfajores:native',
symbol: 'CELO',
name: 'Celo',
actions: ['Send', 'Add'],
moreActions: ['Send', 'Add', 'Withdraw'],
learnMore: true,
},
{
tokenId: 'celo-alfajores:0x048f47d358ec521a6cf384461d674750a3cb58c8',
symbol: 'TT',
name: 'Test Token',
actions: ['Send'],
moreActions: [],
learnMore: false,
Expand All @@ -53,13 +60,15 @@ export default Assets = () => {
{
tokenId: 'celo-alfajores:native',
symbol: 'CELO',
name: 'Celo',
actions: ['Add'],
moreActions: [],
learnMore: true,
},
{
tokenId: 'celo-alfajores:0x874069fa1eb16d44d622f2e0ca25eea172369bc1',
symbol: 'cUSD',
name: 'Celo Dollar',
actions: ['Add'],
moreActions: [],
learnMore: true,
Expand Down Expand Up @@ -99,75 +108,79 @@ export default Assets = () => {
await expect(element(by.id('TokenBalanceItem')).atIndex(0)).toBeVisible()
})

describe.each(tokens)('For $symbol', ({ symbol, tokenId, learnMore, actions, moreActions }) => {
it('navigates to asset details on tapping asset', async () => {
await waitForElementByIdAndTap(`TokenBalanceItemTouchable/${tokenId}`)
await waitForElementId('TokenDetails/AssetValue')
})

if (actions.includes('Send')) {
it('send action navigates to send flow', async () => {
await element(by.id('TokenDetails/Action/Send')).tap()
await validateSendFlow(symbol)
describe.each(tokens)(
'For $symbol',
({ symbol, tokenId, name, learnMore, actions, moreActions }) => {
it('navigates to asset details on tapping asset', async () => {
await waitForElementByIdAndTap(`TokenBalanceItemTouchable/${tokenId}`)
await waitForElementId('TokenDetails/AssetValue')
})
}

if (actions.includes('Add')) {
it('add action navigates to add cico flow', async () => {
await element(by.id('TokenDetails/Action/Add')).tap()
await validateAddFlow(symbol)
await waitForElementId('TokenDetails/AssetValue')
})
}
if (actions.includes('Send')) {
it('send action navigates to send flow', async () => {
await element(by.id('TokenDetails/Action/Send')).tap()
await validateSendFlow(symbol)
await waitForElementId('TokenDetails/AssetValue')
})
}

if (moreActions.includes('Send')) {
it('send action under more actions navigates to send flow', async () => {
await element(by.id('TokenDetails/Action/More')).tap()
await waitForElementByIdAndTap('TokenDetailsMoreActions/Send')
await validateSendFlow(symbol)
await element(by.id('TokenDetailsMoreActions')).swipe('down')
await waitForElementId('TokenDetails/AssetValue')
})
}
if (actions.includes('Add')) {
it('add action navigates to add cico flow', async () => {
await element(by.id('TokenDetails/Action/Add')).tap()
await validateAddFlow(symbol)
await waitForElementId('TokenDetails/AssetValue')
})
}

if (moreActions.includes('Add')) {
it('add action under more actions navigates to add cico flow', async () => {
await element(by.id('TokenDetails/Action/More')).tap()
await waitForElementByIdAndTap('TokenDetailsMoreActions/Add')
await validateAddFlow(symbol)
await element(by.id('TokenDetailsMoreActions')).swipe('down')
await waitForElementId('TokenDetails/AssetValue')
})
}
if (moreActions.includes('Send')) {
it('send action under more actions navigates to send flow', async () => {
await element(by.id('TokenDetails/Action/More')).tap()
await waitForElementByIdAndTap('TokenDetailsMoreActions/Send')
await validateSendFlow(symbol)
await element(by.id('TokenDetailsMoreActions')).swipe('down')
await waitForElementId('TokenDetails/AssetValue')
})
}

if (moreActions.includes('Withdraw')) {
it('withdraw action under more actions navigates to withdraw spend screen', async () => {
await element(by.id('TokenDetails/Action/More')).tap()
await waitForElementByIdAndTap('TokenDetailsMoreActions/Withdraw')
await waitForElementId('FiatExchangeTokenBalance')
await element(by.id('BackChevron')).tap()
await element(by.id('TokenDetailsMoreActions')).swipe('down')
await waitForElementId('TokenDetails/AssetValue')
})
}
if (moreActions.includes('Add')) {
it('add action under more actions navigates to add cico flow', async () => {
await element(by.id('TokenDetails/Action/More')).tap()
await waitForElementByIdAndTap('TokenDetailsMoreActions/Add')
await validateAddFlow(symbol)
await element(by.id('TokenDetailsMoreActions')).swipe('down')
await waitForElementId('TokenDetails/AssetValue')
})
}

if (learnMore) {
it('learn more navigates to coingecko page', async () => {
await waitForElementByIdAndTap('TokenDetails/LearnMore')
await waitForElementId('RNWebView')
await waitFor(element(by.text('www.coingecko.com')))
.toBeVisible()
.withTimeout(10 * 1000)
await element(by.id('WebViewScreen/CloseButton')).tap()
await waitForElementId('TokenDetails/AssetValue')
if (moreActions.includes('Withdraw')) {
it('withdraw action under more actions navigates to withdraw spend screen', async () => {
await element(by.id('TokenDetails/Action/More')).tap()
await waitForElementByIdAndTap('TokenDetailsMoreActions/Withdraw')
await waitForElementId('FiatExchangeTokenBalance')
await element(by.id('BackChevron')).tap()
await element(by.id('TokenDetailsMoreActions')).swipe('down')
await waitForElementId('TokenDetails/AssetValue')
})
}

if (learnMore) {
it('learn more navigates to coingecko page', async () => {
await scrollIntoView(`Learn more about ${name}`, 'TokenDetailsScrollView')
await waitForElementByIdAndTap('TokenDetails/LearnMore')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional nit: seems odd to use text for scrolling and id for tapping. would be nice if this was consistent

await waitForElementId('RNWebView')
await waitFor(element(by.text('www.coingecko.com')))
.toBeVisible()
.withTimeout(10 * 1000)
await element(by.id('WebViewScreen/CloseButton')).tap()
await waitForElementId('TokenBalanceItem')
})
}

it('navigates back to Assets page', async () => {
await element(by.id('BackChevron')).tap()
await waitForElementId('Assets/TabBar')
})
}

it('navigates back to Assets page', async () => {
await element(by.id('BackChevron')).tap()
await waitForElementId('Assets/TabBar')
})
})
)
})
}
3 changes: 2 additions & 1 deletion src/account/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { parsePhoneNumber } from '@celo/phone-utils'
import { ADDRESS_LENGTH } from 'src/exchange/reducer'

const ADDRESS_LENGTH = 42 // TODO(ACT-1173): see if this can be replaced with a viem helper

export const isAddressFormat = (content: string): boolean => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to your PR, but guess this is something we could replace with a viem helper, which I believe we use in the qr scanner. Maybe leave a note / make a tech debt issue?

return content.startsWith('0x') && content.length === ADDRESS_LENGTH
Expand Down
6 changes: 1 addition & 5 deletions src/alert/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Action } from '@reduxjs/toolkit'
import { Actions, ActionTypes, AlertTypes } from 'src/alert/actions'
import { ErrorMessages } from 'src/app/ErrorMessages'
import { ActionTypes as ExchangeActionTypes } from 'src/exchange/actions'
import { RootState } from 'src/redux/reducers'

export enum ErrorDisplayType {
Expand All @@ -24,10 +23,7 @@ type State = Alert | null

const initialState = null

export const reducer = (
state: State = initialState,
action: ActionTypes | ExchangeActionTypes
): State => {
export const reducer = (state: State = initialState, action: ActionTypes): State => {
switch (action.type) {
case Actions.SHOW:
return {
Expand Down
2 changes: 1 addition & 1 deletion src/app/reducers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Platform } from 'react-native'
import { BIOMETRY_TYPE } from 'react-native-keychain'
import { Actions, ActionTypes, AppState, MultichainBetaStatus } from 'src/app/actions'
import { CeloNewsConfig } from 'src/celoNews/types'
import { SuperchargeTokenConfigByToken } from 'src/consumerIncentives/types'
import { CeloNewsConfig } from 'src/exchange/types'
import { REMOTE_CONFIG_VALUES_DEFAULTS } from 'src/firebase/remoteConfigValuesDefaults'
import { Screens } from 'src/navigator/Screens'
import { getRehydratePayload, REHYDRATE, RehydrateAction } from 'src/redux/persist-helper'
Expand Down
14 changes: 7 additions & 7 deletions src/app/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ import { findBestAvailableLanguage } from 'react-native-localize'
import { eventChannel } from 'redux-saga'
import { e164NumberSelector } from 'src/account/selectors'
import { AppEvents, InviteEvents } from 'src/analytics/Events'
import { HooksEnablePreviewOrigin } from 'src/analytics/types'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import { HooksEnablePreviewOrigin } from 'src/analytics/types'
import {
Actions,
OpenDeepLink,
OpenUrlAction,
SetAppState,
androidMobileServicesAvailabilityChecked,
appLock,
inAppReviewRequested,
inviteLinkConsumed,
minAppVersionDetermined,
OpenDeepLink,
openDeepLink,
OpenUrlAction,
phoneNumberVerificationMigrated,
SetAppState,
setAppState,
setSupportedBiometryType,
updateRemoteConfigValues,
Expand All @@ -38,13 +38,13 @@ import {
sentryNetworkErrorsSelector,
shouldRunVerificationMigrationSelector,
} from 'src/app/selectors'
import { CeloNewsConfig } from 'src/celoNews/types'
import { DEFAULT_APP_LANGUAGE, FETCH_TIMEOUT_DURATION, isE2EEnv } from 'src/config'
import { claimRewardsSuccess } from 'src/consumerIncentives/slice'
import { SuperchargeTokenConfigByToken } from 'src/consumerIncentives/types'
import { handleDappkitDeepLink } from 'src/dappkit/dappkit'
import { CeloNewsConfig } from 'src/exchange/types'
import { FiatAccountSchemaCountryOverrides } from 'src/fiatconnect/types'
import { FiatExchangeFlow } from 'src/fiatExchanges/utils'
import { FiatAccountSchemaCountryOverrides } from 'src/fiatconnect/types'
import { appVersionDeprecationChannel, fetchRemoteConfigValues } from 'src/firebase/firebase'
import { initI18n } from 'src/i18n'
import {
Expand All @@ -70,9 +70,9 @@ import { getFeatureGate, patchUpdateStatsigUser, setupOverridesFromLaunchArgs }
import { StatsigFeatureGates } from 'src/statsig/types'
import { swapSuccess } from 'src/swap/slice'
import { NetworkId } from 'src/transactions/types'
import Logger from 'src/utils/Logger'
import { ensureError } from 'src/utils/ensureError'
import { isDeepLink, navigateToURI } from 'src/utils/linking'
import Logger from 'src/utils/Logger'
import { safely } from 'src/utils/safely'
import { ONE_DAY_IN_MILLIS } from 'src/utils/time'
import { isWalletConnectEnabled } from 'src/walletConnect/saga'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React from 'react'
import { Provider } from 'react-redux'
import { CeloNewsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import CeloNewsFeed from 'src/exchange/CeloNewsFeed'
import { CeloNewsArticles } from 'src/exchange/types'
import CeloNewsFeed from 'src/celoNews/CeloNewsFeed'
import { CeloNewsArticles } from 'src/celoNews/types'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import networkConfig from 'src/web3/networkConfig'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import { FlatList, ListRenderItemInfo, StyleSheet, Text, View } from 'react-nati
import { CeloNewsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import { celoNewsConfigSelector } from 'src/app/selectors'
import CeloNewsFeedItem from 'src/celoNews/CeloNewsFeedItem'
import { CeloNewsArticle, CeloNewsArticles } from 'src/celoNews/types'
import Button, { BtnSizes, BtnTypes } from 'src/components/Button'
import EmptyView from 'src/components/EmptyView'
import CeloNewsFeedItem from 'src/exchange/CeloNewsFeedItem'
import { CeloNewsArticle, CeloNewsArticles } from 'src/exchange/types'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import { useSelector } from 'src/redux/hooks'
import colors from 'src/styles/colors'
import { typeScale } from 'src/styles/fonts'
import { Spacing } from 'src/styles/styles'
import { fetchWithTimeout } from 'src/utils/fetchWithTimeout'
import Logger from 'src/utils/Logger'
import { fetchWithTimeout } from 'src/utils/fetchWithTimeout'
import networkConfig from 'src/web3/networkConfig'

const TAG = 'exchange/CeloNewsFeed'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fireEvent, render } from '@testing-library/react-native'
import React from 'react'
import { CeloNewsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import CeloNewsFeedItem from 'src/exchange/CeloNewsFeedItem'
import CeloNewsFeedItem from 'src/celoNews/CeloNewsFeedItem'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as React from 'react'
import { Image, StyleSheet, Text, View } from 'react-native'
import { CeloNewsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import { CeloNewsArticle } from 'src/celoNews/types'
import SkeletonPlaceholder from 'src/components/SkeletonPlaceholder'
import Touchable from 'src/components/Touchable'
import { CeloNewsArticle } from 'src/exchange/types'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import colors from 'src/styles/colors'
Expand Down
File renamed without changes.
Loading
Loading