Skip to content

Commit 8e4a18c

Browse files
authored
test: add Trezor send e2e (#1858)
1 parent 739cb78 commit 8e4a18c

File tree

10 files changed

+78
-8
lines changed

10 files changed

+78
-8
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@TrezorSendExtended @Trezor @Testnet
2+
Feature: Trezor Send extended
3+
4+
@LW-7878
5+
Scenario: Extended-view - Send ADA (single asset) E2E
6+
Given I connect, unlock and enter correct pin on Trezor emulator
7+
And I save token: "Cardano" balance
8+
When I click "Send" button on page header
9+
And I fill bundle 1 with "WalletReceiveSimpleTransactionE2E" main address with following assets:
10+
| type | assetName | ticker | amount |
11+
| ADA | Cardano | tADA | 2.1234 |
12+
And I click "Review transaction" button on "Send" page
13+
And I save fee value
14+
And I click "Confirm" button on "Transaction summary" page
15+
And I reject analytics and click "Allow once for this session" on Trezor Connect page
16+
And I confirm send simple transaction on Trezor emulator
17+
And I switch to window with Lace
18+
Then The Transaction submitted screen is displayed in extended mode
19+
When I close the drawer by clicking close button
20+
And I navigate to Tokens extended page
21+
Then the sent amount of: "2.123" with "saved" fee for token "Cardano" is subtracted from the total balance
22+
When I navigate to Activity extended page
23+
Then the Sent transaction is displayed with value: "2.29 tADA" and tokens count 1
24+
And I click and open recent transactions details until find transaction with correct hash
25+
Then The Tx details are displayed as "core.activityDetails.sent" for ADA with value: 2.12 and wallet: "WalletReceiveSimpleTransactionE2E" address
26+
When I open wallet: "WalletReceiveSimpleTransactionE2E" in: extended mode
27+
And Wallet is synced
28+
And I navigate to Activity extended page
29+
Then the Received transaction is displayed with value: "2.12 tADA" and tokens count 1
30+
And I click and open recent transactions details until find transaction with correct hash
31+
And The Tx details are displayed as "core.activityDetails.received" for ADA with value: 2.12 and wallet: "TrezorWallet" address
32+
33+

packages/e2e-tests/src/hooks/beforeTagHooks.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,15 @@ Before(
313313
await checkAndStartEmulator();
314314
}
315315
);
316+
317+
Before(
318+
{
319+
tags: '@TrezorSendExtended'
320+
},
321+
async () => {
322+
await extendedViewRepositoryWalletInitialization([TestWalletName.TrezorWallet]);
323+
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
324+
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
325+
await localStorageInitializer.disableShowPinExtension();
326+
}
327+
);

packages/e2e-tests/src/steps/trezorEmulatorSteps.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Given } from '@cucumber/cucumber';
2-
import { clickImageOnScreenshot } from '../utils/trezorEmulatorApiClient';
2+
import { clickImageOnScreenshot, holdImageOnScreenshot } from '../utils/trezorEmulatorApiClient';
33
import { browser } from '@wdio/globals';
44
import extendedView from '../page/extendedView';
55

