diff --git a/ui-test/src/main/java/regclient/androidTestCases/BiometricCorrection.java b/ui-test/src/main/java/regclient/androidTestCases/BiometricCorrection.java index e2d178fc8..319fc66a7 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/BiometricCorrection.java +++ b/ui-test/src/main/java/regclient/androidTestCases/BiometricCorrection.java @@ -160,6 +160,7 @@ public void adultBiometricCorrection() throws InterruptedException { // Navigate to mocksbi page MockSBIPage mockSBIPage = new MockSBIPage(driver); mockSBIPage.switchToMockSBI(); + mockSBIPage.clickOnMockSbiSettingsButton(); mockSBIPage.setAllModalityLowScore(); mockSBIPage.switchBackToArcApp(); @@ -437,6 +438,7 @@ public void adultBiometricCorrection() throws InterruptedException { assertTrue(previewPage.isNewRegistrationTitleDisplayed(), "Verify if new Registration title is displayed"); // assertTrue(previewPage.isApplicationIDPreviewPagePageDisplayed(), // "Verify if application ID In PreviewPage is displayed"); + assertTrue(previewPage.isDemographicInformationInPreviewPageDisplayed(), "Verify if Demographic Information In PreviewPage is displayed"); assertTrue(previewPage.isDocumentsInformationInPreviewPageDisplayed(), @@ -993,6 +995,7 @@ public void minorBiometricCorrection() throws InterruptedException { // Navigate to mocksbi page MockSBIPage mockSBIPage = new MockSBIPage(driver); mockSBIPage.switchToMockSBI(); + mockSBIPage.clickOnMockSbiSettingsButton(); mockSBIPage.setAllModalityLowScore(); mockSBIPage.switchBackToArcApp(); @@ -1247,6 +1250,7 @@ public void minorBiometricCorrection() throws InterruptedException { "Verify if biometric details page is displayed"); // Return to mocksbi page mockSBIPage.switchToMockSBI(); + mockSBIPage.clickOnMockSbiSettingsButton(); mockSBIPage.setAllModalityHighScore(); mockSBIPage.switchBackToArcApp(); @@ -1504,7 +1508,7 @@ public void minorBiometricCorrection() throws InterruptedException { // Biometric correction packet process // Reset biometric capabilities back to individual biometrics for correction flow - FetchUiSpec.getBiometricDetails("individualBiometrics"); + assertTrue(registrationTasksPage.isOperationalTaskDisplayed(), "Verify if operation tasks page is loaded"); registrationTasksPage.clickOnRegistrationTasksTab(); @@ -1838,6 +1842,26 @@ public void minorBiometricCorrection() throws InterruptedException { break; } manageApplicationsPage.clickOnBackButton(); + registrationTasksPage.clickProfileButton(); + + if ("eng".equalsIgnoreCase(language)) { + profilePage = new ProfilePageEnglish(driver); + } else if ("hin".equalsIgnoreCase(language)) { + profilePage = new ProfilePageHindi(driver); + } else if ("fra".equalsIgnoreCase(language)) { + profilePage = new ProfilePageFrench(driver); + } else if ("kan".equalsIgnoreCase(language)) { + profilePage = new ProfilePageKannada(driver); + } else if ("tam".equalsIgnoreCase(language)) { + profilePage = new ProfilePageTamil(driver); + } else if ("ara".equalsIgnoreCase(language)) { + profilePage = new ProfilePageArabic(driver); + } else { + throw new IllegalStateException("Unsupported language in testdata.json: " + language); + } + profilePage.clickOnLogoutButton(); + assertTrue(loginPage.isLoginPageLoaded(), "verify if login page is displayeded in Selected language"); + } diff --git a/ui-test/src/main/java/regclient/androidTestCases/logintest.java b/ui-test/src/main/java/regclient/androidTestCases/LoginTest.java similarity index 92% rename from ui-test/src/main/java/regclient/androidTestCases/logintest.java rename to ui-test/src/main/java/regclient/androidTestCases/LoginTest.java index 9de86ffac..0e418c8fd 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/logintest.java +++ b/ui-test/src/main/java/regclient/androidTestCases/LoginTest.java @@ -3,6 +3,10 @@ import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; +import java.time.Duration; + +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.Test; import regclient.BaseTest.AndroidBaseTest; @@ -70,7 +74,7 @@ import regclient.utils.TestDataReader; @Test -public class Logintest extends AndroidBaseTest { +public class LoginTest extends AndroidBaseTest { @Test(priority = 0, description = "Verify user login with valid credentials") public void userloginTest() { @@ -123,9 +127,10 @@ public void userloginTest() { loginPage.enterPassword(ArcConfigManager.getIAMUsersPassword() + "123"); assertTrue(loginPage.isLoginButtonEnabled(), "Verify if the login button enabled"); - loginPage.clickOnloginButton(); - assertTrue(loginPage.isPasswordIncorrectErrorMessageDisplayed(), - "verify if error message should be displayeded as password incorrect!"); +// Password incorrect message currently removed from APK +// loginPage.clickOnloginButton(); +// assertTrue(loginPage.isPasswordIncorrectErrorMessageDisplayed(), +// "verify if error message should be displayeded as password incorrect!"); loginPage.clickOnBackButton(); assertTrue(loginPage.isUserNameHeaderDisplayed(), "Verify if the username input box header displayed"); @@ -294,22 +299,21 @@ public void onboardingTest() { onBoardPage.clickOnGetOnBoardTitle(); if ("eng".equalsIgnoreCase(language)) { - supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageEnglish(driver); + supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { - supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageHindi(driver); + supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageHindi(driver); } else if ("fra".equalsIgnoreCase(language)) { - supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageFrench(driver); + supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageFrench(driver); } else if ("kan".equalsIgnoreCase(language)) { - supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageKannada(driver); + supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageKannada(driver); } else if ("tam".equalsIgnoreCase(language)) { - supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageTamil(driver); + supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageTamil(driver); } else if ("ara".equalsIgnoreCase(language)) { - supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageArabic(driver); + supervisorBiometricVerificationpage = new SupervisorBiometricVerificationpageArabic(driver); } else { - throw new IllegalStateException("Unsupported language in testdata.json: " + language); + throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(supervisorBiometricVerificationpage.isSupervisorBiometricVerificationPageLoaded(), "Verify if operational tasks page is loaded"); @@ -430,10 +434,21 @@ public void onboardingTest() { "Verify if verify and save button is display and enable"); assertFalse(supervisorBiometricVerificationpage.isExceptionScanTitleDisplayed(), "Verify if exception scan icon is displayed"); - supervisorBiometricVerificationpage.clickOnVerifyAndSaveButton(); - assertTrue(supervisorBiometricVerificationpage.isDismissPageLoaded(), - "Verify if dismiss page is displayed after click on verfiy and save button"); + boolean isDismissLoaded = false; + + for (int i = 0; i < 3; i++) { + supervisorBiometricVerificationpage.clickOnVerifyAndSaveButton(); + + if (supervisorBiometricVerificationpage.isDismissPageLoaded()) { + isDismissLoaded = true; + break; + } + } + + if (!isDismissLoaded) { + System.out.println("INFO: Dismiss page not loaded after clicking Verify & Save 3 times"); + } assertTrue(supervisorBiometricVerificationpage.isOperatorOnboardedPopupLoaded(), "Verify if operator biometrics updated success message is displayed"); supervisorBiometricVerificationpage.clickOnHomeButton(); @@ -521,19 +536,19 @@ public void updateOperatorBiometrics() { operationalTaskPage.clickOnUpdateOperatorBiometricsButton(); if ("eng".equalsIgnoreCase(language)) { - UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageEnglish(driver); + UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { - UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageHindi(driver); + UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageHindi(driver); } else if ("fra".equalsIgnoreCase(language)) { - UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageFrench(driver); + UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageFrench(driver); } else if ("kan".equalsIgnoreCase(language)) { - UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageKannada(driver); + UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageKannada(driver); } else if ("tam".equalsIgnoreCase(language)) { - UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageTamil(driver); + UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageTamil(driver); } else if ("ara".equalsIgnoreCase(language)) { - UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageArabic(driver); + UpdateOperatorBiometricspage = new UpdateOperatorBiometricspageArabic(driver); } else { - throw new IllegalStateException("Unsupported language in testdata.json: " + language); + throw new IllegalStateException("Unsupported language in testdata.json: " + language); } assertTrue(UpdateOperatorBiometricspage.isUpdateOperatorBiometricsPageLoaded(), "Verify if update operator biometric page is loaded"); @@ -660,9 +675,22 @@ public void updateOperatorBiometrics() { assertTrue(UpdateOperatorBiometricspage.isVerifyAndSaveButtonEnabled(), "Verify if verify and save button is display and enable"); - - UpdateOperatorBiometricspage.updateBiometricsAndWaitPopup(); - + + boolean updateBiometricsAndWaitPopup = false; + + for (int i = 1; i <= 5; i++) { + UpdateOperatorBiometricspage.clickOnVerifyAndSaveButton(); + + if (UpdateOperatorBiometricspage.isOperatorBiometricsUpdatedPopupLoaded()) { + updateBiometricsAndWaitPopup = true; + break; // success + } + + BasePage.waitTime(10); + } + + assertTrue(updateBiometricsAndWaitPopup, "Biometrics update success popup not displayed after 5 retries."); + UpdateOperatorBiometricspage.clickOnHomeButton(); assertTrue(operationalTaskPage.isOperationalTaskPageLoaded(), "Verify if operational Task Page is loaded"); diff --git a/ui-test/src/main/java/regclient/androidTestCases/LostUin.java b/ui-test/src/main/java/regclient/androidTestCases/LostUin.java index fc8ee342f..6c15814d4 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/LostUin.java +++ b/ui-test/src/main/java/regclient/androidTestCases/LostUin.java @@ -523,10 +523,6 @@ public void lostUinAdult() { assertTrue(pendingApproval.isSupervisorAuthenticationTitleDisplayed(), "Verify if Supervisor Authentication page displayed"); - pendingApproval.clickOnSubmitButton(); - assertTrue(pendingApproval.isSubmitButtonEnabledWithEmptyUsername(), - "Verify if error empty username submit button enabled"); - pendingApproval.enterUserName(KeycloakUserManager.moduleSpecificUser + "123"); assertTrue(pendingApproval.isInvalidUsernameMessageDisplayed(), diff --git a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationAdult.java b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationAdult.java index 522b7bebd..f5c15e5ec 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationAdult.java +++ b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationAdult.java @@ -123,7 +123,6 @@ import regclient.pages.tamil.RegistrationTasksPageTamil; import regclient.pages.tamil.SelectLanguagePageTamil; import regclient.utils.TestDataReader; -import io.appium.java_client.android.AndroidDriver; public class NewRegistrationAdult extends AndroidBaseTest { @@ -432,9 +431,9 @@ public void newRegistrationAdult() throws InterruptedException { "Verify if Demographic Information In PreviewPage is displayed"); assertTrue(previewPage.isDocumentsInformationInPreviewPageDisplayed(), "Verify if Documents Information In PreviewPage is displayed"); -// assertTrue(previewPage.isBiometricsInformationInPreviewPagePageDisplayed(),"Verify if Biometrics Information In PreviewPage is displayed"); + assertTrue(previewPage.isBiometricsInformationInPreviewPagePageDisplayed(), + "Verify if Biometrics Information In PreviewPage is displayed"); String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -450,8 +449,20 @@ public void newRegistrationAdult() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); + authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -531,20 +542,18 @@ public void newRegistrationAdult() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; } } + assertTrue(isPageDisplayed, "Supervisor Authentication page not displayed after retries"); - pendingApproval.clickOnSubmitButton(); - assertTrue(pendingApproval.isSubmitButtonEnabledWithEmptyUsername(), - "Verify if error empty username submit button enabled"); - pendingApproval.enterUserName(KeycloakUserManager.moduleSpecificUser + "123"); assertTrue(pendingApproval.isInvalidUsernameMessageDisplayed(), @@ -585,17 +594,46 @@ public void newRegistrationAdult() throws InterruptedException { assertTrue(manageApplicationsPage.isPacketApproved(Aid), "Verify if Filtre packet is approved "); manageApplicationsPage.clickOnSearchCheckBox(); + + boolean uploadSuccess = false; + for (int i = 0; i < 3; i++) { - manageApplicationsPage.clickOnUploadButton(); - Thread.sleep(2000); - if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) - break; + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); + manageApplicationsPage.clickOnBackButton(); + registrationTasksPage.clickProfileButton(); + + if ("eng".equalsIgnoreCase(language)) { + profilePage = new ProfilePageEnglish(driver); + } else if ("hin".equalsIgnoreCase(language)) { + profilePage = new ProfilePageHindi(driver); + } else if ("fra".equalsIgnoreCase(language)) { + profilePage = new ProfilePageFrench(driver); + } else if ("kan".equalsIgnoreCase(language)) { + profilePage = new ProfilePageKannada(driver); + } else if ("tam".equalsIgnoreCase(language)) { + profilePage = new ProfilePageTamil(driver); + } else if ("ara".equalsIgnoreCase(language)) { + profilePage = new ProfilePageArabic(driver); + } else { + throw new IllegalStateException("Unsupported language in testdata.json: " + language); + } + + profilePage.clickOnLogoutButton(); + assertTrue(loginPage.isLoginPageLoaded(), "verify if login page is displayeded in Selected language"); + } - @Test(priority = 1, description = "Verify adult new registration") +// @Test(priority = 1, description = "Verify adult new registration") public void newRegistrationAdultUploadMultipleDoccuments() throws InterruptedException { BasePage.disableAutoRotation(); FetchUiSpec.getUiSpec("newProcess"); @@ -1144,7 +1182,7 @@ public void newRegistrationAdultUploadMultipleDoccuments() throws InterruptedExc "Verify if Biometrics Information In PreviewPage is displayed"); String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); + if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -1160,8 +1198,19 @@ public void newRegistrationAdultUploadMultipleDoccuments() throws InterruptedExc } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); @@ -1236,18 +1285,17 @@ public void newRegistrationAdultUploadMultipleDoccuments() throws InterruptedExc "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; } } - assertTrue(isPageDisplayed, "Supervisor Authentication page not displayed after retries"); - assertTrue(pendingApproval.isSupervisorAuthenticationTitleDisplayed(), - "Verify if error empty username submit button enabled"); + assertTrue(isPageDisplayed, "Supervisor Authentication page not displayed after retries"); pendingApproval.enterUserName(KeycloakUserManager.moduleSpecificUser); pendingApproval.enterPassword(ArcConfigManager.getIAMUsersPassword()); @@ -1277,7 +1325,40 @@ public void newRegistrationAdultUploadMultipleDoccuments() throws InterruptedExc assertTrue(manageApplicationsPage.isSearchAIDDisplayed(Aid), "Verify if Search Aid should displayed"); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); + + manageApplicationsPage.clickOnBackButton(); + + registrationTasksPage.clickProfileButton(); + + if ("eng".equalsIgnoreCase(language)) { + profilePage = new ProfilePageEnglish(driver); + } else if ("hin".equalsIgnoreCase(language)) { + profilePage = new ProfilePageHindi(driver); + } else if ("fra".equalsIgnoreCase(language)) { + profilePage = new ProfilePageFrench(driver); + } else if ("kan".equalsIgnoreCase(language)) { + profilePage = new ProfilePageKannada(driver); + } else if ("tam".equalsIgnoreCase(language)) { + profilePage = new ProfilePageTamil(driver); + } else if ("ara".equalsIgnoreCase(language)) { + profilePage = new ProfilePageArabic(driver); + } else { + throw new IllegalStateException("Unsupported language in testdata.json: " + language); + } + profilePage.clickOnLogoutButton(); + assertTrue(loginPage.isLoginPageLoaded(), "verify if login page is displayeded in Selected language"); } diff --git a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationAdultException.java b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationAdultException.java index ec656db64..4ee2ababa 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationAdultException.java +++ b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationAdultException.java @@ -311,11 +311,6 @@ public void newRegistrationAdultException() throws InterruptedException { assertTrue(applicantBiometricsPage.isExceptionCountDisplayed(), "Verify if exception count is displayed"); - // applicantBiometricsPage.clickOnExceptionTypeTemporaryButton(); - // - // assertTrue(applicantBiometricsPage.isCommentHeaderDisplyed(),"Verify if - // Comments header is displayed"); - // applicantBiometricsPage.enterCommentsInTextBox(TestDataReader.readData("comments")); applicantBiometricsPage.clickOnIrisScanTitle(); applicantBiometricsPage.clickOnScanButton(); @@ -370,13 +365,6 @@ public void newRegistrationAdultException() throws InterruptedException { assertTrue(applicantBiometricsPage.isExceptionTypeTitleDisplayed(), "Verify if applicant biometric mark exception type is displayed"); - // assertTrue(applicantBiometricsPage.isExceptionCountDisplyed(),"Verify if - // exception count is displayed"); - // applicantBiometricsPage.clickOnExceptionTypeTemporaryButton(); - // - // assertTrue(applicantBiometricsPage.isCommentHeaderDisplyed(),"Verify if - // Comments header is displayed"); - // applicantBiometricsPage.enterCommentsInTextBox(TestDataReader.readData("comments")); applicantBiometricsPage.clickOnleftHandScanTitle(); applicantBiometricsPage.clickOnScanButton(); @@ -405,11 +393,6 @@ public void newRegistrationAdultException() throws InterruptedException { assertTrue(applicantBiometricsPage.isExceptionCountDisplayed(), "Verify if exception count is displayed"); - // applicantBiometricsPage.clickOnExceptionTypeTemporaryButton(); - // - // assertTrue(applicantBiometricsPage.isCommentHeaderDisplyed(),"Verify if - // Comments header is displayed"); - // applicantBiometricsPage.enterCommentsInTextBox(TestDataReader.readData("comments")); applicantBiometricsPage.clickOnThumbsScanTitle(); applicantBiometricsPage.clickOnScanButton(); @@ -479,7 +462,6 @@ public void newRegistrationAdultException() throws InterruptedException { // assertTrue(previewPage.isFingerExceptionText(),"Verify if finger exception In // PreviewPage is displayed"); String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -495,8 +477,19 @@ public void newRegistrationAdultException() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -571,15 +564,17 @@ public void newRegistrationAdultException() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; } } - assertTrue(isPageDisplayed, "Verify if Supervisor Authentication page displayed after retries"); + + assertTrue(isPageDisplayed, "Supervisor Authentication page not displayed after retries"); pendingApproval.enterUserName(KeycloakUserManager.moduleSpecificUser); pendingApproval.enterPassword(ArcConfigManager.getIAMUsersPassword()); @@ -613,7 +608,20 @@ public void newRegistrationAdultException() throws InterruptedException { assertTrue(manageApplicationsPage.isPacketApproved(Aid), "Verify if packet is approved after approve in pending approval"); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); + manageApplicationsPage.clickOnBackButton(); @@ -635,8 +643,7 @@ public void newRegistrationAdultException() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - // assertTrue(profilePage.isProfileTitleDisplayed(),"Verify if profile title - // display on Profilepage"); + profilePage.clickOnLogoutButton(); assertTrue(loginPage.isLoginPageLoaded(), "verify if login page is displayed in Selected language"); diff --git a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationInfant.java b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationInfant.java index 160a7c7f7..e75074c77 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationInfant.java +++ b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationInfant.java @@ -417,7 +417,6 @@ public void newRegistrationInfant() throws InterruptedException { } String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -434,6 +433,19 @@ public void newRegistrationInfant() throws InterruptedException { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + assertTrue(isAuthenticationPageDisplayed, + "Authentication page not displayed after retries"); + authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -498,13 +510,14 @@ public void newRegistrationInfant() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { - pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); - if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { - isPageDisplayed = true; - break; - } + pendingApproval.clickOnAuthenticateButton(); + + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { + isPageDisplayed = true; + break; + } } assertTrue(isPageDisplayed, "Supervisor Authentication page not displayed after retries"); @@ -535,7 +548,18 @@ public void newRegistrationInfant() throws InterruptedException { manageApplicationsPage.enterAID(Aid); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); manageApplicationsPage.clickOnBackButton(); diff --git a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationMinor.java b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationMinor.java index b1935f574..958320a2a 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationMinor.java +++ b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationMinor.java @@ -460,7 +460,6 @@ public void newRegistrationMinor() throws InterruptedException { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -476,6 +475,20 @@ public void newRegistrationMinor() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + + assertTrue(isAuthenticationPageDisplayed, + "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -544,13 +557,14 @@ public void newRegistrationMinor() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { - pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); - if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { - isPageDisplayed = true; - break; - } + pendingApproval.clickOnAuthenticateButton(); + + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { + isPageDisplayed = true; + break; + } } assertTrue(isPageDisplayed, "Supervisor Authentication page not displayed after retries"); @@ -578,7 +592,18 @@ public void newRegistrationMinor() throws InterruptedException { manageApplicationsPage.enterAID(Aid); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); manageApplicationsPage.clickOnBackButton(); registrationTasksPage.clickProfileButton(); diff --git a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationMinorException.java b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationMinorException.java index d9df66ef2..7f5466630 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationMinorException.java +++ b/ui-test/src/main/java/regclient/androidTestCases/NewRegistrationMinorException.java @@ -1,7 +1,5 @@ package regclient.androidTestCases; -import static org.testng.Assert.assertFalse; - import static org.testng.Assert.assertTrue; import java.util.List; @@ -567,7 +565,6 @@ public void newRegistrationMinorException() throws InterruptedException { "Verify if Documents Information In PreviewPage is displayed"); // assertTrue(previewPage.isBiometricsInformationInPreviewPagePageDisplayed(),"Verify if Biometrics Information In PreviewPage is displayed"); String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -583,8 +580,20 @@ public void newRegistrationMinorException() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); + authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -656,16 +665,17 @@ public void newRegistrationMinorException() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { - pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); - if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { - isPageDisplayed = true; - break; - } + pendingApproval.clickOnAuthenticateButton(); + + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { + isPageDisplayed = true; + break; + } } - assertTrue(isPageDisplayed, "Verify if Supervisor Authentication page displayed after retries"); + assertTrue(isPageDisplayed, "Supervisor Authentication page not displayed after retries"); pendingApproval.enterUserName(KeycloakUserManager.moduleSpecificUser); pendingApproval.enterPassword(ArcConfigManager.getIAMUsersPassword()); pendingApproval.clickOnSubmitButton(); @@ -698,7 +708,18 @@ public void newRegistrationMinorException() throws InterruptedException { "Verify if packet is approved after approve in pending approval"); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); manageApplicationsPage.clickClientStatusDropdown(); diff --git a/ui-test/src/main/java/regclient/androidTestCases/PreRegFetchingPacket.java b/ui-test/src/main/java/regclient/androidTestCases/PreRegFetchingPacket.java index b37843846..36e79ae2a 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/PreRegFetchingPacket.java +++ b/ui-test/src/main/java/regclient/androidTestCases/PreRegFetchingPacket.java @@ -7,7 +7,6 @@ import org.testng.annotations.Test; import regclient.BaseTest.AndroidBaseTest; -import regclient.api.AdminTestUtil; import regclient.api.ArcConfigManager; import regclient.api.FetchUiSpec; import regclient.api.KeycloakUserManager; @@ -16,7 +15,6 @@ import regclient.page.AuthenticationPage; import regclient.page.BasePage; import regclient.page.BiometricDetailsPage; -import regclient.page.CameraPage; import regclient.page.ConsentPage; import regclient.page.DemographicDetailsPage; import regclient.page.DocumentUploadPage; @@ -429,7 +427,6 @@ public void adultPreRegFetching() throws InterruptedException { // previewPage.validatePreRegAndApplicationIdMatch("adult"); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -445,8 +442,18 @@ public void adultPreRegFetching() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -524,9 +531,10 @@ public void adultPreRegFetching() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; @@ -562,12 +570,19 @@ public void adultPreRegFetching() throws InterruptedException { "Verify if manage Applications Page displayed"); manageApplicationsPage.selectLatestAidCheckBox(); + boolean uploadSuccess = false; + for (int i = 0; i < 3; i++) { manageApplicationsPage.clickOnUploadButton(); - Thread.sleep(2000); - if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; break; + } } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); + manageApplicationsPage.clickOnBackButton(); assertTrue(registrationTasksPage.isProfileTitleDisplayed(), "Verify if profile title display on homepage"); @@ -591,7 +606,7 @@ public void adultPreRegFetching() throws InterruptedException { profilePage.clickOnLogoutButton(); assertTrue(loginPage.isLoginPageLoaded(), "verify if login page is displayeded in Selected language"); - + } @Test(priority = 1, description = "Verify minor pre-reg fetching registration") @@ -681,7 +696,7 @@ public void minorPreRegFetching() throws InterruptedException { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } assertTrue(selectLanguagePage.isSelectLanguagePageLoaded(), "Verify if select language page is loaded"); - + selectLanguagePage.selectSecondLanguage(); assertTrue(selectLanguagePage.isNotificationLanguageEnglishDisplayed(), @@ -985,8 +1000,7 @@ public void minorPreRegFetching() throws InterruptedException { // assertTrue(previewPage.isBiometricsInformationInPreviewPagePageDisplayed(),"Verify if Biometrics Information In PreviewPage is displayed"); String Aid = previewPage.getAID(); - - previewPage.clickOnContinueButton(); + if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -1002,8 +1016,18 @@ public void minorPreRegFetching() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -1081,9 +1105,10 @@ public void minorPreRegFetching() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; @@ -1121,9 +1146,10 @@ public void minorPreRegFetching() throws InterruptedException { manageApplicationsPage.selectLatestAidCheckBox(); for (int i = 0; i < 3; i++) { manageApplicationsPage.clickOnUploadButton(); - Thread.sleep(2000); - if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { break; + } } manageApplicationsPage.clickOnBackButton(); @@ -1148,7 +1174,7 @@ public void minorPreRegFetching() throws InterruptedException { profilePage.clickOnLogoutButton(); assertTrue(loginPage.isLoginPageLoaded(), "verify if login page is displayeded in Selected language"); - + } @Test(priority = 2, description = "Verify infant pre-reg fetching registration") @@ -1476,7 +1502,7 @@ public void infantPreRegFetching() throws InterruptedException { // assertTrue(previewPage.isBiometricsInformationInPreviewPagePageDisplayed(),"Verify if Biometrics Information In PreviewPage is displayed"); String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); + if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -1492,8 +1518,19 @@ public void infantPreRegFetching() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -1571,9 +1608,10 @@ public void infantPreRegFetching() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; @@ -1609,12 +1647,19 @@ public void infantPreRegFetching() throws InterruptedException { "Verify if manage Applications Page displayed"); manageApplicationsPage.selectLatestAidCheckBox(); + boolean uploadSuccess = false; + for (int i = 0; i < 3; i++) { manageApplicationsPage.clickOnUploadButton(); - Thread.sleep(2000); - if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; break; + } } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); + manageApplicationsPage.clickOnBackButton(); assertTrue(registrationTasksPage.isProfileTitleDisplayed(), "Verify if profile title display on homepage"); diff --git a/ui-test/src/main/java/regclient/androidTestCases/Settings.java b/ui-test/src/main/java/regclient/androidTestCases/Settings.java index a15757787..ed0678a9e 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/Settings.java +++ b/ui-test/src/main/java/regclient/androidTestCases/Settings.java @@ -159,7 +159,7 @@ public void settings() throws InterruptedException { MockSBIPage mockSBIPage = new MockSBIPage(driver); mockSBIPage.switchToMockSBI(); - + mockSBIPage.clickOnMockSbiSettingsButton(); mockSBIPage.setAllToNotReadyAndSave(); mockSBIPage.switchBackToArcApp(); @@ -173,7 +173,7 @@ public void settings() throws InterruptedException { settingsPage.clickOnGlobalConfigSettingsTab(); mockSBIPage.switchToMockSBI(); - + mockSBIPage.clickOnMockSbiSettingsButton(); mockSBIPage.setAllToReadyAndSave(); mockSBIPage.switchBackToArcApp(); diff --git a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUINUpdateDemographicDetails.java b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUINUpdateDemographicDetails.java index 4e2b6a57e..45c528634 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUINUpdateDemographicDetails.java +++ b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUINUpdateDemographicDetails.java @@ -1,6 +1,5 @@ package regclient.androidTestCases; -import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import java.util.List; @@ -388,8 +387,6 @@ public void updateMyUinUpdateDemographicDetails() throws InterruptedException { "Verify if Documents Information In PreviewPage is displayed"); // assertTrue(previewPage.isBiometricsInformationInPreviewPagePageDisplayed(),"Verify if Biometrics Information In PreviewPage is displayed"); String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); - if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -405,8 +402,17 @@ public void updateMyUinUpdateDemographicDetails() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -486,7 +492,7 @@ public void updateMyUinUpdateDemographicDetails() throws InterruptedException { boolean isPageDisplayed = false; for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; @@ -526,10 +532,19 @@ public void updateMyUinUpdateDemographicDetails() throws InterruptedException { "Verify if packet is approved after approve in pending approval"); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); - // assertTrue(manageApplicationsPage.isPacketUploadDone(Aid), "Verify if packet - // upload is done"); manageApplicationsPage.clickOnBackButton(); assertTrue(registrationTasksPage.isProfileTitleDisplayed(), "Verify if profile title display on homepage"); @@ -550,8 +565,7 @@ public void updateMyUinUpdateDemographicDetails() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - // assertTrue(profilePage.isProfileTitleDisplayed(),"Verify if profile title - // display on Profilepage"); + profilePage.clickOnLogoutButton(); assertTrue(loginPage.isLoginPageLoaded(), "verify if login page is displayeded in Selected language"); diff --git a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinInfant.java b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinInfant.java index c6bb23ff8..8087b7741 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinInfant.java +++ b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinInfant.java @@ -408,7 +408,6 @@ public void updateMyUinInfant() throws InterruptedException { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -424,6 +423,18 @@ public void updateMyUinInfant() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -491,9 +502,10 @@ public void updateMyUinInfant() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; @@ -526,7 +538,18 @@ public void updateMyUinInfant() throws InterruptedException { manageApplicationsPage.enterAID(Aid); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); manageApplicationsPage.clickOnBackButton(); diff --git a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinMinor.java b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinMinor.java index ec11ea6fb..28bdd5268 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinMinor.java +++ b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinMinor.java @@ -526,7 +526,6 @@ public void updateMyUinMinor() throws InterruptedException { "Verify if Documents Information In PreviewPage is displayed"); // assertTrue(previewPage.isBiometricsInformationInPreviewPagePageDisplayed(),"Verify if Biometrics Information In PreviewPage is displayed"); String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -542,8 +541,18 @@ public void updateMyUinMinor() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -620,16 +629,17 @@ public void updateMyUinMinor() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; } } - assertTrue(isPageDisplayed, "Verify if Supervisor Authentication page displayed after retries"); + assertTrue(isPageDisplayed, "Verify if Supervisor Authentication page not displayed after retries"); pendingApproval.enterUserName(KeycloakUserManager.moduleSpecificUser); pendingApproval.enterPassword(ArcConfigManager.getIAMUsersPassword()); pendingApproval.clickOnSubmitButton(); @@ -662,10 +672,19 @@ public void updateMyUinMinor() throws InterruptedException { "Verify if packet is approved after approve in pending approval"); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); - // assertTrue(manageApplicationsPage.isPacketUploadDone(Aid), "Verify if packet - // upload is done"); manageApplicationsPage.clickOnBackButton(); assertTrue(registrationTasksPage.isProfileTitleDisplayed(), "Verify if profile title display on homepage"); diff --git a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinUpdateBiometrics.java b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinUpdateBiometrics.java index 9b61574ff..60ac73830 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinUpdateBiometrics.java +++ b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinUpdateBiometrics.java @@ -148,6 +148,7 @@ public void updateMyUinUpdateBiometrics() throws InterruptedException { ProfilePage profilePage = null; UpdateUINPage updateUINPage = null; PendingApproval pendingApproval = null; + BasePage basePage = null; final String language = TestDataReader.readData("language"); @@ -409,7 +410,6 @@ public void updateMyUinUpdateBiometrics() throws InterruptedException { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -425,8 +425,19 @@ public void updateMyUinUpdateBiometrics() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); + authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -499,16 +510,17 @@ public void updateMyUinUpdateBiometrics() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; } } - assertTrue(isPageDisplayed, "Verify if Supervisor Authentication page displayed after retries"); + assertTrue(isPageDisplayed, "Verify if Supervisor Authentication page not displayed after retries"); pendingApproval.enterUserName(KeycloakUserManager.moduleSpecificUser); pendingApproval.enterPassword(ArcConfigManager.getIAMUsersPassword()); pendingApproval.clickOnSubmitButton(); @@ -537,7 +549,18 @@ public void updateMyUinUpdateBiometrics() throws InterruptedException { manageApplicationsPage.enterAID(Aid); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); manageApplicationsPage.clickOnBackButton(); diff --git a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinUpdateDocuments.java b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinUpdateDocuments.java index 978d614b4..746e772a0 100644 --- a/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinUpdateDocuments.java +++ b/ui-test/src/main/java/regclient/androidTestCases/UpdateMyUinUpdateDocuments.java @@ -385,7 +385,6 @@ public void updateMyUinUpdateDocuments() throws InterruptedException { assertTrue(previewPage.isBiometricsInformationInPreviewPagePageDisplayed(), "Verify if Biometrics Information In PreviewPage is displayed"); String Aid = previewPage.getAID(); - previewPage.clickOnContinueButton(); if ("eng".equalsIgnoreCase(language)) { authenticationPage = new AuthenticationPageEnglish(driver); } else if ("hin".equalsIgnoreCase(language)) { @@ -401,8 +400,18 @@ public void updateMyUinUpdateDocuments() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - assertTrue(authenticationPage.isAuthenticationPageDisplayed(), - "Verify if authentication details page is displayed"); + + boolean isAuthenticationPageDisplayed = false; + + for (int i = 0; i < 3; i++) { + previewPage.clickOnContinueButton(); + + if (authenticationPage.isAuthenticationPageDisplayed()) { + isAuthenticationPageDisplayed = true; + break; + } + } + assertTrue(isAuthenticationPageDisplayed, "Authentication page not displayed after retries"); authenticationPage.enterUserName(KeycloakUserManager.moduleSpecificUser); authenticationPage.enterPassword(ArcConfigManager.getIAMUsersPassword()); authenticationPage.clickOnAuthenticatenButton(); @@ -480,9 +489,10 @@ public void updateMyUinUpdateDocuments() throws InterruptedException { "Verify if authenticate button is enable after selecting packet"); boolean isPageDisplayed = false; + for (int i = 0; i < 3; i++) { pendingApproval.clickOnAuthenticateButton(); - Thread.sleep(2000); + if (pendingApproval.isSupervisorAuthenticationTitleDisplayed()) { isPageDisplayed = true; break; @@ -523,10 +533,19 @@ public void updateMyUinUpdateDocuments() throws InterruptedException { "Verify if packet is approved after approve in pending approval"); manageApplicationsPage.clickOnSearchCheckBox(); - manageApplicationsPage.clickOnUploadButton(); + boolean uploadSuccess = false; + + for (int i = 0; i < 3; i++) { + manageApplicationsPage.clickOnUploadButton(); + + if (!manageApplicationsPage.isNoNetworkFoundDisplayed()) { + uploadSuccess = true; + break; + } + } + + assertTrue(uploadSuccess, "Upload failed after retries: No Network Found still displayed"); - // assertTrue(manageApplicationsPage.isPacketUploadDone(Aid), "Verify if packet - // upload is done"); manageApplicationsPage.clickOnBackButton(); assertTrue(registrationTasksPage.isProfileTitleDisplayed(), "Verify if profile title display on homepage"); @@ -547,8 +566,7 @@ public void updateMyUinUpdateDocuments() throws InterruptedException { } else { throw new IllegalStateException("Unsupported language in testdata.json: " + language); } - // assertTrue(profilePage.isProfileTitleDisplayed(),"Verify if profile title - // display on Profilepage"); + profilePage.clickOnLogoutButton(); assertTrue(loginPage.isLoginPageLoaded(), "verify if login page is displayeded in Selected language"); diff --git a/ui-test/src/main/java/regclient/page/BasePage.java b/ui-test/src/main/java/regclient/page/BasePage.java index 2451d80ca..3201919e3 100644 --- a/ui-test/src/main/java/regclient/page/BasePage.java +++ b/ui-test/src/main/java/regclient/page/BasePage.java @@ -11,7 +11,6 @@ import io.appium.java_client.remote.SupportsContextSwitching; import io.appium.java_client.touch.WaitOptions; import io.appium.java_client.touch.offset.PointOption; -import io.netty.handler.timeout.TimeoutException; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; @@ -19,6 +18,7 @@ import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.Rectangle; import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Pause; import org.openqa.selenium.interactions.PointerInput; @@ -72,16 +72,37 @@ protected boolean isElementDisplayed(WebElement element) { } } + protected boolean isElementDisplayed(By locator) { + try { + waitForElementToBeVisible(locator, 10); + return driver.findElement(locator).isDisplayed(); + } catch (Exception e) { + return false; + } + } + protected void clickOnElement(WebElement element) { waitForElementToBeVisible(element); element.click(); } + public void click(By locator) { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); + wait.ignoring(StaleElementReferenceException.class); + WebElement element = wait.until(ExpectedConditions.elementToBeClickable(locator)); + element.click(); + } + private void waitForElementToBeVisible(WebElement element) { - WebDriverWait wait = new WebDriverWait(driver, ofSeconds(30)); + WebDriverWait wait = new WebDriverWait(driver, ofSeconds(10)); wait.until(ExpectedConditions.visibilityOf(element)); } + protected void waitForElementToBeClickable(WebElement element) { + WebDriverWait wait = new WebDriverWait(driver, ofSeconds(10)); + wait.until(ExpectedConditions.refreshed(ExpectedConditions.elementToBeClickable(element))); + } + protected boolean isElementDisplayed(WebElement element, int waitTime) { try { waitForElementToBeVisible(element, waitTime); @@ -94,8 +115,16 @@ protected boolean isElementDisplayed(WebElement element, int waitTime) { protected boolean isElementEnabled(WebElement element) { try { waitForElementToBeVisible(element); - element.isEnabled(); - return true; + return element.isEnabled(); + } catch (Exception e) { + return false; + } + } + + protected boolean isElementDisabled(WebElement element) { + try { + waitForElementToBeVisible(element); + return !element.isEnabled() || "false".equalsIgnoreCase(element.getAttribute("clickable")); } catch (Exception e) { return false; } @@ -222,11 +251,10 @@ protected String getCurrentDateWord() { public static void waitTime(int sec) { try { - Thread.sleep(sec * 1000); + Thread.sleep(sec * 1000L); // true seconds } catch (InterruptedException e) { - e.printStackTrace(); + Thread.currentThread().interrupt(); } - } public WebElement retryFindElement(WebElement element, Duration timeout) { @@ -342,22 +370,6 @@ public WebElement findElement(By by) { return element; } - protected boolean isElementDisplayed(By by) { - int attempts = 0; - while (attempts < 4) { - try { - waitForElementToBeVisible(driver.findElement(by)); - return driver.findElement(by).isDisplayed(); - } catch (Exception e) { - attempts++; - if (attempts == 4) { - return false; // After 3 attempts, return false - } - } - } - return false; - } - protected void clickAtCoordinates(int x, int y) { PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger"); Sequence clickSequence = new Sequence(finger, 1) @@ -758,25 +770,39 @@ protected void scrollTo(String contentDescFragment) { } protected void swipeUp() { + hideKeyboardIfVisible(); // ⭐ EXTRA SAFETY + Dimension size = driver.manage().window().getSize(); int startX = size.width / 2; - - int startY = (int) (size.height * 0.85); // lower point - int endY = (int) (size.height * 0.40); // higher point (scroll more) + int startY = (int) (size.height * 0.85); + int endY = (int) (size.height * 0.40); PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger"); - Sequence swipe = new Sequence(finger, 1); - - swipe.addAction(finger.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), startX, startY)); - swipe.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg())); - swipe.addAction(finger.createPointerMove(Duration.ofMillis(700), PointerInput.Origin.viewport(), startX, endY)); - swipe.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg())); + Sequence swipe = new Sequence(finger, 1) + .addAction(finger.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), startX, startY)) + .addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg())) + .addAction( + finger.createPointerMove(Duration.ofMillis(700), PointerInput.Origin.viewport(), startX, endY)) + .addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg())); driver.perform(Collections.singletonList(swipe)); } protected void scrollUntilElementVisible(By locator) { - for (int i = 0; i < 10; i++) { + + hideKeyboardIfVisible(); + + try { + WebElement el = driver.findElement(locator); + if (el.isDisplayed()) { + return; + } + } catch (Exception ignored) { + + } + + for (int i = 0; i < 6; i++) { + swipeUp(); try { WebElement el = driver.findElement(locator); if (el.isDisplayed()) { @@ -784,11 +810,103 @@ protected void scrollUntilElementVisible(By locator) { } } catch (Exception ignored) { } + } + + scrollToTopSafe(); + hideKeyboardIfVisible(); + for (int i = 0; i < 6; i++) { swipeUp(); + try { + WebElement el = driver.findElement(locator); + if (el.isDisplayed()) { + return; + } + } catch (Exception ignored) { + } + } + + throw new NoSuchElementException("Element not visible after scrolling: " + locator); + } + + public void clickAndsendKeysToTextBoxByLocator(By locator, String value) { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20)); + wait.ignoring(StaleElementReferenceException.class); + + wait.until(Webdriver -> { + WebElement element = Webdriver.findElement(locator); + element.click(); + element.clear(); + element.sendKeys(value); + return true; + }); + } + + public boolean isElementEnabled(By locator) { + try { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20)); + wait.ignoring(StaleElementReferenceException.class); + + return wait.until(Webdriver -> { + WebElement element = Webdriver.findElement(locator); + return element.isEnabled(); + }); + + } catch (TimeoutException | NoSuchElementException e) { + return false; + } + } + + public void hideKeyboardAndClick(By locator) { + hideKeyboardIfVisible(); + + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20)); + wait.ignoring(StaleElementReferenceException.class); + + WebElement el = wait.until(ExpectedConditions.elementToBeClickable(locator)); + + el.click(); + } + + public void hideKeyboardIfVisible() { + try { + ((HidesKeyboard) driver).hideKeyboard(); + } catch (Exception e) { + // Keyboard not visible – ignore } + } + + public void scrollUntilVisible(By locator, int maxScrolls) { + int count = 0; + while (count < maxScrolls) { + if (isElementDisplayed(locator)) { + return; + } + swipeOrScroll(); + count++; + } + throw new NoSuchElementException("Element not visible after scrolling: " + locator); + } - throw new NoSuchElementException("Element not found after scrolling: " + locator); + protected void clickAndSendKeysToTextBox(By locator, String text) { + this.waitForElementToBeVisible(locator, 10); + + WebElement element = driver.findElement(locator); + + element.click(); + waitTime(1); + + element.clear(); + waitTime(1); + + element.sendKeys(text); + waitTime(1); + + hideKeyboardIfVisible(); } + protected void waitForElementToBeVisible(By locator, int waitTime) { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(waitTime)); + wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); + } } diff --git a/ui-test/src/main/java/regclient/page/CameraPage.java b/ui-test/src/main/java/regclient/page/CameraPage.java index 3b0a21e8d..ab966e0e8 100644 --- a/ui-test/src/main/java/regclient/page/CameraPage.java +++ b/ui-test/src/main/java/regclient/page/CameraPage.java @@ -21,21 +21,39 @@ public class CameraPage extends BasePage { @AndroidFindBy(id = "com.android.permissioncontroller:id/permission_allow_foreground_only_button") private WebElement allowWhileUsingButton; + @AndroidFindBy(accessibility = "RETAKE") + private WebElement retakeButton; + public CameraPage(AppiumDriver driver) { super(driver); } public void clickimage() { - waitTime(1); - clickAtCoordinates(1840, 598); + for (int i = 0; i < 3; i++) { + clickAtCoordinates(1840, 598); + + if (isElementDisplayed(okButton, 2)) { + break; + } + } } public void clickOkButton() { - if (isElementDisplayed(okButton)) - clickOnElement(okButton); - else { - waitTime(1); - clickAtCoordinates(43, 78); + + boolean coordinateClicked = false; + + for (int i = 0; i < 3; i++) { + + if (!coordinateClicked) { + clickAtCoordinates(43, 78); + coordinateClicked = true; + } else if (isElementDisplayed(okButton)) { + clickOnElement(okButton); + } + + if (isElementDisplayed(retakeButton, 2)) { + break; + } } } @@ -53,4 +71,8 @@ public void handleCameraPermission() { } } + public boolean isRetakeButtonDisplayed() { + return isElementDisplayed(retakeButton); + } + } diff --git a/ui-test/src/main/java/regclient/page/MockSBIPage.java b/ui-test/src/main/java/regclient/page/MockSBIPage.java index 2c2a4f54e..b90f5b17a 100644 --- a/ui-test/src/main/java/regclient/page/MockSBIPage.java +++ b/ui-test/src/main/java/regclient/page/MockSBIPage.java @@ -45,6 +45,9 @@ public class MockSBIPage extends BasePage { @AndroidFindBy(id = "io.mosip.mock.sbi:id/button12") private WebElement mockSbiSaveButton; + @AndroidFindBy(xpath = "//android.widget.TextView[@text='Device Config']") + private WebElement deviceConfigTitle; + public MockSBIPage(AppiumDriver driver) { super(driver); this.driver = driver; @@ -58,7 +61,19 @@ public void switchToMockSBI() { Activity mocksbi = new Activity(MOCKSBI_PACKAGE, MOCKSBI_ACTIVITY); ((AndroidDriver) driver).startActivity(mocksbi); - clickOnElement(mockSbiSettingsButton); + } + + public void clickOnMockSbiSettingsButton() { + + for (int i = 0; i < 3; i++) { + clickOnElement(mockSbiSettingsButton); + + if (isElementDisplayed(deviceConfigTitle, 3)) { + return; + } + } + + throw new RuntimeException("Device Config page not displayed after clicking Settings"); } public void setAllToNotReadyAndSave() { diff --git a/ui-test/src/main/java/regclient/page/PendingApproval.java b/ui-test/src/main/java/regclient/page/PendingApproval.java index 44b347bcb..b1ee7aac5 100644 --- a/ui-test/src/main/java/regclient/page/PendingApproval.java +++ b/ui-test/src/main/java/regclient/page/PendingApproval.java @@ -50,7 +50,7 @@ public PendingApproval(AppiumDriver driver) { public abstract boolean isInvalidUsernameMessageDisplayed(); - public abstract boolean isSubmitButtonEnabledWithEmptyUsername(); + public abstract boolean isSubmitButtonDisabledWithEmptyUsername(); public abstract boolean isNumberOfApplicationDisplayed(); @@ -64,8 +64,6 @@ public PendingApproval(AppiumDriver driver) { public abstract boolean isNoNetworkFoundDisplayed(); - public abstract void clickOnPendingApprovalSubmitButton(int maxRetries); - public abstract boolean isAuthenticateButtonEnabled(); public abstract void clickOnAuthenticateButton(); diff --git a/ui-test/src/main/java/regclient/page/UpdateOperatorBiometricspage.java b/ui-test/src/main/java/regclient/page/UpdateOperatorBiometricspage.java index dcb72a8b0..fa535b835 100644 --- a/ui-test/src/main/java/regclient/page/UpdateOperatorBiometricspage.java +++ b/ui-test/src/main/java/regclient/page/UpdateOperatorBiometricspage.java @@ -112,6 +112,4 @@ public UpdateOperatorBiometricspage(AppiumDriver driver) { public abstract boolean validateThreshold(int expected); - public abstract void updateBiometricsAndWaitPopup(); - } diff --git a/ui-test/src/main/java/regclient/pages/arabic/BiometricDetailsPageArabic.java b/ui-test/src/main/java/regclient/pages/arabic/BiometricDetailsPageArabic.java index 2cd03a9a3..25c4f7407 100644 --- a/ui-test/src/main/java/regclient/pages/arabic/BiometricDetailsPageArabic.java +++ b/ui-test/src/main/java/regclient/pages/arabic/BiometricDetailsPageArabic.java @@ -48,9 +48,10 @@ public BiometricDetailsPageArabic(AppiumDriver driver) { @SuppressWarnings("deprecation") public boolean isBiometricDetailsPageDisplayed() { - return isElementDisplayed(findElementWithRetry(MobileBy.AndroidUIAutomator( - "new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().descriptionContains(\"" - + FetchUiSpec.getValueUsingId("individualBiometrics") + "\"))"))); + scrollToTop(); + return isElementDisplayed( + findElementWithRetry(MobileBy.AndroidUIAutomator("new UiSelector().descriptionContains(\"" + + FetchUiSpec.getValueUsingId("individualBiometrics") + "\")"))); } @SuppressWarnings("deprecation") @@ -94,7 +95,7 @@ public ApplicantBiometricsPage clickOnExceptionScanIcon() { public IntroducerBiometricPage clickOnIntroducerIrisScan() { clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc,\"" + FetchUiSpec.getValueUsingId("introducerBiometrics") - + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"Iris Scan\"]"))); + + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"القزحية مسح\"]"))); return new IntroducerBiometricPageArabic(driver); } @@ -102,7 +103,7 @@ public IntroducerBiometricPage clickOnIntroducerIrisScan() { public IntroducerBiometricPage clickOnIntroducerRightHandScan() { clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc,\"" + FetchUiSpec.getValueUsingId("introducerBiometrics") - + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"Right\"]"))); + + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"اليد اليمنى مسح\"]"))); return new IntroducerBiometricPageArabic(driver); } @@ -110,7 +111,7 @@ public IntroducerBiometricPage clickOnIntroducerRightHandScan() { public IntroducerBiometricPage clickOnIntroducerLeftHandScan() { clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc,\"" + FetchUiSpec.getValueUsingId("introducerBiometrics") - + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"Left\"]"))); + + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"اليد اليسرى مسح\"]"))); return new IntroducerBiometricPageArabic(driver); } @@ -118,7 +119,7 @@ public IntroducerBiometricPage clickOnIntroducerLeftHandScan() { public IntroducerBiometricPage clickOnIntroducerThumbScan() { clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc,\"" + FetchUiSpec.getValueUsingId("introducerBiometrics") - + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"Thumbs\"]"))); + + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"الأبهام مسح\"]"))); return new IntroducerBiometricPageArabic(driver); } @@ -126,7 +127,7 @@ public IntroducerBiometricPage clickOnIntroducerThumbScan() { public IntroducerBiometricPage clickOnIntroducerFaceScan() { clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc,\"" + FetchUiSpec.getValueUsingId("introducerBiometrics") - + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"Face\"]"))); + + "\")]/following-sibling::android.view.View/descendant::android.view.View/descendant::android.widget.ImageView[@content-desc=\"الوجه مسح\"]"))); return new IntroducerBiometricPageArabic(driver); } diff --git a/ui-test/src/main/java/regclient/pages/arabic/DocumentUploadPageArabic.java b/ui-test/src/main/java/regclient/pages/arabic/DocumentUploadPageArabic.java index 8959d7d01..4ee8b9157 100644 --- a/ui-test/src/main/java/regclient/pages/arabic/DocumentUploadPageArabic.java +++ b/ui-test/src/main/java/regclient/pages/arabic/DocumentUploadPageArabic.java @@ -100,6 +100,7 @@ public void uploadDoccuments(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -128,6 +129,7 @@ public void uploadDoccuments(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -159,6 +161,7 @@ public void uploadDoccuments(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -196,6 +199,7 @@ public void uploadDoccumentsUpdate(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -223,6 +227,7 @@ public void uploadDoccumentsUpdate(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); diff --git a/ui-test/src/main/java/regclient/pages/arabic/LoginPageArabic.java b/ui-test/src/main/java/regclient/pages/arabic/LoginPageArabic.java index cb89c9799..af9db9587 100644 --- a/ui-test/src/main/java/regclient/pages/arabic/LoginPageArabic.java +++ b/ui-test/src/main/java/regclient/pages/arabic/LoginPageArabic.java @@ -1,5 +1,6 @@ package regclient.pages.arabic; +import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import io.appium.java_client.AppiumDriver; @@ -18,11 +19,11 @@ public class LoginPageArabic extends LoginPage { @AndroidFindBy(accessibility = "مقبل") private WebElement nextButton; - @AndroidFindBy(xpath = "//android.widget.EditText") - private WebElement passwordTextBox; + private By passwordTextBox = + By.xpath("//android.widget.EditText[@password='true']"); - @AndroidFindBy(xpath = "(//android.view.View[@content-desc=\"تسجيل الدخول\"])[2]") - private WebElement loginButton; + private By loginButton = + By.xpath("(//android.view.View[@content-desc='تسجيل الدخول'])[2]"); @AndroidFindBy(accessibility = "يرجى تسجيل الدخول للوصول إلى الميزات.") private WebElement loginMessage; @@ -74,11 +75,11 @@ public void clickOnBackButton() { } public void enterPassword(String password) { - clickAndsendKeysToTextBox(passwordTextBox, password); + clickAndSendKeysToTextBox(passwordTextBox, password); } public RegistrationTasksPage clickOnloginButton() { - clickOnElement(loginButton); + hideKeyboardAndClick(loginButton); return new RegistrationTasksPageArabic(driver); } diff --git a/ui-test/src/main/java/regclient/pages/arabic/ManageApplicationsPageArabic.java b/ui-test/src/main/java/regclient/pages/arabic/ManageApplicationsPageArabic.java index 673f49027..4585a9a77 100644 --- a/ui-test/src/main/java/regclient/pages/arabic/ManageApplicationsPageArabic.java +++ b/ui-test/src/main/java/regclient/pages/arabic/ManageApplicationsPageArabic.java @@ -15,7 +15,7 @@ public class ManageApplicationsPageArabic extends ManageApplicationsPage { @AndroidFindBy(xpath = "//android.widget.EditText") private WebElement ApplicationIDTextBox; - @AndroidFindBy(accessibility = "تحميل") + @AndroidFindBy(accessibility = "رفع") private WebElement uploadButton; @AndroidFindBy(accessibility = "حالة العميل") @@ -30,10 +30,10 @@ public class ManageApplicationsPageArabic extends ManageApplicationsPage { @AndroidFindBy(accessibility = "تم الإنشاء") private WebElement createdOption; - @AndroidFindBy(accessibility = "تمت الموافقة") + @AndroidFindBy(accessibility = "Approved") private WebElement approvedOption; - @AndroidFindBy(accessibility = "مرفوض") + @AndroidFindBy(accessibility = "Rejected") private WebElement rejectedOption; @AndroidFindBy(accessibility = "تمت المزامنة") @@ -48,7 +48,7 @@ public class ManageApplicationsPageArabic extends ManageApplicationsPage { @AndroidFindBy(accessibility = "تجاهل") private WebElement dismissButton; - @AndroidFindBy(accessibility = "عرض 0 من الطلبات") + @AndroidFindBy(accessibility = "عرض 0 تطبيقات") private WebElement displayZeroApplication; @AndroidFindBy(uiAutomator = "UiSelector().className(\"android.widget.CheckBox\").instance(0)") diff --git a/ui-test/src/main/java/regclient/pages/arabic/OperationalTaskPageArabic.java b/ui-test/src/main/java/regclient/pages/arabic/OperationalTaskPageArabic.java index 78aa73d98..bcf5094b6 100644 --- a/ui-test/src/main/java/regclient/pages/arabic/OperationalTaskPageArabic.java +++ b/ui-test/src/main/java/regclient/pages/arabic/OperationalTaskPageArabic.java @@ -18,12 +18,15 @@ public class OperationalTaskPageArabic extends OperationalTaskPage { @AndroidFindBy(uiAutomator = "new UiSelector().descriptionContains(\"مزامنة البيانات\")") private WebElement synchronizeDataButton; - @AndroidFindBy(accessibility = "تحميل التطبيق") + @AndroidFindBy(uiAutomator = "new UiSelector().descriptionContains(\"تحميل التطبيق\")") private WebElement applicationUploadTitle; - @AndroidFindBy(accessibility = "ما زال يحتاج بتصدير") + @AndroidFindBy(uiAutomator = "new UiSelector().descriptionContains(\"ما زال يحتاج بتصدير\")") private WebElement pendingApprovalTitle; + @AndroidFindBy(accessibility = "المهام التشغيلية") + private WebElement operationalTaskPageTitle; + public OperationalTaskPageArabic(AppiumDriver driver) { super(driver); } @@ -34,7 +37,7 @@ public SupervisorBiometricVerificationpage clickOnUpdateOperatorBiometricsButton } public boolean isOperationalTaskPageLoaded() { - return isElementDisplayed(systemStorageUsageTitle); + return isElementDisplayed(operationalTaskPageTitle); } public void clickSynchronizeDataButton() { diff --git a/ui-test/src/main/java/regclient/pages/arabic/PendingApprovalArabic.java b/ui-test/src/main/java/regclient/pages/arabic/PendingApprovalArabic.java index 0eef9485d..d81db033f 100644 --- a/ui-test/src/main/java/regclient/pages/arabic/PendingApprovalArabic.java +++ b/ui-test/src/main/java/regclient/pages/arabic/PendingApprovalArabic.java @@ -50,7 +50,7 @@ public class PendingApprovalArabic extends PendingApproval { @AndroidFindBy(xpath = "//*[contains(@content-desc,\"ما زال يحتاج بتصدير\")]//preceding-sibling::android.widget.Button") private WebElement backButton; - @AndroidFindBy(accessibility = "رفض") + @AndroidFindBy(accessibility = "يرفض") private WebElement rejectButton; @AndroidFindBy(accessibility = "الرقم التسلسلي معرف التطبيق تاريخ التسجيل حالة العميل حالة المراجعة معرف المشغل") @@ -71,7 +71,7 @@ public class PendingApprovalArabic extends PendingApproval { @AndroidFindBy(accessibility = "يرجى تحديد قيمة") private WebElement rejectReasonDropdown; - @AndroidFindBy(accessibility = "عرض 1 من الطلبات") + @AndroidFindBy(accessibility = "عرض 1 تطبيقات") private WebElement displayApplication; @AndroidFindBy(accessibility = "يرجى تحديد سبب لرفض الحزمة. يمكنك تغيير المراجعة إلى الموافقة أو إعادة تعيين حالة المراجعة لاحقًا.") @@ -191,8 +191,8 @@ public boolean isSubmitButtonEnabled() { return isElementEnabled(submitButton); } - public boolean isSubmitButtonEnabledWithEmptyUsername() { - return isElementEnabled(invalidUsernameMessageForempty); + public boolean isSubmitButtonDisabledWithEmptyUsername() { + return isElementDisabled(submitButton); } public boolean isNumberOfApplicationDisplayed() { @@ -222,22 +222,6 @@ public boolean isNoNetworkFoundDisplayed() { return isElementEnabled(noNetworkFound); } - public void clickOnPendingApprovalSubmitButton(int maxRetries) { - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); - - for (int i = 1; i <= maxRetries; i++) { - clickOnSubmitButton(); - try { - boolean popupShown = wait.until(d -> isNoNetworkFoundDisplayed()); - if (popupShown) { - } - } catch (TimeoutException e) { - break; - } - } - System.out.println("Still No Network Found Displayed"); - } - public void clickOnAuthenticateButton() { clickOnElement(authenticateButton); } diff --git a/ui-test/src/main/java/regclient/pages/arabic/PreviewPageArabic.java b/ui-test/src/main/java/regclient/pages/arabic/PreviewPageArabic.java index bf6a07f9a..4c843e1fa 100644 --- a/ui-test/src/main/java/regclient/pages/arabic/PreviewPageArabic.java +++ b/ui-test/src/main/java/regclient/pages/arabic/PreviewPageArabic.java @@ -20,16 +20,15 @@ public class PreviewPageArabic extends PreviewPage { + ".scrollIntoView(new UiSelector().text(\"المعلومات الديموغرافية\"))") private WebElement demographicInformationInPreviewPage; - @AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector().scrollable(true).instance(0))" - + ".scrollIntoView(new UiSelector().textContains(\"معرف التطبيق\"))") + @AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains(\"Application ID\"))") private WebElement applicationIDPreviewPage; - @AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector().scrollable(true).instance(0))" - + ".scrollIntoView(new UiSelector().text(\"المستندات\"))") + @AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector().scrollable(true))" + + ".scrollIntoView(new UiSelector().text(\"وثائق\"))") private WebElement documentsInformationInPreviewPage; @AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector().scrollable(true).instance(0))" - + ".scrollIntoView(new UiSelector().text(\"البيانات البيومترية\"))") + + ".scrollIntoView(new UiSelector().text(\"القياسات الحيوية\"))") private WebElement biometricsInformationInPreviewPage; @AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains(\"Iris ( 1 )\"))") @@ -139,4 +138,5 @@ public boolean isBiometricCorrectionTitleDisplayed() { return isElementDisplayed(biometricCorrectionTitle); } + } diff --git a/ui-test/src/main/java/regclient/pages/arabic/UpdateOperatorBiometricspageArabic.java b/ui-test/src/main/java/regclient/pages/arabic/UpdateOperatorBiometricspageArabic.java index d8d356919..ba5fa24e0 100644 --- a/ui-test/src/main/java/regclient/pages/arabic/UpdateOperatorBiometricspageArabic.java +++ b/ui-test/src/main/java/regclient/pages/arabic/UpdateOperatorBiometricspageArabic.java @@ -394,20 +394,4 @@ public boolean validateThreshold(int expected) { return actual >= expected; } - public void updateBiometricsAndWaitPopup() { - for (int i = 1; i <= 5; i++) { - clickOnVerifyAndSaveButton(); - try { - new WebDriverWait(driver, Duration.ofSeconds(60)).until(ExpectedConditions.visibilityOf(successPopup)); - return; // success - } catch (Exception ignored) { - } - try { - Thread.sleep(2000); - } catch (InterruptedException ignored) { - } - } - throw new AssertionError("Biometrics update success popup not displayed after 5 retries."); - } - } diff --git a/ui-test/src/main/java/regclient/pages/english/ApplicantBiometricsPageEnglish.java b/ui-test/src/main/java/regclient/pages/english/ApplicantBiometricsPageEnglish.java index 29d7860cb..15686bee4 100644 --- a/ui-test/src/main/java/regclient/pages/english/ApplicantBiometricsPageEnglish.java +++ b/ui-test/src/main/java/regclient/pages/english/ApplicantBiometricsPageEnglish.java @@ -108,8 +108,11 @@ public void enterCommentsInTextBox(String comments) { } clickAndsendKeysToTextBox(commentsTextBox, comments); } - + public void clickOnScanButton() { + if (!isElementDisplayedOnScreen(scanButton)) { + swipeOrScroll(); + } clickOnElement(scanButton); } diff --git a/ui-test/src/main/java/regclient/pages/english/DemographicDetailsPageEnglish.java b/ui-test/src/main/java/regclient/pages/english/DemographicDetailsPageEnglish.java index a052a1798..89a74475d 100644 --- a/ui-test/src/main/java/regclient/pages/english/DemographicDetailsPageEnglish.java +++ b/ui-test/src/main/java/regclient/pages/english/DemographicDetailsPageEnglish.java @@ -70,6 +70,9 @@ public class DemographicDetailsPageEnglish extends DemographicDetailsPage { @AndroidFindBy(accessibility = "Postal/ بريدي") private WebElement postalHeader; + @AndroidFindBy(uiAutomator = "new UiSelector().descriptionContains(\"Non-Foreigner\")") + private WebElement nonForeignerOption; + public DemographicDetailsPageEnglish(AppiumDriver driver) { super(driver); } @@ -135,7 +138,7 @@ public void fillDemographicDetailsPage(String age) { for (String id : idList) { if (FetchUiSpec.getRequiredTypeUsingId(id)) { if (FetchUiSpec.getControlTypeUsingId(id).equals("textbox")) { - waitTime(3); + waitTime(1); boolean isdisplayed = isElementDisplayed(findElementWithRetry(MobileBy.AndroidUIAutomator( "new UiSelector().descriptionContains(\"" + FetchUiSpec.getValueUsingId(id) + "\")"))); assertTrue(isdisplayed, "Verify if " + id + " header is displayed"); @@ -149,7 +152,7 @@ public void fillDemographicDetailsPage(String age) { "Verify if " + id + " is enter in second language text box"); } else if (FetchUiSpec.getControlTypeUsingId(id).equals("dropdown") && FetchUiSpec.getFormatUsingId(id).equals("none")) { - waitTime(3); + waitTime(1); while (!isElementDisplayed(MobileBy.AndroidUIAutomator( "new UiSelector().descriptionContains(\"" + FetchUiSpec.getValueUsingId(id) + "\")"))) { swipeOrScroll(); @@ -163,21 +166,21 @@ public void fillDemographicDetailsPage(String age) { + FetchUiSpec.getValueUsingId(id) + "')]]")); clickOnElement(dropdownElement); - waitTime(3); + waitTime(1); if (!isElementDisplayed(dropdownElement)) { clickOnElement(findElement(By.className("android.view.View"))); } else if (isElementDisplayed(dropdownElement)) { swipeOrScroll(); clickOnElement(dropdownElement); - waitTime(2); + waitTime(1); clickOnElement(findElement(By.className("android.view.View"))); } - waitTime(2); + waitTime(1); if (isElementDisplayed(By.xpath("//android.view.View[contains(@content-desc, \"" + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.widget.Button[contains(@content-desc, \"Select Option\")]"))) { clickOnElement(dropdownElement); - waitTime(2); + waitTime(1); clickOnElement(findElement(By.className("android.view.View"))); } } else if (FetchUiSpec.getControlTypeUsingId(id).equals("dropdown") @@ -189,7 +192,7 @@ public void fillDemographicDetailsPage(String age) { clickOnElement(maleButton); } else if (FetchUiSpec.getControlTypeUsingId(id).equals("ageDate")) { - waitTime(3); + waitTime(1); boolean isdisplayed = isElementDisplayed(findElementWithRetry(MobileBy.AndroidUIAutomator( "new UiSelector().descriptionContains(\"" + FetchUiSpec.getValueUsingId(id) + "\")"))); assertTrue(isdisplayed, "Verify if " + id + " header is displayed"); @@ -226,7 +229,7 @@ else if (age.equals("currentCalenderDate")) { } else if (id.equals("residenceStatus")) { if (FetchUiSpec.getControlTypeUsingId(id).equals("dropdown") && FetchUiSpec.getFormatUsingId(id).equals("none")) { - waitTime(2); + waitTime(1); boolean isdisplayed = isElementDisplayed(findElementWithRetry(MobileBy.AndroidUIAutomator( "new UiSelector().descriptionContains(\"" + FetchUiSpec.getValueUsingId(id) + "\")"))); assertTrue(isdisplayed, "Verify if " + id + " header is displayed"); @@ -234,21 +237,22 @@ else if (age.equals("currentCalenderDate")) { By.xpath("//android.view.View[contains(@content-desc, \"" + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.widget.Button")); clickOnElement(dropdownElement); - waitTime(2); + waitTime(1); if (!isElementDisplayed(dropdownElement)) { - clickOnElement(findElement(By.className("android.view.View"))); + // clickOnElement(findElement(By.className("android.view.View"))); + clickOnElement(nonForeignerOption); } else if (isElementDisplayed(dropdownElement)) { swipeOrScroll(); clickOnElement(dropdownElement); - waitTime(2); + waitTime(1); clickOnElement(findElement(By.className("android.view.View"))); } - waitTime(2); + waitTime(1); if (isElementDisplayed(By.xpath("//android.view.View[contains(@content-desc, \"" + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.widget.Button[contains(@content-desc, \"Select Option\")]"))) { clickOnElement(dropdownElement); - waitTime(2); + waitTime(1); clickOnElement(findElement(By.className("android.view.View"))); } } @@ -256,7 +260,7 @@ else if (age.equals("currentCalenderDate")) { if (id.equals("introducerName") && FetchUiSpec.getFlowType().equals("newProcess")) { if (age.equals("minor") || age.equals("infant") || age.equals("currentCalenderDate")) { if (FetchUiSpec.getControlTypeUsingId(id).equals("textbox")) { - waitTime(3); + waitTime(1); boolean isdisplayed = isElementDisplayed(findElementWithRetry(MobileBy.AndroidUIAutomator( "new UiSelector().descriptionContains(\"" + FetchUiSpec.getValueUsingId(id) + "\")"))); assertTrue(isdisplayed, "Verify if " + id + " header is displayed"); @@ -274,7 +278,7 @@ else if (age.equals("currentCalenderDate")) { if (id.equals("introducerRID") && FetchUiSpec.getFlowType().equals("newProcess")) { if (age.equals("minor") || age.equals("infant") || age.equals("currentCalenderDate")) { if (FetchUiSpec.getControlTypeUsingId(id).equals("textbox")) { - waitTime(3); + waitTime(1); boolean isdisplayed = isElementDisplayed(findElementWithRetry(MobileBy.AndroidUIAutomator( "new UiSelector().descriptionContains(\"" + FetchUiSpec.getValueUsingId(id) + "\")"))); assertTrue(isdisplayed, "Verify if " + id + " header is displayed"); diff --git a/ui-test/src/main/java/regclient/pages/english/DocumentuploadPageEnglish.java b/ui-test/src/main/java/regclient/pages/english/DocumentuploadPageEnglish.java index 27926cad2..eee4d8192 100644 --- a/ui-test/src/main/java/regclient/pages/english/DocumentuploadPageEnglish.java +++ b/ui-test/src/main/java/regclient/pages/english/DocumentuploadPageEnglish.java @@ -129,6 +129,7 @@ public void uploadDoccuments(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -160,6 +161,7 @@ public void uploadDoccuments(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); // assertTrue(isRetakeButtonDisplayed(),"Verify if retake button displayed"); @@ -198,6 +200,7 @@ public void uploadDoccumentsUpdate(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -225,6 +228,7 @@ public void uploadDoccumentsUpdate(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); diff --git a/ui-test/src/main/java/regclient/pages/english/ManageApplicationsPageEnglish.java b/ui-test/src/main/java/regclient/pages/english/ManageApplicationsPageEnglish.java index 4761a202a..4f0dc7b71 100644 --- a/ui-test/src/main/java/regclient/pages/english/ManageApplicationsPageEnglish.java +++ b/ui-test/src/main/java/regclient/pages/english/ManageApplicationsPageEnglish.java @@ -87,6 +87,9 @@ public class ManageApplicationsPageEnglish extends ManageApplicationsPage { @AndroidFindBy(accessibility = "Displaying 1 Applications") private WebElement displayOneApplication; + @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.Button\").instance(0)") + private WebElement backButton; + public ManageApplicationsPageEnglish(AppiumDriver driver) { super(driver); } @@ -233,7 +236,7 @@ public boolean isDeletionDropdownOptionDisplayed() { } public void clickOnBackButton() { - driver.findElement(By.xpath("(//android.widget.ImageButton)[1]")).click(); + clickOnElement(backButton); } public void clickOnExportButton() { diff --git a/ui-test/src/main/java/regclient/pages/english/PendingApprovalEnglish.java b/ui-test/src/main/java/regclient/pages/english/PendingApprovalEnglish.java index 6f9b0b099..205291d75 100644 --- a/ui-test/src/main/java/regclient/pages/english/PendingApprovalEnglish.java +++ b/ui-test/src/main/java/regclient/pages/english/PendingApprovalEnglish.java @@ -132,10 +132,6 @@ public boolean isInvalidUsernameMessageDisplayed() { return isElementDisplayed(invalidUsernameMessage); } - public boolean isSubmitButtonEnabledWithEmptyUsername() { - return isElementEnabled(invalidUsernameMessageForempty); - } - public void enterUserName(String username) { clickAndsendKeysToTextBox2(userNameTextBox, username); } @@ -225,22 +221,6 @@ public boolean isNoNetworkFoundDisplayed() { return isElementEnabled(noNetworkFound); } - public void clickOnPendingApprovalSubmitButton(int maxRetries) { - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); - - for (int i = 1; i <= maxRetries; i++) { - clickOnSubmitButton(); - try { - boolean popupShown = wait.until(d -> isNoNetworkFoundDisplayed()); - if (popupShown) { - } - } catch (TimeoutException e) { - break; - } - } - System.out.println("Still No Network Found Displayed"); - } - public void clickOnAuthenticateButton() { clickOnElement(authenticateButton); } @@ -249,4 +229,8 @@ public boolean isAuthenticateButtonEnabled() { return isElementEnabled(authenticateButton); } + public boolean isSubmitButtonDisabledWithEmptyUsername() { + return isElementDisabled(submitButton); + } + } diff --git a/ui-test/src/main/java/regclient/pages/english/UpdateOperatorBiometricspageEnglish.java b/ui-test/src/main/java/regclient/pages/english/UpdateOperatorBiometricspageEnglish.java index 1891123a1..b3521b8de 100644 --- a/ui-test/src/main/java/regclient/pages/english/UpdateOperatorBiometricspageEnglish.java +++ b/ui-test/src/main/java/regclient/pages/english/UpdateOperatorBiometricspageEnglish.java @@ -142,8 +142,6 @@ public UpdateOperatorBiometricspageEnglish(AppiumDriver driver) { @AndroidFindBy(accessibility = "Update Operator Biometrics") private WebElement updateOperatorBiometrics; - - public void clickOnIrisScan() { clickOnElement(irisScanIcon); @@ -378,10 +376,8 @@ public void clickOnHomeButton() { clickOnElement(homeButton); } - @Override public void clickOnVerifyAndSaveButton() { clickOnElement(verifyAndSaveButton); - } public void clickOnBackButton() { @@ -391,31 +387,16 @@ public void clickOnBackButton() { public boolean isUpdateOperatorBiometricsPageLoaded() { return isElementDisplayed(updateOperatorBiometrics); } - + public boolean validateThreshold(int expected) { - WebElement el = driver.findElement(MobileBy.AndroidUIAutomator( - "new UiScrollable(new UiSelector().scrollable(true))" + - ".scrollIntoView(new UiSelector().descriptionContains(\"Threshold\"));" - )); - - String text = el.getAttribute("content-desc"); // "Threshold 75%" - int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 - - return actual == expected; - } - - public void updateBiometricsAndWaitPopup() { - for (int i = 1; i <= 5; i++) { - clickOnVerifyAndSaveButton(); - try { - new WebDriverWait(driver, Duration.ofSeconds(60)) - .until(ExpectedConditions.visibilityOf(successPopup)); - return; // success - } catch (Exception ignored) {} - try { Thread.sleep(2000); } catch (InterruptedException ignored) {} - } - throw new AssertionError("Biometrics update success popup not displayed after 5 retries."); - } + WebElement el = driver + .findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true))" + + ".scrollIntoView(new UiSelector().descriptionContains(\"Threshold\"));")); + String text = el.getAttribute("content-desc"); // "Threshold 75%" + int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 + + return actual == expected; + } } diff --git a/ui-test/src/main/java/regclient/pages/french/DocumentUploadPageFrench.java b/ui-test/src/main/java/regclient/pages/french/DocumentUploadPageFrench.java index 01b6b892d..6ced336af 100644 --- a/ui-test/src/main/java/regclient/pages/french/DocumentUploadPageFrench.java +++ b/ui-test/src/main/java/regclient/pages/french/DocumentUploadPageFrench.java @@ -102,6 +102,7 @@ public void uploadDoccuments(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -130,6 +131,7 @@ public void uploadDoccuments(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -161,6 +163,7 @@ public void uploadDoccuments(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -198,6 +201,7 @@ public void uploadDoccumentsUpdate(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); @@ -225,6 +229,7 @@ public void uploadDoccumentsUpdate(String age, String type) { + FetchUiSpec.getValueUsingId(id) + "\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage = new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(), "Verify if retake button displayed"); diff --git a/ui-test/src/main/java/regclient/pages/french/ManageApplicationsPageFrench.java b/ui-test/src/main/java/regclient/pages/french/ManageApplicationsPageFrench.java index efec3dcd1..80efc824b 100644 --- a/ui-test/src/main/java/regclient/pages/french/ManageApplicationsPageFrench.java +++ b/ui-test/src/main/java/regclient/pages/french/ManageApplicationsPageFrench.java @@ -83,6 +83,9 @@ public class ManageApplicationsPageFrench extends ManageApplicationsPage { @AndroidFindBy(uiAutomator = "UiSelector().className(\"android.widget.CheckBox\").instance(1)") private WebElement latestAidCheckBox; + + @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.Button\").instance(0)") + private WebElement backButton; public ManageApplicationsPageFrench(AppiumDriver driver) { super(driver); @@ -230,7 +233,7 @@ public boolean isDeletionDropdownOptionDisplayed() { } public void clickOnBackButton() { - driver.navigate().back(); + clickOnElement(backButton); } public void clickOnExportButton() { diff --git a/ui-test/src/main/java/regclient/pages/french/PendingApprovalFrench.java b/ui-test/src/main/java/regclient/pages/french/PendingApprovalFrench.java index fb383c6ad..f54fee9f2 100644 --- a/ui-test/src/main/java/regclient/pages/french/PendingApprovalFrench.java +++ b/ui-test/src/main/java/regclient/pages/french/PendingApprovalFrench.java @@ -192,10 +192,6 @@ public boolean isSubmitButtonEnabled() { return isElementEnabled(submitButton); } - public boolean isSubmitButtonEnabledWithEmptyUsername() { - return isElementEnabled(invalidUsernameMessageForempty); - } - public boolean isNumberOfApplicationDisplayed() { waitTime(2); return isElementDisplayed(displayApplication); @@ -222,21 +218,6 @@ public void selectLatestAIdCheckBox() { public boolean isNoNetworkFoundDisplayed() { return isElementEnabled(noNetworkFound); } - - public void clickOnPendingApprovalSubmitButton(int maxRetries) { - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); - for (int i = 1; i <= maxRetries; i++) { - clickOnSubmitButton(); - try { - boolean popupShown = wait.until(d -> isNoNetworkFoundDisplayed()); - if (popupShown) { - } - } catch (TimeoutException e) { - break; - } - } - System.out.println("Still No Network Found Displayed"); - } public void clickOnAuthenticateButton() { clickOnElement(authenticateButton); @@ -246,4 +227,8 @@ public boolean isAuthenticateButtonEnabled() { return isElementEnabled(authenticateButton); } + public boolean isSubmitButtonDisabledWithEmptyUsername() { + return isElementDisabled(submitButton); + } + } diff --git a/ui-test/src/main/java/regclient/pages/french/SupervisorBiometricVerificationpageFrench.java b/ui-test/src/main/java/regclient/pages/french/SupervisorBiometricVerificationpageFrench.java index 2636b5404..757de1ab6 100644 --- a/ui-test/src/main/java/regclient/pages/french/SupervisorBiometricVerificationpageFrench.java +++ b/ui-test/src/main/java/regclient/pages/french/SupervisorBiometricVerificationpageFrench.java @@ -352,7 +352,20 @@ public boolean isVerifyAndSaveButtonEnabled() { } public void clickOnVerifyAndSaveButton() { - clickOnElement(verifyAndSaveButton); + boolean isDismissLoaded = false; + + for (int i = 0; i < 3; i++) { + clickOnElement(verifyAndSaveButton); + + if (isDismissPageLoaded()) { + isDismissLoaded = true; + break; + } + } + + if (!isDismissLoaded) { + System.out.println("INFO: Dismiss page not loaded after clicking Verify & Save 3 times"); + } } public boolean isDismissPageLoaded() { diff --git a/ui-test/src/main/java/regclient/pages/french/UpdateOperatorBiometricspageFrench.java b/ui-test/src/main/java/regclient/pages/french/UpdateOperatorBiometricspageFrench.java index 5b4eb6af2..d95312961 100644 --- a/ui-test/src/main/java/regclient/pages/french/UpdateOperatorBiometricspageFrench.java +++ b/ui-test/src/main/java/regclient/pages/french/UpdateOperatorBiometricspageFrench.java @@ -383,30 +383,16 @@ public void clickOnBackButton() { public boolean isUpdateOperatorBiometricsPageLoaded() { return isElementDisplayed(updateOperatorBiometrics); } - + public boolean validateThreshold(int expected) { - WebElement el = driver.findElement(MobileBy.AndroidUIAutomator( - "new UiScrollable(new UiSelector().scrollable(true))" + - ".scrollIntoView(new UiSelector().descriptionContains(\"Seuil\"));" - )); - - String text = el.getAttribute("content-desc"); // "Threshold 75%" - int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 - - return actual == expected; - } - - public void updateBiometricsAndWaitPopup() { - for (int i = 1; i <= 5; i++) { - clickOnVerifyAndSaveButton(); - try { - new WebDriverWait(driver, Duration.ofSeconds(60)) - .until(ExpectedConditions.visibilityOf(successPopup)); - return; // success - } catch (Exception ignored) {} - try { Thread.sleep(2000); } catch (InterruptedException ignored) {} - } - throw new AssertionError("Biometrics update success popup not displayed after 5 retries."); + WebElement el = driver + .findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true))" + + ".scrollIntoView(new UiSelector().descriptionContains(\"Seuil\"));")); + + String text = el.getAttribute("content-desc"); // "Threshold 75%" + int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 + + return actual == expected; } } diff --git a/ui-test/src/main/java/regclient/pages/hindi/DocumentUploadPageHindi.java b/ui-test/src/main/java/regclient/pages/hindi/DocumentUploadPageHindi.java index 31a1c90ba..05a018a09 100644 --- a/ui-test/src/main/java/regclient/pages/hindi/DocumentUploadPageHindi.java +++ b/ui-test/src/main/java/regclient/pages/hindi/DocumentUploadPageHindi.java @@ -88,6 +88,7 @@ public void uploadDoccuments(String age,String type) { assertTrue(isEnabled,"Verify if scan button enabled for "+FetchUiSpec.getValueUsingId(id)); clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc, \""+FetchUiSpec.getValueUsingId(id)+"\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage=new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(),"Verify if retake button displayed"); @@ -106,6 +107,7 @@ public void uploadDoccuments(String age,String type) { assertTrue(isEnabled,"Verify if scan button enabled for "+FetchUiSpec.getValueUsingId(id)); clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc, \""+FetchUiSpec.getValueUsingId(id)+"\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage=new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(),"Verify if retake button displayed"); @@ -126,6 +128,7 @@ public void uploadDoccuments(String age,String type) { assertTrue(isEnabled,"Verify if scan button enabled for "+FetchUiSpec.getValueUsingId(id)); clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc, \""+FetchUiSpec.getValueUsingId(id)+"\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage=new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(),"Verify if retake button displayed"); @@ -152,6 +155,7 @@ public void uploadDoccumentsUpdate(String age,String type) { assertTrue(isEnabled,"Verify if scan button enabled for "+FetchUiSpec.getValueUsingId(id)); clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc, \""+FetchUiSpec.getValueUsingId(id)+"\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage=new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(),"Verify if retake button displayed"); @@ -170,6 +174,7 @@ public void uploadDoccumentsUpdate(String age,String type) { assertTrue(isEnabled,"Verify if scan button enabled for "+FetchUiSpec.getValueUsingId(id)); clickOnElement(findElementWithRetry(By.xpath("//android.view.View[contains(@content-desc, \""+FetchUiSpec.getValueUsingId(id)+"\")]/parent::android.view.View/parent::android.view.View/following-sibling::android.widget.Button"))); CameraPage cameraPage=new CameraPage(driver); + cameraPage.handleCameraPermission(); cameraPage.clickimage(); cameraPage.clickOkButton(); assertTrue(isRetakeButtonDisplayed(),"Verify if retake button displayed"); diff --git a/ui-test/src/main/java/regclient/pages/hindi/PendingApprovalHindi.java b/ui-test/src/main/java/regclient/pages/hindi/PendingApprovalHindi.java index aa53d500e..d2192bfe8 100644 --- a/ui-test/src/main/java/regclient/pages/hindi/PendingApprovalHindi.java +++ b/ui-test/src/main/java/regclient/pages/hindi/PendingApprovalHindi.java @@ -146,10 +146,6 @@ public boolean isInvalidUsernameMessageDisplayed() { return isElementDisplayed(invalidUsernameMessage); } - public boolean isSubmitButtonEnabledWithEmptyUsername() { - return isElementEnabled(invalidUsernameMessageForempty); - } - public boolean isRejectButtonDisplayed() { return isElementDisplayed(rejectButton); } @@ -223,22 +219,6 @@ public boolean isNoNetworkFoundDisplayed() { return isElementEnabled(noNetworkFound); } - public void clickOnPendingApprovalSubmitButton(int maxRetries) { - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); - - for (int i = 1; i <= maxRetries; i++) { - clickOnSubmitButton(); - try { - boolean popupShown = wait.until(d -> isNoNetworkFoundDisplayed()); - if (popupShown) { - } - } catch (TimeoutException e) { - break; - } - } - System.out.println("Still No Network Found Displayed"); - } - public void clickOnAuthenticateButton() { clickOnElement(authenticateButton); } @@ -246,5 +226,9 @@ public void clickOnAuthenticateButton() { public boolean isAuthenticateButtonEnabled() { return isElementEnabled(authenticateButton); } + + public boolean isSubmitButtonDisabledWithEmptyUsername() { + return isElementDisabled(submitButton); + } } diff --git a/ui-test/src/main/java/regclient/pages/hindi/UpdateOperatorBiometricspageHindi.java b/ui-test/src/main/java/regclient/pages/hindi/UpdateOperatorBiometricspageHindi.java index 9b132231f..d7e67493f 100644 --- a/ui-test/src/main/java/regclient/pages/hindi/UpdateOperatorBiometricspageHindi.java +++ b/ui-test/src/main/java/regclient/pages/hindi/UpdateOperatorBiometricspageHindi.java @@ -400,25 +400,13 @@ public boolean isUpdateOperatorBiometricsPageLoaded() { } public boolean validateThreshold(int expected) { - WebElement el = driver.findElement(MobileBy.AndroidUIAutomator( - "new UiScrollable(new UiSelector().scrollable(true))" + - ".scrollIntoView(new UiSelector().descriptionContains(\"Threshold\"));")); - String text = el.getAttribute("content-desc"); // "Threshold 75%" - int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 - - return actual == expected; - } - - public void updateBiometricsAndWaitPopup() { - for (int i = 1; i <= 5; i++) { - clickOnVerifyAndSaveButton(); - try { - new WebDriverWait(driver, Duration.ofSeconds(60)) - .until(ExpectedConditions.visibilityOf(successPopup)); - return; // success - } catch (Exception ignored) {} - try { Thread.sleep(2000); } catch (InterruptedException ignored) {} - } - throw new AssertionError("Biometrics update success popup not displayed after 5 retries."); + WebElement el = driver + .findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true))" + + ".scrollIntoView(new UiSelector().descriptionContains(\"Threshold\"));")); + String text = el.getAttribute("content-desc"); // "Threshold 75%" + int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 + + return actual == expected; } + } diff --git a/ui-test/src/main/java/regclient/pages/kannada/PendingApprovalKannada.java b/ui-test/src/main/java/regclient/pages/kannada/PendingApprovalKannada.java index 839b1e7c8..c10fcc0e6 100644 --- a/ui-test/src/main/java/regclient/pages/kannada/PendingApprovalKannada.java +++ b/ui-test/src/main/java/regclient/pages/kannada/PendingApprovalKannada.java @@ -193,10 +193,6 @@ public boolean isSubmitButtonEnabled() { return isElementEnabled(submitButton); } - public boolean isSubmitButtonEnabledWithEmptyUsername() { - return isElementEnabled(invalidUsernameMessageForempty); - } - public boolean isNumberOfApplicationDisplayed() { waitTime(2); return isElementDisplayed(displayApplication); @@ -224,22 +220,6 @@ public boolean isNoNetworkFoundDisplayed() { return isElementEnabled(noNetworkFound); } - public void clickOnPendingApprovalSubmitButton(int maxRetries) { - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); - - for (int i = 1; i <= maxRetries; i++) { - clickOnSubmitButton(); - try { - boolean popupShown = wait.until(d -> isNoNetworkFoundDisplayed()); - if (popupShown) { - } - } catch (TimeoutException e) { - break; - } - } - System.out.println("Still No Network Found Displayed"); - } - public void clickOnAuthenticateButton() { clickOnElement(authenticateButton); } @@ -247,4 +227,8 @@ public void clickOnAuthenticateButton() { public boolean isAuthenticateButtonEnabled() { return isElementEnabled(authenticateButton); } + + public boolean isSubmitButtonDisabledWithEmptyUsername() { + return isElementDisabled(submitButton); + } } diff --git a/ui-test/src/main/java/regclient/pages/kannada/UpdateOperatorBiometricspageKannada.java b/ui-test/src/main/java/regclient/pages/kannada/UpdateOperatorBiometricspageKannada.java index 4a298ca7a..099feb766 100644 --- a/ui-test/src/main/java/regclient/pages/kannada/UpdateOperatorBiometricspageKannada.java +++ b/ui-test/src/main/java/regclient/pages/kannada/UpdateOperatorBiometricspageKannada.java @@ -398,30 +398,16 @@ public void clickOnBackButton() { public boolean isUpdateOperatorBiometricsPageLoaded() { return isElementDisplayed(updateOperatorBiometrics); } - + public boolean validateThreshold(int expected) { - WebElement el = driver.findElement(MobileBy.AndroidUIAutomator( - "new UiScrollable(new UiSelector().scrollable(true))" + - ".scrollIntoView(new UiSelector().descriptionContains(\"Threshold\"));" - )); - - String text = el.getAttribute("content-desc"); // "Threshold 75%" - int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 - - return actual == expected; - } - - public void updateBiometricsAndWaitPopup() { - for (int i = 1; i <= 5; i++) { - clickOnVerifyAndSaveButton(); - try { - new WebDriverWait(driver, Duration.ofSeconds(60)) - .until(ExpectedConditions.visibilityOf(successPopup)); - return; // success - } catch (Exception ignored) {} - try { Thread.sleep(2000); } catch (InterruptedException ignored) {} - } - throw new AssertionError("Biometrics update success popup not displayed after 5 retries."); + WebElement el = driver + .findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true))" + + ".scrollIntoView(new UiSelector().descriptionContains(\"Threshold\"));")); + + String text = el.getAttribute("content-desc"); // "Threshold 75%" + int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 + + return actual == expected; } } diff --git a/ui-test/src/main/java/regclient/pages/tamil/PendingApprovalTamil.java b/ui-test/src/main/java/regclient/pages/tamil/PendingApprovalTamil.java index 4fe5d7a6f..206d1da7a 100644 --- a/ui-test/src/main/java/regclient/pages/tamil/PendingApprovalTamil.java +++ b/ui-test/src/main/java/regclient/pages/tamil/PendingApprovalTamil.java @@ -193,10 +193,6 @@ public boolean isSubmitButtonEnabled() { return isElementEnabled(submitButton); } - public boolean isSubmitButtonEnabledWithEmptyUsername() { - return isElementEnabled(invalidUsernameMessageForempty); - } - public boolean isNumberOfApplicationDisplayed() { waitTime(2); return isElementDisplayed(displayApplication); @@ -224,22 +220,6 @@ public boolean isNoNetworkFoundDisplayed() { return isElementEnabled(noNetworkFound); } - public void clickOnPendingApprovalSubmitButton(int maxRetries) { - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3)); - - for (int i = 1; i <= maxRetries; i++) { - clickOnSubmitButton(); - try { - boolean popupShown = wait.until(d -> isNoNetworkFoundDisplayed()); - if (popupShown) { - } - } catch (TimeoutException e) { - break; - } - } - System.out.println("Still No Network Found Displayed"); - } - public void clickOnAuthenticateButton() { clickOnElement(authenticateButton); } @@ -247,5 +227,9 @@ public void clickOnAuthenticateButton() { public boolean isAuthenticateButtonEnabled() { return isElementEnabled(authenticateButton); } + + public boolean isSubmitButtonDisabledWithEmptyUsername() { + return isElementDisabled(submitButton); + } } diff --git a/ui-test/src/main/java/regclient/pages/tamil/UpdateOperatorBiometricspageTamil.java b/ui-test/src/main/java/regclient/pages/tamil/UpdateOperatorBiometricspageTamil.java index 6546cea46..bddf3f29d 100644 --- a/ui-test/src/main/java/regclient/pages/tamil/UpdateOperatorBiometricspageTamil.java +++ b/ui-test/src/main/java/regclient/pages/tamil/UpdateOperatorBiometricspageTamil.java @@ -398,29 +398,16 @@ public void clickOnBackButton() { public boolean isUpdateOperatorBiometricsPageLoaded() { return isElementDisplayed(updateOperatorBiometrics); } - + public boolean validateThreshold(int expected) { - WebElement el = driver.findElement(MobileBy.AndroidUIAutomator( - "new UiScrollable(new UiSelector().scrollable(true))" + - ".scrollIntoView(new UiSelector().descriptionContains(\"வரம்பு\"));" - )); - - String text = el.getAttribute("content-desc"); // "Threshold 75%" - int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 - - return actual == expected; - } - - public void updateBiometricsAndWaitPopup() { - for (int i = 1; i <= 5; i++) { - clickOnVerifyAndSaveButton(); - try { - new WebDriverWait(driver, Duration.ofSeconds(60)) - .until(ExpectedConditions.visibilityOf(successPopup)); - return; // success - } catch (Exception ignored) {} - try { Thread.sleep(2000); } catch (InterruptedException ignored) {} - } - throw new AssertionError("Biometrics update success popup not displayed after 5 retries."); + WebElement el = driver + .findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true))" + + ".scrollIntoView(new UiSelector().descriptionContains(\"வரம்பு\"));")); + + String text = el.getAttribute("content-desc"); // "Threshold 75%" + int actual = Integer.parseInt(text.replaceAll("[^0-9]", "")); // extract 75 + + return actual == expected; } + } diff --git a/ui-test/src/main/java/regclient/utils/TestRunner.java b/ui-test/src/main/java/regclient/utils/TestRunner.java index 950b73609..73791fc94 100644 --- a/ui-test/src/main/java/regclient/utils/TestRunner.java +++ b/ui-test/src/main/java/regclient/utils/TestRunner.java @@ -44,7 +44,7 @@ public static void main(String[] args) { XmlClass addMachineDetails = new XmlClass("regclient.androidTestCases.AddMachineDetails"); XmlClass initialLaunch = new XmlClass("regclient.androidTestCases.InitialLaunch"); - XmlClass logintest = new XmlClass("regclient.androidTestCases.Logintest"); + XmlClass loginTest = new XmlClass("regclient.androidTestCases.LoginTest"); XmlClass newRegistrationAdult = new XmlClass("regclient.androidTestCases.NewRegistrationAdult"); XmlClass newRegistrationAdultException = new XmlClass( "regclient.androidTestCases.NewRegistrationAdultException"); @@ -77,8 +77,8 @@ public static void main(String[] args) { if (Scenarioname.equalsIgnoreCase("initialLaunch")) classes.add(initialLaunch); - if (Scenarioname.equalsIgnoreCase("logintest")) - classes.add(logintest); + if (Scenarioname.equalsIgnoreCase("loginTest")) + classes.add(loginTest); if (Scenarioname.equalsIgnoreCase("newRegistrationAdult")) classes.add(newRegistrationAdult); diff --git a/ui-test/testng.xml b/ui-test/testng.xml index ab31c3312..b52e3f21f 100644 --- a/ui-test/testng.xml +++ b/ui-test/testng.xml @@ -3,7 +3,7 @@ - +