From 45c24935f00cc088dea4458f9ecb3a315faf5fc2 Mon Sep 17 00:00:00 2001 From: dan437 <80175477+dan437@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:09:28 +0100 Subject: [PATCH] Remove the STX OptIn modal Remove E2E tests for the STX OptIn modal, cleanup --- app/components/Nav/App/index.js | 6 - .../SmartTranactionsOptInModal.tsx | 298 ------------------ .../SmartTransactionsOptInModal.test.tsx | 149 --------- app/components/Views/Wallet/index.tsx | 33 +- app/constants/navigation/Routes.ts | 1 - app/core/Engine.ts | 1 + .../slices/smartTransactions/index.test.ts | 25 -- .../redux/slices/smartTransactions/index.ts | 34 -- app/reducers/index.ts | 3 - app/util/onboarding/index.test.ts | 90 ------ app/util/onboarding/index.ts | 45 --- .../sentry/__snapshots__/utils.test.ts.snap | 3 - app/util/sentry/utils.test.ts | 3 - app/util/test/initial-background-state.json | 2 +- .../modals/TransactionProtectionModal.js | 23 -- .../SmartTransactionsOptInModal.selectors.js | 4 - .../TransactionProtectionModal.selectors.js | 6 - .../Modals/TransactionProtectionModal.js | 33 -- wdio/step-definitions/common-steps.js | 11 - 19 files changed, 3 insertions(+), 767 deletions(-) delete mode 100644 app/components/Views/SmartTransactionsOptInModal/SmartTranactionsOptInModal.tsx delete mode 100644 app/components/Views/SmartTransactionsOptInModal/SmartTransactionsOptInModal.test.tsx delete mode 100644 app/core/redux/slices/smartTransactions/index.test.ts delete mode 100644 app/core/redux/slices/smartTransactions/index.ts delete mode 100644 app/util/onboarding/index.test.ts delete mode 100644 e2e/pages/modals/TransactionProtectionModal.js delete mode 100644 e2e/selectors/Modals/SmartTransactionsOptInModal.selectors.js delete mode 100644 e2e/selectors/Modals/TransactionProtectionModal.selectors.js delete mode 100644 wdio/screen-objects/Modals/TransactionProtectionModal.js diff --git a/app/components/Nav/App/index.js b/app/components/Nav/App/index.js index 27bc4c34d8d0..0aecbd4ec640 100644 --- a/app/components/Nav/App/index.js +++ b/app/components/Nav/App/index.js @@ -112,7 +112,6 @@ import LedgerSelectAccount from '../../Views/LedgerSelectAccount'; import OnboardingSuccess from '../../Views/OnboardingSuccess'; import DefaultSettings from '../../Views/OnboardingSuccess/DefaultSettings'; import BasicFunctionalityModal from '../../UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal'; -import SmartTransactionsOptInModal from '../../Views/SmartTransactionsOptInModal/SmartTranactionsOptInModal'; import ProfileSyncingModal from '../../UI/ProfileSyncing/ProfileSyncingModal/ProfileSyncingModal'; import ResetNotificationsModal from '../../UI/Notification/ResetNotificationsModal'; import NFTAutoDetectionModal from '../../../../app/components/Views/NFTAutoDetectionModal/NFTAutoDetectionModal'; @@ -396,7 +395,6 @@ const App = (props) => { }); }, [handleDeeplink]); - useEffect(() => { if (navigator) { // Initialize deep link manager @@ -578,10 +576,6 @@ const App = (props) => { name={Routes.MODAL.MODAL_MANDATORY} component={ModalMandatory} /> - - StyleSheet.create({ - scroll: { - maxHeight: maxItemHeight, - }, - content: { - gap: 16, - paddingHorizontal: MODAL_PADDING, - }, - buttons: { - gap: 10, - justifyContent: 'center', - }, - button: { - width: '100%', - textAlign: 'center', - }, - secondaryButtonText: { - color: colors.text.alternative, - }, - header: { - alignItems: 'center', - }, - descriptions: { - gap: 16, - }, - screen: { justifyContent: 'center', alignItems: 'center' }, - modal: { - backgroundColor: colors.background.default, - borderRadius: 10, - marginHorizontal: MODAL_MARGIN, - }, - bodyContainer: { - width: itemWidth, - paddingVertical: 16, - paddingBottom: 16, - }, - benefits: { - flexDirection: 'row', - justifyContent: 'space-between', - paddingHorizontal: 8, - }, - benefit: { - width: '33%', - gap: 4, - alignItems: 'center', - }, - benefitIcon: { - width: 35, - height: 35, - alignItems: 'center', - justifyContent: 'center', - borderRadius: 50, - backgroundColor: colors.primary.muted, - }, - benefitText: { - textAlign: 'center', - }, - backgroundImage: { - gap: 16, - height: 140, - justifyContent: 'center', - }, - }); - -interface Props { - iconName: IconName; - text: string[]; -} -const Benefit = ({ iconName, text }: Props) => { - const { colors } = useTheme(); - const styles = createStyles(colors); - - return ( - - - - - {text.map((t) => ( - - {t} - - ))} - - - ); -}; - -const SmartTransactionsOptInModal = () => { - const modalRef = useRef(null); - const { colors } = useTheme(); - const { trackEvent } = useMetrics(); - const dispatch = useDispatch(); - - const styles = createStyles(colors); - - const hasOptedIn = useRef(null); - - const dismissModal = async () => { - modalRef.current?.dismissModal(); - }; - - const markOptInModalAsSeen = async () => { - const version = await StorageWrapper.getItem(CURRENT_APP_VERSION); - dispatch(updateOptInModalAppVersionSeen(version)); - }; - - const optIn = async () => { - Engine.context.PreferencesController.setSmartTransactionsOptInStatus(true); - trackEvent(MetaMetricsEvents.SMART_TRANSACTION_OPT_IN, { - stx_opt_in: true, - location: 'SmartTransactionsOptInModal', - }); - hasOptedIn.current = true; - await markOptInModalAsSeen(); - dismissModal(); - }; - - const optOut = async () => { - Engine.context.PreferencesController.setSmartTransactionsOptInStatus(false); - trackEvent(MetaMetricsEvents.SMART_TRANSACTION_OPT_IN, { - stx_opt_in: false, - location: 'SmartTransactionsOptInModal', - }); - hasOptedIn.current = false; - await markOptInModalAsSeen(); - dismissModal(); - }; - - const handleDismiss = async () => { - // Opt out of STX if no prior decision made. - if (hasOptedIn.current === null) { - optOut(); - } - }; - - const Header = () => ( - - - {strings('whats_new.stx.header')} - - - ); - - const Benefits = () => ( - - - - - - ); - - const Descriptions = () => ( - - {strings('whats_new.stx.description_1')} - - {strings('whats_new.stx.description_2')}{' '} - { - Linking.openURL(AppConstants.URLS.SMART_TXS); - }} - > - {strings('whats_new.stx.learn_more')} - - - - ); - - const PrimaryButton = () => ( - - ); - - const SecondaryButton = () => ( - - ); - - return ( - - - - -
- - - - {/* Content */} - - - - - - - - - - - - - - ); -}; - -export default SmartTransactionsOptInModal; diff --git a/app/components/Views/SmartTransactionsOptInModal/SmartTransactionsOptInModal.test.tsx b/app/components/Views/SmartTransactionsOptInModal/SmartTransactionsOptInModal.test.tsx deleted file mode 100644 index 02664a58ebfb..000000000000 --- a/app/components/Views/SmartTransactionsOptInModal/SmartTransactionsOptInModal.test.tsx +++ /dev/null @@ -1,149 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import React from 'react'; -import { fireEvent } from '@testing-library/react-native'; -import SmartTransactionsOptInModal from './SmartTranactionsOptInModal'; -import renderWithProvider from '../../../util/test/renderWithProvider'; -import { backgroundState } from '../../../util/test/initial-root-state'; -import { strings } from '../../../../locales/i18n'; -import Engine from '../../../core/Engine'; -import { shouldShowWhatsNewModal } from '../../../util/onboarding'; -import { updateOptInModalAppVersionSeen } from '../../../core/redux/slices/smartTransactions'; - -const mockNavigate = jest.fn(); -jest.mock('@react-navigation/native', () => { - const actualReactNavigation = jest.requireActual('@react-navigation/native'); - return { - ...actualReactNavigation, - useNavigation: () => ({ - navigate: mockNavigate, - goBack: jest.fn(), - }), - }; -}); - -jest.mock('../../../core/Engine', () => ({ - context: { - PreferencesController: { - setSmartTransactionsOptInStatus: jest.fn(), - }, - }, -})); - -const VERSION = '1.0.0'; -jest.mock('../../../store/storage-wrapper', () => ({ - getItem: jest.fn(() => VERSION), - setItem: jest.fn(), - removeItem: jest.fn(), -})); - -jest.mock('../../../util/onboarding', () => ({ - shouldShowWhatsNewModal: jest.fn(), -})); - -jest.mock('../../../core/redux/slices/smartTransactions', () => ({ - updateOptInModalAppVersionSeen: jest.fn(() => ({ type: 'hello' })), -})); - -const initialState = { - engine: { - backgroundState, - }, -}; - -function wait(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} - -describe('SmartTransactionsOptInModal', () => { - afterEach(() => { - mockNavigate.mockReset(); - }); - - it('should render properly', () => { - const { getByText } = renderWithProvider(, { - state: initialState, - }); - - const header = getByText(strings('whats_new.stx.header')); - expect(header).toBeDefined(); - - const description1 = getByText(strings('whats_new.stx.description_1')); - expect(description1).toBeDefined(); - - const description2 = getByText(strings('whats_new.stx.description_2'), { - exact: false, - }); - expect(description2).toBeDefined(); - - const primaryButton = getByText(strings('whats_new.stx.primary_button')); - expect(primaryButton).toBeDefined(); - - const secondaryButton = getByText(strings('whats_new.stx.no_thanks')); - expect(secondaryButton).toBeDefined(); - }); - - it('should opt user in when primary button is pressed', () => { - const { getByText } = renderWithProvider(, { - state: initialState, - }); - - const primaryButton = getByText(strings('whats_new.stx.primary_button')); - fireEvent.press(primaryButton); - - expect( - Engine.context.PreferencesController.setSmartTransactionsOptInStatus, - ).toHaveBeenCalledWith(true); - }); - - it('opts user out when secondary button is pressed', async () => { - const { getByText } = renderWithProvider(, { - state: initialState, - }); - - const secondaryButton = getByText(strings('whats_new.stx.no_thanks')); - fireEvent.press(secondaryButton); - - expect( - Engine.context.PreferencesController.setSmartTransactionsOptInStatus, - ).toHaveBeenCalledWith(false); - }); - - it('should update last app version seen on primary button press', () => { - const { getByText } = renderWithProvider(, { - state: initialState, - }); - - const primaryButton = getByText(strings('whats_new.stx.primary_button')); - fireEvent.press(primaryButton); - - expect(updateOptInModalAppVersionSeen).toHaveBeenCalledWith(VERSION); - }); - - it('should update last app version seen on secondary button press', () => { - const { getByText } = renderWithProvider(, { - state: initialState, - }); - - const secondaryButton = getByText(strings('whats_new.stx.no_thanks')); - fireEvent.press(secondaryButton); - - expect(updateOptInModalAppVersionSeen).toHaveBeenCalledWith(VERSION); - }); - - it("should not navigate to What's New modal", async () => { - (shouldShowWhatsNewModal as jest.Mock).mockImplementation( - async () => false, - ); - - const { getByText } = renderWithProvider(, { - state: initialState, - }); - - const primaryButton = getByText(strings('whats_new.stx.primary_button')); - fireEvent.press(primaryButton); - - await wait(10); - - expect(mockNavigate).not.toHaveBeenCalled(); - }); -}); diff --git a/app/components/Views/Wallet/index.tsx b/app/components/Views/Wallet/index.tsx index 886a36d645af..cb9e58385551 100644 --- a/app/components/Views/Wallet/index.tsx +++ b/app/components/Views/Wallet/index.tsx @@ -43,7 +43,6 @@ import { getTicker } from '../../../util/transactions'; import OnboardingWizard from '../../UI/OnboardingWizard'; import ErrorBoundary from '../ErrorBoundary'; import { useTheme } from '../../../util/theme'; -import { shouldShowSmartTransactionsOptInModal } from '../../../util/onboarding'; import Logger from '../../../util/Logger'; import Routes from '../../../constants/navigation/Routes'; import { @@ -347,7 +346,7 @@ const Wallet = ({ }); /** - * Check to see if we need to show What's New modal and Smart Transactions Opt In modal + * Check to see if we need to show What's New modal */ useEffect(() => { const networkOnboarded = getIsNetworkOnboarded( @@ -362,36 +361,6 @@ const Wallet = ({ // Do not check since it will conflict with the onboarding wizard and/or network onboarding return; } - - // Show STX opt in modal before What's New modal - // Fired on the first load of the wallet and also on network switch - const checkSmartTransactionsOptInModal = async () => { - try { - const accountHasZeroBalance = hexToBN( - accountBalanceByChainId?.balance || '0x0', - ).isZero(); - const shouldShowStxOptInModal = - await shouldShowSmartTransactionsOptInModal( - providerConfig.chainId, - providerConfig.rpcUrl, - accountHasZeroBalance, - ); - if (shouldShowStxOptInModal) { - navigation.navigate(Routes.MODAL.ROOT_MODAL_FLOW, { - screen: Routes.MODAL.SMART_TRANSACTIONS_OPT_IN, - }); - } - } catch (error) { - Logger.log( - error, - 'Error while checking Smart Tranasctions Opt In modal!', - ); - } - }; - - InteractionManager.runAfterInteractions(() => { - checkSmartTransactionsOptInModal(); - }); }, [ wizardStep, navigation, diff --git a/app/constants/navigation/Routes.ts b/app/constants/navigation/Routes.ts index 75d0fcdd28d4..e6b3f6f99a04 100644 --- a/app/constants/navigation/Routes.ts +++ b/app/constants/navigation/Routes.ts @@ -43,7 +43,6 @@ const Routes = { MODAL_CONFIRMATION: 'ModalConfirmation', MODAL_MANDATORY: 'ModalMandatory', WHATS_NEW: 'WhatsNewModal', - SMART_TRANSACTIONS_OPT_IN: 'SmartTransactionsOptInModal', TURN_OFF_REMEMBER_ME: 'TurnOffRememberMeModal', UPDATE_NEEDED: 'UpdateNeededModal', ENABLE_AUTOMATIC_SECURITY_CHECKS: 'EnableAutomaticSecurityChecksModal', diff --git a/app/core/Engine.ts b/app/core/Engine.ts index 0c9901b42a50..fd26e821de23 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -534,6 +534,7 @@ class Engine { useNftDetection: true, // set this to true to enable nft detection by default to new users displayNftMedia: true, securityAlertsEnabled: true, + smartTransactionsOptInStatus: true, ...initialState.PreferencesController, }, }); diff --git a/app/core/redux/slices/smartTransactions/index.test.ts b/app/core/redux/slices/smartTransactions/index.test.ts deleted file mode 100644 index f97ff4436a6d..000000000000 --- a/app/core/redux/slices/smartTransactions/index.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import reducer, { - updateOptInModalAppVersionSeen, - SmartTransactionsState, -} from '.'; - -describe('smartTransactions slice', () => { - // Define the initial state for your tests - const initialState: SmartTransactionsState = { - optInModalAppVersionSeen: null, - }; - - it('should handle initial state', () => { - expect(reducer(undefined, { type: 'unknown' })).toEqual({ - optInModalAppVersionSeen: null, - }); - }); - - it('should handle updateOptInModalAppVersionSeen', () => { - const actual = reducer( - initialState, - updateOptInModalAppVersionSeen('2.0.0'), - ); - expect(actual.optInModalAppVersionSeen).toEqual('2.0.0'); - }); -}); diff --git a/app/core/redux/slices/smartTransactions/index.ts b/app/core/redux/slices/smartTransactions/index.ts deleted file mode 100644 index f644375d10a7..000000000000 --- a/app/core/redux/slices/smartTransactions/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { PayloadAction, createSlice } from '@reduxjs/toolkit'; - -export interface SmartTransactionsState { - optInModalAppVersionSeen: string | null; -} - -export const initialState: SmartTransactionsState = { - optInModalAppVersionSeen: null, -}; - -const name = 'smartTransactions'; - -const slice = createSlice({ - name, - initialState, - reducers: { - /** - * Updates the the app version seen for the opt in modal. - * @param state - The current state of the smartTransactions slice. - * @param action - An action with the new app version seen as payload. - */ - updateOptInModalAppVersionSeen: (state, action: PayloadAction) => { - state.optInModalAppVersionSeen = action.payload; - }, - }, -}); - -const { actions, reducer } = slice; - -export default reducer; - -// Actions / action-creators - -export const { updateOptInModalAppVersionSeen } = actions; diff --git a/app/reducers/index.ts b/app/reducers/index.ts index 51f397e11288..9dc180eb9b9f 100644 --- a/app/reducers/index.ts +++ b/app/reducers/index.ts @@ -29,7 +29,6 @@ import rpcEventReducer from './rpcEvents'; import accountsReducer from './accounts'; import sdkReducer from './sdk'; import inpageProviderReducer from '../core/redux/slices/inpageProvider'; -import smartTransactionsReducer from '../core/redux/slices/smartTransactions'; import transactionMetricsReducer from '../core/redux/slices/transactionMetrics'; import originThrottlingReducer from '../core/redux/slices/originThrottling'; import notificationsAccountsProvider from '../core/redux/slices/notifications'; @@ -80,7 +79,6 @@ export interface RootState { // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any transaction: any; - smartTransactions: StateFromReducer; user: IUserReducer; // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -145,7 +143,6 @@ const rootReducer = combineReducers({ settings: settingsReducer, alert: alertReducer, transaction: transactionReducer, - smartTransactions: smartTransactionsReducer, user: userReducer, wizard: wizardReducer, onboarding: onboardingReducer, diff --git a/app/util/onboarding/index.test.ts b/app/util/onboarding/index.test.ts deleted file mode 100644 index ed29990daca9..000000000000 --- a/app/util/onboarding/index.test.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { shouldShowSmartTransactionsOptInModal } from './index'; -import StorageWrapper from '../../store/storage-wrapper'; -import { NETWORKS_CHAIN_ID } from '../../constants/network'; -import { store } from '../../store'; - -const getMockState = (optInModalAppVersionSeen: string | null) => ({ - smartTransactions: { - optInModalAppVersionSeen, - }, -}); - -jest.mock('../../store/storage-wrapper'); - -jest.mock('../../store', () => ({ - store: { - getState: jest.fn(() => getMockState(null)), - dispatch: jest.fn(), - }, -})); - -describe('shouldShowSmartTransactionOptInModal', () => { - beforeEach(() => { - // Clear all instances and calls to constructor and all methods: - (StorageWrapper.getItem as jest.Mock).mockClear(); - (store.getState as jest.Mock).mockClear(); - }); - - it('returns true if a user has not seen the modal, is on Ethereum mainnet with default RPC URL and has non-zero balance', async () => { - (StorageWrapper.getItem as jest.Mock).mockResolvedValueOnce('7.24.0'); // currentAppVersion - (store.getState as jest.Mock).mockReturnValueOnce(getMockState(null)); // versionSeen - - const result = await shouldShowSmartTransactionsOptInModal( - NETWORKS_CHAIN_ID.MAINNET, - undefined, - false, - ); - expect(result).toBe(true); - }); - - test.each([ - [NETWORKS_CHAIN_ID.MAINNET, 'http://mainnet-url.example.com'], - [NETWORKS_CHAIN_ID.ARBITRUM, 'http://arbitrum-url.example.com'], - ])( - `returns false if chainId is not ${NETWORKS_CHAIN_ID.MAINNET} or providerConfigRpcUrl is defined`, - async (chainId, rpcUrl) => { - const result = await shouldShowSmartTransactionsOptInModal( - chainId, - rpcUrl, - false, - ); - expect(result).toBe(false); - }, - ); - - it('returns false if user has seen the modal', async () => { - (StorageWrapper.getItem as jest.Mock).mockResolvedValueOnce('7.24.0'); // currentAppVersion - (store.getState as jest.Mock).mockReturnValueOnce(getMockState('7.24.0')); // versionSeen - - const result = await shouldShowSmartTransactionsOptInModal( - NETWORKS_CHAIN_ID.MAINNET, - undefined, - false, - ); - expect(result).toBe(false); - }); - - it('returns false if app version is not correct', async () => { - (StorageWrapper.getItem as jest.Mock).mockResolvedValueOnce('7.0.0'); // currentAppVersion - (store.getState as jest.Mock).mockReturnValueOnce(getMockState(null)); // versionSeen - - const result = await shouldShowSmartTransactionsOptInModal( - NETWORKS_CHAIN_ID.MAINNET, - undefined, - false, - ); - expect(result).toBe(false); - }); - - it('returns false if a user has 0 balance on Ethereum Mainnet with default RPC URL', async () => { - (StorageWrapper.getItem as jest.Mock).mockResolvedValueOnce('7.24.0'); // currentAppVersion - (store.getState as jest.Mock).mockReturnValueOnce(getMockState(null)); // versionSeen - - const result = await shouldShowSmartTransactionsOptInModal( - NETWORKS_CHAIN_ID.MAINNET, - undefined, - true, - ); - expect(result).toBe(false); - }); -}); diff --git a/app/util/onboarding/index.ts b/app/util/onboarding/index.ts index 3afd4ad6a6ce..041f5a448eb9 100644 --- a/app/util/onboarding/index.ts +++ b/app/util/onboarding/index.ts @@ -15,51 +15,6 @@ const isVersionSeenAndGreaterThanMinAppVersion = ( minAppVersion: string, ) => !!versionSeen && compareVersions.compare(versionSeen, minAppVersion, '>='); -const STX_OPT_IN_MIN_APP_VERSION = '7.24.0'; - -/** - * - * @param chainId The chainId of the current network - * @param providerConfigRpcUrl The RPC URL of the current network - * @returns Boolean indicating whether or not to show smart transactions opt in modal - */ -export const shouldShowSmartTransactionsOptInModal = async ( - chainId: string, - providerConfigRpcUrl: string | undefined, - accountHasZeroBalance: boolean, -) => { - if ( - process.env.IS_TEST === 'true' || - chainId !== NETWORKS_CHAIN_ID.MAINNET || - providerConfigRpcUrl !== undefined || // undefined is the default RPC URL (Infura). - accountHasZeroBalance - ) { - return false; - } - - const versionSeen = - store.getState().smartTransactions.optInModalAppVersionSeen; - - const currentAppVersion = await StorageWrapper.getItem(CURRENT_APP_VERSION); - - // Check if user has seen - const seen = isVersionSeenAndGreaterThanMinAppVersion( - versionSeen, - STX_OPT_IN_MIN_APP_VERSION, - ); - - if (seen) return false; - - // Check version - const versionCorrect = compareVersions.compare( - currentAppVersion as string, - STX_OPT_IN_MIN_APP_VERSION, - '>=', - ); - - return versionCorrect; -}; - /** * Returns boolean indicating whether or not to show whats new modal * diff --git a/app/util/sentry/__snapshots__/utils.test.ts.snap b/app/util/sentry/__snapshots__/utils.test.ts.snap index e0808824efb8..f85b956d97f4 100644 --- a/app/util/sentry/__snapshots__/utils.test.ts.snap +++ b/app/util/sentry/__snapshots__/utils.test.ts.snap @@ -197,9 +197,6 @@ exports[`captureSentryFeedback maskObject masks initial root state fixture 1`] = "useBlockieIcon": true, }, "signatureRequest": "object", - "smartTransactions": { - "optInModalAppVersionSeen": null, - }, "swaps": "object", "transaction": "object", "transactionMetrics": "object", diff --git a/app/util/sentry/utils.test.ts b/app/util/sentry/utils.test.ts index a0b5fceb3ef3..cbce0d6eb4c5 100644 --- a/app/util/sentry/utils.test.ts +++ b/app/util/sentry/utils.test.ts @@ -366,9 +366,6 @@ describe('captureSentryFeedback', () => { type: undefined, warningGasPriceHigh: undefined, }, - smartTransactions: { - optInModalAppVersionSeen: null, - }, user: { ambiguousAddressEntries: {}, backUpSeedphraseVisible: false, diff --git a/app/util/test/initial-background-state.json b/app/util/test/initial-background-state.json index 9cf1471581ad..7f65c3a46f6d 100644 --- a/app/util/test/initial-background-state.json +++ b/app/util/test/initial-background-state.json @@ -112,7 +112,7 @@ "0x64": true }, "isIpfsGatewayEnabled": true, - "smartTransactionsOptInStatus": false, + "smartTransactionsOptInStatus": true, "useTransactionSimulations": true }, "TokenBalancesController": { diff --git a/e2e/pages/modals/TransactionProtectionModal.js b/e2e/pages/modals/TransactionProtectionModal.js deleted file mode 100644 index 0af997f56ab9..000000000000 --- a/e2e/pages/modals/TransactionProtectionModal.js +++ /dev/null @@ -1,23 +0,0 @@ -import { TransactionProtectionModalSelectorText } from '../../selectors/Modals/TransactionProtectionModal.selectors'; -import Matchers from '../../utils/Matchers'; -import Gestures from '../../utils/Gestures'; - -class TransactionProtectionModal { - get header() { - return Matchers.getElementByText( - TransactionProtectionModalSelectorText.HEADER, - ); - } - - get enableButton() { - return Matchers.getElementByText( - TransactionProtectionModalSelectorText.ENABLE_BUTTON, - ); - } - - async tapEnableButton() { - await Gestures.waitAndTap(this.enableButton); - } -} - -export default new TransactionProtectionModal(); diff --git a/e2e/selectors/Modals/SmartTransactionsOptInModal.selectors.js b/e2e/selectors/Modals/SmartTransactionsOptInModal.selectors.js deleted file mode 100644 index 449c585d83b5..000000000000 --- a/e2e/selectors/Modals/SmartTransactionsOptInModal.selectors.js +++ /dev/null @@ -1,4 +0,0 @@ -export const SmartTransactionsOptInModalSelectorsIDs = { - CLOSE_BUTTON: 'smart-transactions-opt-in-modal-close-button', - CONTAINER: 'smart-transactions-opt-in-modal-container', -}; diff --git a/e2e/selectors/Modals/TransactionProtectionModal.selectors.js b/e2e/selectors/Modals/TransactionProtectionModal.selectors.js deleted file mode 100644 index 98978e8f6a85..000000000000 --- a/e2e/selectors/Modals/TransactionProtectionModal.selectors.js +++ /dev/null @@ -1,6 +0,0 @@ -import enContent from '../../../locales/languages/en.json'; - -export const TransactionProtectionModalSelectorText = { - HEADER: enContent.whats_new.stx.header, - ENABLE_BUTTON: enContent.whats_new.stx.primary_button, -}; diff --git a/wdio/screen-objects/Modals/TransactionProtectionModal.js b/wdio/screen-objects/Modals/TransactionProtectionModal.js deleted file mode 100644 index b12db031e576..000000000000 --- a/wdio/screen-objects/Modals/TransactionProtectionModal.js +++ /dev/null @@ -1,33 +0,0 @@ -import { - TransactionProtectionModalSelectorText -} from '../../../e2e/selectors/Modals/TransactionProtectionModal.selectors'; -import Gestures from '../../helpers/Gestures'; -import Selectors from '../../helpers/Selectors'; - -class TransactionProtectionModal { - get header() { - return Selectors.getXpathElementByText( - TransactionProtectionModalSelectorText.HEADER, - ); - } - - get enableButton() { - return Selectors.getXpathElementByText( - TransactionProtectionModalSelectorText.ENABLE_BUTTON, - ); - } - - async isVisible() { - await expect(this.header).toBeDisplayed(); - } - - async isNotVisible() { - await expect(this.header).not.toBeDisplayed(); - } - - async tapEnableButton() { - await Gestures.waitAndTap(this.enableButton); - } -} - -export default new TransactionProtectionModal(); diff --git a/wdio/step-definitions/common-steps.js b/wdio/step-definitions/common-steps.js index 39f06270b6db..174a39509816 100644 --- a/wdio/step-definitions/common-steps.js +++ b/wdio/step-definitions/common-steps.js @@ -17,7 +17,6 @@ import WhatsNewModal from '../screen-objects/Modals/WhatsNewModal'; import Gestures from '../helpers/Gestures'; import OnboardingSucessScreen from '../screen-objects/OnboardingSucessScreen.js'; import ExperienceEnhancerModal from '../screen-objects/Modals/ExperienceEnhancerModal'; -import TransactionProtectionModal from '../screen-objects/Modals/TransactionProtectionModal'; import SettingsScreen from '../screen-objects/SettingsScreen'; Then(/^the Welcome screen is displayed$/, async () => { @@ -321,16 +320,6 @@ Given(/^I close all the onboarding modals$/, async () => { console.log('The onboarding modal is not visible'); } - try { - await TransactionProtectionModal.isVisible(); - await TransactionProtectionModal.tapEnableButton(); - await TransactionProtectionModal.isNotVisible(); - } catch { - /* eslint-disable no-console */ - - console.log('The whats new modal is not visible'); - } - try { // Handle Marketing consent modal