Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package registrationtest.pages;

import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;

import org.testfx.api.FxRobot;
import org.testfx.util.WaitForAsyncUtils;

import javafx.application.Platform;
import javafx.geometry.VerticalDirection;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import registrationtest.controls.Buttons;
import registrationtest.utility.ExtentReportUtil;
import registrationtest.utility.JsonUtil;
import registrationtest.utility.PropertiesUtil;
import registrationtest.utility.WaitsUtil;
Expand Down Expand Up @@ -173,6 +178,7 @@ public void exceptionsFingerPrintSlabRight(String idBioType, String idModality,
listException = exceptionList(jsonContent);
// FINGERPRINT_SLAB_RIGHT
clickModality(idBioType, idModality);
Thread.sleep(500);

if (listException.contains("rightIndex") && listException.contains("rightLittle")
&& listException.contains("rightRing") && listException.contains("rightMiddle")) {
Expand All @@ -195,6 +201,7 @@ public void exceptionsFingerPrintSlabRight(String idBioType, String idModality,
waitsUtil.clickNodeAssert("#rightMiddle");
}
}
WaitForAsyncUtils.waitForFxEvents();
if (flag == false)
clickScanBtn(idBioType, jsonContent, idModality);
} catch (Exception e) {
Expand Down Expand Up @@ -636,6 +643,70 @@ private int readThresholdScoreSafe(String idBioType, String jsonContent) {
}
}

public void verifyCapturedBiometricsRetained(String identity) {
String bioFieldId = "individualBiometrics";
List<String> bioAttributes = bioAttributeList(identity);
List<String> listException = exceptionList(identity);
if (listException == null) {
listException = new ArrayList<>();
}

ExtentReportUtil.test1.info("Verifying biometric data retained on biometric page");
scrollBiometricModalityListToTop();

try {
if (hasIris(bioAttributes)) {
verifyModalityCaptureStatus(bioFieldId, IRIS_DOUBLE, "Iris biometrics");
}
if (hasRightFingers(bioAttributes)) {
verifyModalityCaptureStatus(bioFieldId, FINGERPRINT_SLAB_RIGHT, "Right hand biometrics");
}
if (hasLeftFingers(bioAttributes)) {
verifyModalityCaptureStatus(bioFieldId, FINGERPRINT_SLAB_LEFT, "Left hand biometrics");
}
if (hasThumbs(bioAttributes)) {
verifyModalityCaptureStatus(bioFieldId, FINGERPRINT_SLAB_THUMBS, "Thumb biometrics");
}
if (hasFace(bioAttributes)) {
verifyModalityCaptureStatus(bioFieldId, FACE, "Face biometrics");
}
if (!listException.isEmpty()) {
verifyModalityCaptureStatus(bioFieldId, EXCEPTION_PHOTO, "Exception photo");
}
ExtentReportUtil.test1.info("Biometric data and exception photo retained on biometric page");
} catch (IOException e) {
logger.error("Failed to verify retained biometric data", e);
throw new AssertionError("Failed to verify retained biometric data", e);
}
}

private void scrollBiometricModalityListToTop() {
try {
int scrollCount = Integer.parseInt(PropertiesUtil.getKeyValue("bioscroll"));
for (int i = 0; i < scrollCount; i++) {
robot.scroll(1, VerticalDirection.UP);
}
WaitForAsyncUtils.waitForFxEvents();
} catch (Exception e) {
logger.error("Failed to scroll biometric modality list to top", e);
}
}

private void verifyModalityCaptureStatus(String bioFieldId, String modality, String description) {
String buttonId = "#" + bioFieldId + modality + "Button";
String paneId = "#" + bioFieldId + modality + "PANE";

Node modalityButton = waitsUtil.waitForFirstVisibleNode(buttonId, 20_000);
robot.moveTo(modalityButton);
robot.clickOn(modalityButton);
WaitForAsyncUtils.waitForFxEvents();

Node completionMark = waitsUtil.waitForFirstVisibleNode(paneId, 20_000);
assertTrue(completionMark != null && completionMark.isVisible(),
description + " not displayed on biometric page after document navigation");
ExtentReportUtil.test1.info(description + " verified on biometric page");
}

