diff --git a/cashtab/package-lock.json b/cashtab/package-lock.json --- a/cashtab/package-lock.json +++ b/cashtab/package-lock.json @@ -1,12 +1,12 @@ { "name": "cashtab", - "version": "2.26.1", + "version": "2.26.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cashtab", - "version": "2.26.1", + "version": "2.26.2", "dependencies": { "@bitgo/utxo-lib": "^9.33.0", "@zxing/browser": "^0.1.4", diff --git a/cashtab/package.json b/cashtab/package.json --- a/cashtab/package.json +++ b/cashtab/package.json @@ -1,6 +1,6 @@ { "name": "cashtab", - "version": "2.26.1", + "version": "2.26.2", "private": true, "scripts": { "start": "node scripts/start.js", diff --git a/cashtab/src/components/Airdrop/Airdrop.js b/cashtab/src/components/Airdrop/Airdrop.js --- a/cashtab/src/components/Airdrop/Airdrop.js +++ b/cashtab/src/components/Airdrop/Airdrop.js @@ -352,7 +352,7 @@ handleIgnoreMintAddress(prev => !prev) @@ -398,7 +398,7 @@ handleIgnoreMinEtokenBalanceAmt(prev => !prev) @@ -418,7 +418,7 @@ handleIgnoreCustomAddresses(prev => !prev) diff --git a/cashtab/src/components/Airdrop/__tests__/Airdrop.test.js b/cashtab/src/components/Airdrop/__tests__/Airdrop.test.js --- a/cashtab/src/components/Airdrop/__tests__/Airdrop.test.js +++ b/cashtab/src/components/Airdrop/__tests__/Airdrop.test.js @@ -111,7 +111,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); await user.type( @@ -139,7 +141,7 @@ ); // We can ignore the mint address - await user.click(screen.getByTestId('ignore-mint-address')); + await user.click(screen.getByTitle('Toggle Ignore Mint Address')); await user.click( screen.getByRole('button', { name: /Calculate Airdrop/ }), ); @@ -152,7 +154,7 @@ ); // We can ignore other addresses - await user.click(screen.getByTestId('ignore-custom-addresses')); + await user.click(screen.getByTitle('Toggle Ignore Custom Addresses')); await user.type( await screen.findByPlaceholderText(/If more than one XEC address/), 'ecash:qzj5zu6fgg8v2we82gh76xnrk9njcreglum9ffspnr,ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj', @@ -171,7 +173,7 @@ // We can airdrop people with less of a token the same amount of XEC as other users in case we happen to think in this way // We can ignore other addresses - await user.click(screen.getByTestId('communist-airdrop')); + await user.click(screen.getByTitle('Toggle Communism')); await user.click( screen.getByRole('button', { name: /Calculate Airdrop/ }), @@ -213,7 +215,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); await user.type( @@ -241,7 +245,7 @@ ); // We can ignore the mint address - await user.click(screen.getByTestId('ignore-mint-address')); + await user.click(screen.getByTitle('Toggle Ignore Mint Address')); await user.click( screen.getByRole('button', { name: /Calculate Airdrop/ }), ); @@ -254,7 +258,7 @@ ); // We can ignore addresses based on having too little of the token - await user.click(screen.getByTestId('minimum-etoken-holder-balance')); + await user.click(screen.getByTitle('Toggle Minimum Token Balance')); await user.type( await screen.findByPlaceholderText(/Minimum eToken balance/), '0.25', @@ -272,7 +276,7 @@ ); // We can ignore another address - await user.click(screen.getByTestId('ignore-custom-addresses')); + await user.click(screen.getByTitle('Toggle Ignore Custom Addresses')); await user.type( await screen.findByPlaceholderText(/If more than one XEC address/), 'ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2', diff --git a/cashtab/src/components/Alias/__tests__/Alias.test.js b/cashtab/src/components/Alias/__tests__/Alias.test.js --- a/cashtab/src/components/Alias/__tests__/Alias.test.js +++ b/cashtab/src/components/Alias/__tests__/Alias.test.js @@ -109,7 +109,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Validate rendering of registered and pending alias tags @@ -147,7 +149,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Tags rendered as expected @@ -186,7 +190,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Validate the aliases within the dropdowns @@ -219,7 +225,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // We see registered aliases @@ -251,7 +259,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Validate the aliases within the dropdowns diff --git a/cashtab/src/components/App/App.js b/cashtab/src/components/App/App.js --- a/cashtab/src/components/App/App.js +++ b/cashtab/src/components/App/App.js @@ -463,7 +463,7 @@ {!cashtabLoaded ? ( - + ) : ( <> {wallet === false ? ( @@ -552,7 +552,7 @@ )} - + navigate('/send')} style={{ paddingBottom: '10px' }} @@ -687,30 +687,29 @@ navigate('/etokens')} > navigate('receive')} > navigate('/backup')} > @@ -719,7 +718,6 @@ navigate('/wallets')} > @@ -728,7 +726,6 @@ navigate('/contacts')} > @@ -737,7 +734,6 @@ navigate('/airdrop')} > @@ -748,7 +744,6 @@ {process.env.REACT_APP_BUILD_ENV !== 'extension' && ( navigate('/swap')} > @@ -758,7 +753,6 @@ )} navigate('/signverifymsg') @@ -778,7 +772,6 @@ )} navigate('/configure')} > diff --git a/cashtab/src/components/App/__tests__/App.test.js b/cashtab/src/components/App/__tests__/App.test.js --- a/cashtab/src/components/App/__tests__/App.test.js +++ b/cashtab/src/components/App/__tests__/App.test.js @@ -136,7 +136,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // We get the Onboarding screen @@ -154,7 +156,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // We get the Onboarding screen @@ -174,7 +178,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // We get the Onboarding screen @@ -194,7 +200,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // We get the Onboarding screen @@ -209,42 +217,58 @@ render(); // Default route is home - await screen.findByTestId('tx-history-ctn'); + await screen.findByTitle('Tx History'); // Navigate to Send screen - await user.click(screen.queryByTestId('nav-btn-send')); + await user.click( + screen.getByRole('button', { + name: /Send Screen/i, + }), + ); // Now we see the Send screen (we check by confirming presence of the send to many switch) - expect(screen.getByTestId('send-to-many-switch')).toBeInTheDocument(); + expect(screen.getByTitle('Toggle Multisend')).toBeInTheDocument(); // Navigate to eTokens screen - await user.click(screen.queryByTestId('nav-btn-etokens')); + await user.click( + screen.getByRole('button', { + name: /Tokens/i, + }), + ); // Now we see the eTokens screen - expect(screen.getByTestId('etokens-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('Wallet Tokens')).toBeInTheDocument(); // Navigate to Receive screen - await user.click(screen.queryByTestId('nav-btn-receive')); + await user.click( + screen.getByRole('button', { + name: /Receive/i, + }), + ); // Now we see the Receive screen - expect(screen.getByTestId('receive-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('Receive')).toBeInTheDocument(); // We do not expect to see hamburger menu items before the menu is clicked // This is handled by dynamic css changes, so test that - expect(screen.queryByTestId('hamburger-menu')).toHaveStyle( + expect(screen.queryByTitle('Other Screens')).toHaveStyle( `max-height: 0`, ); // Click the hamburger menu - await user.click(screen.queryByTestId('hamburger')); + await user.click(screen.queryByTitle('Show Other Screens')); // Now we see these items - expect(screen.queryByTestId('hamburger-menu')).toHaveStyle( + expect(screen.queryByTitle('Other Screens')).toHaveStyle( `max-height: 100rem`, ); // Navigate to Airdrop screen - await user.click(screen.queryByTestId('nav-btn-airdrop')); + await user.click( + screen.getByRole('button', { + name: /Airdrop/i, + }), + ); // Now we see the Airdrop screen expect( @@ -252,13 +276,17 @@ ).toBeInTheDocument(); // The hamburger menu closes on nav - expect(screen.queryByTestId('hamburger-menu')).toHaveStyle( + expect(screen.queryByTitle('Other Screens')).toHaveStyle( `max-height: 0`, ); // ... but, we can still click these items with the testing library, so we do // Navigate to Swap screen - await user.click(screen.queryByTestId('nav-btn-swap')); + await user.click( + screen.getByRole('button', { + name: /Swap/i, + }), + ); // Now we see the Swap screen expect( @@ -266,19 +294,31 @@ ).toBeInTheDocument(); // Navigate to SignVerifyMsg screen - await user.click(screen.queryByTestId('nav-btn-signverifymsg')); + await user.click( + screen.getByRole('button', { + name: /Sign & Verify/i, + }), + ); // Now we see the SignVerifyMsg screen - expect(screen.getByTestId('signverifymsg-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('Sign & Verify')).toBeInTheDocument(); // Navigate to Settings screen - await user.click(screen.queryByTestId('nav-btn-configure')); + await user.click( + screen.getByRole('button', { + name: /Settings/i, + }), + ); // Now we see the Settings screen - expect(screen.getByTestId('configure-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('Settings')).toBeInTheDocument(); // Navigate to Backup screen - await user.click(screen.queryByTestId('nav-btn-backup')); + await user.click( + screen.getByRole('button', { + name: /Wallet Backup/i, + }), + ); // Now we see the Backup screen expect( @@ -288,16 +328,24 @@ ).toBeInTheDocument(); // Navigate to Contacts screen - await user.click(screen.queryByTestId('nav-btn-contacts')); + await user.click( + screen.getByRole('button', { + name: /Contacts/i, + }), + ); // Now we see the Contacts screen - expect(screen.getByTestId('contacts')).toBeInTheDocument(); + expect(screen.getByTitle('Contacts')).toBeInTheDocument(); // Navigate to Wallets screen - await user.click(screen.queryByTestId('nav-btn-wallets')); + await user.click( + screen.getByRole('button', { + name: /Wallets/i, + }), + ); // Now we see the Wallets screen - expect(screen.getByTestId('wallets')).toBeInTheDocument(); + expect(screen.getByTitle('Wallets')).toBeInTheDocument(); }); it('Adding a contact to to a new contactList by clicking on tx history adds it to localforage and wallet context', async () => { const mockedChronik = await initializeCashtabStateForTests( @@ -309,16 +357,18 @@ // Wait for the page to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '10,000.00 XEC', ); // We see the home container - await screen.findByTestId('tx-history-ctn'); + await screen.findByTitle('Tx History'); // Open the collapse of this tx in tx history to see the panel options // We can click anywhere on this tx @@ -370,16 +420,18 @@ // Wait for the page to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '10,000.00 XEC', ); // We see the home container - await screen.findByTestId('tx-history-ctn'); + await screen.findByTitle('Tx History'); // Open the collapse of this tx in tx history to see the panel options // We can click anywhere on this tx @@ -427,9 +479,7 @@ // Wait for cashtabbootup, so that loadContactList has been called // Wallet-info is rendered - expect( - await screen.findByTestId('wallet-info-ctn'), - ).toBeInTheDocument(); + expect(await screen.findByTitle('Wallet Info')).toBeInTheDocument(); // localforage has been updated with the new format for an empty contact list await waitFor(async () => @@ -447,19 +497,17 @@ render(); // Wallet-info is rendered - expect( - await screen.findByTestId('wallet-info-ctn'), - ).toBeInTheDocument(); + expect(await screen.findByTitle('Wallet Info')).toBeInTheDocument(); // Balance is correct - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '10,000.00 XEC', ); // We do not see the send screen before clicking the button await waitFor(() => expect( - screen.queryByTestId('send-to-many-switch'), + screen.queryByTitle('Toggle Multisend'), ).not.toBeInTheDocument(), ); @@ -467,7 +515,7 @@ // Now we see the Send screen expect( - await screen.findByTestId('send-to-many-switch'), + await screen.findByTitle('Toggle Multisend'), ).toBeInTheDocument(); // The SendXec send address input is rendered and has expected value @@ -631,16 +679,18 @@ // The wallet must load from API calls await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '9,513.12 XEC', ); // We are forwarded to the home screen after the wallet loads - expect(await screen.findByTestId('tx-history-ctn')).toBeInTheDocument(); + expect(await screen.findByTitle('Tx History')).toBeInTheDocument(); // The imported wallet is in localforage const wallets = await localforage.getItem('wallets'); @@ -679,11 +729,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '9,513.12 XEC', ); @@ -715,11 +767,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '9,513.12 XEC', ); @@ -753,11 +807,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '9,513.12 XEC', ); @@ -795,11 +851,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '9,513.12 XEC', ); @@ -825,11 +883,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '9,513.12 XEC', ); @@ -850,11 +910,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '9,513.12 XEC', ); @@ -890,11 +952,13 @@ // Wait for the page to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '9,513.12 XEC', ); @@ -920,11 +984,13 @@ // Wait for the page to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait balance to be rendered correctly so we know Cashtab has loaded the wallet - expect(await screen.findByTestId('balance-xec')).toHaveTextContent( + expect(await screen.findByTitle('Balance in XEC')).toHaveTextContent( '9,513.12 XEC', ); @@ -1019,7 +1085,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Advance timers more than the price interval @@ -1066,7 +1134,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Advance timers more than the price interval diff --git a/cashtab/src/components/App/fixtures/__tests__/CashtabTestWrapper.test.js b/cashtab/src/components/App/fixtures/__tests__/CashtabTestWrapper.test.js --- a/cashtab/src/components/App/fixtures/__tests__/CashtabTestWrapper.test.js +++ b/cashtab/src/components/App/fixtures/__tests__/CashtabTestWrapper.test.js @@ -78,20 +78,22 @@ // We are at the component, i.e. home page if we do not nav anywhere // API Error is NOT rendered - await waitFor(() => - expect(screen.queryByTestId('api-error')).not.toBeInTheDocument(), - ); + expect( + screen.queryByText('Error in chronik connection'), + ).not.toBeInTheDocument(); // Wait for Cashtab to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for the balance to render expect(await screen.findByText('9,513.12 XEC')).toBeInTheDocument(); // Home container - expect(await screen.findByTestId('tx-history-ctn')).toBeInTheDocument(); + expect(await screen.findByTitle('Tx History')).toBeInTheDocument(); }); it('We can render other pages by passing the route', async () => { const mockedChronik = await initializeCashtabStateForTests( @@ -103,6 +105,6 @@ ); // We are at the component, i.e. home page if we do not nav anywhere - expect(await screen.findByTestId('configure-ctn')).toBeInTheDocument(); + expect(await screen.findByTitle('Settings')).toBeInTheDocument(); }); }); diff --git a/cashtab/src/components/Common/BalanceHeader.js b/cashtab/src/components/Common/BalanceHeader.js --- a/cashtab/src/components/Common/BalanceHeader.js +++ b/cashtab/src/components/Common/BalanceHeader.js @@ -95,7 +95,7 @@ ) : ( <> {formattedBalanceXec} {appConfig.ticker}{' '} @@ -103,7 +103,7 @@ {renderFiatValues && ( <> {supportedFiatCurrencies[settings.fiatCurrency].symbol} @@ -112,7 +112,7 @@ settings.fiatCurrency ].slug.toUpperCase()} - + 1 {appConfig.ticker} = {formattedExchangeRate}{' '} {settings.fiatCurrency.toUpperCase()} diff --git a/cashtab/src/components/Common/CustomIcons.js b/cashtab/src/components/Common/CustomIcons.js --- a/cashtab/src/components/Common/CustomIcons.js +++ b/cashtab/src/components/Common/CustomIcons.js @@ -47,13 +47,6 @@ export const TokenNotificationIcon = () => ( ); -export const ThemedContactSendOutlined = styled(Send)` - color: ${props => props.theme.icons.outlined} !important; - transform: rotate(-35deg); - padding: 0.15rem 0rem 0.18rem 0rem; - height: 1.3em; - width: 1.3em; -`; export const ThemedLinkSolid = styled(LinkSolid)` fill: ${props => props.theme.contrast}; @@ -69,22 +62,6 @@ width: 1.3em; `; -export const ThemedEditOutlined = styled(Edit)` - stroke: ${props => props.theme.eCashBlue}; - fill: ${props => props.theme.eCashBlue}; - width: 20px; - height: 20px; - cursor: pointer; -`; - -export const ThemedTrashcanOutlined = styled(Trashcan)` - stroke: ${props => props.theme.eCashBlue}; - fill: ${props => props.theme.eCashBlue}; - width: 20px; - height: 20px; - cursor: pointer; -`; - export const ThemedSignAndVerifyMsg = styled(Audit)` min-width: 24px; `; @@ -177,6 +154,26 @@ export const MintIcon = () => ; export const CopyPasteIcon = () => ; export const AddContactIcon = () => ; +const TrashCanWrapper = styled.div` + stroke: ${props => props.theme.eCashBlue}; + fill: ${props => props.theme.eCashBlue}; + cursor: pointer; +`; +export const TrashcanIcon = () => ( + + + +); +const EditWrapper = styled.div` + stroke: ${props => props.theme.eCashBlue}; + fill: ${props => props.theme.eCashBlue}; + cursor: pointer; +`; +export const EditIcon = () => ( + + + +); export const ReplyIcon = () => ; export const UnknownIcon = () => ; export const CashtabMsgIcon = () => ; diff --git a/cashtab/src/components/Common/ScanQRCode.js b/cashtab/src/components/Common/ScanQRCode.js --- a/cashtab/src/components/Common/ScanQRCode.js +++ b/cashtab/src/components/Common/ScanQRCode.js @@ -124,7 +124,7 @@ return ( <> setVisible(!visible)} > @@ -148,7 +148,7 @@ ) : ( )} diff --git a/cashtab/src/components/Common/Switch.js b/cashtab/src/components/Common/Switch.js --- a/cashtab/src/components/Common/Switch.js +++ b/cashtab/src/components/Common/Switch.js @@ -113,13 +113,13 @@ { render( @@ -61,24 +61,24 @@ ); // Loader is not rendered - expect(screen.queryByTestId('cash-loader')).not.toBeInTheDocument(); + expect(screen.queryByTitle('Loading')).not.toBeInTheDocument(); // XEC balance is calculated correctly - const BalanceXec = screen.getByTestId('balance-xec'); + const BalanceXec = screen.getByTitle('Balance in XEC'); expect(BalanceXec).toHaveTextContent(`10,000,000.00 XEC`); // XEC balance is not hidden expect(BalanceXec).toHaveStyle(`text-shadow: none`); // Fiat balance is calculated correctly - const BalanceFiat = screen.getByTestId('balance-fiat'); + const BalanceFiat = screen.getByTitle('Balance in Local Currency'); expect(BalanceFiat).toHaveTextContent(`$300.00 USD`); // Fiat balance is not hidden expect(BalanceFiat).toHaveStyle(`text-shadow: none`); // eCash price is rendered - expect(screen.getByTestId('ecash-price')).toHaveTextContent( + expect(screen.getByTitle('Price in Local Currency')).toHaveTextContent( `1 XEC = 0.00003000 USD`, ); }); @@ -95,24 +95,24 @@ ); // Loader is not rendered - expect(screen.queryByTestId('cash-loader')).not.toBeInTheDocument(); + expect(screen.queryByTitle('Loading')).not.toBeInTheDocument(); // XEC balance is displayed - const BalanceXec = screen.getByTestId('balance-xec'); + const BalanceXec = screen.getByTitle('Balance in XEC'); expect(BalanceXec).toHaveTextContent(`10 000 000,00 XEC`); // XEC balance is not hidden expect(BalanceXec).toHaveStyle(`text-shadow: none`); // Fiat balance is calculated correctly - const BalanceFiat = screen.getByTestId('balance-fiat'); + const BalanceFiat = screen.getByTitle('Balance in Local Currency'); expect(BalanceFiat).toHaveTextContent(`â‚Ŧ300,00 EUR`); // Fiat balance is not hidden expect(BalanceFiat).toHaveStyle(`text-shadow: none`); // eCash price is rendered - expect(screen.getByTestId('ecash-price')).toHaveTextContent( + expect(screen.getByTitle('Price in Local Currency')).toHaveTextContent( `1 XEC = 0,00003000 EUR`, ); }); @@ -128,24 +128,24 @@ ); // Loader is not rendered - expect(screen.queryByTestId('cash-loader')).not.toBeInTheDocument(); + expect(screen.queryByTitle('Loading')).not.toBeInTheDocument(); // XEC balance is calculated correctly - const BalanceXec = screen.getByTestId('balance-xec'); + const BalanceXec = screen.getByTitle('Balance in XEC'); expect(BalanceXec).toHaveTextContent(`10,000,000.00 XEC`); // XEC balance is hidden expect(BalanceXec).toHaveStyle(`text-shadow: 0 0 15px #fff`); // Fiat balance is calculated correctly - const BalanceFiat = screen.getByTestId('balance-fiat'); + const BalanceFiat = screen.getByTitle('Balance in Local Currency'); expect(BalanceFiat).toHaveTextContent(`$300.00 USD`); // Fiat balance is not hidden expect(BalanceFiat).toHaveStyle(`text-shadow: 0 0 15px #fff`); // eCash price is rendered - expect(screen.getByTestId('ecash-price')).toHaveTextContent( + expect(screen.getByTitle('Price in Local Currency')).toHaveTextContent( `1 XEC = 0.00003000 USD`, ); }); @@ -161,24 +161,24 @@ ); // Loader is not rendered - expect(screen.queryByTestId('cash-loader')).not.toBeInTheDocument(); + expect(screen.queryByTitle('Loading')).not.toBeInTheDocument(); // XEC balance is calculated correctly - const BalanceXec = screen.getByTestId('balance-xec'); + const BalanceXec = screen.getByTitle('Balance in XEC'); expect(BalanceXec).toHaveTextContent(`10,000,000.00 XEC`); // XEC balance is not hidden expect(BalanceXec).toHaveStyle(`text-shadow: none`); // Fiat balance is calculated correctly - const BalanceFiat = screen.getByTestId('balance-fiat'); + const BalanceFiat = screen.getByTitle('Balance in Local Currency'); expect(BalanceFiat).toHaveTextContent(`ÂŖ300.00 GBP`); // Fiat balance is not hidden expect(BalanceFiat).toHaveStyle(`text-shadow: none`); // eCash price is rendered - expect(screen.getByTestId('ecash-price')).toHaveTextContent( + expect(screen.getByTitle('Price in Local Currency')).toHaveTextContent( `1 XEC = 0.00003000 GBP`, ); }); @@ -192,19 +192,23 @@ ); // Loader is not rendered - expect(screen.queryByTestId('cash-loader')).not.toBeInTheDocument(); + expect(screen.queryByTitle('Loading')).not.toBeInTheDocument(); // XEC balance is calculated correctly - const BalanceXec = screen.getByTestId('balance-xec'); + const BalanceXec = screen.getByTitle('Balance in XEC'); expect(BalanceXec).toHaveTextContent(`10,000,000.00 XEC`); // XEC balance is not hidden expect(BalanceXec).toHaveStyle(`text-shadow: none`); // Fiat balance is not rendered - expect(screen.queryByTestId('balance-fiat')).not.toBeInTheDocument(); + expect( + screen.queryByTitle('Balance in Local Currency'), + ).not.toBeInTheDocument(); // eCash price is not rendered - expect(screen.queryByTestId('ecash-price')).not.toBeInTheDocument(); + expect( + screen.queryByTitle('Price in Local Currency'), + ).not.toBeInTheDocument(); }); }); diff --git a/cashtab/src/components/Common/__tests__/ScanQRCode.test.js b/cashtab/src/components/Common/__tests__/ScanQRCode.test.js --- a/cashtab/src/components/Common/__tests__/ScanQRCode.test.js +++ b/cashtab/src/components/Common/__tests__/ScanQRCode.test.js @@ -49,17 +49,17 @@ ); // Button to open modal is rendered - const StartScanningButton = screen.queryByTestId('scan-qr-code'); + const StartScanningButton = screen.queryByTitle('Scan QR Code'); expect(StartScanningButton).toBeInTheDocument(); // The video component inside the modal is rendered - expect(await screen.findByTestId('video')).toBeInTheDocument(); + expect(await screen.findByTitle('Video Preview')).toBeInTheDocument(); // Click the close button await userEvent.click(screen.getByRole('button', { name: /X/ })); // Expect modal to be closed - expect(screen.queryByTestId('video')).not.toBeInTheDocument(); + expect(screen.queryByTitle('Video Preview')).not.toBeInTheDocument(); }); it('Does not render the modal on load if loadWithCameraOpen is false', async () => { render( @@ -69,16 +69,16 @@ ); // Button to open modal is rendered - const StartScanningButton = screen.queryByTestId('scan-qr-code'); + const StartScanningButton = screen.queryByTitle('Scan QR Code'); expect(StartScanningButton).toBeInTheDocument(); // The modal root component is not rendered - expect(screen.queryByTestId('video')).not.toBeInTheDocument(); + expect(screen.queryByTitle('Video Preview')).not.toBeInTheDocument(); // Click the open modal button await userEvent.click(StartScanningButton); // The modal is rendered - expect(await screen.findByTestId('video')).toBeInTheDocument(); + expect(await screen.findByTitle('Video Preview')).toBeInTheDocument(); }); }); diff --git a/cashtab/src/components/Configure/Configure.js b/cashtab/src/components/Configure/Configure.js --- a/cashtab/src/components/Configure/Configure.js +++ b/cashtab/src/components/Configure/Configure.js @@ -119,7 +119,7 @@ }; return ( - + ℹī¸ Backup wallet has moved @@ -164,7 +164,7 @@ @@ -173,7 +173,7 @@ {isMobile(navigator) && ( @@ -199,7 +199,7 @@ diff --git a/cashtab/src/components/Configure/__tests__/Configure.test.js b/cashtab/src/components/Configure/__tests__/Configure.test.js --- a/cashtab/src/components/Configure/__tests__/Configure.test.js +++ b/cashtab/src/components/Configure/__tests__/Configure.test.js @@ -104,7 +104,7 @@ ); // We are on the settings screen - await screen.findByTestId('configure-ctn'); + await screen.findByTitle('Settings'); // We do not see the auto open option expect( @@ -130,7 +130,7 @@ ); // We are on the settings screen - await screen.findByTestId('configure-ctn'); + await screen.findByTitle('Settings'); // Now we do see the auto open option expect( @@ -163,27 +163,35 @@ render(); // Default route is home - await screen.findByTestId('tx-history-ctn'); + await screen.findByTitle('Tx History'); // Click the hamburger menu - await user.click(screen.queryByTestId('hamburger')); + await user.click(screen.queryByTitle('Show Other Screens')); // Navigate to Settings screen - await user.click(screen.queryByTestId('nav-btn-configure')); + await user.click( + screen.getByRole('button', { + name: /Settings/i, + }), + ); // Now we see the Settings screen - expect(screen.getByTestId('configure-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('Settings')).toBeInTheDocument(); // Send confirmations are disabled by default // Enable send confirmations - await user.click(screen.getByTestId('send-confirmations-switch')); + await user.click(screen.getByTitle('Toggle Send Confirmations')); // Navigate to the Send screen - await user.click(screen.queryByTestId('nav-btn-send')); + await user.click( + screen.getByRole('button', { + name: /Send Screen/i, + }), + ); // Now we see the Send screen - expect(screen.getByTestId('send-to-many-switch')).toBeInTheDocument(); + expect(screen.getByTitle('Toggle Multisend')).toBeInTheDocument(); // Fill out to and amount await user.type( @@ -192,7 +200,7 @@ ); await user.type(screen.getByPlaceholderText('Amount'), '55'); // click send - await user.click(screen.getByRole('button', { name: /Send/ })); + await user.click(screen.getByRole('button', { name: 'Send' })); // we see a modal expect( await screen.findByText( @@ -264,27 +272,34 @@ render(); // Default route is home - await screen.findByTestId('tx-history-ctn'); + await screen.findByTitle('Tx History'); // Click the hamburger menu - await user.click(screen.queryByTestId('hamburger')); + await user.click(screen.queryByTitle('Show Other Screens')); - // Navigate to Settings screen - await user.click(screen.queryByTestId('nav-btn-configure')); + await user.click( + screen.getByRole('button', { + name: /Settings/i, + }), + ); // Now we see the Settings screen - expect(screen.getByTestId('configure-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('Settings')).toBeInTheDocument(); // Send confirmations are disabled by default // Enable min fee sends - await user.click(screen.getByTestId('settings-minFeeSends-switch')); + await user.click(screen.getByTitle('Toggle minimum fee sends')); // Navigate to the Send screen - await user.click(screen.queryByTestId('nav-btn-send')); + await user.click( + screen.getByRole('button', { + name: /Send Screen/i, + }), + ); // Now we see the Send screen - expect(screen.getByTestId('send-to-many-switch')).toBeInTheDocument(); + expect(screen.getByTitle('Toggle Multisend')).toBeInTheDocument(); // Fill out to and amount await user.type( @@ -294,7 +309,7 @@ await user.type(screen.getByPlaceholderText('Amount'), '55'); // click send to broadcast the tx - await user.click(screen.getByRole('button', { name: /Send/ })); + await user.click(screen.getByRole('button', { name: 'Send' })); // Notification is rendered with expected txid const txSuccessNotification = await screen.findByText('eCash sent'); @@ -311,7 +326,11 @@ // Send some tokens // Navigate to eTokens screen - await user.click(screen.queryByTestId('nav-btn-etokens')); + await user.click( + screen.getByRole('button', { + name: /Tokens/i, + }), + ); // Click on the VIP token await user.click(screen.getByText('GRP')); @@ -327,7 +346,7 @@ await user.type(screen.getByPlaceholderText('Amount'), '99000001'); // Click the Send token button - await user.click(screen.getByRole('button', { name: /Send/ })); + await user.click(screen.getByRole('button', { name: /Send GRP/ })); const sendTokenSuccessNotification = await screen.findByText( 'eToken sent', @@ -357,7 +376,9 @@ // Wait for wallet to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Choose GBP @@ -367,7 +388,7 @@ ); // We expect balance header to be updated - expect(screen.getByTestId('ecash-price')).toHaveTextContent( + expect(screen.getByTitle('Price in Local Currency')).toHaveTextContent( `1 XEC = 0.00002000 GBP`, ); diff --git a/cashtab/src/components/Contacts/__tests__/index.test.js b/cashtab/src/components/Contacts/__tests__/index.test.js --- a/cashtab/src/components/Contacts/__tests__/index.test.js +++ b/cashtab/src/components/Contacts/__tests__/index.test.js @@ -109,14 +109,20 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Contacts component is rendered - expect(screen.getByTestId('contacts')).toBeInTheDocument(); + expect(screen.getByTitle('Contacts')).toBeInTheDocument(); // Click the first row Delete button - await user.click(screen.getAllByTestId('delete-contact-btn')[0]); + await user.click( + screen.getByRole('button', { + name: /Delete alpha/i, + }), + ); // Type correct confirmation phrase in confirm delete modal await user.type( @@ -151,7 +157,7 @@ }); // Add a contact - await user.click(screen.getByTestId('add-contact-btn')); + await user.click(screen.getByRole('button', { name: 'Add Contact' })); const nameInput = screen.getByPlaceholderText('Enter contact name'); const addrInput = screen.getByPlaceholderText( @@ -214,7 +220,11 @@ await user.click(screen.getByText('Cancel')); // We can rename a contact - await user.click(screen.getAllByTestId('rename-contact-btn')[0]); + await user.click( + screen.getByRole('button', { + name: /Rename beta/i, + }), + ); const editNameInput = screen.getByPlaceholderText( 'Enter new contact name', @@ -265,11 +275,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Click the first row Send button - await user.click(screen.getAllByTestId('send-to-contact')[0]); + await user.click(screen.getAllByTitle('tx-sent')[0]); // Now we are on the SendXec page and the address field is filled out expect(screen.getByPlaceholderText('Address')).toHaveValue( diff --git a/cashtab/src/components/Contacts/index.js b/cashtab/src/components/Contacts/index.js --- a/cashtab/src/components/Contacts/index.js +++ b/cashtab/src/components/Contacts/index.js @@ -8,9 +8,9 @@ import CopyToClipboard from 'components/Common/CopyToClipboard'; import { CopyPasteIcon, - ThemedTrashcanOutlined, - ThemedEditOutlined, - ThemedContactSendOutlined, + TrashcanIcon, + EditIcon, + SendIcon, } from 'components/Common/CustomIcons'; import Modal from 'components/Common/Modal'; import { ModalInput, InputFlex } from 'components/Common/Inputs'; @@ -26,6 +26,7 @@ ButtonRow, ContactListName, ButtonPanel, + SvgButton, } from 'components/Contacts/styles'; const Contacts = () => { @@ -284,7 +285,7 @@ )} - + {contactList && contactList.length > 0 ? ( contactList.map((contact, index) => ( @@ -299,27 +300,30 @@ > - setContactToBeRenamed(contact) } - /> + > + + - + - setContactToBeDeleted(contact) } - /> + > + + )) @@ -336,7 +340,6 @@ setShowAddNewContactModal(true)} > Add Contact diff --git a/cashtab/src/components/Contacts/styles.js b/cashtab/src/components/Contacts/styles.js --- a/cashtab/src/components/Contacts/styles.js +++ b/cashtab/src/components/Contacts/styles.js @@ -64,3 +64,9 @@ gap: 9px; align-items: baseline; `; + +export const SvgButton = styled.button` + border: none; + background: none; + cursor: pointer; +`; diff --git a/cashtab/src/components/Etokens/CreateTokenForm.js b/cashtab/src/components/Etokens/CreateTokenForm.js --- a/cashtab/src/components/Etokens/CreateTokenForm.js +++ b/cashtab/src/components/Etokens/CreateTokenForm.js @@ -645,7 +645,7 @@ /> ) : ( - + - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Renders CreateTokenForm, as this wallet has sufficient balance to create a token @@ -116,7 +118,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for the wallet balance to load diff --git a/cashtab/src/components/Etokens/__tests__/CreateTokenForm.test.js b/cashtab/src/components/Etokens/__tests__/CreateTokenForm.test.js --- a/cashtab/src/components/Etokens/__tests__/CreateTokenForm.test.js +++ b/cashtab/src/components/Etokens/__tests__/CreateTokenForm.test.js @@ -184,7 +184,7 @@ ); // Hit the switch for a variable supply token - await user.click(screen.getByTestId('mint-baton-switch')); + await user.click(screen.getByTitle('Toggle Mint Baton')); // Click the Create eToken button await user.click(screen.getByRole('button', { name: /Create eToken/ })); diff --git a/cashtab/src/components/Home/Home.js b/cashtab/src/components/Home/Home.js --- a/cashtab/src/components/Home/Home.js +++ b/cashtab/src/components/Home/Home.js @@ -135,7 +135,7 @@ return ( <> {apiError && } - + ); // Initially, Home component is not rendered - expect(screen.queryByTestId('tx-history-ctn')).not.toBeInTheDocument(); + expect(screen.queryByTitle('Tx History')).not.toBeInTheDocument(); // Initially, Loading ctn is rendered - expect(screen.getByTestId('loading-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('Cashtab Loading')).toBeInTheDocument(); // After wallet loads, this is reversed await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for the balance to render expect(await screen.findByText('9,513.12 XEC')).toBeInTheDocument(); // The home screen is in the document - expect(await screen.findByTestId('tx-history-ctn')).toBeInTheDocument(); + expect(await screen.findByTitle('Tx History')).toBeInTheDocument(); // No API Error await waitFor(() => @@ -119,7 +121,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // API Error is rendered @@ -137,7 +141,9 @@ // Wait for the component to finish loading await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Backup warning is rendered @@ -148,6 +154,6 @@ await screen.findByText('Do not share your backup with anyone.'); // Receive QR code is rendered - expect(screen.getByTestId('receive-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('Receive')).toBeInTheDocument(); }); }); diff --git a/cashtab/src/components/Receive/QRCode.js b/cashtab/src/components/Receive/QRCode.js --- a/cashtab/src/components/Receive/QRCode.js +++ b/cashtab/src/components/Receive/QRCode.js @@ -161,8 +161,7 @@ + {wallet !== false && ( - + 500 ? 48 : 24} diff --git a/cashtab/src/components/Receive/__tests__/QRCode.test.js b/cashtab/src/components/Receive/__tests__/QRCode.test.js --- a/cashtab/src/components/Receive/__tests__/QRCode.test.js +++ b/cashtab/src/components/Receive/__tests__/QRCode.test.js @@ -23,7 +23,7 @@ const QrCodeCopied = screen.queryByText('Address Copied to Clipboard'); expect(QrCodeCopied).toHaveStyle('display: none'); - const qrCodeElement = screen.getByTestId('raw-qr-code'); + const qrCodeElement = screen.getByTitle('Raw QR Code'); await userEvent.click(qrCodeElement); // We do see the addr copied div with correct address after click @@ -42,7 +42,7 @@ const QrCodeCopied = screen.queryByText('Address Copied to Clipboard'); expect(QrCodeCopied).toHaveStyle('display: none'); - const qrCodeElement = screen.getByTestId('raw-qr-code'); + const qrCodeElement = screen.getByTitle('Raw QR Code'); await userEvent.click(qrCodeElement); // We do see the addr copied div with correct address after click @@ -56,6 +56,6 @@ , ); - expect(screen.getByTestId('raw-qr-code')).toBeInTheDocument(); + expect(screen.getByTitle('Raw QR Code')).toBeInTheDocument(); }); }); diff --git a/cashtab/src/components/Receive/__tests__/Receive.test.js b/cashtab/src/components/Receive/__tests__/Receive.test.js --- a/cashtab/src/components/Receive/__tests__/Receive.test.js +++ b/cashtab/src/components/Receive/__tests__/Receive.test.js @@ -91,14 +91,16 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Receive screen is rendered - expect(await screen.findByTestId('receive-ctn')).toBeInTheDocument(); + expect(await screen.findByTitle('Receive')).toBeInTheDocument(); // QR Code is rendered - expect(screen.getByTestId('qr-code-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('QR Code')).toBeInTheDocument(); // Copy div is not displayed expect(screen.queryByText('Address Copied to Clipboard')).toHaveStyle( @@ -106,7 +108,7 @@ ); // Click the QR Code - const qrCodeItself = screen.queryByTestId('raw-qr-code'); + const qrCodeItself = screen.queryByTitle('Raw QR Code'); await user.click(qrCodeItself); // Copy div is displayed @@ -143,15 +145,17 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Receive screen is rendered - expect(await screen.findByTestId('receive-ctn')).toBeInTheDocument(); + expect(await screen.findByTitle('Receive')).toBeInTheDocument(); // We render the rest of the component as expected // QR Code is rendered - expect(screen.getByTestId('qr-code-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('QR Code')).toBeInTheDocument(); // Copy div is not displayed expect(screen.queryByText('Address Copied to Clipboard')).toHaveStyle( @@ -161,7 +165,7 @@ // We expect QR Code width of 245px = 320 - CASHTAB_MOBILE_QR_PADDING of 75px // QR Code is rendered const EXPECTED_DESKTOP_WIDTH = '245'; - const qrCodeItself = screen.queryByTestId('raw-qr-code'); + const qrCodeItself = screen.queryByTitle('Raw QR Code'); expect(qrCodeItself).toBeInTheDocument(); expect(qrCodeItself).toHaveAttribute('width', EXPECTED_DESKTOP_WIDTH); expect(qrCodeItself).toHaveAttribute('height', EXPECTED_DESKTOP_WIDTH); @@ -188,15 +192,17 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Receive screen is rendered - expect(await screen.findByTestId('receive-ctn')).toBeInTheDocument(); + expect(await screen.findByTitle('Receive')).toBeInTheDocument(); // We render the rest of the component as expected // QR Code is rendered - expect(screen.getByTestId('qr-code-ctn')).toBeInTheDocument(); + expect(screen.getByTitle('QR Code')).toBeInTheDocument(); // Copy div is not displayed expect(screen.queryByText('Address Copied to Clipboard')).toHaveStyle( @@ -206,7 +212,7 @@ // We expect QR Code width of 250 for extension // QR Code is rendered const EXPECTED_DESKTOP_WIDTH = '250'; - const qrCodeItself = screen.queryByTestId('raw-qr-code'); + const qrCodeItself = screen.queryByTitle('Raw QR Code'); expect(qrCodeItself).toBeInTheDocument(); expect(qrCodeItself).toHaveAttribute('width', EXPECTED_DESKTOP_WIDTH); expect(qrCodeItself).toHaveAttribute('height', EXPECTED_DESKTOP_WIDTH); diff --git a/cashtab/src/components/Send/SendToken.js b/cashtab/src/components/Send/SendToken.js --- a/cashtab/src/components/Send/SendToken.js +++ b/cashtab/src/components/Send/SendToken.js @@ -935,7 +935,7 @@ )} )} {txInfoFromUrl && ( - - Webapp Tx Request - + Webapp Tx Request )} { checkForConfirmationBeforeSendXec(); diff --git a/cashtab/src/components/Send/__tests__/SendByUrlParams.test.js b/cashtab/src/components/Send/__tests__/SendByUrlParams.test.js --- a/cashtab/src/components/Send/__tests__/SendByUrlParams.test.js +++ b/cashtab/src/components/Send/__tests__/SendByUrlParams.test.js @@ -100,7 +100,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for balance to be loaded, as input fields are not populated until balance loads @@ -110,7 +112,7 @@ const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -144,7 +146,7 @@ // The Send button is not disabled because we have a valid amount expect( - await screen.findByRole('button', { name: /Send/ }), + await screen.findByRole('button', { name: 'Send' }), ).not.toHaveStyle('cursor: not-allowed'); }); it('Legacy params. Address and value keys are set and valid. Invalid bip21 string is ignored.', async () => { @@ -169,7 +171,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for balance to be loaded @@ -179,7 +183,7 @@ const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -201,7 +205,7 @@ // The Send button is not disabled because we have a valid amount expect( - await screen.findByRole('button', { name: /Send/ }), + await screen.findByRole('button', { name: 'Send' }), ).not.toHaveStyle('cursor: not-allowed'); // No addr validation errors on load @@ -233,7 +237,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for balance to be loaded, as input fields are not populated until balance loads @@ -243,7 +249,7 @@ const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -264,7 +270,7 @@ expect(screen.getByText('Webapp Tx Request')).toBeInTheDocument(); // The Send button is disabled because no amount is entered - expect(await screen.findByRole('button', { name: /Send/ })).toHaveStyle( + expect(await screen.findByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); @@ -297,7 +303,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for balance to be loaded, as input fields are not populated until balance loads @@ -307,7 +315,7 @@ const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -328,7 +336,7 @@ expect(screen.getByText('Webapp Tx Request')).toBeInTheDocument(); // The Send button is disabled because no amount is entered - expect(await screen.findByRole('button', { name: /Send/ })).toHaveStyle( + expect(await screen.findByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); @@ -359,14 +367,16 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -385,7 +395,7 @@ expect(screen.queryByText('Webapp Tx Request')).not.toBeInTheDocument(); // The Send button is disabled because no amount is entered - expect(await screen.findByRole('button', { name: /Send/ })).toHaveStyle( + expect(await screen.findByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); @@ -418,14 +428,16 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -444,7 +456,7 @@ expect(screen.queryByText('Webapp Tx Request')).not.toBeInTheDocument(); // The Send button is disabled because no amount is entered - expect(await screen.findByRole('button', { name: /Send/ })).toHaveStyle( + expect(await screen.findByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); @@ -478,7 +490,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for balance to be loaded @@ -488,7 +502,7 @@ const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -510,7 +524,7 @@ // The Send button is not disabled because we have a valid amount expect( - await screen.findByRole('button', { name: /Send/ }), + await screen.findByRole('button', { name: 'Send' }), ).not.toHaveStyle('cursor: not-allowed'); // No addr validation errors on load @@ -546,7 +560,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for balance to be loaded @@ -556,7 +572,7 @@ const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -570,7 +586,7 @@ expect(addressInputEl).toHaveProperty('disabled', true); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -601,13 +617,13 @@ } // The op_return_raw switch is disabled because we have txInfoFromUrl - expect(screen.getByTestId('opreturnraw-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle op_return_raw')).toHaveProperty( 'disabled', true, ); // The op_return_raw switch is checked because it is set by txInfoFromUrl - expect(screen.getByTestId('opreturnraw-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle op_return_raw')).toHaveProperty( 'checked', true, ); @@ -619,14 +635,14 @@ // The Send button is enabled as we have valid address and amount params expect( - await screen.findByRole('button', { name: /Send/ }), + await screen.findByRole('button', { name: 'Send' }), ).not.toHaveStyle('cursor: not-allowed'); // The "Webapp Tx Request" notice is rendered expect(screen.getByText('Webapp Tx Request')).toBeInTheDocument(); // The Cashtab Msg switch is disabled because we have txInfoFromUrl - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', true, ); @@ -656,7 +672,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Wait for balance to be loaded, as input fields are not populated until balance loads @@ -666,7 +684,7 @@ const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -680,7 +698,7 @@ expect(addressInputEl).toHaveProperty('disabled', true); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -697,7 +715,7 @@ ).toBeInTheDocument(); // The Send button is disabled - expect(await screen.findByRole('button', { name: /Send/ })).toHaveStyle( + expect(await screen.findByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); @@ -705,7 +723,7 @@ expect(screen.getByText('Webapp Tx Request')).toBeInTheDocument(); // The Cashtab Msg switch is disabled because we have txInfoFromUrl - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', true, ); @@ -727,14 +745,16 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); const amountInputEl = screen.getByPlaceholderText('Amount'); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -753,7 +773,7 @@ expect(screen.queryByText('Webapp Tx Request')).not.toBeInTheDocument(); // The Send button is disabled - expect(await screen.findByRole('button', { name: /Send/ })).toHaveStyle( + expect(await screen.findByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); diff --git a/cashtab/src/components/Send/__tests__/SendToken.test.js b/cashtab/src/components/Send/__tests__/SendToken.test.js --- a/cashtab/src/components/Send/__tests__/SendToken.test.js +++ b/cashtab/src/components/Send/__tests__/SendToken.test.js @@ -455,7 +455,7 @@ await user.type(amountInputEl, amountInput); // Click the Send token button - await user.click(screen.getByRole('button', { name: /Send/ })); + await user.click(screen.getByRole('button', { name: /Send BEAR/ })); const sendTokenSuccessNotification = await screen.findByText( 'eToken sent', @@ -489,7 +489,7 @@ expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); // Click the burn switch to show the burn interface - await user.click(screen.getByTestId('burn-switch')); + await user.click(screen.getByTitle('Toggle Burn')); await user.type(screen.getByPlaceholderText('Burn Amount'), '1'); @@ -530,7 +530,7 @@ expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); // The mint switch is disabled - expect(screen.getByTestId('mint-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Mint')).toHaveProperty( 'disabled', true, ); @@ -636,7 +636,7 @@ expect((await screen.findAllByText(/CACHET/))[0]).toBeInTheDocument(); // The mint switch is enabled - const mintSwitch = screen.getByTestId('mint-switch'); + const mintSwitch = screen.getByTitle('Toggle Mint'); expect(mintSwitch).toHaveProperty('disabled', false); // Click the mint switch diff --git a/cashtab/src/components/Send/__tests__/SendXec.test.js b/cashtab/src/components/Send/__tests__/SendXec.test.js --- a/cashtab/src/components/Send/__tests__/SendXec.test.js +++ b/cashtab/src/components/Send/__tests__/SendXec.test.js @@ -89,7 +89,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -104,13 +106,13 @@ expect(amountInputEl).toHaveProperty('disabled', false); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); // The Send button is disabled - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); @@ -124,7 +126,7 @@ } // We select op_return_raw input - await user.click(screen.getByTestId('opreturnraw-switch')); + await user.click(screen.getByTitle('Toggle op_return_raw')); // We do not see the parsed op return raw msg area bc the op_return_raw input is empty expect( @@ -141,7 +143,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -156,7 +160,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -177,7 +181,7 @@ } // The Send button is disabled because amount is null - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); }); @@ -191,7 +195,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -225,7 +231,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -246,7 +252,7 @@ } // The Send button is disabled because amount is null - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); @@ -270,7 +276,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -284,7 +292,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -299,7 +307,7 @@ expect(screen.getByText('Invalid address')).toBeInTheDocument(); // The Send button is disabled - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); }); @@ -313,7 +321,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -327,7 +337,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -344,7 +354,7 @@ ).toBeInTheDocument(); // The Send button is disabled - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); }); @@ -358,7 +368,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -390,7 +402,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -409,7 +421,7 @@ ).toBeInTheDocument(); // The Send button is disabled - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); }); @@ -423,7 +435,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -448,7 +462,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -467,7 +481,7 @@ ).toBeInTheDocument(); // The Send button is disabled - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); }); @@ -481,7 +495,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -496,7 +512,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -517,7 +533,7 @@ } // The Send button is enabled as we have valid address and amount params - expect(screen.getByRole('button', { name: /Send/ })).not.toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).not.toHaveStyle( 'cursor: not-allowed', ); }); @@ -531,7 +547,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -565,7 +583,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -586,7 +604,7 @@ } // The Send button is enabled as we have valid address and amount params - expect(screen.getByRole('button', { name: /Send/ })).not.toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).not.toHaveStyle( 'cursor: not-allowed', ); @@ -610,7 +628,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -636,12 +656,12 @@ ).toBeInTheDocument(); // The Send button is disabled - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -656,7 +676,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -684,12 +706,12 @@ ).toBeInTheDocument(); // The Send button is disabled - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -704,7 +726,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -753,12 +777,12 @@ ).toBeInTheDocument(); // The Send button is disabled - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -783,7 +807,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -798,7 +824,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -815,12 +841,12 @@ ).toBeInTheDocument(); // The Send button is disabled - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); // The Cashtab Msg switch is disabled because we have a querystring address input - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', true, ); @@ -835,7 +861,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -850,7 +878,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -881,12 +909,12 @@ expect(opReturnRawInput).toHaveProperty('disabled', true); // The Send button is disabled because amount is not entered - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); // The Cashtab Msg switch is disabled because op_return_raw is set - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', true, ); @@ -901,7 +929,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -916,7 +946,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -947,12 +977,12 @@ expect(opReturnRawInput).toHaveProperty('disabled', true); // The Send button is enabled as we have valid address and amount params - expect(screen.getByRole('button', { name: /Send/ })).not.toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).not.toHaveStyle( 'cursor: not-allowed', ); // The Cashtab Msg switch is disabled because op_return_raw is set - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', true, ); @@ -967,7 +997,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -982,7 +1014,7 @@ expect(addressInputEl).toHaveValue(addressInput); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -1009,12 +1041,12 @@ ).toBeInTheDocument(); // The Send button is disabled as we have valid address and amount params - expect(screen.getByRole('button', { name: /Send/ })).toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).toHaveStyle( 'cursor: not-allowed', ); // The Cashtab Msg switch is disabled because op_return_raw is set - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', true, ); @@ -1040,7 +1072,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -1058,7 +1092,7 @@ expect(addressInputEl).toHaveProperty('disabled', false); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -1094,19 +1128,19 @@ } // The Send button is enabled as we have valid address and amount params - expect(screen.getByRole('button', { name: /Send/ })).not.toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).not.toHaveStyle( 'cursor: not-allowed', ); // The Cashtab Msg switch is disabled because op_return_raw is set - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', true, ); // Click Send await user.click( - screen.getByRole('button', { name: /Send/ }), + screen.getByRole('button', { name: 'Send' }), addressInput, ); @@ -1136,7 +1170,7 @@ ); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -1145,7 +1179,7 @@ expect(addressInputEl).toHaveValue(''); // The Cashtab Msg switch is not disabled because op_return_raw is not set - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', false, ); @@ -1171,7 +1205,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -1187,7 +1223,7 @@ expect(amountInputEl).toHaveValue(9509.26); // Let's add a Cashtab message - await user.click(screen.getByTestId('cashtab-msg-switch')); + await user.click(screen.getByTitle('Toggle Cashtab Msg')); // Confirm that even a msg of blank spaces is added await user.type( @@ -1225,7 +1261,7 @@ // Click Send await user.click( - screen.getByRole('button', { name: /Send/ }), + screen.getByRole('button', { name: 'Send' }), addressInput, ); @@ -1266,7 +1302,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Confirm we have minFeeSends true in settings @@ -1290,7 +1328,7 @@ expect(addressInputEl).toHaveProperty('disabled', false); // The "Send to Many" switch is disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', true, ); @@ -1321,19 +1359,19 @@ } // The Send button is enabled as we have valid address and amount params - expect(screen.getByRole('button', { name: /Send/ })).not.toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).not.toHaveStyle( 'cursor: not-allowed', ); // The Cashtab Msg switch is disabled because op_return_raw is set - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', true, ); // Click Send await user.click( - screen.getByRole('button', { name: /Send/ }), + screen.getByRole('button', { name: 'Send' }), addressInput, ); @@ -1363,7 +1401,7 @@ ); // The "Send to Many" switch is not disabled - expect(screen.getByTestId('send-to-many-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Multisend')).toHaveProperty( 'disabled', false, ); @@ -1372,7 +1410,7 @@ expect(addressInputEl).toHaveValue(''); // The Cashtab Msg switch is no longer disabled because op_return_raw is not set - expect(screen.getByTestId('cashtab-msg-switch')).toHaveProperty( + expect(screen.getByTitle('Toggle Cashtab Msg')).toHaveProperty( 'disabled', false, ); @@ -1398,7 +1436,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -1422,7 +1462,7 @@ // Click Send await user.click( - screen.getByRole('button', { name: /Send/ }), + screen.getByRole('button', { name: 'Send' }), addressInput, ); @@ -1456,11 +1496,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Select multi-send mode - await user.click(screen.getByTestId('send-to-many-switch')); + await user.click(screen.getByTitle('Toggle Multisend')); const multiSendInputEl = screen.getByPlaceholderText( /One address & amount per line/, @@ -1474,12 +1516,12 @@ expect(multiSendInputEl).toHaveValue(multiSendInput); // The Send button is enabled as we have valid multisend input - expect(screen.getByRole('button', { name: /Send/ })).not.toHaveStyle( + expect(screen.getByRole('button', { name: 'Send' })).not.toHaveStyle( 'cursor: not-allowed', ); // Click Send - await user.click(screen.getByRole('button', { name: /Send/ })); + await user.click(screen.getByRole('button', { name: 'Send' })); // Notification is rendered with expected txid?; const txSuccessNotification = await screen.findByText('eCash sent'); @@ -1511,7 +1553,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); const addressInputEl = screen.getByPlaceholderText('Address'); @@ -1527,7 +1571,7 @@ expect(amountInputEl).toHaveValue(9509.26); // Let's add a Cashtab message - await user.click(screen.getByTestId('cashtab-msg-switch')); + await user.click(screen.getByTitle('Toggle Cashtab Msg')); // Confirm that even a msg of blank spaces is added await user.type( @@ -1564,7 +1608,7 @@ expect(amountInputEl).toHaveValue(9507.87); // Now we turn the Cashtab Msg switch off without clearing the input field - await user.click(screen.getByTestId('cashtab-msg-switch')); + await user.click(screen.getByTitle('Toggle Cashtab Msg')); // Click max again to recalc max amount // Note: for now, it is not expected behavior onMax to recalculate as the tx changes, onMax @@ -1577,7 +1621,7 @@ // Click Send await user.click( - screen.getByRole('button', { name: /Send/ }), + screen.getByRole('button', { name: 'Send' }), addressInput, ); diff --git a/cashtab/src/components/SignVerifyMsg/SignVerifyMsg.js b/cashtab/src/components/SignVerifyMsg/SignVerifyMsg.js --- a/cashtab/src/components/SignVerifyMsg/SignVerifyMsg.js +++ b/cashtab/src/components/SignVerifyMsg/SignVerifyMsg.js @@ -166,10 +166,10 @@ }; return ( - + - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Insert message to be signed @@ -122,11 +124,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Click the switch to show verify forms - await user.click(screen.getByTestId('sign-mode-switch')); + await user.click(screen.getByTitle('Toggle Sign Verify')); // Insert message to be signed await user.type( @@ -171,11 +175,13 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // Click the switch to show verify forms - await user.click(screen.getByTestId('sign-mode-switch')); + await user.click(screen.getByTitle('Toggle Sign Verify')); // Insert message to be signed await user.type( diff --git a/cashtab/src/components/Wallets/__tests__/index.test.js b/cashtab/src/components/Wallets/__tests__/index.test.js --- a/cashtab/src/components/Wallets/__tests__/index.test.js +++ b/cashtab/src/components/Wallets/__tests__/index.test.js @@ -115,7 +115,9 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTitle('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); // We can add a savedWallet as a contact @@ -172,11 +174,11 @@ // Wait for the app to load await waitFor(() => - expect(screen.queryByTestId('loading-ctn')).not.toBeInTheDocument(), + expect( + screen.queryByTitle('Cashtab Loading'), + ).not.toBeInTheDocument(), ); - // Note, the savedWallets collapse loads open by default - // We see expected saved wallets // Note, we see these in the wallet header dropdown and in the savedWallets list expect((await screen.findAllByText('alpha'))[1]).toBeInTheDocument(); @@ -185,8 +187,8 @@ expect((await screen.findAllByText('delta'))[1]).toBeInTheDocument(); expect((await screen.findAllByText('echo'))[1]).toBeInTheDocument(); - // Let's rename alpha. Its button will be the first in the list. - await user.click(screen.getAllByTestId('rename-saved-wallet')[0]); + // Let's rename alpha. Its button will be the second edit button, as the first is for the active wallet. + await user.click(screen.getAllByTitle('edit')[1]); // We see a modal. expect(await screen.findByText(`Rename "alpha"?`)).toBeInTheDocument(); @@ -227,7 +229,7 @@ ).toBeInTheDocument(); // Now let's rename the active wallet - await user.click(screen.getByTestId('rename-active-wallet')); + await user.click(screen.getAllByTitle('edit')[0]); await user.type( await screen.findByPlaceholderText('Enter new wallet name'), @@ -253,7 +255,8 @@ // We can delete a wallet // Delete the first wallet in the savedWallets list - await user.click(screen.getAllByTestId('delete-saved-wallet')[0]); + // It's the first appearance of the trashcan button bc we do not support deleting the active wallet + await user.click(screen.getAllByTitle('trashcan')[0]); // We see a confirmation modal expect( diff --git a/cashtab/src/components/Wallets/index.js b/cashtab/src/components/Wallets/index.js --- a/cashtab/src/components/Wallets/index.js +++ b/cashtab/src/components/Wallets/index.js @@ -7,8 +7,8 @@ import CopyToClipboard from 'components/Common/CopyToClipboard'; import { CopyPasteIcon, - ThemedTrashcanOutlined, - ThemedEditOutlined, + TrashcanIcon, + EditIcon, AddContactIcon, } from 'components/Common/CustomIcons'; import Modal from 'components/Common/Modal'; @@ -358,7 +358,7 @@ /> )} - + {wallets.map((wallet, index) => index === 0 ? ( @@ -374,12 +374,13 @@ > - setWalletToBeRenamed(wallet) } - /> + > + + addWalletToContacts(wallet) @@ -418,12 +419,13 @@ > - setWalletToBeRenamed(wallet) } - /> + > + + addWalletToContacts(wallet) @@ -431,12 +433,13 @@ > - setWalletToBeDeleted(wallet) } - /> + > + +