From dd131052ce079fff418446757b7a2a8549e81ece Mon Sep 17 00:00:00 2001 From: BrodyHughes <41711440+BrodyHughes@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:34:34 -0500 Subject: [PATCH 1/6] init --- .../SettingsSheet/components/Backups/BackUpMenuButton.tsx | 1 + .../SettingsSheet/components/Backups/SecretWarning.tsx | 8 +++++++- .../SettingsSheet/components/Backups/ViewWalletBackup.tsx | 1 + src/screens/SettingsSheet/components/Menu.tsx | 5 +++-- src/screens/SettingsSheet/components/MenuHeader.tsx | 5 +++-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/screens/SettingsSheet/components/Backups/BackUpMenuButton.tsx b/src/screens/SettingsSheet/components/Backups/BackUpMenuButton.tsx index a4b292ca9a0..1b2f4334e8e 100644 --- a/src/screens/SettingsSheet/components/Backups/BackUpMenuButton.tsx +++ b/src/screens/SettingsSheet/components/Backups/BackUpMenuButton.tsx @@ -84,6 +84,7 @@ export const BackUpMenuItem = ({ > {({ onNewEmoji }: { onNewEmoji: () => void }) => ( { - + { .map((account: RainbowAccount) => ( } diff --git a/src/screens/SettingsSheet/components/Menu.tsx b/src/screens/SettingsSheet/components/Menu.tsx index 273debda1cd..e324b60a21b 100644 --- a/src/screens/SettingsSheet/components/Menu.tsx +++ b/src/screens/SettingsSheet/components/Menu.tsx @@ -5,13 +5,14 @@ interface MenuProps { children: React.ReactNode; header?: string; description?: string | React.ReactNode; + testId?: string; } -const Menu = ({ children, description, header }: MenuProps) => { +const Menu = ({ children, description, header, testId }: MenuProps) => { return ( <> {!!header && ( - + {header} diff --git a/src/screens/SettingsSheet/components/MenuHeader.tsx b/src/screens/SettingsSheet/components/MenuHeader.tsx index 4aa2e40c2a6..e83847f2244 100644 --- a/src/screens/SettingsSheet/components/MenuHeader.tsx +++ b/src/screens/SettingsSheet/components/MenuHeader.tsx @@ -128,14 +128,15 @@ interface LabelProps { text: string; linkText?: string; onPress?: () => void; + testID?: string; } -const Label = ({ text, linkText, onPress }: LabelProps) => { +const Label = ({ text, linkText, onPress, testID }: LabelProps) => { return ( {text} {linkText && onPress && ( - + {' '} {linkText} From 532720ac08edb5b69f07220bb6ff86912c24991b Mon Sep 17 00:00:00 2001 From: BrodyHughes <41711440+BrodyHughes@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:35:18 -0500 Subject: [PATCH 2/6] test file --- e2e/8_manualBackup.spec.ts | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 e2e/8_manualBackup.spec.ts diff --git a/e2e/8_manualBackup.spec.ts b/e2e/8_manualBackup.spec.ts new file mode 100644 index 00000000000..ceb56292469 --- /dev/null +++ b/e2e/8_manualBackup.spec.ts @@ -0,0 +1,75 @@ +/* eslint-disable no-await-in-loop */ +import { + beforeAllcleanApp, + importWalletFlow, + afterAllcleanApp, + tap, + tapByText, + delayTime, + tapAtPoint, + checkIfExistsByText, + checkIfExists, + waitAndTap, + checkIfDoesntExist, +} from './helpers'; + +describe('Backups', () => { + beforeAll(async () => { + await beforeAllcleanApp({ hardhat: false }); + }); + afterAll(async () => { + await afterAllcleanApp({ hardhat: false }); + }); + + it('Imports wallet', async () => { + await importWalletFlow(); + }); + + it('Should go to settings', async () => { + await tapAtPoint('wallet-screen', { x: 355, y: 80 }); + await tapByText('Settings'); + await checkIfExists('settings-sheet'); + }); + + it('Should go to backups', async () => { + await tap('backup-section'); + await checkIfExistsByText('Wallets & Backup'); + }); + + it('Should alert that iCloud isnt enabled', async () => { + await waitAndTap('backup-now-button'); + await checkIfExistsByText('iCloud Not Enabled'); + await tapByText('No thanks'); + }); + + it('Should go to specific wallets backup sheet and view seed phrase', async () => { + await delayTime('medium'); + await tapByText('Not backed up'); + await delayTime('medium'); + await tapByText('Back Up Manually'); + await waitAndTap('show-secret-button'); + }); + + it('Should check if seed phrase exists word by word and confirm backup', async () => { + await delayTime('medium'); + const words = process.env.TEST_SEEDS ? process.env.TEST_SEEDS.split(' ') : []; + for (const word of words) { + await checkIfExistsByText(word.trim()); + } + await delayTime('medium'); + await tapByText("􀆅 I've saved these words"); + }); + + it('Should go back to the backup sheet and it should be updated', async () => { + await delayTime('medium'); + await checkIfExistsByText('Wallets & Backup'); + await checkIfDoesntExist('Not backed up', 1_000); + }); + + it('Should go to specific wallets backup sheet and it should be backup up now', async () => { + await delayTime('medium'); + await tapByText('Imported'); + await delayTime('medium'); + await checkIfExistsByText('Backed up manually'); + }); +}); From 97b625ced45e873f9fd63c15f777952640d1c507 Mon Sep 17 00:00:00 2001 From: BrodyHughes <41711440+BrodyHughes@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:34:34 -0500 Subject: [PATCH 3/6] init --- .../SettingsSheet/components/Backups/BackUpMenuButton.tsx | 1 + .../SettingsSheet/components/Backups/SecretWarning.tsx | 8 +++++++- .../SettingsSheet/components/Backups/ViewWalletBackup.tsx | 1 + src/screens/SettingsSheet/components/Menu.tsx | 5 +++-- src/screens/SettingsSheet/components/MenuHeader.tsx | 5 +++-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/screens/SettingsSheet/components/Backups/BackUpMenuButton.tsx b/src/screens/SettingsSheet/components/Backups/BackUpMenuButton.tsx index a4b292ca9a0..1b2f4334e8e 100644 --- a/src/screens/SettingsSheet/components/Backups/BackUpMenuButton.tsx +++ b/src/screens/SettingsSheet/components/Backups/BackUpMenuButton.tsx @@ -84,6 +84,7 @@ export const BackUpMenuItem = ({ > {({ onNewEmoji }: { onNewEmoji: () => void }) => ( { - + { .map((account: RainbowAccount) => ( } diff --git a/src/screens/SettingsSheet/components/Menu.tsx b/src/screens/SettingsSheet/components/Menu.tsx index 273debda1cd..e324b60a21b 100644 --- a/src/screens/SettingsSheet/components/Menu.tsx +++ b/src/screens/SettingsSheet/components/Menu.tsx @@ -5,13 +5,14 @@ interface MenuProps { children: React.ReactNode; header?: string; description?: string | React.ReactNode; + testId?: string; } -const Menu = ({ children, description, header }: MenuProps) => { +const Menu = ({ children, description, header, testId }: MenuProps) => { return ( <> {!!header && ( - + {header} diff --git a/src/screens/SettingsSheet/components/MenuHeader.tsx b/src/screens/SettingsSheet/components/MenuHeader.tsx index 4aa2e40c2a6..e83847f2244 100644 --- a/src/screens/SettingsSheet/components/MenuHeader.tsx +++ b/src/screens/SettingsSheet/components/MenuHeader.tsx @@ -128,14 +128,15 @@ interface LabelProps { text: string; linkText?: string; onPress?: () => void; + testID?: string; } -const Label = ({ text, linkText, onPress }: LabelProps) => { +const Label = ({ text, linkText, onPress, testID }: LabelProps) => { return ( {text} {linkText && onPress && ( - + {' '} {linkText} From 7ca7d54a03ba11ce292ae60b97b552c1f8d31b90 Mon Sep 17 00:00:00 2001 From: BrodyHughes <41711440+BrodyHughes@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:35:18 -0500 Subject: [PATCH 4/6] test file --- e2e/8_manualBackup.spec.ts | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 e2e/8_manualBackup.spec.ts diff --git a/e2e/8_manualBackup.spec.ts b/e2e/8_manualBackup.spec.ts new file mode 100644 index 00000000000..ceb56292469 --- /dev/null +++ b/e2e/8_manualBackup.spec.ts @@ -0,0 +1,75 @@ +/* eslint-disable no-await-in-loop */ +import { + beforeAllcleanApp, + importWalletFlow, + afterAllcleanApp, + tap, + tapByText, + delayTime, + tapAtPoint, + checkIfExistsByText, + checkIfExists, + waitAndTap, + checkIfDoesntExist, +} from './helpers'; + +describe('Backups', () => { + beforeAll(async () => { + await beforeAllcleanApp({ hardhat: false }); + }); + afterAll(async () => { + await afterAllcleanApp({ hardhat: false }); + }); + + it('Imports wallet', async () => { + await importWalletFlow(); + }); + + it('Should go to settings', async () => { + await tapAtPoint('wallet-screen', { x: 355, y: 80 }); + await tapByText('Settings'); + await checkIfExists('settings-sheet'); + }); + + it('Should go to backups', async () => { + await tap('backup-section'); + await checkIfExistsByText('Wallets & Backup'); + }); + + it('Should alert that iCloud isnt enabled', async () => { + await waitAndTap('backup-now-button'); + await checkIfExistsByText('iCloud Not Enabled'); + await tapByText('No thanks'); + }); + + it('Should go to specific wallets backup sheet and view seed phrase', async () => { + await delayTime('medium'); + await tapByText('Not backed up'); + await delayTime('medium'); + await tapByText('Back Up Manually'); + await waitAndTap('show-secret-button'); + }); + + it('Should check if seed phrase exists word by word and confirm backup', async () => { + await delayTime('medium'); + const words = process.env.TEST_SEEDS ? process.env.TEST_SEEDS.split(' ') : []; + for (const word of words) { + await checkIfExistsByText(word.trim()); + } + await delayTime('medium'); + await tapByText("􀆅 I've saved these words"); + }); + + it('Should go back to the backup sheet and it should be updated', async () => { + await delayTime('medium'); + await checkIfExistsByText('Wallets & Backup'); + await checkIfDoesntExist('Not backed up', 1_000); + }); + + it('Should go to specific wallets backup sheet and it should be backup up now', async () => { + await delayTime('medium'); + await tapByText('Imported'); + await delayTime('medium'); + await checkIfExistsByText('Backed up manually'); + }); +}); From 227249293764f980046be65d62f6c7ed5e4aa61e Mon Sep 17 00:00:00 2001 From: BrodyHughes <41711440+BrodyHughes@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:39:33 -0500 Subject: [PATCH 5/6] start using testID --- e2e/8_manualBackup.spec.ts | 36 +++++++++++-------- package.json | 2 +- .../asset-list/RecyclerAssetList2/index.tsx | 2 +- src/components/backup/BackupSheet.tsx | 2 +- .../secret-display/SecretDisplaySection.tsx | 2 +- src/design-system/components/Inset/Inset.tsx | 9 +++-- .../components/Backups/ViewWalletBackup.tsx | 1 + .../components/Backups/WalletsAndBackup.tsx | 8 ++++- .../SettingsSheet/components/MenuItem.tsx | 4 ++- 9 files changed, 43 insertions(+), 23 deletions(-) diff --git a/e2e/8_manualBackup.spec.ts b/e2e/8_manualBackup.spec.ts index ceb56292469..6f4836ac5e3 100644 --- a/e2e/8_manualBackup.spec.ts +++ b/e2e/8_manualBackup.spec.ts @@ -26,7 +26,7 @@ describe('Backups', () => { }); it('Should go to settings', async () => { - await tapAtPoint('wallet-screen', { x: 355, y: 80 }); + await waitAndTap('settings-menu'); await tapByText('Settings'); await checkIfExists('settings-sheet'); }); @@ -38,15 +38,18 @@ describe('Backups', () => { it('Should alert that iCloud isnt enabled', async () => { await waitAndTap('backup-now-button'); + + // Alert await checkIfExistsByText('iCloud Not Enabled'); await tapByText('No thanks'); }); it('Should go to specific wallets backup sheet and view seed phrase', async () => { await delayTime('medium'); - await tapByText('Not backed up'); + await waitAndTap('not-backed-up'); + await delayTime('medium'); + await waitAndTap('manually-backup'); await delayTime('medium'); - await tapByText('Back Up Manually'); await waitAndTap('show-secret-button'); }); @@ -57,19 +60,22 @@ describe('Backups', () => { await checkIfExistsByText(word.trim()); } await delayTime('medium'); - await tapByText("􀆅 I've saved these words"); + await waitAndTap('saved-these-words'); }); - it('Should go back to the backup sheet and it should be updated', async () => { - await delayTime('medium'); - await checkIfExistsByText('Wallets & Backup'); - await checkIfDoesntExist('Not backed up', 1_000); - }); + // it('Should go back to the backup sheet and it should be updated', async () => { + // await delayTime('medium'); + // // TEST ID + // await checkIfExistsByText('Wallets & Backup'); + // await checkIfDoesntExist('Not backed up', 1_000); + // }); - it('Should go to specific wallets backup sheet and it should be backup up now', async () => { - await delayTime('medium'); - await tapByText('Imported'); - await delayTime('medium'); - await checkIfExistsByText('Backed up manually'); - }); + // it('Should go to specific wallets backup sheet and it should be backup up now', async () => { + // await delayTime('medium'); + // // TEST ID + // await tapByText('Imported'); + // await delayTime('medium'); + // // TEST ID + // await checkIfExistsByText('Backed up manually'); + // }); }); diff --git a/package.json b/package.json index fa8a957e764..0fde54f015e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "check-lockfile": "./scripts/check-lockfile.sh", "clean:android": "yarn uninstall:android && rm -rf android/build && yarn gradle clean && rm -rf ~/.gradle/caches", "clean:ios": "rm -rf ios/build && cd ios && bundle exec pod deintegrate", - "clean:packager": "watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-map-*", + "clean:packager": "watchman watch-del-all", "clean:node": "rm -rf node_modules", "nuke": "./scripts/nuke.sh", "detox:android": "detox build -c android.emu.debug && detox test -c android.emu.debug --loglevel verbose", diff --git a/src/components/asset-list/RecyclerAssetList2/index.tsx b/src/components/asset-list/RecyclerAssetList2/index.tsx index 69fb257fb5c..9c39e196ee7 100644 --- a/src/components/asset-list/RecyclerAssetList2/index.tsx +++ b/src/components/asset-list/RecyclerAssetList2/index.tsx @@ -260,7 +260,7 @@ function NavbarOverlay({ accentColor, position }: { accentColor?: string; positi ) : ( - + diff --git a/src/components/backup/BackupSheet.tsx b/src/components/backup/BackupSheet.tsx index be2bd57ebd8..5b6a0a4300a 100644 --- a/src/components/backup/BackupSheet.tsx +++ b/src/components/backup/BackupSheet.tsx @@ -44,7 +44,7 @@ export default function BackupSheet() { {({ backgroundColor }) => ( - + )} diff --git a/src/design-system/components/Inset/Inset.tsx b/src/design-system/components/Inset/Inset.tsx index a2fdce45392..79f48520f8d 100644 --- a/src/design-system/components/Inset/Inset.tsx +++ b/src/design-system/components/Inset/Inset.tsx @@ -12,12 +12,13 @@ export type InsetProps = { bottom?: Space; left?: Space; right?: Space; + testId?: string; }; /** * @description Renders a container with padding. */ -export function Inset({ space: spaceProp, horizontal, vertical, top, bottom, left, right, children }: InsetProps) { +export function Inset({ space: spaceProp, horizontal, vertical, top, bottom, left, right, children, testId }: InsetProps) { const margin = resolveToken(space, spaceProp); const marginBottom = resolveToken(space, bottom); const marginHorizontal = resolveToken(space, horizontal); @@ -39,5 +40,9 @@ export function Inset({ space: spaceProp, horizontal, vertical, top, bottom, lef [margin, marginBottom, marginHorizontal, marginLeft, marginRight, marginTop, marginVertical] ); - return {children}; + return ( + + {children} + + ); } diff --git a/src/screens/SettingsSheet/components/Backups/ViewWalletBackup.tsx b/src/screens/SettingsSheet/components/Backups/ViewWalletBackup.tsx index 29864c08391..3e8ad71f0a4 100644 --- a/src/screens/SettingsSheet/components/Backups/ViewWalletBackup.tsx +++ b/src/screens/SettingsSheet/components/Backups/ViewWalletBackup.tsx @@ -457,6 +457,7 @@ const ViewWalletBackup = () => { onPress={onManualBackup} size={52} titleComponent={} + testID={'back-up-manually'} /> { } > - {!backedUp && } + {!backedUp && ( + + )} {imported && } { +const Label = ({ text, warn, color, testID }: LabelProps) => { const { colors } = useTheme(); return ( {text} From 2f7009b6edc9f0de2caf7efa8c762037c11265e4 Mon Sep 17 00:00:00 2001 From: BrodyHughes <41711440+BrodyHughes@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:22:42 -0500 Subject: [PATCH 6/6] final updates --- e2e/8_manualBackup.spec.ts | 29 +++++++++---------- .../backup/BackupChooseProviderStep.tsx | 2 +- .../secret-display/SecretDisplaySection.tsx | 10 +++++-- .../components/Backups/ViewWalletBackup.tsx | 1 + .../components/Backups/WalletsAndBackup.tsx | 2 +- .../SettingsSheet/components/MenuHeader.tsx | 5 ++-- .../components/SettingsSection.tsx | 2 +- 7 files changed, 28 insertions(+), 23 deletions(-) diff --git a/e2e/8_manualBackup.spec.ts b/e2e/8_manualBackup.spec.ts index 6f4836ac5e3..bc595e5cdf2 100644 --- a/e2e/8_manualBackup.spec.ts +++ b/e2e/8_manualBackup.spec.ts @@ -47,8 +47,8 @@ describe('Backups', () => { it('Should go to specific wallets backup sheet and view seed phrase', async () => { await delayTime('medium'); await waitAndTap('not-backed-up'); - await delayTime('medium'); - await waitAndTap('manually-backup'); + await delayTime('long'); + await waitAndTap('back-up-manually'); await delayTime('medium'); await waitAndTap('show-secret-button'); }); @@ -63,19 +63,16 @@ describe('Backups', () => { await waitAndTap('saved-these-words'); }); - // it('Should go back to the backup sheet and it should be updated', async () => { - // await delayTime('medium'); - // // TEST ID - // await checkIfExistsByText('Wallets & Backup'); - // await checkIfDoesntExist('Not backed up', 1_000); - // }); + it('Should go back to the backup sheet and it should be updated', async () => { + await delayTime('medium'); + await checkIfExistsByText('Wallets & Backup'); + await checkIfDoesntExist('not-backed-up', 1_000); + }); - // it('Should go to specific wallets backup sheet and it should be backup up now', async () => { - // await delayTime('medium'); - // // TEST ID - // await tapByText('Imported'); - // await delayTime('medium'); - // // TEST ID - // await checkIfExistsByText('Backed up manually'); - // }); + it('Should go to specific wallets backup sheet and it should be backup up now', async () => { + await delayTime('medium'); + await tap('back-ups-imported'); + await delayTime('medium'); + await checkIfExists('backed-up-manually'); + }); }); diff --git a/src/components/backup/BackupChooseProviderStep.tsx b/src/components/backup/BackupChooseProviderStep.tsx index da9520335df..d18dbeb68f5 100644 --- a/src/components/backup/BackupChooseProviderStep.tsx +++ b/src/components/backup/BackupChooseProviderStep.tsx @@ -101,7 +101,7 @@ export default function BackupSheetSectionNoProvider() { }; return ( - + {lang.t(lang.l.back_up.cloud.how_would_you_like_to_backup)} diff --git a/src/components/secret-display/SecretDisplaySection.tsx b/src/components/secret-display/SecretDisplaySection.tsx index c613f5efa15..eaa38f59627 100644 --- a/src/components/secret-display/SecretDisplaySection.tsx +++ b/src/components/secret-display/SecretDisplaySection.tsx @@ -221,8 +221,14 @@ export function SecretDisplaySection({ onSecretLoaded, onWalletTypeIdentified }: {isBackingUp && ( - - + + )} diff --git a/src/screens/SettingsSheet/components/Backups/ViewWalletBackup.tsx b/src/screens/SettingsSheet/components/Backups/ViewWalletBackup.tsx index 3e8ad71f0a4..b776bc6dd9a 100644 --- a/src/screens/SettingsSheet/components/Backups/ViewWalletBackup.tsx +++ b/src/screens/SettingsSheet/components/Backups/ViewWalletBackup.tsx @@ -492,6 +492,7 @@ const ViewWalletBackup = () => { : i18n.t(i18n.l.wallet.back_ups.backed_up_manually) } weight="heavy" + testID={'backed-up-manually'} /> } labelComponent={ diff --git a/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx b/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx index 79bdf7c5541..17f0290ca6c 100644 --- a/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx +++ b/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx @@ -599,7 +599,7 @@ export const WalletsAndBackup = () => { } > {!backedUp && } - {imported && } + {imported && } 1 diff --git a/src/screens/SettingsSheet/components/MenuHeader.tsx b/src/screens/SettingsSheet/components/MenuHeader.tsx index e83847f2244..6c2cd8d1b65 100644 --- a/src/screens/SettingsSheet/components/MenuHeader.tsx +++ b/src/screens/SettingsSheet/components/MenuHeader.tsx @@ -116,10 +116,11 @@ interface TitleProps { weight?: 'regular' | 'medium' | 'semibold' | 'bold' | 'heavy'; disabled?: boolean; isLink?: boolean; + testID?: string; } -const Title = ({ text, weight = 'semibold' }: TitleProps) => ( - +const Title = ({ text, weight = 'semibold', testID }: TitleProps) => ( + {text} ); diff --git a/src/screens/SettingsSheet/components/SettingsSection.tsx b/src/screens/SettingsSheet/components/SettingsSection.tsx index 7990dea4521..27c29e18593 100644 --- a/src/screens/SettingsSheet/components/SettingsSection.tsx +++ b/src/screens/SettingsSheet/components/SettingsSection.tsx @@ -181,7 +181,7 @@ const SettingsSection = ({ } size={60} - testID="backup-section" + testID={'backup-section'} titleComponent={} /> )}