Skip to content

Commit

Permalink
chore(trading): update files content
Browse files Browse the repository at this point in the history
  • Loading branch information
adderpositive authored and tomasklim committed Jan 29, 2025
1 parent 30e5f00 commit 83f851f
Showing 229 changed files with 3,294 additions and 3,441 deletions.
14 changes: 7 additions & 7 deletions packages/components/src/components/Image/images.ts
Original file line number Diff line number Diff line change
@@ -21,9 +21,9 @@ export const SVG_IMAGES = {
CONNECT_DEVICE: 'connect-device.svg',
ERROR_404: 'error-404.svg',
INVITY_LOGO: 'invity-logo.svg',
COINMARKET_AVATAR: 'coinmarket-avatar.svg',
COINMARKET_SUCCESS: 'coinmarket-success.svg',
COINMARKET_WAITING: 'coinmarket-waiting.svg',
TRADING_AVATAR: 'coinmarket-avatar.svg',
TRADING_SUCCESS: 'coinmarket-success.svg',
TRADING_WAITING: 'coinmarket-waiting.svg',
WARNING: 'warning.svg',
USER_FOCUS: 'user-focus.svg',
HOURGLASS: 'hourglass.svg',
@@ -56,10 +56,10 @@ export const PNG_IMAGES = {
CLOCK_2x: 'clock@2x.png',
COINS: 'coins.png',
COINS_2x: 'coins@2x.png',
COINMARKET_DCA_INVITY_APP_QR: 'coinmarket-dca-invity-app-qr.png',
COINMARKET_DCA_INVITY_APP_QR_2x: 'coinmarket-dca-invity-app-qr@2x.png',
COINMARKET_INVITY_ICON: 'coinmarket-invity-icon.png',
COINMARKET_INVITY_ICON_2x: 'coinmarket-invity-icon@2x.png',
TRADING_DCA_INVITY_APP_QR: 'coinmarket-dca-invity-app-qr.png',
TRADING_DCA_INVITY_APP_QR_2x: 'coinmarket-dca-invity-app-qr@2x.png',
TRADING_INVITY_ICON: 'coinmarket-invity-icon.png',
TRADING_INVITY_ICON_2x: 'coinmarket-invity-icon@2x.png',
ERROR: 'error.png',
ERROR_2x: 'error@2x.png',
EXTRA_INFO: 'extra-info.png',
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ export const selectAssetModalOptions: (
)[] = [
{
type: 'group',
label: 'TR_COINMARKET_POPULAR_CURRENCIES',
label: 'TR_TRADING_POPULAR_CURRENCIES',
},
{
type: 'currency',
@@ -165,7 +165,7 @@ export const selectAssetModalOptions: (
},
{
type: 'group',
label: 'TR_COINMARKET_OTHER_CURRENCIES',
label: 'TR_TRADING_OTHER_CURRENCIES',
},
{
type: 'currency',
@@ -219,7 +219,7 @@ export const selectAssetModalOptions: (
},
{
type: 'group',
label: 'TR_COINMARKET_NETWORK_TOKENS',
label: 'TR_TRADING_NETWORK_TOKENS',
coingeckoId: 'ethereum',
networkName: 'Ethereum',
},
@@ -324,7 +324,7 @@ export const selectAssetModalOptions: (
},
{
type: 'group',
label: 'TR_COINMARKET_NETWORK_TOKENS',
label: 'TR_TRADING_NETWORK_TOKENS',
coingeckoId: 'solana',
networkName: 'Solana',
},
@@ -374,7 +374,7 @@ export const selectAssetModalOptions: (
},
{
type: 'group',
label: 'TR_COINMARKET_NETWORK_TOKENS',
label: 'TR_TRADING_NETWORK_TOKENS',
coingeckoId: 'binance-smart-chain',
networkName: 'BNB Smart Chain',
},
@@ -424,7 +424,7 @@ export const selectAssetModalOptions: (
},
{
type: 'group',
label: 'TR_COINMARKET_NETWORK_TOKENS',
label: 'TR_TRADING_NETWORK_TOKENS',
coingeckoId: 'base',
networkName: 'Base',
},
2 changes: 1 addition & 1 deletion packages/suite-analytics/src/constants.ts
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ export enum EventType {

CoinjoinAnonymityGain = 'coinjoin/anonymity-gain',

CoinmarketConfirmTrade = 'trade/confirm-trade',
TradingConfirmTrade = 'trade/confirm-trade',

MenuGuide = 'menu/guide',
MenuNotificationsToggle = 'menu/notifications/toggle',
2 changes: 1 addition & 1 deletion packages/suite-analytics/src/types/events.ts
Original file line number Diff line number Diff line change
@@ -173,7 +173,7 @@ export type SuiteAnalyticsEvent =
};
}
| {
type: EventType.CoinmarketConfirmTrade;
type: EventType.TradingConfirmTrade;
payload: {
type: 'buy' | 'sell' | 'exchange';
};
Original file line number Diff line number Diff line change
@@ -15,8 +15,8 @@ import {
import expectedTradeRequestPayload from '../../fixtures/invity/buy/trade-request.json';
import { DevicePromptActions } from './devicePromptActions';

const quoteProviderLocator = '@coinmarket/offers/quote/provider';
const quoteAmountLocator = '@coinmarket/offers/quote/crypto-amount';
const quoteProviderLocator = '@trading/offers/quote/provider';
const quoteAmountLocator = '@trading/offers/quote/crypto-amount';
const getCountryLabel = (country: string) => {
const labelWithFlag = regional.countriesMap.get(country);
if (!labelWithFlag) {
@@ -54,7 +54,7 @@ export class MarketActions {
readonly youPayFiatInput: Locator;
readonly youPayCurrencyDropdown: Locator;
readonly youPayCurrencyOption = (currency: FiatCurrencyCode) =>
this.page.getByTestId(`@coinmarket/form/fiat-currency-select/option/${currency}`);
this.page.getByTestId(`@trading/form/fiat-currency-select/option/${currency}`);
readonly youPayFiatCryptoSwitchButton: Locator;
readonly youPayCryptoInput: Locator;
readonly youPayFractionButton = (amount: '10%' | '25%' | '50%' | 'Max') =>
@@ -64,22 +64,21 @@ export class MarketActions {
readonly customFeeInput: Locator;
readonly countryOfResidenceDropdown: Locator;
readonly countryOfResidenceOption = (countryCode: string) =>
this.page.getByTestId(`@coinmarket/form/country-select/option/${countryCode}`);
this.page.getByTestId(`@trading/form/country-select/option/${countryCode}`);
readonly accountDropdown: Locator;
readonly accountSearchInput: Locator;
readonly accountTabFilter = (tab: 'all-networks' | 'eth' | 'pol' | 'bsc' | 'sol') =>
this.page.getByTestId(`@coinmarket/form/select-crypto/network-tab/${tab}`);
this.page.getByTestId(`@trading/form/select-crypto/network-tab/${tab}`);
readonly accountOption = (cryptoName: string, symbol: NetworkSymbol) =>
this.page.getByTestId(`@coinmarket/form/select-crypto/option/${cryptoName}-${symbol}`);
this.page.getByTestId(`@trading/form/select-crypto/option/${cryptoName}-${symbol}`);
readonly paymentMethodDropdown: Locator;
readonly paymentMethodOption = (method: PaymentMethods) =>
this.page.getByTestId(`@coinmarket/form/payment-method-select/option/${method}`);
// Compared offers
this.page.getByTestId(`@trading/form/payment-method-select/option/${method}`);
readonly buyOffersPage: Locator;
readonly compareButton: Locator;
readonly quotes: Locator;
readonly quoteOfProvider = (provider: string) =>
this.page.getByTestId(`@coinmarket/offers/quote-${provider}`);
this.page.getByTestId(`@trading/offers/quote-${provider}`);
readonly quoteAmount: Locator;
readonly refreshTime: Locator;
readonly selectThisQuoteButton: Locator;
@@ -114,72 +113,63 @@ export class MarketActions {
private url: string,
) {
this.devicePrompt = new DevicePromptActions(page);

this.offerSpinner = this.page.getByTestId('@coinmarket/offers/loading-spinner');
this.section = this.page.getByTestId('@coinmarket');
this.form = this.page.getByTestId('@coinmarket/form');
this.offerSpinner = this.page.getByTestId('@trading/offers/loading-spinner');
this.section = this.page.getByTestId('@trading');
this.form = this.page.getByTestId('@trading/form');
this.quoteProvider = this.page.getByTestId(quoteProviderLocator);
this.bestOfferSection = this.page.getByTestId('@coinmarket/best-offer');
this.bestOfferAmount = this.page.getByTestId('@coinmarket/best-offer/amount');
this.buyBestOfferButton = this.page.getByTestId('@coinmarket/form/buy-button');
this.youPayFiatInput = this.page.getByTestId('@coinmarket/form/fiat-input');
this.bestOfferSection = this.page.getByTestId('@trading/best-offer');
this.bestOfferAmount = this.page.getByTestId('@trading/best-offer/amount');
this.buyBestOfferButton = this.page.getByTestId('@trading/form/buy-button');
this.youPayFiatInput = this.page.getByTestId('@trading/form/fiat-input');
this.youPayCurrencyDropdown = this.page.getByTestId(
'@coinmarket/form/fiat-currency-select/input',
'@trading/form/fiat-currency-select/input',
);
this.youPayFiatCryptoSwitchButton = this.page.getByTestId(
'@coinmarket/form/switch-crypto-fiat',
'@trading/form/switch-crypto-fiat',
);
this.youPayCryptoInput = this.page.getByTestId('@coinmarket/form/crypto-input');
this.youPayCryptoInput = this.page.getByTestId('@trading/form/crypto-input');
this.customFeeInput = this.page.getByTestId('feePerUnit');
this.countryOfResidenceDropdown = this.page.getByTestId(
'@coinmarket/form/country-select/input',
);
this.accountDropdown = this.page.getByTestId('@coinmarket/form/select-crypto/input');
this.accountSearchInput = this.page.getByTestId(
'@coinmarket/form/select-crypto/search-input',
'@trading/form/country-select/input',
);
this.accountDropdown = this.page.getByTestId('@trading/form/select-crypto/input');
this.accountSearchInput = this.page.getByTestId('@trading/form/select-crypto/search-input');
this.paymentMethodDropdown = this.page.getByTestId(
'@coinmarket/form/payment-method-select/input',
'@trading/form/payment-method-select/input',
);
this.buyOffersPage = this.page.getByTestId('@coinmarket/buy-offers');
this.compareButton = this.page.getByTestId('@coinmarket/form/compare-button');
this.quotes = this.page.getByTestId('@coinmarket/offers/quote');
this.buyOffersPage = this.page.getByTestId('@trading/buy-offers');
this.compareButton = this.page.getByTestId('@trading/form/compare-button');
this.quotes = this.page.getByTestId('@trading/offers/quote');
this.quoteAmount = this.page.getByTestId(quoteAmountLocator);
this.refreshTime = this.page.getByTestId('@coinmarket/refresh-time-text');
this.selectThisQuoteButton = this.page.getByTestId(
'@coinmarket/offers/get-this-deal-button',
);
this.refreshTime = this.page.getByTestId('@trading/refresh-time-text');
this.selectThisQuoteButton = this.page.getByTestId('@trading/offers/get-this-deal-button');
this.modal = this.page.getByTestId('@modal');
this.buyTermsConfirmButton = this.page.getByTestId(
'@coinmarket/buy/offers/buy-terms-confirm-button',
'@trading/buy/offers/buy-terms-confirm-button',
);
this.confirmOnTrezorButton = this.page.getByTestId(
'@coinmarket/offer/confirm-on-trezor-button',
'@trading/offer/confirm-on-trezor-button',
);
this.confirmationSection = this.page.getByTestId('@coinmarket/selected-offer');
this.confirmationCryptoAmount = this.page.getByTestId(
'@coinmarket/form/info/crypto-amount',
);
this.confirmationFiatAmount = this.page.getByTestId('@coinmarket/form/info/fiat-amount');
this.confirmationProvider = this.page.getByTestId('@coinmarket/form/info/provider');
this.confirmationAddress = this.page.getByTestId('@coinmarket/form/verify/address');
this.confirmationSection = this.page.getByTestId('@trading/selected-offer');
this.confirmationCryptoAmount = this.page.getByTestId('@trading/form/info/crypto-amount');
this.confirmationFiatAmount = this.page.getByTestId('@trading/form/info/fiat-amount');
this.confirmationProvider = this.page.getByTestId('@trading/form/info/provider');
this.confirmationAddress = this.page.getByTestId('@trading/form/verify/address');
this.confirmTradeButton = this.page.getByTestId(
'@coinmarket/offer/continue-transaction-button',
'@trading/offer/continue-transaction-button',
);
this.exchangeFeeDetails = this.page.getByTestId('@wallet/fee-details');
this.broadcastButton = this.page.getByTestId('broadcast-button');
this.sendAddressInput = this.page.getByTestId('outputs.0.address');
this.sendAmountInput = this.page.getByTestId('outputs.0.amount');
this.sendButton = this.page.getByTestId('@send/review-button');
this.transactionList = this.page.getByTestId('@coinmarket/transactions/list');
this.transactionInfo = this.page.getByTestId('@coinmarket/transactions/info');
this.transactionStatus = this.page.getByTestId('@coinmarket/transactions/status');
this.transactionList = this.page.getByTestId('@trading/transactions/list');
this.transactionInfo = this.page.getByTestId('@trading/transactions/info');
this.transactionStatus = this.page.getByTestId('@trading/transactions/status');
this.transactionDetailsButton = this.page.getByRole('button', { name: 'View Details' });
this.transactionDetailStatus = this.page.getByTestId(
'@coinmarket/transaction/detail/status',
);
this.transactionDetailStatus = this.page.getByTestId('@trading/transaction/detail/status');
this.proceedToPayButton = this.page.getByRole('button', { name: 'Proceed to pay' });
this.transactionDetail = this.page.getByTestId('@coinmarket/transaction/detail');
this.transactionDetail = this.page.getByTestId('@trading/transaction/detail');
}

@step()
@@ -270,9 +260,9 @@ export class MarketActions {
});
}

const redirecteTradeResponse = createRedirectedTradeResponse(this.url);
const redirectedTradeResponse = createRedirectedTradeResponse(this.url);
await this.page.route(invityEndpoint.buyTrade, async route => {
await route.fulfill({ json: redirecteTradeResponse });
await route.fulfill({ json: redirectedTradeResponse });
});
}

Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ export class WalletActions {
readonly walletStakingButton: Locator;
readonly stakeAddress: Locator;
readonly walletExtraDropDown: Locator;
readonly coinMarketBuyButton: Locator;
readonly tradingBuyButton: Locator;
readonly coinExchangeButton: Locator;
readonly coinMarketDropdownBuyButton: Locator;
readonly tradingDropdownBuyButton: Locator;
readonly balanceOfAccount = (symbol: NetworkSymbol) =>
this.page.getByTestId(`@wallet/coin-balance/value-${symbol}`);
readonly accountDetailsTabButton: Locator;
@@ -44,11 +44,11 @@ export class WalletActions {
this.walletStakingButton = this.page.getByTestId('@wallet/menu/staking');
this.stakeAddress = this.page.getByTestId('@cardano/staking/address');
this.walletExtraDropDown = this.page.getByTestId('@wallet/menu/extra-dropdown');
this.coinMarketBuyButton = this.page.getByTestId('@wallet/menu/wallet-coinmarket-buy');
this.coinExchangeButton = this.page.getByTestId('@wallet/menu/wallet-coinmarket-exchange');
this.coinMarketDropdownBuyButton = this.page
this.tradingBuyButton = this.page.getByTestId('@wallet/menu/wallet-trading-buy');
this.coinExchangeButton = this.page.getByTestId('@wallet/menu/wallet-trading-exchange');
this.tradingDropdownBuyButton = this.page
.getByRole('list')
.getByTestId('@wallet/menu/wallet-coinmarket-buy');
.getByTestId('@wallet/menu/wallet-trading-buy');
this.accountDetailsTabButton = this.page.getByTestId('@wallet/menu/wallet-details');
this.accountDetails = this.page.getByTestId('@wallet/account-details');
this.showPublicKeyButton = this.page.getByTestId('@wallets/details/show-xpub-button');
@@ -112,15 +112,15 @@ export class WalletActions {
}

@step()
async openCoinMarket(params: WalletParams = {}) {
async openTrading(params: WalletParams = {}) {
await this.accountButton(params).click();
//TODO: #16073 We cannot set resolution for Electron. on CI button is hidden under dropdown due to a breakpoint
const isBuyButtonHidden = !(await this.coinMarketBuyButton.isVisible());
const isBuyButtonHidden = !(await this.tradingBuyButton.isVisible());
if (isBuyButtonHidden) {
await this.walletExtraDropDown.click();
await this.coinMarketDropdownBuyButton.click();
await this.tradingDropdownBuyButton.click();
} else {
await this.coinMarketBuyButton.click();
await this.tradingBuyButton.click();
}
}

Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ test.describe('Coin market buy', { tag: ['@group=other', '@snapshot', '@webOnly'
await marketPage.mockInvity();
await onboardingPage.completeOnboarding();
await dashboardPage.discoveryShouldFinish();
await walletPage.openCoinMarket();
await walletPage.openTrading();
});

test('Select compared offers to buy', async ({ marketPage }) => {
Loading

0 comments on commit 83f851f

Please sign in to comment.