public void infantbioUploadTBD(String idmod, List<String> list, String id, String identity) {
// TODO Auto-generated method stub
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import registrationtest.pojo.schema.Screens;
import registrationtest.utility.ComboBoxUtil;
import registrationtest.utility.DateUtil;
import registrationtest.utility.ExtentReportUtil;
import registrationtest.utility.JsonUtil;
import registrationtest.utility.PropertiesUtil;
import registrationtest.utility.WaitsUtil;
Expand Down Expand Up @@ -79,6 +80,7 @@ public class DemographicPage {
LinkedHashMap<String, Integer> allignmentgroupMap;

Boolean flag = false;
boolean skipDocumentUpload = false;

public DemographicPage(FxRobot robot) {
logger.info(" DemographicPage Constructor ");
Expand Down Expand Up @@ -282,11 +284,161 @@ public WebViewDocument screensFlow(String JsonIdentity, String flow, String ageG
logger.error("", e);
}
}

if ("BiometricDetails".equalsIgnoreCase(nameTab)
&& "Y".equalsIgnoreCase(JsonUtil.getOptionalIdentityValue(JsonIdentity, "verifyBioAfterSkipPOE"))) {
runBioRetainedAfterSkipPOETest(JsonIdentity, flow, ageGroup);
}

if ("BiometricDetails".equalsIgnoreCase(nameTab)
&& "Y".equalsIgnoreCase(JsonUtil.getOptionalIdentityValue(JsonIdentity, "verifyPoeDeleteFlow"))) {
runBioRetainedAfterPoeDeleteTest(JsonIdentity, flow, ageGroup);
Comment thread
jayesh12234 marked this conversation as resolved.
}
}
return webViewDocument;

}

private void runBioRetainedAfterSkipPOETest(String jsonIdentity, String flow, String ageGroup) {
try {
if (hasDocumentsScreen()) {
skipPoeOnDocumentsScreen(jsonIdentity, flow, ageGroup);
} else if (hasPoeOnBiometricScreen()) {
skipPoeOnBiometricScreen(jsonIdentity);
} else {
throw new AssertionError(
"verifyBioAfterSkipPOE requires a Documents screen or proofOfException on BiometricDetails");
}

buttons.clickNextBtn();

navigateToBiometricScreenForVerification();
biometricUploadPage.verifyCapturedBiometricsRetained(jsonIdentity);
} catch (Exception e) {
logger.error("Bio retained after skip POE verification failed", e);
throw new AssertionError("Bio retained after skip POE verification failed", e);
}
}

private void runBioRetainedAfterPoeDeleteTest(String jsonIdentity, String flow, String ageGroup) {
try {
if (hasDocumentsScreen()) {
uploadAndDeletePoeOnDocumentsScreen(jsonIdentity, flow, ageGroup);
} else if (hasPoeOnBiometricScreen()) {
uploadAndDeletePoeOnBiometricScreen(jsonIdentity);
} else {
throw new AssertionError(
"verifyPoeDeleteFlow requires a Documents screen or proofOfException on BiometricDetails");
}

buttons.clickNextBtn();

navigateToBiometricScreenForVerification();
biometricUploadPage.verifyCapturedBiometricsRetained(jsonIdentity);
} catch (Exception e) {
logger.error("Bio retained after POE delete verification failed", e);
throw new AssertionError("Bio retained after POE delete verification failed", e);
}
}

private void skipPoeOnDocumentsScreen(String jsonIdentity, String flow, String ageGroup) throws IOException {
ExtentReportUtil.test1.info(
"Navigate to document page after biometrics, skip POE upload, click next and verify biometrics");

waitsUtil.clickNodeAssert("#Documents_tab");
scrollVerticalDirectioncount(Integer.parseInt(PropertiesUtil.getKeyValue("proofscroll")));

for (Screens screen : orderedScreensList) {
if (!"Documents".equalsIgnoreCase(screen.getName())) {
continue;
}
for (Schema schema : screen.getFields()) {
if ("fileupload".equals(schema.getControlType()) && !"POE".equalsIgnoreCase(schema.getSubType())) {
contolType(schema, jsonIdentity, flow, ageGroup);
}
}
break;
}

ExtentReportUtil.test1.info("Skipped POE document upload on document page");
skipDocumentUpload = true;
}

