fix(suite-native): Mobile Trade: fix e2e tests

This commit is contained in:
Jirka Bažant
2025-05-16 11:34:52 +02:00
committed by Jiří Bažant
parent 97ed087c84
commit 3cfff48bda
5 changed files with 40 additions and 2 deletions

View File

@@ -0,0 +1 @@
//jest.mock('./analytics');

View File

@@ -38,7 +38,7 @@ class TradingBuyActions {
}
async scrollScreenToBottom() {
await element(by.id('@screen/Trading')).swipe('up', 'fast', 0.8);
await element(by.id('@screen/Trading')).swipe('up');
}
async waitForQuotesToLoad() {
@@ -112,8 +112,9 @@ class TradingBuyActions {
async setFiatAmount(amount: string) {
await this.getFiatAmountElement().tap();
await this.getFiatAmountElement().replaceText(amount);
await this.getAmountEditingDoneButton().tap();
await this.waitForQuotesToLoad();
await this.scrollScreenToBottom();
await this.getAmountEditingDoneButton().tap({ x: 20, y: 1 });
}
async expectReceiveAccountBalance(expectedValue: string) {

View File

@@ -13,6 +13,18 @@ jest.mock('@suite-common/wallet-core', () => {
};
});
jest.mock('@suite-common/trading', () => {
const actualImplementation = jest.requireActual('@suite-common/trading');
return {
...actualImplementation,
tradingThunks: {
...actualImplementation.tradingThunks,
watchTradeThunk: () => ({ type: 'mocked-action' }),
},
};
});
describe('AccountListItem', () => {
const onPressMock = jest.fn();

View File

@@ -36,6 +36,18 @@ jest.mock('../../hooks/general/useBottomSheetControls', () => ({
}),
}));
jest.mock('@suite-common/trading', () => {
const actualImplementation = jest.requireActual('@suite-common/trading');
return {
...actualImplementation,
tradingThunks: {
...actualImplementation.tradingThunks,
watchTradeThunk: () => ({ type: 'mocked-action' }),
},
};
});
const buyTrade = getBuyTrade({ status: 'SUBMITTED' });
const exchangeTrade = getExchangeTrade({ status: 'CONVERTING' });

View File

@@ -12,6 +12,18 @@ jest.mock('@react-navigation/native', () => ({
useRoute: () => ({ name: 'TradingWebViewScreen', params: { ...mockRouteParams } }),
}));
jest.mock('@suite-common/trading', () => {
const actualImplementation = jest.requireActual('@suite-common/trading');
return {
...actualImplementation,
tradingThunks: {
...actualImplementation.tradingThunks,
watchTradeThunk: () => ({ type: 'mocked-action' }),
},
};
});
describe('TradingWebViewScreen', () => {
it('should render header', async () => {
mockRouteParams = {