From a0edfc0d1975191c3bb2b34d8d50ff785fb09d9c Mon Sep 17 00:00:00 2001 From: Martin Homola Date: Mon, 9 Dec 2024 14:36:21 +0100 Subject: [PATCH] chore(suite): update network symbol naming 12 --- .../support/pageActions/dashboardActions.ts | 4 +-- .../support/pageActions/settingsActions.ts | 30 +++++++++---------- .../e2e/support/pageActions/walletActions.ts | 4 +-- .../e2e/support/pageObjects/accountsObject.ts | 12 ++++---- .../settings/settingsCryptoObject.ts | 4 +-- .../e2e/support/pageObjects/topBarObject.ts | 4 +-- .../tests/wallet/add-account-types.test.ts | 16 +++++----- .../e2e/tests/wallet/check-coins-xpub.test.ts | 14 ++++----- .../tests/wallet/export-transactions.test.ts | 12 ++++---- .../suite-utils/src/__fixtures__/protocol.ts | 4 +-- .../validators/src/schemas/xpubSchema.ts | 4 +-- .../src/components/SelectableNetworkList.tsx | 16 +++++----- .../src/screens/XpubScanScreen.tsx | 2 +- 13 files changed, 64 insertions(+), 62 deletions(-) diff --git a/packages/suite-desktop-core/e2e/support/pageActions/dashboardActions.ts b/packages/suite-desktop-core/e2e/support/pageActions/dashboardActions.ts index 6e24227ef9c..4e558e41776 100644 --- a/packages/suite-desktop-core/e2e/support/pageActions/dashboardActions.ts +++ b/packages/suite-desktop-core/e2e/support/pageActions/dashboardActions.ts @@ -16,8 +16,8 @@ export class DashboardActions { this.window.getByTestId(`@switch-device/wallet-on-index/${index}/eject-button`); readonly confirmDeviceEjectButton: Locator; readonly addStandardWalletButton: Locator; - readonly balanceOfNetwork = (network: NetworkSymbol) => - this.window.getByTestId(`@wallet/coin-balance/value-${network}`); + readonly balanceOfNetwork = (symbol: NetworkSymbol) => + this.window.getByTestId(`@wallet/coin-balance/value-${symbol}`); constructor(window: Page) { this.window = window; diff --git a/packages/suite-desktop-core/e2e/support/pageActions/settingsActions.ts b/packages/suite-desktop-core/e2e/support/pageActions/settingsActions.ts index 294efddc2c3..1dcd4bb87fd 100644 --- a/packages/suite-desktop-core/e2e/support/pageActions/settingsActions.ts +++ b/packages/suite-desktop-core/e2e/support/pageActions/settingsActions.ts @@ -20,10 +20,10 @@ export class SettingsActions { readonly settingsCloseButton: Locator; readonly modal: Locator; //coin Advance settings - readonly coinNetworkButton = (coin: NetworkSymbol) => - this.window.getByTestId(`@settings/wallet/network/${coin}`); - readonly coinAdvanceSettingsButton = (coin: NetworkSymbol) => - this.window.getByTestId(`@settings/wallet/network/${coin}/advance`); + readonly coinNetworkButton = (symbol: NetworkSymbol) => + this.window.getByTestId(`@settings/wallet/network/${symbol}`); + readonly coinAdvanceSettingsButton = (symbol: NetworkSymbol) => + this.window.getByTestId(`@settings/wallet/network/${symbol}/advance`); readonly coinBackendSelector: Locator; readonly coinBackendSelectorOption = (backend: BackendType) => this.window.getByTestId(`@settings/advance/${backend}`); @@ -69,24 +69,24 @@ export class SettingsActions { await expect(this.debugTabButton).toBeVisible(); } - async openCoinAdvanceSettings(coin: NetworkSymbol) { - const isCoinActive = await this.coinNetworkButton(coin).getAttribute('data-active'); + async openCoinAdvanceSettings(symbol: NetworkSymbol) { + const isCoinActive = await this.coinNetworkButton(symbol).getAttribute('data-active'); if (isCoinActive === 'false') { - await this.enableCoin(coin); + await this.enableCoin(symbol); } - await this.coinNetworkButton(coin).hover(); - await this.coinAdvanceSettingsButton(coin).click(); + await this.coinNetworkButton(symbol).hover(); + await this.coinAdvanceSettingsButton(symbol).click(); await expect(this.modal).toBeVisible(); } - async enableCoin(coin: NetworkSymbol) { - await this.coinNetworkButton(coin).click(); - await expect(this.coinNetworkButton(coin)).toBeEnabledCoin(); + async enableCoin(symbol: NetworkSymbol) { + await this.coinNetworkButton(symbol).click(); + await expect(this.coinNetworkButton(symbol)).toBeEnabledCoin(); } - async disableCoin(coin: NetworkSymbol) { - await this.coinNetworkButton(coin).click(); - await expect(this.coinNetworkButton(coin)).toBeDisabledCoin(); + async disableCoin(symbol: NetworkSymbol) { + await this.coinNetworkButton(symbol).click(); + await expect(this.coinNetworkButton(symbol)).toBeDisabledCoin(); } async changeCoinBackend(backend: BackendType, backendUrl: string) { diff --git a/packages/suite-desktop-core/e2e/support/pageActions/walletActions.ts b/packages/suite-desktop-core/e2e/support/pageActions/walletActions.ts index 0acc031b255..3ff5120a862 100644 --- a/packages/suite-desktop-core/e2e/support/pageActions/walletActions.ts +++ b/packages/suite-desktop-core/e2e/support/pageActions/walletActions.ts @@ -44,9 +44,9 @@ export class WalletActions { } } - async getAccountsCount(network: NetworkSymbol) { + async getAccountsCount(symbol: NetworkSymbol) { return await this.window - .locator(`[data-testid*="@account-menu/${network}"][tabindex]`) + .locator(`[data-testid*="@account-menu/${symbol}"][tabindex]`) .count(); } } diff --git a/packages/suite-web/e2e/support/pageObjects/accountsObject.ts b/packages/suite-web/e2e/support/pageObjects/accountsObject.ts index 9001f408e08..df808c32e6e 100644 --- a/packages/suite-web/e2e/support/pageObjects/accountsObject.ts +++ b/packages/suite-web/e2e/support/pageObjects/accountsObject.ts @@ -11,8 +11,8 @@ class AccountsPage { cy.getTestElement(`@account-menu/btc/normal/${index}`).click(); } - applyCoinFilter(coin: NetworkSymbol) { - cy.getTestElement(`@account-menu/filter/${coin}`).as('account').click(); + applyCoinFilter(symbol: NetworkSymbol) { + cy.getTestElement(`@account-menu/filter/${symbol}`).as('account').click(); cy.get('@account').invoke('attr', 'data-test-activated').should('eq', 'true'); } @@ -21,10 +21,10 @@ class AccountsPage { cy.getTestElement('@modal').should('be.visible'); } - activatNewCoin(coinName: NetworkSymbol) { + activatNewCoin(symbol: NetworkSymbol) { this.openAddAccountsModal(); cy.getTestElement('@modal/account/activate_more_coins').click(); - cy.getTestElement(`@settings/wallet/network/${coinName}`).click(); + cy.getTestElement(`@settings/wallet/network/${symbol}`).click(); cy.contains('button', 'Find my').click(); cy.getTestElement('@modal').should('not.exist'); cy.discoveryShouldFinish(); @@ -84,8 +84,8 @@ class AccountsPage { cy.getTestElement('@app').scrollTo('bottom'); } - clickOnDesiredAccount(coinName: NetworkSymbol) { - cy.getTestElement(`@account-menu/${coinName}/normal/0`).click('left'); + clickOnDesiredAccount(symbol: NetworkSymbol) { + cy.getTestElement(`@account-menu/${symbol}/normal/0`).click('left'); } exportDesiredTransactionType(typeOfExport: string) { diff --git a/packages/suite-web/e2e/support/pageObjects/settings/settingsCryptoObject.ts b/packages/suite-web/e2e/support/pageObjects/settings/settingsCryptoObject.ts index 67617bbada1..978bf42050e 100644 --- a/packages/suite-web/e2e/support/pageObjects/settings/settingsCryptoObject.ts +++ b/packages/suite-web/e2e/support/pageObjects/settings/settingsCryptoObject.ts @@ -3,8 +3,8 @@ import { NetworkSymbol } from '@suite-common/wallet-config'; class SettingsCrypto { - activateCoin(coin: NetworkSymbol) { - cy.getTestElement(`@settings/wallet/network/${coin}`).as('selectedCoin').click(); + activateCoin(symbol: NetworkSymbol) { + cy.getTestElement(`@settings/wallet/network/${symbol}`).as('selectedCoin').click(); cy.get('@selectedCoin').invoke('attr', 'data-active').should('be.eq', 'true'); } } diff --git a/packages/suite-web/e2e/support/pageObjects/topBarObject.ts b/packages/suite-web/e2e/support/pageObjects/topBarObject.ts index bf460cae720..644446b0efc 100644 --- a/packages/suite-web/e2e/support/pageObjects/topBarObject.ts +++ b/packages/suite-web/e2e/support/pageObjects/topBarObject.ts @@ -3,8 +3,8 @@ import { NetworkSymbol } from '@suite-common/wallet-config'; class NavBar { - openDefaultAcccount(coin: NetworkSymbol = 'btc') { - cy.getTestElement(`@account-menu/${coin}/normal/0`).click(); + openDefaultAcccount(symbol: NetworkSymbol = 'btc') { + cy.getTestElement(`@account-menu/${symbol}/normal/0`).click(); } openSettings() { diff --git a/packages/suite-web/e2e/tests/wallet/add-account-types.test.ts b/packages/suite-web/e2e/tests/wallet/add-account-types.test.ts index 47754d0fcf4..99bec9d4e33 100644 --- a/packages/suite-web/e2e/tests/wallet/add-account-types.test.ts +++ b/packages/suite-web/e2e/tests/wallet/add-account-types.test.ts @@ -116,37 +116,37 @@ describe('Account types suite', () => { // // Test execution // - const coins: NetworkSymbol[] = ['ada', 'eth']; + const symbols: NetworkSymbol[] = ['ada', 'eth']; // activate the coin onNavBar.openSettings(); cy.getTestElement('@settings/menu/wallet').click(); - coins.forEach((coin: NetworkSymbol) => { - onSettingsCryptoPage.activateCoin(coin); + symbols.forEach((symbol: NetworkSymbol) => { + onSettingsCryptoPage.activateCoin(symbol); }); cy.getTestElement('@suite/menu/suite-index').click(); onNavBar.openDefaultAcccount(); cy.discoveryShouldFinish(); // cardano - coins.forEach((coin: NetworkSymbol) => { - onAccountsPage.applyCoinFilter(coin); + symbols.forEach((symbol: NetworkSymbol) => { + onAccountsPage.applyCoinFilter(symbol); // get the element containing all accounts cy.get( - `[data-testid="@account-menu/normal/group"] > [data-testid*="@account-menu/${coin}/normal"]`, + `[data-testid="@account-menu/normal/group"] > [data-testid*="@account-menu/${symbol}/normal"]`, ).then(currentAccounts => { const numberOfAccounts1 = currentAccounts.length; cy.getTestElement('@account-menu/add-account').click(); cy.getTestElement('@modal').should('be.visible'); - cy.get(`[data-testid="@settings/wallet/network/${coin}"]`) + cy.get(`[data-testid="@settings/wallet/network/${symbol}"]`) .should('be.visible') .click(); cy.getTestElement('@add-account').click(); cy.discoveryShouldFinish(); cy.get( - `[data-testid="@account-menu/normal/group"] > [data-testid*="@account-menu/${coin}/normal"]`, + `[data-testid="@account-menu/normal/group"] > [data-testid*="@account-menu/${symbol}/normal"]`, ).then(newAccounts => { const numberOfAccounts2 = newAccounts.length; expect(numberOfAccounts2).to.be.equal(numberOfAccounts1 + 1); diff --git a/packages/suite-web/e2e/tests/wallet/check-coins-xpub.test.ts b/packages/suite-web/e2e/tests/wallet/check-coins-xpub.test.ts index def19b1f335..c83734835e7 100644 --- a/packages/suite-web/e2e/tests/wallet/check-coins-xpub.test.ts +++ b/packages/suite-web/e2e/tests/wallet/check-coins-xpub.test.ts @@ -25,7 +25,7 @@ describe('Check coins XPUB', () => { cy.task('stopEmu'); }); - const coins: NetworkSymbol[] = ['btc', 'ltc', 'vtc', 'ada']; + const symbols: NetworkSymbol[] = ['btc', 'ltc', 'vtc', 'ada']; /** * 1. Start in Accounts section @@ -36,17 +36,17 @@ describe('Check coins XPUB', () => { * 6. Check that XPUB is present * 7. Check XPUB prefix matches coin type */ - coins.forEach(coin => { - it(`Check ${coin} XPUB`, () => { - if (coin !== 'btc') { - onAccountsPage.activatNewCoin(coin); - cy.getTestElement(`@account-menu/filter/${coin}`).click(); + symbols.forEach(symbol => { + it(`Check ${symbol} XPUB`, () => { + if (symbol !== 'btc') { + onAccountsPage.activatNewCoin(symbol); + cy.getTestElement(`@account-menu/filter/${symbol}`).click(); } cy.getTestElement('@wallet/menu/wallet-details').click(); cy.getTestElement('@wallets/details/show-xpub-button').click(); cy.getTestElement('@device-display/paginated-text').should('exist'); - if (coin !== 'ada') { + if (symbol !== 'ada') { cy.getTestElement('@device-display/paginated-text') .should('be.visible') .invoke('text') diff --git a/packages/suite-web/e2e/tests/wallet/export-transactions.test.ts b/packages/suite-web/e2e/tests/wallet/export-transactions.test.ts index 5159a39681c..cfa589ea347 100644 --- a/packages/suite-web/e2e/tests/wallet/export-transactions.test.ts +++ b/packages/suite-web/e2e/tests/wallet/export-transactions.test.ts @@ -7,7 +7,7 @@ import { onAccountsPage } from '../../support/pageObjects/accountsObject'; import { onSettingsCryptoPage } from '../../support/pageObjects/settings/settingsCryptoObject'; const downloadsFolder = Cypress.config('downloadsFolder'); -const coins: NetworkSymbol[] = ['btc', 'ltc', 'eth', 'ada']; +const symbols: NetworkSymbol[] = ['btc', 'ltc', 'eth', 'ada']; describe('Export transactions', () => { beforeEach(() => { @@ -40,16 +40,16 @@ describe('Export transactions', () => { */ it('Go to account and try to export all possible variants (pdf, csv, json)', () => { cy.prefixedVisit('/settings/coins'); - coins.forEach((coin: NetworkSymbol) => { - if (coin !== 'btc') { - onSettingsCryptoPage.activateCoin(coin); + symbols.forEach((symbol: NetworkSymbol) => { + if (symbol !== 'btc') { + onSettingsCryptoPage.activateCoin(symbol); } }); cy.getTestElement('@suite/menu/suite-index').click(); cy.discoveryShouldFinish(); - coins.forEach((coin: NetworkSymbol) => { - onAccountsPage.clickOnDesiredAccount(coin); + symbols.forEach((symbol: NetworkSymbol) => { + onAccountsPage.clickOnDesiredAccount(symbol); cy.task('rmDir', { dir: downloadsFolder, recursive: true, force: true }); const typesOfExport: Array = ['pdf', 'csv', 'json']; diff --git a/suite-common/suite-utils/src/__fixtures__/protocol.ts b/suite-common/suite-utils/src/__fixtures__/protocol.ts index 1208a177e86..4a9250071f1 100644 --- a/suite-common/suite-utils/src/__fixtures__/protocol.ts +++ b/suite-common/suite-utils/src/__fixtures__/protocol.ts @@ -1,13 +1,13 @@ import { Protocol } from '@suite-common/suite-constants'; import { NetworkSymbol } from '@suite-common/wallet-config'; -type getNetworkSymbolForProtocolFixture = { +type GetNetworkSymbolForProtocolFixture = { description: string; scheme: Protocol; result: NetworkSymbol | undefined; }; -export const getNetworkSymbolForProtocol: getNetworkSymbolForProtocolFixture[] = [ +export const getNetworkSymbolForProtocol: GetNetworkSymbolForProtocolFixture[] = [ { description: 'should return network symbol for bitcoin protocol', scheme: 'bitcoin', diff --git a/suite-common/validators/src/schemas/xpubSchema.ts b/suite-common/validators/src/schemas/xpubSchema.ts index 77f4b1e3890..e40281c69a2 100644 --- a/suite-common/validators/src/schemas/xpubSchema.ts +++ b/suite-common/validators/src/schemas/xpubSchema.ts @@ -5,7 +5,7 @@ import { isAddressValid, isAddressBasedNetwork } from '@suite-common/wallet-util import { yup } from '../config'; -export type XpubFormContext = { networkSymbol?: NetworkSymbol }; +export type XpubFormContext = { symbol?: NetworkSymbol }; export const xpubFormValidationSchema = yup.object({ xpubAddress: yup @@ -15,7 +15,7 @@ export const xpubFormValidationSchema = yup.object({ 'is-invalid-address', 'Address is not valid', (value, { options: { context } }: yup.TestContext) => { - const symbol = context?.networkSymbol; + const symbol = context?.symbol; if (!symbol) return false; diff --git a/suite-native/module-accounts-import/src/components/SelectableNetworkList.tsx b/suite-native/module-accounts-import/src/components/SelectableNetworkList.tsx index a97644acb75..f881b3c564b 100644 --- a/suite-native/module-accounts-import/src/components/SelectableNetworkList.tsx +++ b/suite-native/module-accounts-import/src/components/SelectableNetworkList.tsx @@ -16,17 +16,17 @@ type SelectableAssetListProps = { const NetworkItemSection = ({ title, - networks, + symbols, onSelectItem, }: { title: ReactNode; - networks: NetworkSymbol[]; + symbols: NetworkSymbol[]; onSelectItem: SelectableAssetListProps['onSelectItem']; }) => { return ( - {networks.map(symbol => ( + {symbols.map(symbol => ( ))} @@ -35,19 +35,21 @@ const NetworkItemSection = ({ }; export const SelectableNetworkList = ({ onSelectItem }: SelectableAssetListProps) => { - const portfolioMainnets = useSelector(selectPortfolioTrackerMainnetNetworkSymbols); - const portfolioTestnets = useSelector(selectPortfolioTrackerTestnetNetworkSymbols); + const portfolioMainnetNetworkSymbols = useSelector(selectPortfolioTrackerMainnetNetworkSymbols); + const portfolioTestnetsNetworkSymbols = useSelector( + selectPortfolioTrackerTestnetNetworkSymbols, + ); return ( } - networks={portfolioMainnets} + symbols={portfolioMainnetNetworkSymbols} onSelectItem={onSelectItem} /> } - networks={portfolioTestnets} + symbols={portfolioTestnetsNetworkSymbols} onSelectItem={onSelectItem} /> diff --git a/suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx b/suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx index f25a810522c..7bac432003a 100644 --- a/suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx +++ b/suite-native/module-accounts-import/src/screens/XpubScanScreen.tsx @@ -69,7 +69,7 @@ export const XpubScanScreen = ({ const form = useForm({ validation: xpubFormValidationSchema, - context: { networkSymbol }, + context: { symbol: networkSymbol }, }); const { handleSubmit, setValue, watch } = form; const watchXpubAddress = watch('xpubAddress');