@@ -18,3 +18,11 @@ Given(/^I confirm exporting public key on Trezor emulator$/, async () => {
1818
Given(/^I force the Trezor account setup page to open$/, async () => {
1919
await extendedView.visitTrezorSetupAccountPageWithOverride();
2020
});
21+
22+
Given(/^I confirm send simple transaction on Trezor emulator$/, async () => {
23+
await browser.pause(3000);
24+
await clickImageOnScreenshot('showSimpleButton.png');
25+
await clickImageOnScreenshot('continueButton.png');
26+
await clickImageOnScreenshot('confirmButton.png');
27+
await holdImageOnScreenshot('holdToConfirmButton.png');
28+
});

packages/e2e-tests/src/support/DockerManager.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class DockerManager {
2727
}
2828
}
2929

30+
// eslint-disable-next-line consistent-return
3031
public static async startLwHwTestingToolkit(): Promise<StartedDockerComposeEnvironment> {
3132
Logger.log('Spinning up docker compose environment for lw-hw-testing-toolkit');
3233

@@ -45,8 +46,9 @@ export class DockerManager {
4546

4647
return startedDockerComposeEnvironment;
4748
} catch (error) {
48-
Logger.warn(`Failed to start Docker Compose environment: ${error}`);
49-
throw error;
49+
Logger.error(`Failed to start Docker Compose environment: ${error}`);
50+
// eslint-disable-next-line unicorn/no-process-exit
51+
process.exit(1);
5052
}
5153
}
5254

packages/e2e-tests/src/support/logger.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ export const Logger = {
66

77
warn: (message: string): void => {
88
console.warn(message);
9+
},
10+
11+
error: (message: string): void => {
12+
console.error(message);
913
}
1014
};
Binary file not shown.

packages/e2e-tests/src/utils/trezorEmulatorApiClient.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,31 @@ export const clickImageOnScreenshot = async (imageName: string): Promise<void> =
1111

1212
response.ok
1313
? Logger.log(`Click response: ${await response.text()}`)
14-
: console.error('Error on click:', response.statusText);
14+
: Logger.error(`Error on click: ${response.statusText}`);
1515
} catch (error) {
1616
throw new Error(`Failed to click image '${imageName}' on screenshot: ${error}`);
1717
}
1818
};
1919

20+
export const holdImageOnScreenshot = async (imageName: string): Promise<void> => {
21+
try {
22+
const response = await fetch(`${baseUrl}/hold/${imageName}`, requestOptions);
23+
24+
response.ok
25+
? Logger.log(`Hold response: ${await response.text()}`)
26+
: Logger.error(`Error on hold: ${response.statusText}`);
27+
} catch (error) {
28+
throw new Error(`Failed to hold image '${imageName}' on screenshot: ${error}`);
29+
}
30+
};
31+
2032
export const startEmulator = async (): Promise<void> => {
2133
try {
2234
const response = await fetch(`${baseUrl}/start-emulator`, requestOptions);
2335

2436
response.ok
2537
? Logger.log(`Emulator started: ${await response.text()}`)
26-
: console.error('Error when starting emulator:', response.statusText);
38+
: Logger.error(`Error when starting emulator: ${response.statusText}`);
2739
} catch (error) {
2840
throw new Error(`Failed to start the emulator: ${error}`);
2941
}
@@ -35,7 +47,7 @@ export const stopEmulator = async (): Promise<void> => {
3547

3648
response.ok
3749
? Logger.log(`Emulator stopped: ${await response.text()}`)
38-
: console.error('Error when stopping emulator:', response.statusText);
50+
: Logger.error(`Error when stopping emulator: ${response.statusText}`);
3951
} catch (error) {
4052
throw new Error(`Failed to stop the emulator: ${error}`);
4153
}

packages/e2e-tests/wdio.conf.base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const config: WebdriverIO.Config = {
6565
'./src/features/NavigationMain*.feature',
6666
'./src/features/NetworkSwitching*.feature',
6767
'./src/features/OwnTags*.feature',
68-
'./src/features/trezor/Trezor.feature',
68+
'./src/features/trezor/Trezor*.feature',
6969
'./src/features/WalletAccounts*.feature'
7070
],
7171
batch9: ['./src/features/SendTransactionSimplePopup*.feature'],

packages/e2e-tests/wdio.conf.firefox.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const firefoxConfig = {
5252
'./src/features/NavigationMain*.feature',
5353
'./src/features/NetworkSwitching*.feature',
5454
'./src/features/OwnTags*.feature',
55-
'./src/features/Trezor/Trezor.feature',
5655
'./src/features/WalletAccounts*.feature'
5756
],
5857
batch9: ['./src/features/SendTransactionSimplePopup*.feature'],

0 commit comments

Comments
 (0)