private void skipPoeOnBiometricScreen(String jsonIdentity) throws IOException {
ExtentReportUtil.test1.info(
"On biometric page after biometrics, skip POE document upload, click next and verify biometrics");
ExtentReportUtil.test1.info("Skipped POE document upload on biometric page");
skipDocumentUpload = true;
}

private void uploadAndDeletePoeOnDocumentsScreen(String jsonIdentity, String flow, String ageGroup)
throws IOException {
ExtentReportUtil.test1.info(
"Navigate to document page after biometrics, upload POE, delete POE, click next and verify biometrics");

waitsUtil.clickNodeAssert("#Documents_tab");
scrollVerticalDirectioncount(Integer.parseInt(PropertiesUtil.getKeyValue("proofscroll")));

for (Screens screen : orderedScreensList) {
if (!"Documents".equalsIgnoreCase(screen.getName())) {
continue;
}
for (Schema schema : screen.getFields()) {
if ("fileupload".equals(schema.getControlType()) && !"POE".equalsIgnoreCase(schema.getSubType())) {
contolType(schema, jsonIdentity, flow, ageGroup);
}
}
break;
}

documentUploadPage.uploadPoeDocument(jsonIdentity);
ExtentReportUtil.test1.info("Uploaded POE document on document page");
documentUploadPage.deletePoeDocument();
ExtentReportUtil.test1.info("Deleted POE document on document page");
skipDocumentUpload = true;
}

private void uploadAndDeletePoeOnBiometricScreen(String jsonIdentity) throws IOException {
ExtentReportUtil.test1.info(
"On biometric page after biometrics, upload POE, delete POE, click next and verify biometrics");
scrollVerticalDirectioncount(Integer.parseInt(PropertiesUtil.getKeyValue("bioscroll")));
documentUploadPage.uploadPoeDocument(jsonIdentity);
ExtentReportUtil.test1.info("Uploaded POE document on biometric page");
documentUploadPage.deletePoeDocument();
ExtentReportUtil.test1.info("Deleted POE document on biometric page");
skipDocumentUpload = true;
}

private boolean hasDocumentsScreen() {
for (Screens screen : orderedScreensList) {
if ("Documents".equalsIgnoreCase(screen.getName())) {
return true;
}
}
return false;
}

private boolean hasPoeOnBiometricScreen() {
for (Screens screen : orderedScreensList) {
if (!"BiometricDetails".equalsIgnoreCase(screen.getName())) {
continue;
}
for (Schema field : screen.getFields()) {
if ("fileupload".equals(field.getControlType()) && "POE".equalsIgnoreCase(field.getSubType())) {
return true;
}
}
}
return false;
}

private void navigateToBiometricScreenForVerification() {
waitsUtil.waitForFirstVisibleNode("#BiometricDetails_tab", 15_000);
waitsUtil.clickIfPresent("#BiometricDetails_tab");
waitsUtil.waitForFirstVisibleNode("#individualBiometricsIRIS_DOUBLEButton", 20_000);
org.testfx.util.WaitForAsyncUtils.waitForFxEvents();
}

