From f6c2a7aa568722057557065e8400c4d716c6ba11 Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Thu, 10 Nov 2022 00:45:30 +0000 Subject: [PATCH] chore(#1972): delete deposit page and update deposit cypress tests (#1990) * fix: #1972 update deposit cypress tests and delete deposit trading page * fix: #1972 remove portfolio/deposit route --- .../trading-e2e/src/integration/deposit.cy.ts | 16 ++++-- .../deposit/deposit-container.tsx | 38 -------------- apps/trading/client-pages/deposit/deposit.tsx | 52 ------------------- apps/trading/client-pages/deposit/index.ts | 3 -- .../portfolio/deposits-container.tsx | 6 ++- apps/trading/pages/client-router.tsx | 9 ---- libs/web3/src/lib/web3-wallet-input.tsx | 5 +- 7 files changed, 21 insertions(+), 108 deletions(-) delete mode 100644 apps/trading/client-pages/deposit/deposit-container.tsx delete mode 100644 apps/trading/client-pages/deposit/deposit.tsx delete mode 100644 apps/trading/client-pages/deposit/index.ts diff --git a/apps/trading-e2e/src/integration/deposit.cy.ts b/apps/trading-e2e/src/integration/deposit.cy.ts index 444c765b8..91f44df28 100644 --- a/apps/trading-e2e/src/integration/deposit.cy.ts +++ b/apps/trading-e2e/src/integration/deposit.cy.ts @@ -1,3 +1,5 @@ +import { connectVegaWallet } from '../support/vega-wallet'; + const connectEthWalletBtn = 'connect-eth-wallet-btn'; const assetSelectField = 'select[name="asset"]'; const toAddressField = 'input[name="to"]'; @@ -9,8 +11,14 @@ describe('deposit form validation', { tags: '@smoke' }, () => { cy.mockWeb3Provider(); cy.mockGQLSubscription(); cy.mockTradingPage(); - cy.visit('/#/portfolio/deposit'); + cy.visit('/#/portfolio'); + cy.get('main[data-testid="/portfolio"]').should('exist'); + cy.getByTestId('Deposits').click(); + cy.getByTestId('tab-deposits').contains('Connect your Vega wallet'); + connectVegaWallet(); + // validateFillsDisplayed(); + cy.getByTestId('deposit-button').click(); // Deposit page requires connection Ethereum wallet first cy.getByTestId(connectEthWalletBtn).click(); cy.getByTestId('web3-connector-MetaMask').click(); @@ -19,11 +27,11 @@ describe('deposit form validation', { tags: '@smoke' }, () => { }); it('handles empty fields', () => { - // Submit form to trigger any empty validaion messages + // Submit form to trigger any empty validation messages cy.getByTestId('deposit-submit').click(); cy.getByTestId(formFieldError).should('contain.text', 'Required'); - cy.getByTestId(formFieldError).should('have.length', 3); + cy.getByTestId(formFieldError).should('have.length', 2); // Invalid public key cy.get(toAddressField) @@ -64,7 +72,7 @@ describe('deposit form validation', { tags: '@smoke' }, () => { cy.get('#ethereum-address').should('have.value', ethWalletAddress).click(); cy.getByTestId('dialog-content').within(() => { cy.get('p').should('have.text', `Connected with ${ethWalletAddress}`); - cy.get('button') + cy.getByTestId('disconnect-ethereum-wallet') .should('have.text', 'Disconnect Ethereum Wallet') .click(); }); diff --git a/apps/trading/client-pages/deposit/deposit-container.tsx b/apps/trading/client-pages/deposit/deposit-container.tsx deleted file mode 100644 index 0a1821361..000000000 --- a/apps/trading/client-pages/deposit/deposit-container.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { DepositManager } from '@vegaprotocol/deposits'; -import { useDataProvider, t } from '@vegaprotocol/react-helpers'; -import { enabledAssetsProvider } from '@vegaprotocol/assets'; -import { useEnvironment } from '@vegaprotocol/environment'; -import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; - -/** - * Fetches data required for the Deposit page - */ -export const DepositContainer = () => { - const { VEGA_ENV } = useEnvironment(); - const { data, error, loading } = useDataProvider({ - dataProvider: enabledAssetsProvider, - }); - return ( - { - if (!assets || !assets.length) { - return ( - -

{t('No assets on this network')}

-
- ); - } - - return ( - - ); - }} - /> - ); -}; diff --git a/apps/trading/client-pages/deposit/deposit.tsx b/apps/trading/client-pages/deposit/deposit.tsx deleted file mode 100644 index 91bd27b6c..000000000 --- a/apps/trading/client-pages/deposit/deposit.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { enabledAssetsProvider } from '@vegaprotocol/assets'; -import { DepositManager } from '@vegaprotocol/deposits'; -import { useEnvironment } from '@vegaprotocol/environment'; -import { t, titlefy, useDataProvider } from '@vegaprotocol/react-helpers'; -import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; -import { Web3Container } from '@vegaprotocol/web3'; -import { useEffect } from 'react'; -import { usePageTitleStore } from '../../stores'; - -export const Deposit = () => { - const { updateTitle } = usePageTitleStore((store) => ({ - updateTitle: store.updateTitle, - })); - - useEffect(() => { - updateTitle(titlefy([t('Deposits')])); - }, [updateTitle]); - - const { VEGA_ENV } = useEnvironment(); - const { data, error, loading } = useDataProvider({ - dataProvider: enabledAssetsProvider, - }); - - return ( - -
-

{t('Deposit')}

- { - if (!assets || !assets.length) { - return ( - -

{t('No assets on this network')}

-
- ); - } - - return ( - - ); - }} - /> -
-
- ); -}; diff --git a/apps/trading/client-pages/deposit/index.ts b/apps/trading/client-pages/deposit/index.ts deleted file mode 100644 index aa1922157..000000000 --- a/apps/trading/client-pages/deposit/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Deposit } from './deposit'; - -export default Deposit; diff --git a/apps/trading/client-pages/portfolio/deposits-container.tsx b/apps/trading/client-pages/portfolio/deposits-container.tsx index d90e9690f..b8e62c1f6 100644 --- a/apps/trading/client-pages/portfolio/deposits-container.tsx +++ b/apps/trading/client-pages/portfolio/deposits-container.tsx @@ -25,7 +25,11 @@ export const DepositsContainer = () => { setDepositDialog={setDepositDialog} />
-
diff --git a/apps/trading/pages/client-router.tsx b/apps/trading/pages/client-router.tsx index 0c03298a4..9711dac38 100644 --- a/apps/trading/pages/client-router.tsx +++ b/apps/trading/pages/client-router.tsx @@ -23,15 +23,10 @@ const LazyPortfolio = dynamic(() => import('../client-pages/portfolio'), { ssr: false, }); -const LazyDeposit = dynamic(() => import('../client-pages/deposit'), { - ssr: false, -}); - export enum Routes { HOME = '/', MARKETS = '/markets', PORTFOLIO = '/portfolio', - PORTFOLIO_DEPOSIT = '/portfolio/deposit', } const routerConfig = [ @@ -55,10 +50,6 @@ const routerConfig = [ path: Routes.PORTFOLIO, element: , }, - { - path: Routes.PORTFOLIO_DEPOSIT, - element: , - }, ]; export const ClientRouter = () => { diff --git a/libs/web3/src/lib/web3-wallet-input.tsx b/libs/web3/src/lib/web3-wallet-input.tsx index 5811b5e3d..86d21508b 100644 --- a/libs/web3/src/lib/web3-wallet-input.tsx +++ b/libs/web3/src/lib/web3-wallet-input.tsx @@ -34,7 +34,10 @@ export const Web3WalletInput = ({ inputProps }: Web3WalletInputProps) => { {t('Connected with ')} {account}

-