Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(suite-native): receive flow e2e test added #17264

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions suite-native/app/e2e/pageObjects/accountDetailActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class AccountDetailActions {
async openSend() {
await element(by.id('@account-detail/send-button')).tap();
}

async openReceive() {
await element(by.id('@account-detail/receive-button')).tap();
}
}

export const onAccountDetail = new AccountDetailActions();
26 changes: 26 additions & 0 deletions suite-native/app/e2e/pageObjects/accountReceiveActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { expect as detoxExpect } from 'detox';

class accountReceiveActions {
async waitForScreen() {
await waitFor(element(by.id('@screen/ReceiveAccount'))).toBeVisible();
}

async clickShowAddressButton() {
const showAddressButton = element(by.id('@receive/show-address-button'));

await waitFor(showAddressButton).toBeVisible().withTimeout(30000);
await showAddressButton.tap();

// button should be hidden after tap
await waitFor(showAddressButton).not.toBeVisible().withTimeout(30000);
}

async verifyReceiveAddress(address: string) {
const receiveAddressText = element(by.id('@receive/confirmed-receive-address'));

await waitFor(receiveAddressText).toBeVisible().withTimeout(30000);
detoxExpect(receiveAddressText).toHaveText(address);
}
}

export const onAccountReceive = new accountReceiveActions();
39 changes: 39 additions & 0 deletions suite-native/app/e2e/tests/receive.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { conditionalDescribe } from '@suite-common/test-utils';
import { TrezorUserEnvLink } from '@trezor/trezor-user-env-link';

import { onAccountDetail } from '../pageObjects/accountDetailActions';
import { onAccountReceive } from '../pageObjects/accountReceiveActions';
import { onAlertSheet } from '../pageObjects/alertSheetActions';
import { onCoinEnablingInit } from '../pageObjects/coinEnablingActions';
import { onHome } from '../pageObjects/homeActions';
import { onMyAssets } from '../pageObjects/myAssetsActions';
import { onOnboarding } from '../pageObjects/onboardingActions';
import { onTabBar } from '../pageObjects/tabBarActions';
import { disconnectTrezorUserEnv, openApp, prepareTrezorEmulator } from '../utils';

conditionalDescribe(device.getPlatform() === 'android', 'Receive', () => {
it('Generate device confirmed receive address.', async () => {
await prepareTrezorEmulator();
await openApp({ newInstance: true });
await onOnboarding.skipOnboarding();

await onCoinEnablingInit.waitForScreen();
await onCoinEnablingInit.enableNetwork('btc');
await onCoinEnablingInit.clickOnConfirmButton();
await onAlertSheet.skipViewOnlyMode();

await onHome.waitForScreen();
await onTabBar.navigateToMyAssets();

await onMyAssets.openAccountDetail({ accountName: 'Bitcoin #1' });

await onAccountDetail.openReceive();
await onAccountReceive.waitForScreen();

await onAccountReceive.clickShowAddressButton();
await TrezorUserEnvLink.pressYes();
await onAccountReceive.verifyReceiveAddress('bc1qa55m6kz3crfse5xg2rukulyap4eyp75w0puawz');

disconnectTrezorUserEnv();
});
});
6 changes: 5 additions & 1 deletion suite-native/qr-code/src/components/AddressQRCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export const AddressQRCode = ({ address }: AddressQRCodeProps) => {
<VStack spacing="sp24">
<QRCode data={address} />
<Pressable onLongPress={handleCopyAddress} style={applyStyle(addressContainer)}>
<Text variant="titleSmall" textAlign="center">
<Text
variant="titleSmall"
textAlign="center"
testID="@receive/confirmed-receive-address"
>
{address}
</Text>
</Pressable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export const ShowAddressButtons = ({ onShowAddress }: ShowAddressButtonsProps) =

return (
<VStack spacing="sp24">
<Button viewLeft="eye" size="large" onPress={handleShowAddress}>
<Button
testID="@receive/show-address-button"
viewLeft="eye"
size="large"
onPress={handleShowAddress}
>
<Translation
id={
isPortfolioTrackerDevice
Expand Down