private void scrollVerticalDirection2(int i, Schema schema) {

try {
Expand Down Expand Up @@ -801,6 +953,9 @@ public void applicantBiometrics(Schema schema, String scenario, String id, Strin
public void fileupload(Schema schema, String JsonIdentity, String key, String id, String scenario,
String ageGroup) {
try {
if (skipDocumentUpload) {
return;
}
List<String> documentUploadAttList = documentUploadPage.documentUploadAttributeList(JsonIdentity);
for (String doclist : documentUploadAttList) {
if (schema.getSubType().equals(doclist)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,32 @@ public List<String> documentUploadAttributeList(String identity) {
return documentUploadAttList;
}

public void uploadPoeDocument(String jsonIdentity) {
logger.info("Uploading POE document");
try {
LinkedHashMap<String, String> mapDropValue = JsonUtil.JsonObjSimpleParsing(jsonIdentity, "proofOfException");
Set<String> dropkeys = mapDropValue.keySet();
if (!dropkeys.isEmpty()) {
user_selects_combo_itemdoc("#proofOfException", mapDropValue.get(dropkeys.iterator().next()));
Button scanButton = waitsUtil.waitForNode("#proofOfExceptionbutton", Button.class);
Comment thread
jayesh12234 marked this conversation as resolved.
robot.moveTo(scanButton);
robot.clickOn(scanButton);
selectDocumentScan();
}
} catch (Exception e) {
logger.error("Failed to upload POE document", e);
throw new AssertionError("POE document upload failed", e);
}
}

public void deletePoeDocument() {
logger.info("Deleting POE document");
try {
waitsUtil.clickNodeAssert("#proofOfExceptionclear");
} catch (Exception e) {
logger.error("Failed to delete POE document", e);
throw new AssertionError("POE document delete failed", e);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{ "identity" : {
"ageGroup":"ADULT",
"process":"Lost",
"previewTests":["qrCode","applicationId","dateTime","demographics","biometrics","bioExceptions"],
"ackTests":["qrCode","applicationId","dateTime","demographics","biometrics","bioExceptions"],
"preferredLang":"English",
"documentUploadAttributes":["POB","POA","POI"],
"profile":"Default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"ageGroup":"ADULT",
"process":"Lost",
"UIN":"4538471905",
"ackTests":["qrCode","applicationId","dateTime","biometrics"],
"previewTests":["qrCode","applicationId","dateTime","demographics","biometrics","bioExceptions"],
"ackTests":["qrCode","applicationId","dateTime","demographics","biometrics","bioExceptions"],
"verifyBioAfterSkipPOE":"Y",
"preferredLang":"English",
"documentUploadAttributes":["POB","POA","POI"],
"profile":"Default",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{ "identity" : {
"ageGroup":"MINOR",
"process":"Lost",
"previewTests":["qrCode","applicationId","dateTime","demographics","biometrics","bioExceptions"],
"ackTests":["qrCode","applicationId","dateTime","demographics","biometrics","bioExceptions"],
"preferredLang":"English",
"documentUploadAttributes":["POB","POR","POA","POI"],
"UIN":"5931539704",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"process":"New",
"previewTests":["ALL"],
"verifyPreviewEdit":"Y",
"ackTests":["qrCode","applicationId","dateTime","demographics","documents","biometrics"],
"ackTests":["qrCode","applicationId","dateTime","demographics","documents","biometrics","bioExceptions"],
"preferredLang":"English",
"documentUploadAttributes":["POB","POA","POI"],
"profile":"Default",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{ "identity" : {
"ageGroup":"ADULT",
"process":"New",
"previewTests":["qrCode","applicationId","dateTime","demographics","documents","bioExceptions"],
"previewTests":["qrCode","applicationId","dateTime","demographics","documents","biometrics","bioExceptions"],
"ackTests":["qrCode","applicationId","dateTime","demographics","documents","biometrics","bioExceptions"],
"verifyBioAfterSkipPOE":"Y",
"preferredLang":"English",
"documentUploadAttributes":["POB","POA","POI"],
"profile":"Default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"identity": {
"ageGroup": "INFANT",
"process": "New",
"previewTests":["qrCode","applicationId","dateTime","demographics","documents","biometrics","bioExceptions"],
"ackTests":["qrCode","applicationId","dateTime","demographics","documents","biometrics","bioExceptions"],
"preferredLang": "English",
"documentUploadAttributes": [
"POB",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{ "identity" : {
"ageGroup":"MINOR",
"process":"New",
"previewTests":["qrCode","applicationId","dateTime","demographics","documents","biometrics","bioExceptions"],
"ackTests":["qrCode","applicationId","dateTime","demographics","documents","biometrics","bioExceptions"],
"preferredLang":"English",
"documentUploadAttributes":["POB","POR","POA","POI"],
"UIN":"5931539704",
Expand Down
Loading
Loading