Skip to content

Commit

Permalink
Merge pull request #727 from jayesh12234/develop
Browse files Browse the repository at this point in the history
MOSIP-34293,MOSIP-32510
  • Loading branch information
aranaravi authored Jul 8, 2024
2 parents 4924523 + d26db81 commit 9db6762
Show file tree
Hide file tree
Showing 25 changed files with 737 additions and 1,637 deletions.
2 changes: 1 addition & 1 deletion uitest-resident/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
<version>4.14.1</version>
</dependency>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
import java.util.TimeZone;

import javax.ws.rs.core.MediaType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.Properties;
import java.util.stream.Collectors;

import org.apache.log4j.Logger;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import java.util.List;
import java.util.Properties;

import org.apache.log4j.Logger;

import io.mosip.testrig.residentui.utility.Commons;
import io.mosip.testrig.residentui.utility.TestRunner;
public class ConfigManager {

Expand Down Expand Up @@ -77,6 +74,7 @@ public class ConfigManager {
private static String Aid = "aid";
private static String Headless = "headless";
private static String Docker = "docker";
private static String PacketUpdateWait = "packetUpdateWait";
private static String preconfiguredOtp;


Expand Down Expand Up @@ -185,6 +183,8 @@ public class ConfigManager {
private static String docker;
private static String threadCount;
private static String langselect;
private static String packetUpdateWait;


private static String db_port;
private static String db_domain;
Expand Down Expand Up @@ -407,16 +407,25 @@ public static void init() {

headless =System.getenv(Headless) == null ? propsKernel.getProperty(Headless) : System.getenv(Headless);
propsKernel.setProperty(Headless, headless);

docker =System.getenv(Docker) == null ? propsKernel.getProperty(Docker) : System.getenv(Docker);
propsKernel.setProperty(Docker, docker);



packetUpdateWait =System.getenv(PacketUpdateWait) == null ? propsKernel.getProperty(PacketUpdateWait) : System.getenv(PacketUpdateWait);
propsKernel.setProperty(Docker, packetUpdateWait);

testcases =System.getenv(Testcases) == null ? propsKernel.getProperty(Testcases) : System.getenv(Testcases);
propsKernel.setProperty(Testcases, testcases);

}

public static int packetUpdateWait() {
int wait=0;
wait=Integer.parseInt(packetUpdateWait);
return wait;
}

public static String gettestcases() {
return testcases;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.mosip.testrig.residentui.kernel.util;

import java.util.Map;
import java.util.UUID;

import org.json.simple.JSONObject;

Expand All @@ -16,8 +15,6 @@ public class KernelAuthentication extends BaseTestCase {
static String dataKey = "response";
CommonLibrary clib= new CommonLibrary();
public final Map<String, String> props = clib.readProperty("Kernel");
private String admin_password = props.get("admin_password");
private String admin_userName=props.get("admin_userName");
private String authenticationInternalEndpoint = props.get("authenticationInternal");
private ApplicationLibrary appl=new ApplicationLibrary();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import java.util.Properties;

import javax.ws.rs.core.Response;

import org.apache.log4j.Logger;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.CreatedResponseUtil;
import org.keycloak.admin.client.Keycloak;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
Expand All @@ -18,7 +17,6 @@
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.google.common.collect.ImmutableMap;

//import io.mosip.kernel.core.util.StringUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@
package io.mosip.testrig.residentui.testcase;

import org.openqa.selenium.By;
import org.testng.annotations.Test;

import io.mosip.testrig.residentui.utility.Commons;
import io.mosip.testrig.residentui.utility.JsonUtil;
import io.mosip.testrig.residentui.utility.ResidentBaseClass;

public class BookinganAppointment extends ResidentBaseClass {

@Test
public void bookinganAppointment () throws Exception {
String externalemail="";



Commons.click(test,driver, By.id("dashboardCard3"));
Commons.click(test,driver, By.xpath("(//div[text()=' LOGIN'])[2]"));
Commons.click(test,driver, By.xpath("//mat-select[@role='listbox']"));
//Commons.dropdown(driver, By.id("mat-select-0"));
//Commons.dropdown(driver, By.id("mat-select-0"), "français");
//Commons.enter(driver, By.id("inputFieldContact"), "[email protected]");





}
}
//package io.mosip.testrig.residentui.testcase;
//
//import java.util.ArrayList;
//
//import org.openqa.selenium.By;
//import org.testng.annotations.Test;
//
//import io.mosip.testrig.residentui.kernel.util.ConfigManager;
//import io.mosip.testrig.residentui.utility.Commons;
//import io.mosip.testrig.residentui.utility.MockSMTPListener;
//import io.mosip.testrig.residentui.utility.ResidentBaseClass;
//
//public class BookinganAppointment extends ResidentBaseClass {
//
// @Test
// public void bookinganAppointment () throws Exception {
//// String externalemail = ConfigManager.getexternalemail();
//// Commons.click(test,driver, By.id("bookingAnAppointment"));
//// ArrayList<String> tabs = new ArrayList<>(driver.getWindowHandles());
//// driver.switchTo().window(tabs.get(1));
//// if(ConfigManager.getloginlang().equalsIgnoreCase("fra"))
//// Commons.dropdown(test, driver, By.id("mat-select-0"),"français");
//// else if (ConfigManager.getloginlang().equalsIgnoreCase("ara"))
//// Commons.dropdown(test, driver, By.id("mat-select-0"),"العَرَبِيَّة‎");
//// else
//// Commons.dropdown(test, driver, By.id("mat-select-0"),"English");
//// Commons.enter(test, driver, By.id("inputFieldContact"), Commons.getDateTime());
//// Commons.click(test,driver, By.xpath("//*[text()=' Send OTP ']"));
//// Commons.enter(test, driver, By.id("inputFieldContact"), Commons.getDateTime()+ConfigManager.gettempemail());
//// Commons.click(test,driver, By.xpath("//*[text()=' Send OTP ']"));
//// Commons.enter(test, driver, By.id("inputFieldOTP"),"123456");
//// Commons.click(test,driver, By.xpath("//*[text()=' Verify ']"));
//// Commons.click(test,driver, By.xpath("//*[text()=' OK ']"));
//// Commons.enter(test, driver, By.id("inputFieldOTP"), MockSMTPListener.getOtp(externalemail));
//// Thread.sleep(180000);
//// Commons.click(test,driver, By.xpath("//*[text()=' Send OTP ']"));
//// Commons.enter(test, driver, By.id("inputFieldOTP"), MockSMTPListener.getOtp(externalemail));
//// Commons.click(test,driver, By.xpath("//*[text()=' Verify ']"));
//// Commons.click(test,driver, By.id("mat-checkbox-2"));
//// Commons.click(test,driver, By.xpath("//*[text()=' Submit ']"));
//// Commons.click(test,driver, By.id("mat-checkbox-4-input"));
//// Commons.click(test,driver, By.xpath("//*[text()=' Accept ']"));
//// Commons.enter(test, driver, By.id("mat-input-0"),"abc"+Commons.getDateTime());
//// Commons.enter(test, driver, By.id("mat-input-1"),"abc"+Commons.getDateTime());
//// Commons.enter(test, driver, By.id("mat-input-3"),"20");
//// Commons.dropdown(test, driver, By.id("mat-select-0"));
//// Thread.sleep(11111);
//
//
//
//
// }
//}
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
package io.mosip.testrig.residentui.testcase;


import org.openqa.selenium.By;
import org.testng.annotations.Test;
import io.mosip.testrig.residentui.service.BaseTestCase;
import io.mosip.testrig.residentui.utility.BaseClass;
import io.mosip.testrig.residentui.utility.Commons;

import io.mosip.testrig.residentui.utility.ResidentBaseClass;

@Test(groups = "GI")
public class GetInformation extends ResidentBaseClass {
public class GetInformation extends BaseClass {

@Test(groups = "GI")

public void getInformation() throws Exception {
int totalHierarchyLevels=BaseTestCase.getHierarchyNumbers();
Commons.click(test, driver, By.id("getInformation"));
Commons.click( driver, By.id("getInformation"));
for(int i=0;i<totalHierarchyLevels;i++) {
Commons.dropdown(test, driver, By.id("locationType"), By.id("hierarchyLevel"+i));
Commons.enter(test, driver, By.id("searchLocationBox"), BaseTestCase.GethierarchyName(i));
Thread.sleep(1000);
Commons.click(test, driver, By.id("regCenterSearchBtn"));
Commons.click(test, driver, By.id("regCentersDownloadBtn"));
Commons.dropdown( driver, By.id("locationType"), By.id("hierarchyLevel"+i));
Commons.enter( driver, By.id("searchLocationBox"), BaseTestCase.GethierarchyName(i));
Commons.click( driver, By.id("regCenterSearchBtn"));
Commons.click( driver, By.id("regCentersDownloadBtn"));
Commons.assertCheck(By.id("regCentersDownloadBtn"),"verify if registation center is downloaded");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,87 +4,65 @@

import org.openqa.selenium.By;
import org.testng.annotations.Test;

import com.aventstack.extentreports.Status;

import io.mosip.testrig.residentui.kernel.util.ConfigManager;
import io.mosip.testrig.residentui.utility.BaseClass;
import io.mosip.testrig.residentui.utility.Commons;
import io.mosip.testrig.residentui.utility.JsonUtil;
import io.mosip.testrig.residentui.utility.MockSMTPListener;
import io.mosip.testrig.residentui.utility.ResidentBaseClass;
import io.mosip.testrig.residentui.utility.TestRunner;

@Test(groups = "GMU",dependsOnGroups="UMD")
public class GetMyUIN extends ResidentBaseClass{
public class GetMyUIN extends BaseClass{

String vid =TestRunner.perpetualVid;
@Test(priority=0)
public void getMyUIN() throws Exception {
Thread.sleep(20000);
String tempemail = ConfigManager.gettempemail();
test = extent.createTest("getMyUIN", "verify Login");
Commons.click(test, driver, By.id("getMyUIN"));
Commons.enter(test, driver, By.id("aidValue"), vid);//
test.log(Status.INFO, "AID Entered");
Commons.click(test, driver, By.id("getUinSendOtpBtn"));
Commons.click( driver, By.id("getMyUIN"));
Commons.enter( driver, By.id("aidValue"), vid);//
Commons.click( driver, By.id("getUinSendOtpBtn"));
String otp = MockSMTPListener.getOtp(tempemail);
Thread.sleep(5000);
Commons.enter(test, driver, By.id("otp-input"), otp);
Commons.click(test, driver, By.xpath("//button[@id='getUinsubmitBtn']"));
test.log(Status.INFO, "Click on submit");
Commons.click(test, driver, By.id("dismissBtn"));



Commons.enter( driver, By.id("otp-input"), otp);
Commons.click( driver, By.xpath("//button[@id='getUinsubmitBtn']"));
Commons.assertCheck(By.id("dismissBtn"),"verify if Your UIN card has been successfully downloaded against the Event ID");
Commons.click( driver, By.id("dismissBtn"));
}

@Test(priority=1)
public void getMyUINWithoutAID() throws InterruptedException, IOException {
test=extent.createTest("get MyUIN Without AID", "verify Login");
Thread.sleep(20000);
Commons.click(test, driver, By.id("getMyUIN"));
Commons.click(test,driver, By.id("getUinSendOtpBtn"));
Commons.click( driver, By.id("getMyUIN"));
Commons.click(driver, By.id("getUinSendOtpBtn"));
}

@Test(priority=2)
public void getMyUINWithInvalidOtp() throws Exception {
String tempemail = ConfigManager.gettempemail();
Thread.sleep(20000);
test=extent.createTest("get My UIN With Invalid Otp", "verify Login");
Commons.click(test, driver, By.id("getMyUIN"));
Commons.enter(test,driver, By.id("aidValue"), vid);
Commons.click(test,driver, By.id("getUinSendOtpBtn"));
Commons.click( driver, By.id("getMyUIN"));
Commons.enter(driver, By.id("aidValue"), vid);
Commons.click(driver, By.id("getUinSendOtpBtn"));
String otp = MockSMTPListener.getOtp(tempemail);
Thread.sleep(5000);
Commons.enter(test,driver, By.id("otp-input"), otp+"56");
Commons.click(test,driver, By.xpath("//button[@id='getUinsubmitBtn']"));
Commons.click(test,driver, By.id("dismissBtn"));

Commons.enter(driver, By.id("otp-input"), otp+"56");
Commons.click(driver, By.xpath("//button[@id='getUinsubmitBtn']"));
Commons.click(driver, By.id("dismissBtn"));

}

@Test(priority=3)
public void getMyUINWithExpiredOtp() throws Exception {
// String tempemail = ConfigManager.gettempemail();
Thread.sleep(20000);
test=extent.createTest("get My UIN With Expired Otp", "verify Login");
Commons.click(test, driver, By.id("getMyUIN"));//id
Commons.enter(test,driver, By.id("aidValue"), vid);//
Commons.click(test,driver, By.id("getUinSendOtpBtn"));
// String otp = MockSMTPListener.getOtp(tempemail);
Thread.sleep(5000);
Commons.enter(test,driver, By.id("otp-input"),"12345");
Commons.click(test,driver, By.xpath("//button[@id='getUinsubmitBtn']"));
Commons.click(test,driver, By.id("dismissBtn"));

Commons.click( driver, By.id("getMyUIN"));//id
Commons.enter(driver, By.id("aidValue"), vid);//
Commons.click(driver, By.id("getUinSendOtpBtn"));
Commons.enter(driver, By.id("otp-input"),"12345");
Commons.click(driver, By.xpath("//button[@id='getUinsubmitBtn']"));
Commons.click(driver, By.id("dismissBtn"));

}

@Test(priority=4)
public void getMyUINWithoutOtp() throws Exception {
Thread.sleep(20000);
test=extent.createTest("get My UIN Without Otp", "verify Login");
Commons.click(test, driver, By.id("getMyUIN"));//id
Commons.enter(test,driver, By.id("aidValue"), vid);
Commons.click(test,driver, By.id("getUinSendOtpBtn"));
Thread.sleep(5000);
Commons.click(test,driver, By.xpath("//button[@id='getUinsubmitBtn']"));

Commons.click( driver, By.id("getMyUIN"));//id
Commons.enter(driver, By.id("aidValue"), vid);
Commons.click(driver, By.id("getUinSendOtpBtn"));
Commons.click(driver, By.xpath("//button[@id='getUinsubmitBtn']"));

}
}
Loading

0 comments on commit 9db6762

Please sign in to comment.