From a30ff2d86f4785cd2a1fe27620623a04182efacf Mon Sep 17 00:00:00 2001 From: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Date: Mon, 29 Jan 2024 23:13:16 +0530 Subject: [PATCH] [INJIMOB-691] add testID Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> --- components/AccountInformation.tsx | 10 +++++-- .../BackupAndRestoreAllScreenBanner.tsx | 6 ++-- components/BannerNotification.tsx | 2 +- components/SectionLayout.tsx | 7 ++++- components/ui/Error.tsx | 2 +- components/ui/Timestamp.tsx | 16 ++++++----- components/ui/svg.tsx | 8 +++++- screens/Settings/DataBackupAndRestore.tsx | 4 +++ .../AccountSelectionConfirmation.tsx | 22 ++++++++++++--- .../BackupAndRestoreScreen.tsx | 28 +++++++++++++++---- shared/constants.ts | 2 ++ types/backup-and-restore/backup.d.ts | 4 +-- 12 files changed, 84 insertions(+), 27 deletions(-) diff --git a/components/AccountInformation.tsx b/components/AccountInformation.tsx index 19ad93f7..38f196df 100644 --- a/components/AccountInformation.tsx +++ b/components/AccountInformation.tsx @@ -4,6 +4,7 @@ import {Column, Row, Text} from './ui'; import {Theme} from './ui/styleUtils'; import {ProfileInfo} from '../shared/googleCloudUtils'; import {useTranslation} from 'react-i18next'; +import testIDProps from '../shared/commonUtil'; export const AccountInformation: React.FC = ({email, picture}) => { const {t} = useTranslation('AccountSelection'); @@ -11,6 +12,7 @@ export const AccountInformation: React.FC = ({email, picture}) => { = ({email, picture}) => { - + {t('associatedAccount')} - + {email} diff --git a/components/BackupAndRestoreAllScreenBanner.tsx b/components/BackupAndRestoreAllScreenBanner.tsx index 2e020775..08f4f517 100644 --- a/components/BackupAndRestoreAllScreenBanner.tsx +++ b/components/BackupAndRestoreAllScreenBanner.tsx @@ -9,15 +9,15 @@ export const BackupAndRestoreAllScreenBanner: React.FC = () => { const {t} = useTranslation('BackupAndRestoreBanner'); function backupFailure() { - const translationPath = t( + const translation = t( `backupFailure.${backUpController.backupErrorReason}`, ); return ( ); diff --git a/components/BannerNotification.tsx b/components/BannerNotification.tsx index ad4f40de..7f10f1ee 100644 --- a/components/BannerNotification.tsx +++ b/components/BannerNotification.tsx @@ -18,7 +18,7 @@ export const BannerNotification: React.FC = props => { {props.message} = ({ headerIcon, headerText, children, + testId, }) => { return ( = ({ fontSize: 14, letterSpacing: 0, lineHeight: 17, - }}> + }} + testID={`${testId}Header`}> {headerText} @@ -55,4 +59,5 @@ export type SectionLayoutProps = { headerIcon: React.ReactNode; headerText: string; children: React.ReactNode; + testId: string; }; diff --git a/components/ui/Error.tsx b/components/ui/Error.tsx index dbea43f1..aa7f1eb8 100644 --- a/components/ui/Error.tsx +++ b/components/ui/Error.tsx @@ -34,7 +34,7 @@ export const Error: React.FC = props => { {props.message} {props.helpText && ( - + {props.helpText} )} diff --git a/components/ui/Timestamp.tsx b/components/ui/Timestamp.tsx index bedb5c1a..a8b059a9 100644 --- a/components/ui/Timestamp.tsx +++ b/components/ui/Timestamp.tsx @@ -23,18 +23,19 @@ export const Timestamp: React.FC = props => { const day = date.getDate(); const month = months[date.getMonth()]; const year = date.getFullYear(); - const hours = date.getHours(); - const minutes = date.getMinutes(); + const formattedHours = (date.getHours() % 12 || 12) + .toString() + .padStart(2, '0'); + const formattedMinutes = date.getMinutes().toString().padStart(2, '0'); + const period = date.getHours() >= 12 ? 'PM' : 'AM'; - const period = hours >= 12 ? 'PM' : 'AM'; - const formattedHours = hours % 12 || 12; - - return `${day} ${month} ${year}, ${formattedHours}:${minutes} ${period}`; + return `${day} ${month} ${year}, ${formattedHours}:${formattedMinutes} ${period}`; } return ( = props => { }; interface TimestampProps { - time: Date; + time: number; + testId: string; } diff --git a/components/ui/svg.tsx b/components/ui/svg.tsx index bf684ac0..0599e80c 100644 --- a/components/ui/svg.tsx +++ b/components/ui/svg.tsx @@ -279,7 +279,13 @@ export class SvgImage { } static GoogleDriveIcon(width, height) { - return ; + return ( + + ); } } diff --git a/screens/Settings/DataBackupAndRestore.tsx b/screens/Settings/DataBackupAndRestore.tsx index d3aa41c6..7312737a 100644 --- a/screens/Settings/DataBackupAndRestore.tsx +++ b/screens/Settings/DataBackupAndRestore.tsx @@ -11,6 +11,7 @@ import {SvgImage} from '../../components/ui/svg'; import {AccountSelectionConfirmation} from '../backupAndRestore/AccountSelectionConfirmation'; import {useBackupAndRestore} from '../backupAndRestore/BackupAndRestoreController'; import BackupAndRestoreScreen from '../backupAndRestore/BackupAndRestoreScreen'; +import testIDProps from '../../shared/commonUtil'; export const DataBackupAndRestore: React.FC = ({} = () => { const controller = useBackupAndRestore(); @@ -25,12 +26,14 @@ export const DataBackupAndRestore: React.FC = ({} = () => { {t('dataBackupAndRestore')} {t('new')} @@ -41,6 +44,7 @@ export const DataBackupAndRestore: React.FC = ({} = () => { diff --git a/screens/backupAndRestore/AccountSelectionConfirmation.tsx b/screens/backupAndRestore/AccountSelectionConfirmation.tsx index ff1bc1db..c1daaa02 100644 --- a/screens/backupAndRestore/AccountSelectionConfirmation.tsx +++ b/screens/backupAndRestore/AccountSelectionConfirmation.tsx @@ -30,12 +30,14 @@ export const AccountSelectionConfirmation: React.FC< + style={Theme.BackupAndRestoreStyles.backupProcessInfo} + testID="backupProcessInfo"> {t('backupProcessInfo')} {t('cloudInfo')} @@ -47,15 +49,27 @@ export const AccountSelectionConfirmation: React.FC< style={{paddingHorizontal: 120, paddingVertical: 50}}> {SvgImage.GoogleDriveIcon(45, 45)} - + {t('googleDriveTitle')} -