Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into inji-449-fix-vul…
Browse files Browse the repository at this point in the history
…nerabilities

Signed-off-by: Kiruthika Jeyashankar <[email protected]>
  • Loading branch information
KiruthikaJeyashankar committed Nov 20, 2023
2 parents 0a0f47a + 46aa759 commit 98d3b39
Show file tree
Hide file tree
Showing 40 changed files with 753 additions and 378 deletions.
8 changes: 6 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fileignoreconfig:
- filename: package.json
checksum: a5a22604f2b9d917adaf3561fdcaeccd4e69b92e1240070480d7498e1eda5162
- filename: package-lock.json
checksum: 910a3751a562d84a05a343bb4cc0f1639efb9ce7ae8dffbc662981fca3aa0d25
checksum: 30d7382d644494812081e7902d619a38ca97ef86fb06dcac494b1d601e414228
- filename: components/PasscodeVerify.tsx
checksum: 14654c0f038979fcd0d260170a45894a072f81e0767ca9a0e66935d33b5cc703
- filename: i18n.ts
Expand All @@ -24,7 +24,11 @@ fileignoreconfig:
- filename: screens/Home/IntroSlidersScreen.tsx
checksum: 9ff212530850e9f921f91d406c01f67ea5dd2a44e9cdb5e63d977749c7a7c5bd
- filename: machines/store.ts
checksum: fda6511ab88566820cf6b7324178b4646f495fae5168af73a0fb1c3bb52e5b8d
checksum: fda6511ab88566820cf6b7324178b4646f495fae5168af73a0fb1c3bb52e5b8d
- filename: machines/issuersMachine.ts
checksum: 37805c0e32765ed07ab54df230d6045679a0f5415eacdac3385fc27e9b298504
- filename: machines/issuersMachine.typegen.ts
checksum: 35e8bfe7945b963edceb9b33532cbaf2ee8cb93356dda526e48f2a1e4efec865
- filename: screens/Home/MyVcs/IdInputModal.tsx
checksum: 6f21b2caf20ee1821b69e178a69e755e0b1094275e4a9f9cb4ae5ab515ce5d23
- filename: screens/WelcomeScreenController.ts
Expand Down
11 changes: 4 additions & 7 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plugins {
plugins {
id 'com.gladed.androidgitversion' version '0.4.14'
}

Expand Down Expand Up @@ -105,9 +105,6 @@ android {
}


namespace 'io.mosip.residentapp'


namespace 'io.mosip.residentapp'

defaultConfig {
Expand All @@ -134,7 +131,7 @@ android {
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}

signingConfigs {
release {
def keystore = file('release.keystore')
Expand Down Expand Up @@ -236,7 +233,7 @@ dependencies {
implementation 'com.facebook.fresco:animated-webp:2.0.0'
}
}

compileOnly project(':react-native-android-location-services-dialog-box')
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
Expand All @@ -256,4 +253,4 @@ dependencies {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "./eas-build.gradle"
apply from: "./eas-build.gradle"
3 changes: 0 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Expand Down
5 changes: 3 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ rootProject.name = 'Inji'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/react-native-gradle-plugin')

include ':react-native-android-location-services-dialog-box'
project(':react-native-android-location-services-dialog-box').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-location-services-dialog-box/android')
apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
useExpoModules()
12 changes: 12 additions & 0 deletions components/PasscodeVerify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import {useTranslation} from 'react-i18next';
import {PinInput} from './PinInput';
import {hashData} from '../shared/commonUtil';
import {argon2iConfig} from '../shared/constants';
import {
getErrorEventData,
sendErrorEvent,
} from '../shared/telemetry/TelemetryUtils';
import {TelemetryConstants} from '../shared/telemetry/TelemetryConstants';

export const MAX_PIN = 6;

Expand Down Expand Up @@ -32,6 +37,13 @@ export const PasscodeVerify: React.FC<PasscodeVerifyProps> = props => {
}
}
} catch (error) {
sendErrorEvent(
getErrorEventData(
TelemetryConstants.FlowType.appLogin,
TelemetryConstants.ErrorId.mismatch,
error,
),
);
console.log('error:', error);
}
}
Expand Down
31 changes: 30 additions & 1 deletion components/ui/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,33 @@ export const Loader: React.FC<LoaderProps> = props => {
/>
</View>
</Column>
{(props.isHintVisible || props.isBleErrorVisible) && (
<Column style={Theme.SelectVcOverlayStyles.timeoutHintContainer}>
<Text
align="center"
margin="10"
color={Theme.Colors.TimoutHintText}
size="small"
style={Theme.TextStyles.bold}>
{props.hint}
</Text>
{props.onStayInProgress && (
<Button
type="clear"
title={t('status.stayOnTheScreen')}
onPress={props.onStayInProgress}
/>
)}

{props.onRetry && (
<Button
type="clear"
title={t('status.retry')}
onPress={props.onRetry}
/>
)}
</Column>
)}
<Column style={{display: props.hint ? 'flex' : 'none'}}>
<Column style={Theme.SelectVcOverlayStyles.timeoutHintContainer}>
<Text
Expand All @@ -88,12 +114,15 @@ export const Loader: React.FC<LoaderProps> = props => {
};

export interface LoaderProps {
isVisible: boolean;
title: string;
subTitle?: string;
label?: string;
hint?: string;
onStayInProgress?: () => void;
isHintVisible?: boolean;
isBleErrorVisible?: boolean;
onCancel?: () => void;
onRetry?: () => void;
requester?: boolean;
progress?: boolean | number;
onBackdropPress?: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import io.appium.java_client.pagefactory.iOSXCUITFindBy;
import org.openqa.selenium.WebElement;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;

public class SettingsPage extends BasePage {

@AndroidFindBy(accessibility = "settingsScreen")
Expand All @@ -27,6 +33,21 @@ public class SettingsPage extends BasePage {
@iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeStaticText[`label == \"Wika\"`]")
private WebElement wikaButton;

@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"listItemTitle\")")
private List<WebElement> languages;

@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"aboutInji\")")
private WebElement aboutInji;

@AndroidFindBy(xpath = "//*[contains(@text,'Tuvali-version: v')]")
private WebElement tuvaliVersion;

@AndroidFindBy(accessibility = "injiTourGuide")
private WebElement injiTourGuide;

@AndroidFindBy(accessibility = "receivedCards")
private WebElement receivedCards;

public SettingsPage(AppiumDriver driver) {
super(driver);
}
Expand All @@ -53,4 +74,31 @@ public boolean verifyFilipinoLanguage() {
return this.isElementDisplayed(wikaButton, "Filipino language");
}

public boolean verifyLanguagesInLanguageFilter() {
List<String> expectedLanguages = Arrays.asList("English", "Filipino", "عربى", "हिंदी", "ಕನ್ನಡ", "தமிழ்");

List<String> actualLanguages = languages.stream()
.map(WebElement::getText)
.collect(Collectors.toList());

return new HashSet<>(expectedLanguages).equals(new HashSet<>(actualLanguages));
}

public SettingsPage clickOnAboutInji(){
clickOnElement(aboutInji);
return this;
}

public boolean isTuvaliVersionPresent() {
return this.isElementDisplayed(tuvaliVersion, "Tuvali-version");
}

public void clickOnInjiTourGuide(){
clickOnElement(injiTourGuide);
}

public boolean isReceivedCardsPresent() {
return this.isElementDisplayed(receivedCards, "Received Cards");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,58 @@ public void changeLanguage() {

assertTrue(settingsPage.verifyFilipinoLanguage(), "Verify if language is changed to filipino");
}

@Test
public void languageShouldBeInNativeLanguages() {
ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver);

assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed");
WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference();

assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded");
AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton();

assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed");
SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode();

assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed");
ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target);

assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed");
HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target);

assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed");
SettingsPage settingsPage = homePage.clickOnSettingIcon();

assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed");
settingsPage.clickOnLanguage();

assertTrue(settingsPage.verifyLanguagesInLanguageFilter(), "Verify if all languages are shown in language filter");
}

@Test
public void verifyTuvaliVersion() {
ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver);

assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed");
WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference();

assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded");
AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton();

assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed");
SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode();

assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed");
ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target);

assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed");
HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target);

assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed");
SettingsPage settingsPage = homePage.clickOnSettingIcon();

assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed");
assertTrue(settingsPage.clickOnAboutInji().isTuvaliVersionPresent());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,34 @@ public void activateVcWithoutInternet() throws InterruptedException {
CommonMethods.disableAirplaneMode();

}

@Test
public void verifyListOfLanguagesInOfflineMode() {
CommonMethods.enableAirplaneMode();
ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver);

assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed");
WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference();

assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded");
AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton();

assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed");
SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode();

assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed");
ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target);

assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed");
HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target);

assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed");
SettingsPage settingsPage = homePage.clickOnSettingIcon();

assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed");
settingsPage.clickOnLanguage();

assertTrue(settingsPage.verifyLanguagesInLanguageFilter(), "Verify if all languages are shown in language filter");
CommonMethods.disableAirplaneMode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,31 @@ public void noCardsAvailableToShare() {
ScanPage scanPage = homePage.clickOnScanButton();
assertTrue(scanPage.isNoShareableCardsMessageDisplayed(), "Verify if no shareable cards are available message is displayed");
}

@Test
public void verifyReceivedCardTabPresent() {
ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver);

assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed");
WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference();

assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded");
AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton();

assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed");
SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode();

assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed");
ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target);

assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed");
HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target);

assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed");
SettingsPage settingsPage = homePage.clickOnSettingIcon();

assertTrue(settingsPage.isSettingPageLoaded(), "Verify if setting page is displayed");
assertTrue(settingsPage.isReceivedCardsPresent(), "Verify if received cards tab is displayed");

}
}
Loading

0 comments on commit 98d3b39

Please sign in to comment.