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

[INJIMOB-2943] add testId for intro-slider screens and refactor to improve readability #1804

Merged
merged 1 commit into from
Feb 19, 2025
Merged
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
35 changes: 18 additions & 17 deletions screens/IntroSliders/backupRestoreIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { BackButton } from '../../components/ui/backButton/BackButton';
import { HelpScreen } from '../../components/HelpScreen';
import LinearGradient from 'react-native-linear-gradient';
import { useTranslation } from 'react-i18next';
import { getAccountType, getDriveName } from '../../shared/commonUtil';
import { GMAIL, GOOGLE_DRIVE_NAME } from '../../shared/constants';

const StaticBackupAndRestoreScreen: React.FC = () => {
Expand All @@ -25,22 +24,20 @@ const StaticBackupAndRestoreScreen: React.FC = () => {
};

return (
<View
style={Theme.IntroSliderStyles.backupRestoreIntroOuterView}>
<View style={Theme.IntroSliderStyles.backupRestoreIntroOuterView}>
<View style={Theme.IntroSliderStyles.introScreenNotch}></View>
<View
style={Theme.IntroSliderStyles.backupRestoreIntroScaleStyle}>
<View
style={Theme.IntroSliderStyles.backupRestoreIntroView}>
<View style={Theme.IntroSliderStyles.backupRestoreIntroScaleStyle}>
<View style={Theme.IntroSliderStyles.backupRestoreIntroView}>
<TouchableOpacity onPress={() => { }}>
<BackButton onPress={() => { }} />
</TouchableOpacity>
<Text
weight='bold'
weight="bold"
style={{
fontSize: 16,
color: Theme.Colors.blackIcon,
}}>
}}
testID="screenTitle">
{t('title')}
</Text>
<TouchableOpacity onPress={() => { }}>
Expand All @@ -63,7 +60,9 @@ const StaticBackupAndRestoreScreen: React.FC = () => {
</Text>
</Row>
</View>
</LinearGradient>} />
</LinearGradient>
}
/>
</TouchableOpacity>
</View>
<ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={{ paddingBottom: 16 }}>
Expand All @@ -74,23 +73,25 @@ const StaticBackupAndRestoreScreen: React.FC = () => {
<Row>
<Column>{SvgImage.backUpAndRestoreIcon(34, 24)}</Column>
<Column margin="0 0 0 9">
<Text>
<Text testID="backupCreationTime">
{lastBackupDetails.backupCreationTime}
</Text>
<Text color='grey'>{t('size')} {lastBackupDetails.backupFileSize} MB</Text>
<Text color="grey" testID="backupFileSize">
{t('size')} {lastBackupDetails.backupFileSize} MB
</Text>
</Column>
</Row>
<Row style={{ marginTop: 16 }}>
<Button title={t("backup")} type="gradient" onPress={() => { }} />
<Button title={t('backup')} type="gradient" onPress={() => { }} />
</Row>
</SectionLayout>
<SectionLayout
testId="AccountSection"
headerText={t("driveSettings")}
headerText={t('driveSettings')}
headerIcon={SvgImage.GoogleDriveIconSmall(28, 25)}>
<View style={{ marginBottom: 19 }}>
<Text
testID="storageInfo"
testID="storageInfoText"
style={Theme.BackupAndRestoreStyles.backupProgressText}>
{t('storage', {
driveName: GOOGLE_DRIVE_NAME,
Expand All @@ -102,13 +103,13 @@ const StaticBackupAndRestoreScreen: React.FC = () => {
</SectionLayout>
<SectionLayout
testId="RestoreSection"
headerText={t("restore")}
headerText={t('restore')}
headerIcon={SvgImage.restoreIcon()}>
<Row>
<View style={{ marginBottom: 19 }}>
<Text
style={Theme.BackupAndRestoreStyles.backupProgressText}
testID={'restoreInfo'}>
testID="restoreInfoText">
{t('restoreInfo', { driveName: GMAIL })}
</Text>
<Row style={{ marginTop: 16 }}>
Expand Down
23 changes: 16 additions & 7 deletions screens/IntroSliders/biometricIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ export const StaticAuthScreen: React.FC = () => {
backgroundColor={Theme.Colors.whiteBackgroundColor}
style={Theme.IntroSliderStyles.biometricIntroOuterColumn}
>
<View style={Theme.IntroSliderStyles.biometricIntroNotch}></View>
<ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={{ flexGrow: 1 }}>
<View
testID="notchView"
style={Theme.IntroSliderStyles.biometricIntroNotch}></View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ flexGrow: 1 }}>
<Column
align='space-between'
fill
Expand All @@ -30,7 +34,7 @@ export const StaticAuthScreen: React.FC = () => {
{SvgImage.fingerprintIcon(66)}
<Column margin="30 0 0 0">
<Text
testID="selectAppUnlockMethod"
testID="header"
style={Theme.TextStyles.header}
align="center">
{t('header')}
Expand All @@ -53,24 +57,29 @@ export const StaticAuthScreen: React.FC = () => {
</Text>
</Column>
</Column>
<View style={{ height: 100 }}></View>
<View
testID="spacerView"
style={{ height: 100 }}></View>
<Column>
<Button
testID="useBiometricsButton"
title={t('useBiometrics')}
type="gradient"
margin="0 0 8 0"
onPress={() => { }}
/>
<Button
testID="usePasscode"
testID="usePasscodeButton"
type="clear"
title={t('usePasscode')}
disabled={false}
onPress={() => { }}
/>
</Column>
{/* height increased to enable forxce scroll */}
<View style={{ height: 200 }}></View>
{/* height increased to enable force scroll */}
<View
testID="footerSpacerView"
style={{ height: 200 }}></View>
</Column>
</ScrollView>
</Column>
Expand Down
7 changes: 6 additions & 1 deletion screens/IntroSliders/quickAccessIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ const QRScannerComponent: React.FC = () => (
<Column crossAlign="center">
<Column style={Theme.CameraEnabledStyles.scannerContainer}>
<View
testID="qrScannerView"
style={[
Theme.CameraEnabledStyles.scannerContainer,
Theme.IntroSliderStyles.quickAccessIntroQrScanner,
]}
>
<Image
testID="qrScannerImage"
source={require('../../assets/ClipPathGroup.png')}
style={{
width: '100%',
Expand All @@ -24,7 +26,7 @@ const QRScannerComponent: React.FC = () => (
</View>
<Column fill align="flex-start" style={{ marginTop: 24 }}>
<Text
testID="holdPhoneSteadyMessage"
testID="scanningGuideText"
align="center"
style={Theme.CameraEnabledStyles.holdPhoneSteadyText}
>
Expand All @@ -40,9 +42,11 @@ export const StaticScanScreen: React.FC = () => {

return (
<View
testID="staticScanScreen"
style={Theme.IntroSliderStyles.quickAccessIntroOuterView}
>
<View
testID="introScreenNotch"
style={Theme.IntroSliderStyles.introScreenNotch}
/>
<Column
Expand All @@ -55,6 +59,7 @@ export const StaticScanScreen: React.FC = () => {
backgroundColor={Theme.Colors.whiteBackgroundColor}
>
<Text
testID="shareText"
align="left"
style={{ paddingBottom: 10, paddingLeft: 5 , paddingTop: 10}}
weight="bold"
Expand Down
117 changes: 79 additions & 38 deletions screens/IntroSliders/secureShareIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ export const StaticSendVcScreen: React.FC = () => {
const handleReject = () => { };

return (
<Column fill backgroundColor={Theme.Colors.lightGreyBackgroundColor} style={Theme.IntroSliderStyles.secureShareIntroOuterColumn}>
<View style={Theme.IntroSliderStyles.introScreenNotch}></View>
<Column
testID="sendVcScreen"
fill
backgroundColor={Theme.Colors.lightGreyBackgroundColor}
style={Theme.IntroSliderStyles.secureShareIntroOuterColumn}>
<View
testID="introScreenNotch"
style={Theme.IntroSliderStyles.introScreenNotch}></View>
<Row
align="space-between"
style={{
Expand All @@ -35,12 +41,18 @@ export const StaticSendVcScreen: React.FC = () => {
borderBottomWidth: 1,
borderBottomColor: Theme.Colors.lightGreyBackgroundColor,
}}>
<Text weight='bold' size="large">
<Text
testID="introTitle"
weight="bold"
size="large">
{t("SendVcScreen:introTitle")}
</Text>
</Row>
<Row style={{ paddingHorizontal: 16 }}>
<Text color={Theme.Colors.GrayText} size="extraSmall">
<Text
testID="issuerName"
color={Theme.Colors.GrayText}
size="extraSmall">
Philippines Government
</Text>
</Row>
Expand All @@ -53,55 +65,81 @@ export const StaticSendVcScreen: React.FC = () => {
justifyContent: 'center',
backgroundColor: '#FFF2D6',
}}>
<Text color='#8B6105' size='small'>
<Text
testID="requestMessage"
color="#8B6105"
size="small">
{'<Philippines Govt.>'} {t('SendVcScreen:requestMessage')}
{'<Self-Authentication>'}.
</Text>
</Column>
<Text
testID="pleaseSelectAnId"
margin="0 0 8 16"
weight="bold"
color={Theme.Colors.textValue}
style={{ position: 'relative' }}>
{t("SendVcScreen:pleaseSelectAnId")}
</Text>
<Row align="space-between" style={{ paddingHorizontal: 16 }}>
<Text margin={"3 0 10 0"}>2 {t('SendVPScreen:cardsSelected')}</Text>
<Text color={Theme.Colors.GradientColors[1]}>{t('SendVPScreen:unCheck')}</Text>
<Text
testID="cardsSelected"
margin={"3 0 10 0"}>
2 {t('SendVPScreen:cardsSelected')}
</Text>
<Text
testID="uncheckText"
color={Theme.Colors.GradientColors[1]}>
{t('SendVPScreen:unCheck')}
</Text>
</Row>
<Column scroll>
{staticCards.map(card => (
<LinearGradient colors={Theme.Colors.GradientColorsLight} start={Theme.LinearGradientDirection.start} end={Theme.LinearGradientDirection.end}><Row
key={card.id}
style={{
alignItems: 'center',
padding: 16,
borderBottomWidth: 1,
borderBottomColor: Theme.Colors.lightGreyBackgroundColor,
backgroundColor: card.selected
? Theme.Colors.GradientColorsLight[0]
: Theme.Colors.whiteBackgroundColor,
}}>
<Column style={{ marginLeft: 5, flex: 1 }}>
<Row crossAlign='center'>
<View style={{ paddingRight: 10 }}>
{card.selected ? SvgImage.CheckedIcon() : SvgImage.UnCheckedIcon()}
</View>
<Image style={{ height: 40, width: 40, marginRight: 10 }} source={card.face} />
<Column>
<Text weight='bold'>{card.name}</Text>
<Text
size='extraSmall'
style={{
color: Theme.Colors.blackIcon,
}}>
{t("VcDetails:" + card.status)}
</Text>
</Column>
</Row>
</Column>
{SvgImage.walletActivatedIcon()}
</Row></LinearGradient>
<LinearGradient
key={card.id}
colors={Theme.Colors.GradientColorsLight}
start={Theme.LinearGradientDirection.start}
end={Theme.LinearGradientDirection.end}>
<Row
testID={`cardRow-${card.id}`}
style={{
alignItems: 'center',
padding: 16,
borderBottomWidth: 1,
borderBottomColor: Theme.Colors.lightGreyBackgroundColor,
backgroundColor: card.selected
? Theme.Colors.GradientColorsLight[0]
: Theme.Colors.whiteBackgroundColor,
}}>
<Column style={{ marginLeft: 5, flex: 1 }}>
<Row crossAlign="center">
<View style={{ paddingRight: 10 }}>
{card.selected ? SvgImage.CheckedIcon() : SvgImage.UnCheckedIcon()}
</View>
<Image
testID={`cardFace-${card.id}`}
style={{ height: 40, width: 40, marginRight: 10 }}
source={card.face} />
<Column>
<Text
testID={`cardName-${card.id}`}
weight="bold">
{card.name}
</Text>
<Text
testID={`cardStatus-${card.id}`}
size="extraSmall"
style={{
color: Theme.Colors.blackIcon,
}}>
{t("VcDetails:" + card.status)}
</Text>
</Column>
</Row>
</Column>
{SvgImage.walletActivatedIcon()}
</Row>
</LinearGradient>
))}
</Column>
<Column
Expand All @@ -110,18 +148,21 @@ export const StaticSendVcScreen: React.FC = () => {
backgroundColor: Theme.Colors.whiteBackgroundColor,
}}>
<Button
testID="shareButton"
type="gradient"
title="Share"
styles={{ marginVertical: 8 }}
onPress={handleShare}
/>
<Button
testID="shareWithSelfieButton"
type="gradient"
title="Share with Selfie"
styles={{ marginVertical: 8 }}
onPress={handleShareWithSelfie}
/>
<Button
testID="rejectButton"
type="clear"
title="Reject"
onPress={handleReject}
Expand Down
Loading