mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-13 02:38:15 +01:00
fix(suite-native): Mobile Trade: fix e2e tests
This commit is contained in:
committed by
Jiří Bažant
parent
97ed087c84
commit
3cfff48bda
1
suite-native/analytics/src/jest.setup.ts
Normal file
1
suite-native/analytics/src/jest.setup.ts
Normal file
@@ -0,0 +1 @@
|
||||
//jest.mock('./analytics');
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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' });
|
||||
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user