Skip to content

Commit 5e48028

Browse files
test(e2e): migrate receive specs to the redesigned screen
1 parent 20aa8b9 commit 5e48028

9 files changed

Lines changed: 53 additions & 58 deletions

File tree

suite/e2e/support/pageObjects/metadata/metadataPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class MetadataPage {
4545
this.address = new AddressMetadata(page, devicePrompt);
4646

4747
this.metadataModal = page.getByTestId('@modal/metadata-provider');
48-
this.copyAddressButton = page.getByTestId('@metadata/copy-address-button');
48+
this.copyAddressButton = page.getByTestId('@wallet/receive/copy-address-button');
4949
this.suiteSyncBanner = page.getByTestId('@notification/suite-sync-keys');
5050
this.suiteSyncBannerButton = page.getByTestId('@notification/suite-sync-keys/button');
5151
this.legacyNotification = this.page.getByTestId('@notification/legacy-labeling-upgrade');

suite/e2e/support/pageObjects/walletPage.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,13 @@ export class WalletPage {
3939
readonly sendFormHeader: Locator;
4040
readonly totalSent: Locator;
4141
readonly receiveButton: Locator;
42-
readonly revealAddressButton: Locator;
42+
readonly verifyAddressButton: Locator;
4343
readonly copyAddressButton: Locator;
44+
readonly receiveAddress: Locator;
45+
readonly showNextAddressButton: Locator;
46+
readonly addressCopiedModal: Locator;
47+
readonly addressCopiedModalVerifyButton: Locator;
48+
readonly addressCopiedModalSkipButton: Locator;
4449
readonly stakingButton: Locator;
4550
readonly signAndVerifyButton: Locator;
4651
readonly stakingCardano: Locator;
@@ -50,7 +55,6 @@ export class WalletPage {
5055
readonly fiatAmount: Locator;
5156
readonly walletFilter = (symbol: NetworkSymbol) =>
5257
this.page.getByTestId(`@account-menu/filter/${symbol}`);
53-
readonly showMoreButton: Locator;
5458
readonly topPanelBalance: Locator;
5559
readonly topPanelBalanceWithSymbol: Locator;
5660
readonly addAccountButton: Locator;
@@ -73,8 +77,10 @@ export class WalletPage {
7377
readonly discoveryWarning: Locator;
7478
readonly usedAddress = (index: number) =>
7579
this.page.getByTestId(`@wallet/receive/used-address/${index}`);
76-
readonly usedAddressRevealButton = (index: number) =>
77-
this.page.getByTestId(`@wallet/receive/reveal-address-button/${index}`);
80+
readonly usedAddressVerifyButton = (index: number) =>
81+
this.page.getByTestId(`@wallet/receive/used-address/${index}/verify-button`);
82+
readonly usedAddressCopyButton = (index: number) =>
83+
this.page.getByTestId(`@wallet/receive/used-address/${index}/copy-button`);
7884

7985
constructor(private readonly page: Page) {
8086
this.transactionSearch = this.page.getByTestId('@wallet/accounts/search-icon');
@@ -97,8 +103,19 @@ export class WalletPage {
97103
this.sendFormHeader = this.page.getByTestId('@wallet/send-header');
98104
this.totalSent = this.page.getByTestId('@wallet/send/total-sent');
99105
this.receiveButton = this.page.getByTestId('@wallet/menu/wallet-receive');
100-
this.revealAddressButton = this.page.getByTestId('@wallet/receive/reveal-address-button');
101-
this.copyAddressButton = this.page.getByTestId('@metadata/copy-address-button');
106+
this.verifyAddressButton = this.page.getByTestId('@wallet/receive/verify-address-button');
107+
this.copyAddressButton = this.page.getByTestId('@wallet/receive/copy-address-button');
108+
this.receiveAddress = this.page.getByTestId('@wallet/receive/address');
109+
this.showNextAddressButton = this.page.getByTestId(
110+
'@wallet/receive/show-next-address-button',
111+
);
112+
this.addressCopiedModal = this.page.getByTestId('@wallet/receive/address-copied-modal');
113+
this.addressCopiedModalVerifyButton = this.page.getByTestId(
114+
'@wallet/receive/address-copied-modal/verify-button',
115+
);
116+
this.addressCopiedModalSkipButton = this.page.getByTestId(
117+
'@wallet/receive/address-copied-modal/skip-button',
118+
);
102119
this.stakingButton = this.page.getByTestId('@wallet/menu/staking');
103120
this.signAndVerifyButton = this.page.getByTestId('@wallet/menu/wallet-sign-verify');
104121
this.stakingCardano = this.page.getByTestId('@wallet/cardano/staking');
@@ -108,7 +125,6 @@ export class WalletPage {
108125
this.transactionItem = this.page.getByTestId('@wallet/transaction-item');
109126
this.transactionAddress = this.page.getByTestId('@wallet/transaction/target-address');
110127
this.fiatAmount = this.page.getByTestId('@wallet/account/fiat-amount').first();
111-
this.showMoreButton = this.page.getByTestId('@wallet/receive/used-address/show-more');
112128
this.topPanelBalance = this.page.getByTestId('@wallet/account/crypto-balance');
113129
this.topPanelBalanceWithSymbol = this.page.getByTestId(
114130
'@wallet/account/crypto-balance-with-symbol',

suite/e2e/tests/metadata/legacy/address-metadata.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ test.describe('Metadata - address labeling', { tag: ['@webOnly', '@T3W1', '@T3T1
1717
await test.step('Interact with accounts and metadata', async () => {
1818
await walletPage.openAccount();
1919
await walletPage.receiveButton.click();
20-
await walletPage.showMoreButton.click();
2120
await metadataPage.address.clickEditLabel(metadataAddress);
2221
});
2322

suite/e2e/tests/passphrase/passphrase-cardano.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { messages } from '@suite/intl';
22

3-
import { formatAddress, replaceTemplatesInTranslation } from '../../support/common';
3+
import { replaceTemplatesInTranslation } from '../../support/common';
44
import { expect, test } from '../../support/fixtures';
55

66
const correctPassphraseAddr =
@@ -55,7 +55,7 @@ test.describe('Passphrase with cardano', { tag: ['@nightlyOnly', '@T3W1', '@T3T1
5555
await test.step('Reveal cardano address', async () => {
5656
await walletPage.openAccount({ symbol: 'ada', type: 'normal', atIndex: 0 });
5757
await walletPage.receiveButton.click();
58-
await walletPage.revealAddressButton.click();
58+
await walletPage.verifyAddressButton.click();
5959
});
6060

6161
await test.step('Enter correct passphrase when device asks for passphrase after reset', async () => {
@@ -64,23 +64,20 @@ test.describe('Passphrase with cardano', { tag: ['@nightlyOnly', '@T3W1', '@T3T1
6464
await devicePrompt.waitForPromptAndConfirm(); // Confirm next screen shows your passphrase
6565
await devicePrompt.waitForPromptAndConfirm(); // Confirm passphrase
6666

67-
await expect(devicePrompt.outputValue).toHaveText(formatAddress(correctPassphraseAddr));
68-
6967
await devicePrompt.confirmOnDevicePromptIsShown();
7068
await expect(device).toShowReceiveAddress(correctPassphraseAddr, {
7169
lineFormat: 'cardanoTetragrams',
7270
});
7371
await device.pressYes(); // Confirm receive address
7472

7573
await expect(metadataPage.copyAddressButton).toBeVisible();
76-
await devicePrompt.closeModal();
77-
await expect(walletPage.revealAddressButton).toBeVisible();
74+
await expect(walletPage.verifyAddressButton).toBeVisible();
7875
});
7976

8077
await restartDevice();
8178

8279
await test.step('Reveal cardano address, now enter wrong passphrase', async () => {
83-
await walletPage.revealAddressButton.click();
80+
await walletPage.verifyAddressButton.click();
8481
await dashboardPage.passphraseInput.fill('wrong passphrase');
8582
await dashboardPage.passphraseSubmitButton.click();
8683
await devicePrompt.waitForPromptAndConfirm(); // Confirm next screen shows your passphrase

suite/e2e/tests/passphrase/passphrase-reconnection.test.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { formatAddress } from '../../support/common';
21
import { expect, test } from '../../support/fixtures';
32

43
const abcAddr = 'bc1qpyfvfvm52zx7gek86ajj5pkkne3h385ada8r2y';
@@ -31,16 +30,13 @@ test.describe('Passphrase reconnection', { tag: ['@T3W1', '@T3T1'] }, () => {
3130
atIndex: 0,
3231
});
3332
await walletPage.receiveButton.click();
34-
await walletPage.revealAddressButton.click();
35-
await expect(devicePrompt.outputValue).toHaveText(formatAddress(abcAddr));
33+
await walletPage.verifyAddressButton.click();
3634
await devicePrompt.confirmOnDevicePromptIsShown();
3735
await expect(device).toShowReceiveAddress(abcAddr);
3836
await device.pressYes(); // confirm address
3937

4038
await expect(metadataPage.copyAddressButton).toBeVisible();
4139
await expect(metadataPage.copyAddressButton).toBeEnabled();
42-
43-
await devicePrompt.closeModal();
4440
});
4541

4642
await test.step('Disconnect and reconnect the device', async () => {
@@ -75,7 +71,7 @@ test.describe('Passphrase reconnection', { tag: ['@T3W1', '@T3T1'] }, () => {
7571
await dashboardPage.walletAtIndex(1).click();
7672
await walletPage.receiveButton.click();
7773
await expect(walletPage.usedAddress(0)).toBeVisible();
78-
await walletPage.usedAddressRevealButton(0).click();
74+
await walletPage.usedAddressVerifyButton(0).click();
7975
await expect(page.getByText('Confirm passphrase')).toBeVisible();
8076
await dashboardPage.passphraseInput.fill('abc');
8177
await dashboardPage.passphraseSubmitButton.click();
@@ -84,20 +80,18 @@ test.describe('Passphrase reconnection', { tag: ['@T3W1', '@T3T1'] }, () => {
8480
});
8581

8682
await test.step('Verify displayed receive address', async () => {
87-
await expect(devicePrompt.outputValue).toHaveText(formatAddress(abcAddr));
88-
8983
await devicePrompt.confirmOnDevicePromptIsShown();
9084
await expect(device).toShowReceiveAddress(abcAddr);
9185
await device.pressYes(); // confirm address
9286

9387
await expect(metadataPage.copyAddressButton).toBeVisible();
9488
await expect(metadataPage.copyAddressButton).toBeEnabled();
95-
await devicePrompt.closeModal();
9689
});
9790

9891
await test.step('Second displaying receive address after reconnect should NOT prompt for passphrase', async () => {
99-
await walletPage.usedAddressRevealButton(0).click();
100-
await expect(devicePrompt.outputValue).toBeVisible();
92+
await walletPage.usedAddressVerifyButton(0).click();
93+
// Going straight to the device prompt proves no passphrase was requested again.
94+
await devicePrompt.confirmOnDevicePromptIsShown();
10195

10296
await device.pressYes(); // confirm address
10397

suite/e2e/tests/passphrase/passphrase.test.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { events } from '@suite/analytics';
22
import { TestCategory, TestPriority } from '@trezor/e2e-utils';
33

4-
import { formatAddress } from '../../support/common';
54
import { expect, test } from '../../support/fixtures';
65
import { createTestAnnotation } from '../../support/reporters/annotations';
76
import { ExtractByEventType } from '../../support/types';
@@ -50,16 +49,13 @@ test.describe('Passphrase', { tag: ['@T3W1', '@T3T1'] }, () => {
5049
atIndex: 0,
5150
});
5251
await walletPage.receiveButton.click();
53-
await walletPage.revealAddressButton.click();
54-
await expect(devicePrompt.outputValue).toHaveText(formatAddress(abcAddr));
52+
await walletPage.verifyAddressButton.click();
5553
await devicePrompt.confirmOnDevicePromptIsShown();
5654
await expect(device).toShowReceiveAddress(abcAddr);
5755
await device.pressYes(); // confirm address
5856

5957
await expect(metadataPage.copyAddressButton).toBeVisible();
6058
await expect(metadataPage.copyAddressButton).toBeEnabled();
61-
62-
await devicePrompt.closeModal();
6359
});
6460

6561
await test.step('Add second passphrase wallet #2', async () => {
@@ -81,17 +77,14 @@ test.describe('Passphrase', { tag: ['@T3W1', '@T3T1'] }, () => {
8177
await expect(walletPage.usedAddress(0)).toBeHidden();
8278
});
8379

84-
await expect(walletPage.revealAddressButton).toBeEnabled();
85-
await walletPage.revealAddressButton.click();
86-
await expect(devicePrompt.outputValue).toHaveText(formatAddress(defAddr));
80+
await expect(walletPage.verifyAddressButton).toBeEnabled();
81+
await walletPage.verifyAddressButton.click();
8782
await devicePrompt.confirmOnDevicePromptIsShown();
8883
await expect(device).toShowReceiveAddress(defAddr);
8984
await device.pressYes(); // confirm address
9085

9186
await expect(metadataPage.copyAddressButton).toBeVisible();
9287
await expect(metadataPage.copyAddressButton).toBeEnabled();
93-
94-
await devicePrompt.closeModal();
9588
});
9689

9790
await test.step('Switch back to the wallet #1, which is cached in device', async () => {
@@ -102,18 +95,15 @@ test.describe('Passphrase', { tag: ['@T3W1', '@T3T1'] }, () => {
10295

10396
await test.step('Revealed address stays visible in table of wallet #1', async () => {
10497
await expect(walletPage.usedAddress(0)).toBeVisible();
105-
await expect(walletPage.revealAddressButton).toBeEnabled();
98+
await expect(walletPage.verifyAddressButton).toBeEnabled();
10699

107-
await walletPage.usedAddressRevealButton(0).click();
108-
await expect(devicePrompt.outputValue).toHaveText(formatAddress(abcAddr));
100+
await walletPage.usedAddressVerifyButton(0).click();
109101
await devicePrompt.confirmOnDevicePromptIsShown();
110102
await expect(device).toShowReceiveAddress(abcAddr);
111103
await device.pressYes(); // confirm address
112104

113105
await expect(metadataPage.copyAddressButton).toBeVisible();
114106
await expect(metadataPage.copyAddressButton).toBeEnabled();
115-
116-
await devicePrompt.closeModal();
117107
});
118108
},
119109
);

suite/e2e/tests/wallet/cardano.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { TestCategory, TestPriority, TestStream } from '@trezor/e2e-utils';
22

3-
import { formatAddress } from '../../support/common';
43
import { expect, test } from '../../support/fixtures';
54
import { createTestAnnotation } from '../../support/reporters/annotations';
65

@@ -57,16 +56,13 @@ test.describe('Cardano', { tag: ['@nightlyOnly', '@T3W1', '@T3T1'] }, () => {
5756

5857
await test.step('Verify Cardano receive form', async () => {
5958
await walletPage.receiveButton.click();
60-
await walletPage.revealAddressButton.click();
59+
await walletPage.verifyAddressButton.click();
6160
await devicePrompt.confirmOnDevicePromptIsShown();
6261
await expect(device).toShowReceiveAddress(receiveAddress, {
6362
lineFormat: 'cardanoTetragrams',
6463
});
6564
await device.pressYes();
6665
await expect(walletPage.copyAddressButton).toBeEnabled();
67-
await expect(devicePrompt.outputValue).toHaveText(formatAddress(receiveAddress));
68-
await devicePrompt.confirmOnDevicePromptIsShown();
69-
await settingsPage.modalCloseButton.click();
7066
await page.getByTestId('@account-subpage/back').click();
7167
});
7268
},

suite/e2e/tests/wallet/global-receive-send.test.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,15 @@ test.describe('Global receive and send', { tag: ['@T3T1', '@T3W1'] }, () => {
4242
).toHaveTranslation('LABELING_ACCOUNT', {
4343
values: { networkName: 'Ethereum', index: '3' },
4444
});
45-
await walletPage.revealAddressButton.click();
46-
const addressDisplayedInSuite = await devicePrompt
47-
.outputValueOf('address')
48-
.textContent();
49-
if (!addressDisplayedInSuite) {
50-
throw new Error('Address is missing in receive modal');
51-
}
52-
expect.soft(addressDisplayedInSuite.replace(/\s/g, '')).toEqual(ETHEREUM_ADDRESS_3);
45+
// The address is rendered on the receive screen itself, so there is no modal to read
46+
// it from; the labeling container is keyed by the address it renders.
47+
await expect(
48+
page.getByTestId(`@metadata/addressLabel/${ETHEREUM_ADDRESS_3}/hover-container`),
49+
).toBeVisible();
50+
await walletPage.verifyAddressButton.click();
5351
const addressDisplayedOnDevice = await devicePrompt.getAddressFromDisplay();
5452
expect.soft(addressDisplayedOnDevice).toEqual(DEVICE_ETHEREUM_ADDRESS_3);
53+
await devicePrompt.waitForPromptAndConfirm();
5554
await expect(walletPage.copyAddressButton).toBeEnabled();
5655
});
5756
});

suite/e2e/tests/wallet/receive.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ test.describe('Receive transaction', { tag: ['@T3W1', '@T3T1'] }, () => {
6262
await settingsPage.changeNetworks({ enableNetworks: [coin] });
6363
await walletPage.accountButton({ symbol: coin }).click();
6464
await walletPage.receiveButton.click();
65-
await walletPage.revealAddressButton.click();
66-
const address = await devicePrompt.getAddressFromDisplay();
67-
await devicePrompt.waitForPromptAndConfirm();
6865
// Intercept writeText before clicking copy — Chromium enforces Permissions-Policy
6966
// at the HTTP header level, so navigator.clipboard.readText() is blocked in CI
7067
// even when context permissions are granted. Capture the value on write instead.
@@ -77,8 +74,15 @@ test.describe('Receive transaction', { tag: ['@T3W1', '@T3T1'] }, () => {
7774
return original(text).catch(() => undefined);
7875
};
7976
});
77+
// Copying is the entry point to verification: it opens the prompt offering to
78+
// verify the address that was just copied.
8079
await walletPage.copyAddressButton.click();
8180
await expect(walletPage.copyToCliboardToast).toBeVisible();
81+
await expect(walletPage.addressCopiedModal).toBeVisible();
82+
await walletPage.addressCopiedModalVerifyButton.click();
83+
const address = await devicePrompt.getAddressFromDisplay();
84+
await devicePrompt.waitForPromptAndConfirm();
85+
await expect(walletPage.addressCopiedModal).toBeHidden();
8286
const clipboardText = await page.evaluate(
8387
() => (window as any).__clipboardCapture as string,
8488
);

0 commit comments

Comments
 (0)