Skip to content

Commit 7dc28a9

Browse files
fix(suite): restore connect popup address ui, hover row actions in e2e
1 parent 6c26706 commit 7dc28a9

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

packages/suite/src/components/suite/modals/ReduxModal/DeviceContextModal/DeviceContextModal.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useIntl } from 'react-intl';
33
import { selectSelectedAccount } from '@suite/account';
44
import { messages } from '@suite/intl';
55
import { type MODAL_CONTEXT_DEVICE } from '@suite/modal';
6+
import { selectConnectPopupCall } from '@suite-common/connect-popup';
67
import { selectSelectedDevice } from '@suite-common/device';
78
import TrezorConnect, { UI_REQUEST } from '@trezor/connect';
89

@@ -17,6 +18,8 @@ import { SignMessageModal } from './SignMessageModal';
1718
import { ConfirmXpubModal } from '../ConfirmXpubModal';
1819
import type { ReduxModalProps } from '../ReduxModalProps';
1920
import { TransactionReviewModal } from '../TransactionReviewModal/TransactionReviewModal';
21+
import { ConnectAddressConfirmation } from '../UserContextModal/ConnectAddressConfirmation';
22+
import { ConnectSelectAccount } from '../UserContextModal/ConnectSelectAccount/ConnectSelectAccount';
2023

2124
/** Modals requested by Device from `trezor-connect` */
2225
export const DeviceContextModal = ({
@@ -26,6 +29,7 @@ export const DeviceContextModal = ({
2629
const device = useSelector(selectSelectedDevice);
2730
const intl = useIntl();
2831
const selectedAccount = useSelector(selectSelectedAccount);
32+
const popupCallState = useSelector(state => selectConnectPopupCall(state)?.state);
2933

3034
if (!device) return null;
3135
const abort = () => TrezorConnect.cancel({ reason: intl.formatMessage(messages.TR_CANCELLED) });
@@ -78,10 +82,20 @@ export const DeviceContextModal = ({
7882
return <ConfirmActionModal device={device} />;
7983
}
8084
}
81-
case 'ButtonRequest_Address':
82-
return data?.type === 'address' ? (
83-
<ConfirmActionModal device={device} title="TR_COMPARE_ADDRESS_ON_TREZOR" />
84-
) : null;
85+
case 'ButtonRequest_Address': {
86+
if (data?.type !== 'address') {
87+
return null;
88+
}
89+
90+
if (popupCallState === 'address-confirmation') {
91+
return <ConnectAddressConfirmation />;
92+
}
93+
if (popupCallState === 'select-account') {
94+
return <ConnectSelectAccount />;
95+
}
96+
97+
return <ConfirmActionModal device={device} title="TR_COMPARE_ADDRESS_ON_TREZOR" />;
98+
}
8599
case 'ButtonRequest_PublicKey':
86100
return <ConfirmXpubModal onCancel={abort} />;
87101
default:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ test.describe('Passphrase reconnection', { tag: ['@T3W1', '@T3T1'] }, () => {
7676
await dashboardPage.walletAtIndex(1).click();
7777
await walletPage.receiveButton.click();
7878
await expect(walletPage.usedAddress(0)).toBeVisible();
79+
await walletPage.usedAddress(0).hover();
7980
await walletPage.usedAddressVerifyButton(0).click();
8081
await expect(page.getByText('Confirm passphrase')).toBeVisible();
8182
await dashboardPage.passphraseInput.fill('abc');
@@ -94,6 +95,7 @@ test.describe('Passphrase reconnection', { tag: ['@T3W1', '@T3T1'] }, () => {
9495
});
9596

9697
await test.step('Second displaying receive address after reconnect should NOT prompt for passphrase', async () => {
98+
await walletPage.usedAddress(0).hover();
9799
await walletPage.usedAddressVerifyButton(0).click();
98100
// Going straight to the device prompt proves no passphrase was requested again.
99101
await devicePrompt.confirmOnDevicePromptIsShown();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ test.describe('Passphrase', { tag: ['@T3W1', '@T3T1'] }, () => {
102102
await expect(walletPage.usedAddress(0)).toBeVisible();
103103
await expect(walletPage.verifyAddressButton).toBeEnabled();
104104

105+
await walletPage.usedAddress(0).hover();
105106
await walletPage.usedAddressVerifyButton(0).click();
106107
await devicePrompt.confirmOnDevicePromptIsShown();
107108
await expect(device).toShowReceiveAddress(abcAddr);

0 commit comments

Comments
 (0)