diff --git a/e2e/8_manualBackup.spec.ts b/e2e/8_manualBackup.spec.ts new file mode 100644 index 00000000000..bc595e5cdf2 --- /dev/null +++ b/e2e/8_manualBackup.spec.ts @@ -0,0 +1,78 @@ +/* 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 waitAndTap('settings-menu'); + 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'); + + // 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 waitAndTap('not-backed-up'); + await delayTime('long'); + await waitAndTap('back-up-manually'); + await delayTime('medium'); + 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 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 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/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/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/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 }) => ( {isBackingUp && ( - + )} 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/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 }) => ( { - + { onPress={onManualBackup} size={52} titleComponent={} + testID={'back-up-manually'} /> { : i18n.t(i18n.l.wallet.back_ups.backed_up_manually) } weight="heavy" + testID={'backed-up-manually'} /> } labelComponent={ @@ -535,6 +537,7 @@ const ViewWalletBackup = () => { .map((account: RainbowAccount) => ( } diff --git a/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx b/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx index 13ec95dbcb7..17f0290ca6c 100644 --- a/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx +++ b/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx @@ -320,7 +320,13 @@ export const WalletsAndBackup = () => { } > - {!backedUp && } + {!backedUp && ( + + )} {imported && } { } > {!backedUp && } - {imported && } + {imported && } 1 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..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} ); @@ -128,14 +129,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} diff --git a/src/screens/SettingsSheet/components/MenuItem.tsx b/src/screens/SettingsSheet/components/MenuItem.tsx index 360026e68f1..44d7b14fda3 100644 --- a/src/screens/SettingsSheet/components/MenuItem.tsx +++ b/src/screens/SettingsSheet/components/MenuItem.tsx @@ -136,15 +136,17 @@ interface LabelProps { text: string; warn?: boolean; color?: string; + testID?: string; } -const Label = ({ text, warn, color }: LabelProps) => { +const Label = ({ text, warn, color, testID }: LabelProps) => { const { colors } = useTheme(); return ( {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={} /> )}