From acecd2e3ff43461847ae04ccae65698871961f9c Mon Sep 17 00:00:00 2001 From: Anup Nehe Date: Mon, 23 Oct 2023 11:18:27 +0530 Subject: [PATCH 01/69] MOSIP-29923 --- .../authentication/fw/util/RestClient.java | 39 +++++++++++++++++++ .../adminui/fw/util/AdminTestUtil.java | 3 +- .../testrig/adminui/testcase/DeviceTest.java | 6 ++- .../adminui/utility/BaseTestCaseFunc.java | 15 ++++++- .../main/resources/config/Kernel.properties | 37 +++++++++--------- 5 files changed, 79 insertions(+), 21 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java b/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java index 56195748..13845986 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java @@ -3,9 +3,13 @@ import static io.restassured.RestAssured.given; import java.util.HashMap; +import java.util.Map; import org.apache.log4j.Logger; +import org.json.JSONArray; +import org.json.JSONObject; +import io.mosip.testrig.adminui.kernel.util.ConfigManager; import io.restassured.RestAssured; import io.restassured.config.HttpClientConfig; import io.restassured.config.RestAssuredConfig; @@ -14,6 +18,7 @@ public class RestClient { private static final Logger RESTCLIENT_LOGGER = Logger.getLogger(RestClient.class); + public static String ZONECODE; private static RestAssuredConfig config = RestAssured.config() .httpClient(HttpClientConfig.httpClientConfig().setParam("http.connection.timeout", 500000) .setParam("http.socket.timeout", 500000).setParam("http.connection-manager.timeout", 500000)); @@ -30,6 +35,40 @@ public static Response getRequest(String url, String contentHeader, String accep return getResponse; } + static String getZoneCode(JSONArray responseArray, String code) { + String ZoneCode=""; + + for (int i = 0; i < responseArray.length(); i++) { + ZoneCode = responseArray.getJSONObject(i).getString("code"); + } + + return ZoneCode; + } + public static Response getRequestWithCookieAndPathParm(String url, Map body, String contentHeader, + String acceptHeader, String cookieName, String cookieValue) { + Response getResponse; + JSONObject responseJson = null; + + RESTCLIENT_LOGGER.info("REST-ASSURED: Sending a GET request to " + url); + + getResponse = given().config(config).relaxedHTTPSValidation().pathParams(body) + .cookie(cookieName, cookieValue).log().all().when().get(url).then().log().all().extract() + .response(); + + RESTCLIENT_LOGGER.info( getResponse.asString()); + RESTCLIENT_LOGGER.info( getResponse.time()); + responseJson = new JSONObject(getResponse.getBody().asString()); + if(responseJson.has("response")) { + org.json.JSONArray responseArray = responseJson.getJSONArray("response"); + ZONECODE = getZoneCode (responseArray,"code"); + RESTCLIENT_LOGGER.info( ZONECODE); + + } + + + return getResponse; + } + public static Response getRequestWithCookie(String url, String contentHeader, String acceptHeader, String cookieName, String cookieValue) { RESTCLIENT_LOGGER.info("REST-ASSURED: Sending a GET request to " + url); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java b/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java index f3dc338f..01cab317 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java @@ -237,7 +237,8 @@ public static void initialize() { // Generate Keycloak Users KeycloakUserManager.createUsers(); - BaseTestCaseFunc.mapUserToZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName"),"CSB"); + BaseTestCaseFunc.getLeafeZone(); + BaseTestCaseFunc.mapUserToZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName"),RestClient.ZONECODE); BaseTestCaseFunc.mapZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName")); initialized = true; } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java index 037ca79a..1aa6092f 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java @@ -50,7 +50,11 @@ public void deviceCRUD() throws InterruptedException { // Commons.enter(test,driver, By.id("validity"),validityDate); Commons.calendar(validityDate); Commons.dropdown(test,driver,By.id("deviceSpecId")); - // Commons.dropdown(test,driver,By.id("zone")); + try{ Commons.dropdown(test,driver, By.id("zone")); + + }catch(Exception e) { + test.log(Status.INFO, e); + } Commons.dropdown(test,driver,By.id("regCenterId")); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java index 8eb139cd..b00186a3 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java @@ -20,7 +20,9 @@ import io.mosip.testrig.adminui.kernel.util.CommonLibrary; import io.mosip.testrig.adminui.kernel.util.ConfigManager; import io.mosip.testrig.adminui.kernel.util.KernelAuthentication; +import io.restassured.RestAssured; import io.restassured.response.Response; +import io.restassured.specification.RequestSpecification; //import org.apache.log4j.Logger; @@ -151,13 +153,24 @@ public static JSONObject getRequestJson(String filepath) { return kernelCmnLib.readJsonData(filepath, true); } + + public static void getLeafeZone() { + String token = kernelAuthLib.getTokenByRole("globalAdmin"); + String url=ApplnURI + propsKernel.getProperty("leafzonesURL"); + JSONObject request = new JSONObject(); + + Response response = RestClient.getRequestWithCookieAndPathParm(url, request, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, "Authorization", token); + logger.info(response.getBody()); + } + + @SuppressWarnings("unchecked") public static void mapUserToZone(String user, String zone) { String token = kernelAuthLib.getTokenByRole("globalAdmin"); String url = ApplnURI + propsKernel.getProperty("zoneMappingUrl"); org.json.simple.JSONObject actualrequest = getRequestJson(zoneMappingRequest); JSONObject request = new JSONObject(); - request.put("zoneCode", zone); + request.put("zoneCode", RestClient.ZONECODE); request.put("userId", user); request.put("langCode", BaseTestCaseFunc.getLanguageList().get(0)); request.put("isActive","true"); diff --git a/admintest/src/main/resources/config/Kernel.properties b/admintest/src/main/resources/config/Kernel.properties index ed86e2f9..1dde418d 100644 --- a/admintest/src/main/resources/config/Kernel.properties +++ b/admintest/src/main/resources/config/Kernel.properties @@ -2,6 +2,7 @@ #Make sure all resource apis are covered authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd zoneMappingUrl=/v1/masterdata/zoneuser +leafzonesURL=/v1/masterdata/zones/leafzones/eng zoneNameUrl=/v1/masterdata/zones/zonename zoneMappingActivateUrl=/v1/masterdata/zoneuser userCenterMappingUrl=/v1/masterdata/usercentermapping @@ -12,38 +13,38 @@ bulkUploadUrl=/v1/admin/bulkupload #IDREPO mosip_idrepo_app_id=idrepo mosip_idrepo_client_id=mosip-idrepo-client -mosip_idrepo_client_secret=1goKToWjb8t6nFeW +mosip_idrepo_client_secret=uqQIwIcrlz5oElb5 #IDREPO mosip_idrepo_app_id=idrepo mosip_idrepo_client_id=mosip-idrepo-client -mosip_idrepo_client_secret=1goKToWjb8t6nFeW +mosip_idrepo_client_secret=uqQIwIcrlz5oElb5 keycloak-realm-id=mosip -keycloak-external-url=https://iam.qa-upgrade3.mosip.net +keycloak-external-url=https://iam.qa-triad.mosip.net mosip_testrig_client_id=mosip-testrig-client -mosip_testrig_client_secret=F0nqSasG5fWPpBvG +mosip_testrig_client_secret=84VRHBpEVx4AVB7n admin mosip_admin_app_id=admin admin_password=mosip123 #actuall user login will be 'adminui-auto12' -admin_userName=auto126 +admin_userName=auto122new1 mosip_admin_client_id=mosip-admin-client -mosip_admin_client_secret=f3mZVaYBfuvyfcjJ +mosip_admin_client_secret=ik6vQx0u60FDemR3 #admin admin_zone_password=mosip123 admin_zone_userName=globaladmin mosip_regclient_app_id=registrationclient mosip_reg_client_id=mosip-reg-client -mosip_reg_client_secret=zPnLp4cpbpl3z6LX -iam-users-to-create=auto126 +mosip_reg_client_secret=IviZHMzm4lboHBDJ +iam-users-to-create=auto122new1,globaladmin #iam-users-to-create=111997,220005,111992 iam-users-password=mosip123,mosip123 -roles.auto126=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN +roles.auto122new1=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN roles.globaladmin=GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip -partner_url=jdbc:postgresql://qa-upgrade3.mosip.net:5432/mosip_ida +partner_url=jdbc:postgresql://qa-triad.mosip.net:5432/mosip_ida #----------------------------------Database properties----------------------------------------------------------# postgresqlUser=postgresql db-port=5432 -db-server=qa-upgrade3.mosip.net +db-server=qa-triad.mosip.net hibernate.connection.driver_class=org.postgresql.Driver hibernate.connection.pool_size=1 hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect @@ -56,9 +57,9 @@ km_db_schema=keymgr master_db_schema=master audit_db_schema=audit ida_db_schema=ida -db-server=qa-upgrade3.mosip.net -keycloak-external-url=https://iam.qa-upgrade3.mosip.net -audit_url=jdbc:postgresql://qa-upgrade3.mosip.net:5432/mosip_audit +db-server=qa-triad.mosip.net +keycloak-external-url=https://iam.qa-triad.mosip.net +audit_url=jdbc:postgresql://qa-triad.mosip.net:5432/mosip_audit driver_class=org.postgresql.Driver pool_size=1 dialect=org.hibernate.dialect.PostgreSQLDialect @@ -68,7 +69,7 @@ db-su-user=postgres postgresql-password=9AdeAN3GFr postgresqlUser=postgresql db-port=5432 -db-server=qa-upgrade3.mosip.net +db-server=qa-triad.mosip.net s3-user-key=minioadmin s3-user-secret=minioadmin s3-host=http://minio.minio:9000 @@ -100,7 +101,7 @@ validateBindingEndpoint=esignet-binding #authCertsPath=/home/mosip/authcerts #To run locally authCertsPath= -adminPortalPath=https://admin.qa-upgrade3.mosip.net/ -apiEnvUser=api-internal.qa-upgrade3 -apiInternalEndPoint=https://api-internal.qa-upgrade3.mosip.net +adminPortalPath=https://admin.qa-triad.mosip.net/ +apiEnvUser=api-internal.qa-triad +apiInternalEndPoint=https://api-internal.qa-triad.mosip.net \ No newline at end of file From 6f92e276d4167205de2603665ee96308caf396a2 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 14 Dec 2023 11:50:22 +0530 Subject: [PATCH 02/69] MOSIP-30743 Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java | 2 +- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java index b1c9aa19..af9aa126 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java @@ -91,7 +91,7 @@ public void bulkUploadCRUD(String table) throws Exception { // Commons.click(test,driver,By.id("fileInput")); - String filePath = System.getProperty("user.dir") + "\\BulkUploadFiles\\"+ JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang")+"\\"+table+".csv"; + String filePath = System.getProperty("user.dir") + System.getProperty("path.config")+ "\\BulkUploadFiles\\"+ JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang")+"\\"+table+".csv"; Commons.enter(test, driver, By.id("fileInput"), filePath); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index a0e64ae7..fd02025a 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -189,7 +189,7 @@ public static String[] readFolderJsonList() { try { String langcode = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - File directoryPath = new File(System.getProperty("user.dir") + "\\BulkUploadFiles\\" + langcode + "\\"); + File directoryPath = new File(System.getProperty("user.dir") + System.getProperty("path.config")+ "\\BulkUploadFiles\\" + langcode + "\\"); if (directoryPath.exists()) { From 6735a35a2d8f3954ea1210d5f079124600dee0d0 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 14 Dec 2023 11:57:43 +0530 Subject: [PATCH 03/69] MOSIP-30743 Signed-off-by: Jayesh Kharode --- .../authentication/fw/util/RestClient.java | 39 ------------------- .../adminui/fw/util/AdminTestUtil.java | 3 +- .../testrig/adminui/testcase/DeviceTest.java | 6 +-- .../adminui/utility/BaseTestCaseFunc.java | 15 +------ .../testrig/adminui/utility/TestRunner.java | 3 +- .../main/resources/config/Kernel.properties | 37 +++++++++--------- 6 files changed, 23 insertions(+), 80 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java b/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java index 13845986..56195748 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java @@ -3,13 +3,9 @@ import static io.restassured.RestAssured.given; import java.util.HashMap; -import java.util.Map; import org.apache.log4j.Logger; -import org.json.JSONArray; -import org.json.JSONObject; -import io.mosip.testrig.adminui.kernel.util.ConfigManager; import io.restassured.RestAssured; import io.restassured.config.HttpClientConfig; import io.restassured.config.RestAssuredConfig; @@ -18,7 +14,6 @@ public class RestClient { private static final Logger RESTCLIENT_LOGGER = Logger.getLogger(RestClient.class); - public static String ZONECODE; private static RestAssuredConfig config = RestAssured.config() .httpClient(HttpClientConfig.httpClientConfig().setParam("http.connection.timeout", 500000) .setParam("http.socket.timeout", 500000).setParam("http.connection-manager.timeout", 500000)); @@ -35,40 +30,6 @@ public static Response getRequest(String url, String contentHeader, String accep return getResponse; } - static String getZoneCode(JSONArray responseArray, String code) { - String ZoneCode=""; - - for (int i = 0; i < responseArray.length(); i++) { - ZoneCode = responseArray.getJSONObject(i).getString("code"); - } - - return ZoneCode; - } - public static Response getRequestWithCookieAndPathParm(String url, Map body, String contentHeader, - String acceptHeader, String cookieName, String cookieValue) { - Response getResponse; - JSONObject responseJson = null; - - RESTCLIENT_LOGGER.info("REST-ASSURED: Sending a GET request to " + url); - - getResponse = given().config(config).relaxedHTTPSValidation().pathParams(body) - .cookie(cookieName, cookieValue).log().all().when().get(url).then().log().all().extract() - .response(); - - RESTCLIENT_LOGGER.info( getResponse.asString()); - RESTCLIENT_LOGGER.info( getResponse.time()); - responseJson = new JSONObject(getResponse.getBody().asString()); - if(responseJson.has("response")) { - org.json.JSONArray responseArray = responseJson.getJSONArray("response"); - ZONECODE = getZoneCode (responseArray,"code"); - RESTCLIENT_LOGGER.info( ZONECODE); - - } - - - return getResponse; - } - public static Response getRequestWithCookie(String url, String contentHeader, String acceptHeader, String cookieName, String cookieValue) { RESTCLIENT_LOGGER.info("REST-ASSURED: Sending a GET request to " + url); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java b/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java index 01cab317..f3dc338f 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java @@ -237,8 +237,7 @@ public static void initialize() { // Generate Keycloak Users KeycloakUserManager.createUsers(); - BaseTestCaseFunc.getLeafeZone(); - BaseTestCaseFunc.mapUserToZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName"),RestClient.ZONECODE); + BaseTestCaseFunc.mapUserToZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName"),"CSB"); BaseTestCaseFunc.mapZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName")); initialized = true; } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java index 1aa6092f..037ca79a 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java @@ -50,11 +50,7 @@ public void deviceCRUD() throws InterruptedException { // Commons.enter(test,driver, By.id("validity"),validityDate); Commons.calendar(validityDate); Commons.dropdown(test,driver,By.id("deviceSpecId")); - try{ Commons.dropdown(test,driver, By.id("zone")); - - }catch(Exception e) { - test.log(Status.INFO, e); - } + // Commons.dropdown(test,driver,By.id("zone")); Commons.dropdown(test,driver,By.id("regCenterId")); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java index b00186a3..8eb139cd 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java @@ -20,9 +20,7 @@ import io.mosip.testrig.adminui.kernel.util.CommonLibrary; import io.mosip.testrig.adminui.kernel.util.ConfigManager; import io.mosip.testrig.adminui.kernel.util.KernelAuthentication; -import io.restassured.RestAssured; import io.restassured.response.Response; -import io.restassured.specification.RequestSpecification; //import org.apache.log4j.Logger; @@ -153,24 +151,13 @@ public static JSONObject getRequestJson(String filepath) { return kernelCmnLib.readJsonData(filepath, true); } - - public static void getLeafeZone() { - String token = kernelAuthLib.getTokenByRole("globalAdmin"); - String url=ApplnURI + propsKernel.getProperty("leafzonesURL"); - JSONObject request = new JSONObject(); - - Response response = RestClient.getRequestWithCookieAndPathParm(url, request, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, "Authorization", token); - logger.info(response.getBody()); - } - - @SuppressWarnings("unchecked") public static void mapUserToZone(String user, String zone) { String token = kernelAuthLib.getTokenByRole("globalAdmin"); String url = ApplnURI + propsKernel.getProperty("zoneMappingUrl"); org.json.simple.JSONObject actualrequest = getRequestJson(zoneMappingRequest); JSONObject request = new JSONObject(); - request.put("zoneCode", RestClient.ZONECODE); + request.put("zoneCode", zone); request.put("userId", user); request.put("langCode", BaseTestCaseFunc.getLanguageList().get(0)); request.put("isActive","true"); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java index 4bb6b42b..371c32c1 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java @@ -144,11 +144,12 @@ public static String GetKernalFilename(){ String kernalpath=null; if(System.getProperty("env.user")==null) { kernalpath="Kernel.properties"; - + }else { kernalpath="Kernel_"+path+".properties"; } return kernalpath; } + } diff --git a/admintest/src/main/resources/config/Kernel.properties b/admintest/src/main/resources/config/Kernel.properties index 1dde418d..ed86e2f9 100644 --- a/admintest/src/main/resources/config/Kernel.properties +++ b/admintest/src/main/resources/config/Kernel.properties @@ -2,7 +2,6 @@ #Make sure all resource apis are covered authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd zoneMappingUrl=/v1/masterdata/zoneuser -leafzonesURL=/v1/masterdata/zones/leafzones/eng zoneNameUrl=/v1/masterdata/zones/zonename zoneMappingActivateUrl=/v1/masterdata/zoneuser userCenterMappingUrl=/v1/masterdata/usercentermapping @@ -13,38 +12,38 @@ bulkUploadUrl=/v1/admin/bulkupload #IDREPO mosip_idrepo_app_id=idrepo mosip_idrepo_client_id=mosip-idrepo-client -mosip_idrepo_client_secret=uqQIwIcrlz5oElb5 +mosip_idrepo_client_secret=1goKToWjb8t6nFeW #IDREPO mosip_idrepo_app_id=idrepo mosip_idrepo_client_id=mosip-idrepo-client -mosip_idrepo_client_secret=uqQIwIcrlz5oElb5 +mosip_idrepo_client_secret=1goKToWjb8t6nFeW keycloak-realm-id=mosip -keycloak-external-url=https://iam.qa-triad.mosip.net +keycloak-external-url=https://iam.qa-upgrade3.mosip.net mosip_testrig_client_id=mosip-testrig-client -mosip_testrig_client_secret=84VRHBpEVx4AVB7n +mosip_testrig_client_secret=F0nqSasG5fWPpBvG admin mosip_admin_app_id=admin admin_password=mosip123 #actuall user login will be 'adminui-auto12' -admin_userName=auto122new1 +admin_userName=auto126 mosip_admin_client_id=mosip-admin-client -mosip_admin_client_secret=ik6vQx0u60FDemR3 +mosip_admin_client_secret=f3mZVaYBfuvyfcjJ #admin admin_zone_password=mosip123 admin_zone_userName=globaladmin mosip_regclient_app_id=registrationclient mosip_reg_client_id=mosip-reg-client -mosip_reg_client_secret=IviZHMzm4lboHBDJ -iam-users-to-create=auto122new1,globaladmin +mosip_reg_client_secret=zPnLp4cpbpl3z6LX +iam-users-to-create=auto126 #iam-users-to-create=111997,220005,111992 iam-users-password=mosip123,mosip123 -roles.auto122new1=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN +roles.auto126=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN roles.globaladmin=GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip -partner_url=jdbc:postgresql://qa-triad.mosip.net:5432/mosip_ida +partner_url=jdbc:postgresql://qa-upgrade3.mosip.net:5432/mosip_ida #----------------------------------Database properties----------------------------------------------------------# postgresqlUser=postgresql db-port=5432 -db-server=qa-triad.mosip.net +db-server=qa-upgrade3.mosip.net hibernate.connection.driver_class=org.postgresql.Driver hibernate.connection.pool_size=1 hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect @@ -57,9 +56,9 @@ km_db_schema=keymgr master_db_schema=master audit_db_schema=audit ida_db_schema=ida -db-server=qa-triad.mosip.net -keycloak-external-url=https://iam.qa-triad.mosip.net -audit_url=jdbc:postgresql://qa-triad.mosip.net:5432/mosip_audit +db-server=qa-upgrade3.mosip.net +keycloak-external-url=https://iam.qa-upgrade3.mosip.net +audit_url=jdbc:postgresql://qa-upgrade3.mosip.net:5432/mosip_audit driver_class=org.postgresql.Driver pool_size=1 dialect=org.hibernate.dialect.PostgreSQLDialect @@ -69,7 +68,7 @@ db-su-user=postgres postgresql-password=9AdeAN3GFr postgresqlUser=postgresql db-port=5432 -db-server=qa-triad.mosip.net +db-server=qa-upgrade3.mosip.net s3-user-key=minioadmin s3-user-secret=minioadmin s3-host=http://minio.minio:9000 @@ -101,7 +100,7 @@ validateBindingEndpoint=esignet-binding #authCertsPath=/home/mosip/authcerts #To run locally authCertsPath= -adminPortalPath=https://admin.qa-triad.mosip.net/ -apiEnvUser=api-internal.qa-triad -apiInternalEndPoint=https://api-internal.qa-triad.mosip.net +adminPortalPath=https://admin.qa-upgrade3.mosip.net/ +apiEnvUser=api-internal.qa-upgrade3 +apiInternalEndPoint=https://api-internal.qa-upgrade3.mosip.net \ No newline at end of file From 86740ceab984ec98442c6387478cccd872f45e40 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 14 Dec 2023 14:45:04 +0530 Subject: [PATCH 04/69] MOSIP-30743 Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java | 2 +- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java index af9aa126..a01dbe2c 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java @@ -91,7 +91,7 @@ public void bulkUploadCRUD(String table) throws Exception { // Commons.click(test,driver,By.id("fileInput")); - String filePath = System.getProperty("user.dir") + System.getProperty("path.config")+ "\\BulkUploadFiles\\"+ JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang")+"\\"+table+".csv"; + String filePath = TestRunner.getResourcePath()+ "\\BulkUploadFiles\\"+ JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang")+"\\"+table+".csv"; Commons.enter(test, driver, By.id("fileInput"), filePath); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index fd02025a..127c1f4a 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -189,7 +189,7 @@ public static String[] readFolderJsonList() { try { String langcode = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - File directoryPath = new File(System.getProperty("user.dir") + System.getProperty("path.config")+ "\\BulkUploadFiles\\" + langcode + "\\"); + File directoryPath = new File(TestRunner.getResourcePath()+ "\\BulkUploadFiles\\" + langcode + "\\"); if (directoryPath.exists()) { From 100786505304fded5f6b762e0a102c7ecb3926f6 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 14 Dec 2023 15:00:37 +0530 Subject: [PATCH 05/69] MOSIP-30743 Signed-off-by: Jayesh Kharode --- admintest/src/main/resources/TestData.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/resources/TestData.json b/admintest/src/main/resources/TestData.json index 6b2d0758..e8ab6131 100644 --- a/admintest/src/main/resources/TestData.json +++ b/admintest/src/main/resources/TestData.json @@ -18,7 +18,7 @@ "14machineTypesCRUD": "MT", "15templateCRUD": "T", "BELOW_ARE_STATIC_KEYWORDS": "We are using this setExcludedGroups to exclude scenarios", - "setExcludedGroups": "BU", + "setExcludedGroups": "BL,CTR,CT,DS,D,DT,DOC,DOCT,DF,H,MS,M,MT,T", "holidayDateCenter": "10/12/2025", "holidayDate": "10/09/2025", "validityDate":"10/12/2026", From b25822efa7445f4d5f970850032d548570ab6700 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 26 Dec 2023 11:28:53 +0530 Subject: [PATCH 06/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 7 +- .../authentication/fw/util/RestClient.java | 39 + .../adminui/fw/util/AdminTestUtil.java | 79 +- .../adminui/kernel/util/ConfigManager.java | 26 + .../testrig/adminui/utility/BaseClass.java | 24 +- .../adminui/utility/BaseTestCaseFunc.java | 15 +- .../adminui/utility/EmailableReport.java | 849 ++++++++++++++++++ .../testrig/adminui/utility/TestRunner.java | 55 +- .../main/resources/config/Kernel.properties | 48 +- .../config/healthCheckEndpoint.properties | 43 + .../resources/config/kernel_dev2.properties | 110 +++ .../src/main/resources/testngFile/testng.xml | 38 + 12 files changed, 1267 insertions(+), 66 deletions(-) create mode 100644 admintest/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java create mode 100644 admintest/src/main/resources/config/healthCheckEndpoint.properties create mode 100644 admintest/src/main/resources/config/kernel_dev2.properties create mode 100644 admintest/src/main/resources/testngFile/testng.xml diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 0c8f0748..abab59c7 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -1,5 +1,5 @@ -FROM openjdk:11-jre - +FROM selenium/standalone-chrome:latest +USER root ARG SOURCE ARG COMMIT_HASH ARG COMMIT_ID @@ -32,7 +32,8 @@ RUN groupadd -g ${container_user_gid} ${container_user_group} \ USER ${container_user_uid}:${container_user_gid} COPY --chown=${container_user_uid}:${container_user} --chmod=771 ./entrypoint.sh ${work_dir}/entrypoint.sh -COPY --chown=${container_user}:${container_user} ./src/main/resources/ ${work_dir} +COPY --chown=${container_user}:${container_user} ./src/main/resources/ ${work_dir}/resources/ +COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir} # set working directory WORKDIR ${work_dir} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java b/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java index 56195748..13845986 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java @@ -3,9 +3,13 @@ import static io.restassured.RestAssured.given; import java.util.HashMap; +import java.util.Map; import org.apache.log4j.Logger; +import org.json.JSONArray; +import org.json.JSONObject; +import io.mosip.testrig.adminui.kernel.util.ConfigManager; import io.restassured.RestAssured; import io.restassured.config.HttpClientConfig; import io.restassured.config.RestAssuredConfig; @@ -14,6 +18,7 @@ public class RestClient { private static final Logger RESTCLIENT_LOGGER = Logger.getLogger(RestClient.class); + public static String ZONECODE; private static RestAssuredConfig config = RestAssured.config() .httpClient(HttpClientConfig.httpClientConfig().setParam("http.connection.timeout", 500000) .setParam("http.socket.timeout", 500000).setParam("http.connection-manager.timeout", 500000)); @@ -30,6 +35,40 @@ public static Response getRequest(String url, String contentHeader, String accep return getResponse; } + static String getZoneCode(JSONArray responseArray, String code) { + String ZoneCode=""; + + for (int i = 0; i < responseArray.length(); i++) { + ZoneCode = responseArray.getJSONObject(i).getString("code"); + } + + return ZoneCode; + } + public static Response getRequestWithCookieAndPathParm(String url, Map body, String contentHeader, + String acceptHeader, String cookieName, String cookieValue) { + Response getResponse; + JSONObject responseJson = null; + + RESTCLIENT_LOGGER.info("REST-ASSURED: Sending a GET request to " + url); + + getResponse = given().config(config).relaxedHTTPSValidation().pathParams(body) + .cookie(cookieName, cookieValue).log().all().when().get(url).then().log().all().extract() + .response(); + + RESTCLIENT_LOGGER.info( getResponse.asString()); + RESTCLIENT_LOGGER.info( getResponse.time()); + responseJson = new JSONObject(getResponse.getBody().asString()); + if(responseJson.has("response")) { + org.json.JSONArray responseArray = responseJson.getJSONArray("response"); + ZONECODE = getZoneCode (responseArray,"code"); + RESTCLIENT_LOGGER.info( ZONECODE); + + } + + + return getResponse; + } + public static Response getRequestWithCookie(String url, String contentHeader, String acceptHeader, String cookieName, String cookieValue) { RESTCLIENT_LOGGER.info("REST-ASSURED: Sending a GET request to " + url); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java b/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java index f3dc338f..847ed9e5 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java @@ -1,5 +1,10 @@ package io.mosip.testrig.adminui.fw.util; +import static io.restassured.RestAssured.given; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -21,6 +26,8 @@ import io.mosip.testrig.adminui.kernel.util.KernelAuthentication; import io.mosip.testrig.adminui.kernel.util.KeycloakUserManager; import io.mosip.testrig.adminui.utility.BaseTestCaseFunc; +import io.mosip.testrig.adminui.utility.TestRunner; +import io.restassured.http.ContentType; import io.restassured.response.Response; import org.apache.commons.lang.RandomStringUtils; @@ -32,6 +39,9 @@ public class AdminTestUtil extends BaseTestCaseFunc { public static String tokenRoleIdRepo = "idrepo"; public static String tokenRoleAdmin = "admin"; public static boolean initialized = false; + public static String propsHealthCheckURL = TestRunner.getResourcePath() + "/" + + "config/healthCheckEndpoint.properties"; + private static String serverComponentsCommitDetails; public static String getUnUsedUIN(String role){ @@ -53,6 +63,63 @@ public static String getMasterDataSchema(String role){ return response.asString(); } + public static String getCommitDetails(String path) { + + Response response = null; + response = given().contentType(ContentType.JSON).get(path); + if (response != null && response.getStatusCode() == 200) { + logger.info(response.getBody().asString()); + JSONObject jsonResponse = new JSONObject(response.getBody().asString()); + return "Group: " + jsonResponse.getJSONObject("build").getString("group") + ", Artifact: " + + jsonResponse.getJSONObject("build").getString("artifact") + ", version: " + + jsonResponse.getJSONObject("build").getString("version") + ", Commit ID: " + + jsonResponse.getJSONObject("git").getJSONObject("commit").getString("id"); + } + return path + "- No Response"; + } + public static String getServerComponentsDetails() { + if (serverComponentsCommitDetails != null && !serverComponentsCommitDetails.isEmpty()) + return serverComponentsCommitDetails; + + File file = new File(propsHealthCheckURL); + FileReader fileReader = null; + BufferedReader bufferedReader = null; + StringBuilder stringBuilder = new StringBuilder(); + try { + fileReader = new FileReader(file); + bufferedReader = new BufferedReader(fileReader); + String line; + + while ((line = bufferedReader.readLine()) != null) { + if (line.trim().equals("") || line.trim().startsWith("#")) + continue; + String[] parts = line.trim().split("="); + if (parts.length > 1) { + if (ConfigManager.isInServiceNotDeployedList(parts[1])) { + continue; + } + stringBuilder.append("\n") + .append(getCommitDetails(BaseTestCaseFunc.ApplnURI + parts[1].replace("health", "info"))); + } + } + } catch (Exception e) { + logger.error(e.getMessage()); + } finally { + AdminTestUtil.closeBufferedReader(bufferedReader); + AdminTestUtil.closeFileReader(fileReader); + } + serverComponentsCommitDetails = stringBuilder.toString(); + return serverComponentsCommitDetails; + } + public static void closeBufferedReader(BufferedReader bufferedReader) { + if (bufferedReader != null) { + try { + bufferedReader.close(); + } catch (IOException e) { + // logger.error(GlobalConstants.EXCEPTION_STRING_2 + e.getMessage()); + } + } + } public static String generateCurrentUTCTimeStamp() { Date date = new Date(); @@ -74,6 +141,15 @@ public static boolean activateUIN(String inputJson, String role) { return responseJson.getJSONObject("response").getString("status").equalsIgnoreCase("ACTIVATED"); } + public static void closeFileReader(FileReader fileReader) { + if (fileReader != null) { + try { + fileReader.close(); + } catch (IOException e) { + // logger.error(GlobalConstants.EXCEPTION_STRING_2 + e.getMessage()); + } + } + } public static String buildaddIdentityRequestBody(String schemaJson, String uin, String rid) { org.json.JSONObject schemaresponseJson = new org.json.JSONObject(schemaJson); @@ -237,7 +313,8 @@ public static void initialize() { // Generate Keycloak Users KeycloakUserManager.createUsers(); - BaseTestCaseFunc.mapUserToZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName"),"CSB"); + BaseTestCaseFunc.getLeafeZone(); + BaseTestCaseFunc.mapUserToZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName"),RestClient.ZONECODE); BaseTestCaseFunc.mapZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName")); initialized = true; } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java index 43cdaac9..398be60d 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java @@ -3,6 +3,8 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.util.Arrays; +import java.util.List; import java.util.Properties; import org.apache.log4j.Logger; @@ -86,6 +88,7 @@ public class ConfigManager { private static String MASTER_DB_PASS = "postgresql-password"; private static String MASTER_DB_SCHEMA = "master_db_schema"; // + private static String SERVICES_NOT_DEPLOYED = "servicesNotDeployed"; private static String IAM_EXTERNAL_URL = "keycloak-external-url"; private static String IAM_ADMINPORTAL_PATH = "adminPortalPath"; private static String IAM_APIENVUSER = "apiEnvUser"; @@ -172,6 +175,7 @@ public class ConfigManager { // private static String km_db_pass; // private static String km_db_schema; // + private static String serviceNotDeployedList; private static String enableDebug; private static String master_db_user; private static String master_db_pass; @@ -255,6 +259,10 @@ public static void init() { : System.getenv(IAM_APIINTERNALENDPOINT); logger.info("apiinternalendpoint from config manager::" + iam_apiinternalendpoint); + serviceNotDeployedList = System.getenv(SERVICES_NOT_DEPLOYED) == null + ? propsKernel.getProperty(SERVICES_NOT_DEPLOYED) + : System.getenv(SERVICES_NOT_DEPLOYED); + propsKernel.setProperty(SERVICES_NOT_DEPLOYED, serviceNotDeployedList); //admin testdata end iam_realm_id = getValueForKey(IAM_REALM_ID); iam_users_to_create = getValueForKey(IAM_USERS_TO_CREATE); @@ -515,6 +523,24 @@ private static Properties getproperty(String path) { } return prop; } + public static boolean isInServiceNotDeployedList(String stringToFind) { + synchronized (serviceNotDeployedList) { + if (serviceNotDeployedList.isBlank()) + return false; + List serviceNotDeployed = Arrays.asList(serviceNotDeployedList.split(",")); + if (ConfigManager.IsDebugEnabled()) + logger.info("serviceNotDeployedList: " + serviceNotDeployedList + ", serviceNotDeployed : " + serviceNotDeployed + + ", stringToFind : " + stringToFind); + for (String string : serviceNotDeployed) { + if (string.equalsIgnoreCase(stringToFind)) + return true; + else if(stringToFind.toLowerCase().contains(string.toLowerCase())) { + return true; + } + } + } + return false; + } public static String getiam_adminportal_path() { return iam_adminportal_path; diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 127c1f4a..1d51f0c5 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -89,16 +89,20 @@ public void setUp() throws Exception { Reporter.log("BaseClass",true); test=extent.createTest(getCommitId(),getCommitId()); - ChromeOptions options = new ChromeOptions(); - - String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); - - - if(headless.equalsIgnoreCase("yes")) { - options.addArguments("--headless=new"); - } - - WebDriverManager.chromedriver().setup(); + if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { + String configFilePath ="/usr/bin/chromedriver"; + System.setProperty("webdriver.chrome.driver", configFilePath); + }else { + WebDriverManager.chromedriver().setup(); + } + + + ChromeOptions options = new ChromeOptions(); + String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); + if(headless.equalsIgnoreCase("yes")) { + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + + } driver=new ChromeDriver(options); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java index 8eb139cd..b00186a3 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java @@ -20,7 +20,9 @@ import io.mosip.testrig.adminui.kernel.util.CommonLibrary; import io.mosip.testrig.adminui.kernel.util.ConfigManager; import io.mosip.testrig.adminui.kernel.util.KernelAuthentication; +import io.restassured.RestAssured; import io.restassured.response.Response; +import io.restassured.specification.RequestSpecification; //import org.apache.log4j.Logger; @@ -151,13 +153,24 @@ public static JSONObject getRequestJson(String filepath) { return kernelCmnLib.readJsonData(filepath, true); } + + public static void getLeafeZone() { + String token = kernelAuthLib.getTokenByRole("globalAdmin"); + String url=ApplnURI + propsKernel.getProperty("leafzonesURL"); + JSONObject request = new JSONObject(); + + Response response = RestClient.getRequestWithCookieAndPathParm(url, request, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, "Authorization", token); + logger.info(response.getBody()); + } + + @SuppressWarnings("unchecked") public static void mapUserToZone(String user, String zone) { String token = kernelAuthLib.getTokenByRole("globalAdmin"); String url = ApplnURI + propsKernel.getProperty("zoneMappingUrl"); org.json.simple.JSONObject actualrequest = getRequestJson(zoneMappingRequest); JSONObject request = new JSONObject(); - request.put("zoneCode", zone); + request.put("zoneCode", RestClient.ZONECODE); request.put("userId", user); request.put("langCode", BaseTestCaseFunc.getLanguageList().get(0)); request.put("isActive","true"); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java new file mode 100644 index 00000000..8adad35b --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java @@ -0,0 +1,849 @@ +package io.mosip.testrig.adminui.utility; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.lang.reflect.Field; +import java.text.NumberFormat; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.testng.IReporter; +import org.testng.ISuite; +import org.testng.ISuiteResult; +import org.testng.ITestContext; +import org.testng.ITestResult; +import org.testng.Reporter; +import org.testng.collections.Lists; +import org.testng.internal.Utils; +import org.testng.xml.XmlSuite; + +import io.mosip.testrig.adminui.fw.util.AdminTestUtil; +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +import io.mosip.testrig.adminui.kernel.util.S3Adapter; + + + + +/** + * Reporter that generates a single-page HTML report of the test results. + */ +public class EmailableReport implements IReporter { + static Logger logger = Logger.getLogger(EmailableReport.class); + + protected PrintWriter writer; + + protected final List suiteResults = Lists.newArrayList(); + + // Reusable buffer + private final StringBuilder buffer = new StringBuilder(); + + private String fileName = "emailable-report.html"; + + private static final String JVM_ARG = "emailable.report2.name"; + + int totalPassedTests = 0; + int totalSkippedTests = 0; + int totalFailedTests = 0; + + + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFileName() { + return fileName; + } + + @Override + public void generateReport(List xmlSuites, List suites, String outputDirectory) { + try { + writer = createWriter(outputDirectory); + } catch (IOException e) { + logger.error("Unable to create output file", e); + return; + } + for (ISuite suite : suites) { + suiteResults.add(new SuiteResult(suite)); + } + writeDocumentStart(); + writeHead(); + writeBody(); + writeDocumentEnd(); + writer.close(); + + int totalTestCases = totalPassedTests + totalSkippedTests + totalFailedTests; + String oldString = System.getProperty("emailable.report2.name"); + String temp = "-report_T-" + totalTestCases + "_P-" + totalPassedTests + "_S-" + totalSkippedTests + "_F-" + + totalFailedTests; + String newString = oldString.replace("-report", temp); + + File orignialReportFile = new File(System.getProperty("user.dir") + "/" + + System.getProperty("testng.outpur.dir") + "/" + System.getProperty("emailable.report2.name")); + logger.info("reportFile is::" + System.getProperty("user.dir") + "/" + System.getProperty("testng.outpur.dir") + + "/" + System.getProperty("emailable.report2.name")); + + File newReportFile = new File( + System.getProperty("user.dir") + "/" + System.getProperty("testng.outpur.dir") + "/" + newString); + logger.info("New reportFile is::" + System.getProperty("user.dir") + "/" + + System.getProperty("testng.outpur.dir") + "/" + newString); + + if (orignialReportFile.exists()) { + if (orignialReportFile.renameTo(newReportFile)) { + orignialReportFile.delete(); + logger.info("Report File re-named successfully!"); + + if (ConfigManager.getPushReportsToS3().equalsIgnoreCase("yes")) { + S3Adapter s3Adapter = new S3Adapter(); + boolean isStoreSuccess = false; + boolean isStoreSuccess2 = false; + try { + isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(), BaseTestCaseFunc.testLevel, null, + null, newString, newReportFile); + logger.info("isStoreSuccess:: " + isStoreSuccess); + + /* Need to figure how to handle EXTENT report handling */ + + + + + + } catch (Exception e) { + logger.error("error occured while pushing the object" + e.getMessage()); + } + if (isStoreSuccess && isStoreSuccess2) { + logger.info("Pushed report to S3"); + } else { + logger.error("Failed while pushing file to S3"); + } + } + } else { + logger.error("Renamed report file doesn't exist"); + } + } else { + logger.error("Original report File does not exist!"); + } + } + + private String getCommitId() { + Properties properties = new Properties(); + try (InputStream is = EmailableReport.class.getClassLoader().getResourceAsStream("git.properties")) { + properties.load(is); + + return "Commit Id is: " + properties.getProperty("git.commit.id.abbrev") + " & Branch Name is:" + + properties.getProperty("git.branch"); + + } catch (IOException io) { + logger.error(io.getMessage()); + return ""; + } + + } + + protected PrintWriter createWriter(String outdir) throws IOException { + new File(outdir).mkdirs(); + String jvmArg = System.getProperty(JVM_ARG); + if (jvmArg != null && !jvmArg.trim().isEmpty()) { + fileName = jvmArg; + } + return new PrintWriter(new BufferedWriter(new FileWriter(new File(outdir, fileName)))); + } + + protected void writeDocumentStart() { + writer.println( + ""); + writer.print(""); + } + + protected void writeHead() { + writer.print(""); + writer.print("TestNG Report"); + writeStylesheet(); + writer.print(""); + } + + protected void writeStylesheet() { + writer.print(""); + } + + protected void writeBody() { + writer.print(""); + writeSuiteSummary(); + writeScenarioSummary(); + writeScenarioDetails(); + writer.print(""); + } + + protected void writeDocumentEnd() { + writer.print(""); + } + + protected void writeSuiteSummary() { + NumberFormat integerFormat = NumberFormat.getIntegerInstance(); + NumberFormat decimalFormat = NumberFormat.getNumberInstance(); + + totalPassedTests = 0; + totalSkippedTests = 0; + totalFailedTests = 0; + long totalDuration = 0; + writer.print(""); + int testIndex = 0; + for (SuiteResult suiteResult : suiteResults) { + + writer.print(""); + + writer.print(""); +// writer.print(""); + writer.print(""); + writer.print(""); + writer.print(""); + writer.print(""); + // writer.print(""); + // writer.print(""); + writer.print(""); + + for (TestResult testResult : suiteResult.getTestResults()) { + int passedTests = testResult.getPassedTestCount(); + int skippedTests = testResult.getSkippedTestCount(); + int failedTests = testResult.getFailedTestCount(); + long duration = testResult.getDuration(); + + writer.print(""); + + buffer.setLength(0); +// writeTableData(buffer.append("") +// .append(Utils.escapeHtml(testResult.getTestName())).append("").toString()); + writeTableData(integerFormat.format(passedTests), (passedTests > 0 ? "num green-bg" : "num")); + writeTableData(integerFormat.format(skippedTests), (skippedTests > 0 ? "num orange-bg" : "num")); + writeTableData(integerFormat.format(failedTests), (failedTests > 0 ? "num attn" : "num")); + writeTableData(decimalFormat.format(duration), "num"); + /* + * writeTableData(testResult.getIncludedGroups()); + * writeTableData(testResult.getExcludedGroups()); + */ + + writer.print(""); + + totalPassedTests += passedTests; + totalSkippedTests += skippedTests; + totalFailedTests += failedTests; + totalDuration += duration; + + testIndex++; + } + } + + // Print totals if there was more than one test + if (testIndex > 1) { + writer.print(""); + writer.print(""); + writeTableHeader(integerFormat.format(totalPassedTests), "num"); + writeTableHeader(integerFormat.format(totalSkippedTests), (totalSkippedTests > 0 ? "num attn" : "num")); + writeTableHeader(integerFormat.format(totalFailedTests), (totalFailedTests > 0 ? "num attn" : "num")); + writeTableHeader(decimalFormat.format(totalDuration), "num"); + writer.print(""); + writer.print(""); + } + + writer.print("
"); + writer.print(Utils.escapeHtml(suiteResult.getSuiteName() + "-" + getCommitId())); + writer.print("
");
+			writer.print(Utils.escapeHtml("Server Component Details " + AdminTestUtil.getServerComponentsDetails()));
+			writer.print("
"); +// writer.print(GlobalConstants.TRTR); + + writer.print("
Test Suite# Passed# Skipped# FailedTime (ms)Included GroupsExcluded Groups
Total
"); + } + + /** + * Writes a summary of all the test scenarios. + */ + protected void writeScenarioSummary() { + writer.print(""); + writer.print(""); + writer.print(""); + // writer.print(""); + writer.print(""); + writer.print(""); + writer.print(""); + writer.print(""); + + int testIndex = 0; + int scenarioIndex = 0; + for (SuiteResult suiteResult : suiteResults) { + /* + * writer.print(""); + */ + + for (TestResult testResult : suiteResult.getTestResults()) { + writer.print(""); + + String testName = Utils.escapeHtml("Scenarios"); + + scenarioIndex += writeScenarioSummary(testName + " — Failed (configuration methods)", + testResult.getFailedConfigurationResults(), "failed", scenarioIndex); + scenarioIndex += writeScenarioSummary(testName + " — Failed", testResult.getFailedTestResults(), + "failed", scenarioIndex); + scenarioIndex += writeScenarioSummary(testName + " — Skipped (configuration methods)", + testResult.getSkippedConfigurationResults(), "skipped", scenarioIndex); + scenarioIndex += writeScenarioSummary(testName + " — Skipped", testResult.getSkippedTestResults(), + "skipped", scenarioIndex); + scenarioIndex += writeScenarioSummary(testName + " — Passed", testResult.getPassedTestResults(), + "passed", scenarioIndex); + + writer.print(""); + + testIndex++; + } + } + + writer.print("
Class Test Time (ms)
"); // + * writer.print(Utils.escapeHtml(suiteResult.getSuiteName())); + * writer.print("
"); + } + + /** + * Writes the scenario summary for the results of a given state for a single + * test. + */ + private int writeScenarioSummary(String description, List classResults, String cssClassPrefix, + int startingScenarioIndex) { + int scenarioCount = 0; + if (!classResults.isEmpty()) { + writer.print(""); + writer.print(description); + writer.print(""); + + int scenarioIndex = startingScenarioIndex; + int classIndex = 0; + for (ClassResult classResult : classResults) { + String cssClass = cssClassPrefix + ((classIndex % 2) == 0 ? "even" : "odd"); + + buffer.setLength(0); + int scenariosPerClass = 0; + int methodIndex = 0; + + for (MethodResult methodResult : classResult.getMethodResults()) { + List results = methodResult.getResults(); + int resultsCount = results.size(); + assert resultsCount > 0; + ITestResult firstResult = results.iterator().next(); + String methodName=firstResult.getName(); + // Write the remaining scenarios for the method + + for (int i = 0; i < resultsCount; i++) { + + ITestResult result = results.get(i); + // String [] scenarioDetails = getScenarioDetails(result); + + // String scenarioName = Utils.escapeHtml("Scenario_" + scenarioDetails[0]); + // String scenarioDescription = Utils.escapeHtml(scenarioDetails[1]); + + long scenarioStart = result.getStartMillis(); + long scenarioDuration = result.getEndMillis() - scenarioStart; + +// buffer.append("").append("").append(scenarioName).append("") +// .append("").append(scenarioDescription).append("") +// .append("").append(scenarioDuration).append(""); + buffer.append("") // Start of table row with a specified CSS class + .append("").append(methodName).append("") // Table cell with a hyperlink + .append("").append(scenarioDuration).append(""); // Table cell with scenario duration + + scenarioIndex++; + } + scenariosPerClass += resultsCount; + methodIndex++; + } + + // Write the test results for the class + writer.print(buffer); + classIndex++; + } + scenarioCount = scenarioIndex - startingScenarioIndex; + } + return scenarioCount; + } + + + + /** + * Writes the details for all test scenarios. + */ + protected void writeScenarioDetails() { + int scenarioIndex = 0; + for (SuiteResult suiteResult : suiteResults) { + for (TestResult testResult : suiteResult.getTestResults()) { + /* + * writer.print("

"); + * writer.print(Utils.escapeHtml(testResult.getTestName())); + * writer.print("

"); + */ + + scenarioIndex += writeScenarioDetails(testResult.getFailedConfigurationResults(), scenarioIndex); + scenarioIndex += writeScenarioDetails(testResult.getFailedTestResults(), scenarioIndex); + scenarioIndex += writeScenarioDetails(testResult.getSkippedConfigurationResults(), scenarioIndex); + scenarioIndex += writeScenarioDetails(testResult.getSkippedTestResults(), scenarioIndex); + // scenarioIndex += writeScenarioDetails(testResult.getPassedTestResults(), scenarioIndex); + } + } + } + + /** + * Writes the scenario details for the results of a given state for a single + * test. + */ + private int writeScenarioDetails(List classResults, int startingScenarioIndex) { + int scenarioIndex = startingScenarioIndex; + for (ClassResult classResult : classResults) { + String className = classResult.getClassName(); + for (MethodResult methodResult : classResult.getMethodResults()) { + List results = methodResult.getResults(); + assert !results.isEmpty(); + // ITestResult firstResult = results.iterator().next(); + // String methodName=firstResult.getName(); + String label = Utils + .escapeHtml(className + "#" + results.iterator().next().getMethod().getMethodName()); + for (ITestResult result : results) { + writeScenario(scenarioIndex, label, result); + scenarioIndex++; + } + } + } + + return scenarioIndex - startingScenarioIndex; + } + + /** + * Writes the details for an individual test scenario. + */ + private void writeScenario(int scenarioIndex, String label, ITestResult result) { + writer.print("

"); + writer.print(label); + writer.print("

"); + + writer.print(""); + + // Write test parameters (if any) + Object[] parameters = result.getParameters(); + int parameterCount = (parameters == null ? 0 : parameters.length); + + /* + * if (parameterCount > 0) { writer.print(""); for (int i = + * 1; i <= parameterCount; i++) { writer.print(""); } + * writer.print(""); for (Object parameter : + * parameters) { writer.print(""); } writer.print(""); } + */ + + // Write reporter messages (if any) + List reporterMessages = Reporter.getOutput(result); + if (!reporterMessages.isEmpty()) { + writer.print(""); + } + + // Write exception (if any) + Throwable throwable = result.getThrowable(); + if (throwable != null) { + writer.print(""); + writer.print(""); + } + + writer.print("
Parameter #"); + * writer.print(i); writer.print("
"); + * writer.print(Utils.escapeHtml(Utils.toString(parameter))); + * writer.print("
"); + writeReporterMessages(reporterMessages); + writer.print("
" + + (result.getStatus() == ITestResult.SUCCESS ? "Expected Exception" : "Exception") + "
"); + writeStackTrace(throwable); + writer.print("
"); + writer.print("

back to summary

"); + } + + protected void writeReporterMessages(List reporterMessages) { + writer.print("
"); + Iterator iterator = reporterMessages.iterator(); + assert iterator.hasNext(); + if (Reporter.getEscapeHtml()) { + writer.print(Utils.escapeHtml(iterator.next())); + } else { + writer.print(iterator.next()); + } + while (iterator.hasNext()) { + writer.print("
"); + if (Reporter.getEscapeHtml()) { + writer.print(Utils.escapeHtml(iterator.next())); + } else { + writer.print(iterator.next()); + } + } + writer.print("
"); + } + + protected void writeStackTrace(Throwable throwable) { + writer.print("
"); + writer.print(Utils.shortStackTrace(throwable, true)); + writer.print("
"); + } + + /** + * Writes a TH element with the specified contents and CSS class names. + * + * @param html the HTML contents + * @param cssClasses the space-delimited CSS classes or null if there are no + * classes to apply + */ + protected void writeTableHeader(String html, String cssClasses) { + writeTag("th", html, cssClasses); + } + + /** + * Writes a TD element with the specified contents. + * + * @param html the HTML contents + */ + protected void writeTableData(String html) { + writeTableData(html, null); + } + + /** + * Writes a TD element with the specified contents and CSS class names. + * + * @param html the HTML contents + * @param cssClasses the space-delimited CSS classes or null if there are no + * classes to apply + */ + protected void writeTableData(String html, String cssClasses) { + writeTag("td", html, cssClasses); + } + + /** + * Writes an arbitrary HTML element with the specified contents and CSS class + * names. + * + * @param tag the tag name + * @param html the HTML contents + * @param cssClasses the space-delimited CSS classes or null if there are no + * classes to apply + */ + protected void writeTag(String tag, String html, String cssClasses) { + writer.print("<"); + writer.print(tag); + if (cssClasses != null) { + writer.print(" class=\""); + writer.print(cssClasses); + writer.print("\""); + } + writer.print(">"); + writer.print(html); + writer.print(""); + } + + /** + * Groups {@link TestResult}s by suite. + */ + protected static class SuiteResult { + private final String suiteName; + private final List testResults = Lists.newArrayList(); + + public SuiteResult(ISuite suite) { + suiteName = suite.getName(); + for (ISuiteResult suiteResult : suite.getResults().values()) { + testResults.add(new TestResult(suiteResult.getTestContext())); + } + } + + public String getSuiteName() { + return suiteName; + } + + /** + * @return the test results (possibly empty) + */ + public List getTestResults() { + return testResults; + } + } + + /** + * Groups {@link ClassResult}s by test, type (configuration or test), and + * status. + */ + protected static class TestResult { + /** + * Orders test results by class name and then by method name (in lexicographic + * order). + */ + protected static final Comparator RESULT_COMPARATOR = new Comparator() { + @Override + public int compare(ITestResult o1, ITestResult o2) { + int result = o1.getTestClass().getName().compareTo(o2.getTestClass().getName()); + if (result == 0) { + result = o1.getMethod().getMethodName().compareTo(o2.getMethod().getMethodName()); + } + return result; + } + }; + + private final String testName; + private final List failedConfigurationResults; + private final List failedTestResults; + private final List skippedConfigurationResults; + private final List skippedTestResults; + private final List passedTestResults; + private final int failedTestCount; + private final int skippedTestCount; + private final int passedTestCount; + private final long duration; + private final String includedGroups; + private final String excludedGroups; + + public TestResult(ITestContext context) { + testName = context.getName(); + + Set failedConfigurations = context.getFailedConfigurations().getAllResults(); + Set failedTests = context.getFailedTests().getAllResults(); + Set skippedConfigurations = context.getSkippedConfigurations().getAllResults(); + Set skippedTests = context.getSkippedTests().getAllResults(); + Set passedTests = context.getPassedTests().getAllResults(); + + failedConfigurationResults = groupResults(failedConfigurations); + failedTestResults = groupResults(failedTests); + skippedConfigurationResults = groupResults(skippedConfigurations); + skippedTestResults = groupResults(skippedTests); + passedTestResults = groupResults(passedTests); + + failedTestCount = failedTests.size(); + skippedTestCount = skippedTests.size(); + passedTestCount = passedTests.size(); + + duration = context.getEndDate().getTime() - context.getStartDate().getTime(); + + includedGroups = formatGroups(context.getIncludedGroups()); + excludedGroups = formatGroups(context.getExcludedGroups()); + } + + /** + * Groups test results by method and then by class. + */ + protected List groupResults(Set results) { + List classResults = Lists.newArrayList(); + if (!results.isEmpty()) { + List resultsPerClass = Lists.newArrayList(); + List resultsPerMethod = Lists.newArrayList(); + + List resultsList = Lists.newArrayList(results); + Collections.sort(resultsList, RESULT_COMPARATOR); + Iterator resultsIterator = resultsList.iterator(); + assert resultsIterator.hasNext(); + + ITestResult result = resultsIterator.next(); + resultsPerMethod.add(result); + + String previousClassName = result.getTestClass().getName(); + String previousMethodName = result.getMethod().getMethodName(); + while (resultsIterator.hasNext()) { + result = resultsIterator.next(); + + String className = result.getTestClass().getName(); + if (!previousClassName.equals(className)) { + // Different class implies different method + assert !resultsPerMethod.isEmpty(); + resultsPerClass.add(new MethodResult(resultsPerMethod)); + resultsPerMethod = Lists.newArrayList(); + + assert !resultsPerClass.isEmpty(); + classResults.add(new ClassResult(previousClassName, resultsPerClass)); + resultsPerClass = Lists.newArrayList(); + + previousClassName = className; + previousMethodName = result.getMethod().getMethodName(); + } else { + String methodName = result.getMethod().getMethodName(); + if (!previousMethodName.equals(methodName)) { + assert !resultsPerMethod.isEmpty(); + resultsPerClass.add(new MethodResult(resultsPerMethod)); + resultsPerMethod = Lists.newArrayList(); + + previousMethodName = methodName; + } + } + resultsPerMethod.add(result); + } + assert !resultsPerMethod.isEmpty(); + resultsPerClass.add(new MethodResult(resultsPerMethod)); + assert !resultsPerClass.isEmpty(); + classResults.add(new ClassResult(previousClassName, resultsPerClass)); + } + return classResults; + } + + public String getTestName() { + return testName; + } + + /** + * @return the results for failed configurations (possibly empty) + */ + public List getFailedConfigurationResults() { + return failedConfigurationResults; + } + + /** + * @return the results for failed tests (possibly empty) + */ + public List getFailedTestResults() { + return failedTestResults; + } + + /** + * @return the results for skipped configurations (possibly empty) + */ + public List getSkippedConfigurationResults() { + return skippedConfigurationResults; + } + + /** + * @return the results for skipped tests (possibly empty) + */ + public List getSkippedTestResults() { + return skippedTestResults; + } + + /** + * @return the results for passed tests (possibly empty) + */ + public List getPassedTestResults() { + return passedTestResults; + } + + public int getFailedTestCount() { + return failedTestCount; + } + + public int getSkippedTestCount() { + return skippedTestCount; + } + + public int getPassedTestCount() { + return passedTestCount; + } + + public long getDuration() { + return duration; + } + + public String getIncludedGroups() { + return includedGroups; + } + + public String getExcludedGroups() { + return excludedGroups; + } + + /** + * Formats an array of groups for display. + */ + protected String formatGroups(String[] groups) { + if (groups.length == 0) { + return ""; + } + + StringBuilder builder = new StringBuilder(); + builder.append(groups[0]); + for (int i = 1; i < groups.length; i++) { + builder.append(", ").append(groups[i]); + } + return builder.toString(); + } + } + + /** + * Groups {@link MethodResult}s by class. + */ + protected static class ClassResult { + private final String className; + private final List methodResults; + + /** + * @param className the class name + * @param methodResults the non-null, non-empty {@link MethodResult} list + */ + public ClassResult(String className, List methodResults) { + this.className = className; + this.methodResults = methodResults; + } + + public String getClassName() { + return className; + } + + /** + * @return the non-null, non-empty {@link MethodResult} list + */ + public List getMethodResults() { + return methodResults; + } + } + + /** + * Groups test results by method. + */ + protected static class MethodResult { + private final List results; + + /** + * @param results the non-null, non-empty result list + */ + public MethodResult(List results) { + this.results = results; + } + + /** + * @return the non-null, non-empty result list + */ + public List getResults() { + return results; + } + } + +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java index 371c32c1..7b445732 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java @@ -10,6 +10,7 @@ import io.mosip.testrig.adminui.dbaccess.DBManager; import io.mosip.testrig.adminui.fw.util.AdminTestUtil; +import io.mosip.testrig.adminui.kernel.util.ConfigManager; import io.mosip.testrig.adminui.testcase.*; @@ -69,38 +70,34 @@ public static void main(String[] args) throws Exception { public static void startTestRunner() throws Exception { File homeDir = null; - // TestNG runner = new TestNG(); -testNg=new TestNG(); - - String listExcludedGroups=JsonUtil.JsonObjParsing(Commons.getTestData(),"setExcludedGroups"); - testNg.setExcludedGroups(listExcludedGroups); - testNg.setTestClasses(new Class[] { - - CenterTest.class,HolidaysTest.class,TemplateTest.class - - , - - DeviceTest.class,MachineTest.class - ,BlockListTest.class,CenterTypeTest.class, - DeviceSpecificationTest.class,DeviceTypesTest.class, - MachineSpecificationTest.class,MachineTypesTest.class, - DynamicFieldTest.class,DocumentCategoriesTest.class,DocumentTypes.class, - - BulkUploadTest.class - - }); + TestNG runner = new TestNG(); + List suitefiles = new ArrayList(); + String os = System.getProperty("os.name"); + if (checkRunType().contains("IDE") || os.toLowerCase().contains("windows") == true) { + homeDir = new File(getResourcePath() + "/testngFile"); + + } else { + homeDir = new File(getResourcePath() + "/testngFile"); + + } + + for (File file : homeDir.listFiles()) { + if (file.getName().toLowerCase() != null) { + suitefiles.add(file.getAbsolutePath()); + } + } + + runner.setTestSuites(suitefiles); + System.getProperties().setProperty("testng.outpur.dir", "testng-report"); - testNg.setOutputDirectory("testng-report"); - System.getProperties().setProperty("emailable.report2.name", "AdminUI" + "-" - + System.getProperty("env.user") + System.currentTimeMillis() + "-report.html"); - - - testNg.run(); - - // MockSMTPListener mockSMTPListener = new MockSMTPListener(); - // mockSMTPListener.bTerminate = true; + runner.setOutputDirectory("testng-report"); + System.getProperties().setProperty("emailable.report2.name", "ADMINUI-" + BaseTestCaseFunc.environment + "-" + + "-run-" + System.currentTimeMillis() + "-report.html"); + runner.run(); + + System.exit(0); } diff --git a/admintest/src/main/resources/config/Kernel.properties b/admintest/src/main/resources/config/Kernel.properties index ed86e2f9..55f556b4 100644 --- a/admintest/src/main/resources/config/Kernel.properties +++ b/admintest/src/main/resources/config/Kernel.properties @@ -2,7 +2,8 @@ #Make sure all resource apis are covered authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd zoneMappingUrl=/v1/masterdata/zoneuser -zoneNameUrl=/v1/masterdata/zones/zonename +leafzonesURL=/v1/masterdata/zones/leafzones/eng +#zoneNameUrl=/v1/masterdata/zones/zonename zoneMappingActivateUrl=/v1/masterdata/zoneuser userCenterMappingUrl=/v1/masterdata/usercentermapping bulkUploadUrl=/v1/admin/bulkupload @@ -12,63 +13,63 @@ bulkUploadUrl=/v1/admin/bulkupload #IDREPO mosip_idrepo_app_id=idrepo mosip_idrepo_client_id=mosip-idrepo-client -mosip_idrepo_client_secret=1goKToWjb8t6nFeW +mosip_idrepo_client_secret=IGsZkHXcAoqGKRTA #IDREPO mosip_idrepo_app_id=idrepo mosip_idrepo_client_id=mosip-idrepo-client -mosip_idrepo_client_secret=1goKToWjb8t6nFeW +mosip_idrepo_client_secret=IGsZkHXcAoqGKRTA keycloak-realm-id=mosip -keycloak-external-url=https://iam.qa-upgrade3.mosip.net +keycloak-external-url=https://iam.dev2.mosip.net mosip_testrig_client_id=mosip-testrig-client -mosip_testrig_client_secret=F0nqSasG5fWPpBvG +mosip_testrig_client_secret=Xup50UX3AybAkzkH admin mosip_admin_app_id=admin admin_password=mosip123 #actuall user login will be 'adminui-auto12' -admin_userName=auto126 +admin_userName=admin1 mosip_admin_client_id=mosip-admin-client -mosip_admin_client_secret=f3mZVaYBfuvyfcjJ +mosip_admin_client_secret=E4386XMrYOvoHMJ5 #admin admin_zone_password=mosip123 admin_zone_userName=globaladmin mosip_regclient_app_id=registrationclient mosip_reg_client_id=mosip-reg-client -mosip_reg_client_secret=zPnLp4cpbpl3z6LX -iam-users-to-create=auto126 +mosip_reg_client_secret=3H9qsSxmYn4bXBk8 +iam-users-to-create=admin1,globaladmin #iam-users-to-create=111997,220005,111992 iam-users-password=mosip123,mosip123 -roles.auto126=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN +roles.admin1=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN roles.globaladmin=GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip -partner_url=jdbc:postgresql://qa-upgrade3.mosip.net:5432/mosip_ida +partner_url=jdbc:postgresql://dev2.mosip.net:5432/mosip_ida #----------------------------------Database properties----------------------------------------------------------# postgresqlUser=postgresql db-port=5432 -db-server=qa-upgrade3.mosip.net +db-server=dev2.mosip.net hibernate.connection.driver_class=org.postgresql.Driver hibernate.connection.pool_size=1 hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect hibernate.show_sql=true hibernate.current_session_context_class=thread db-su-user=postgres -postgresql-password=9AdeAN3GFr +postgresql-password=FRekEGMjiC pms_db_schema=pms km_db_schema=keymgr master_db_schema=master audit_db_schema=audit ida_db_schema=ida -db-server=qa-upgrade3.mosip.net -keycloak-external-url=https://iam.qa-upgrade3.mosip.net -audit_url=jdbc:postgresql://qa-upgrade3.mosip.net:5432/mosip_audit +db-server=dev2.mosip.net +keycloak-external-url=https://iam.dev2.mosip.net +audit_url=jdbc:postgresql://dev2.mosip.net:5432/mosip_audit driver_class=org.postgresql.Driver pool_size=1 dialect=org.hibernate.dialect.PostgreSQLDialect show_sql=true current_session_context_class=thread db-su-user=postgres -postgresql-password=9AdeAN3GFr +postgresql-password=FRekEGMjiC postgresqlUser=postgresql db-port=5432 -db-server=qa-upgrade3.mosip.net +db-server=dev2.mosip.net s3-user-key=minioadmin s3-user-secret=minioadmin s3-host=http://minio.minio:9000 @@ -77,7 +78,7 @@ s3-region=null reportExpirationInDays=3 # supported values yes or no push-reports-to-s3=no -enableDebug=no +enableDebug=yes # supported values are 1 to 8 threadCount=1 # supported values are 0 ,1, 2 based on number of env languages @@ -100,7 +101,10 @@ validateBindingEndpoint=esignet-binding #authCertsPath=/home/mosip/authcerts #To run locally authCertsPath= -adminPortalPath=https://admin.qa-upgrade3.mosip.net/ -apiEnvUser=api-internal.qa-upgrade3 -apiInternalEndPoint=https://api-internal.qa-upgrade3.mosip.net + +servicesNotDeployed= + +adminPortalPath=https://admin.dev2.mosip.net/ +apiEnvUser=api-internal.dev2 +apiInternalEndPoint=https://api-internal.dev2.mosip.net \ No newline at end of file diff --git a/admintest/src/main/resources/config/healthCheckEndpoint.properties b/admintest/src/main/resources/config/healthCheckEndpoint.properties new file mode 100644 index 00000000..1958eb2a --- /dev/null +++ b/admintest/src/main/resources/config/healthCheckEndpoint.properties @@ -0,0 +1,43 @@ +###### = +regproc_masterdata=/v1/hotlist/actuator/health +masterdata=/v1/admin/actuator/health +auth_idrepo_resident_regproc_masterdata=/v1/auditmanager/actuator/health +regproc=/v1/identity/actuator/health +auth_idrepo_resident_regproc_masterdata=/v1/authmanager/actuator/health +auth_idrepo_regproc=/biosdk-service/actuator/health +auth_mobileid=/v1/credentialservice/actuator/health +auth_mobileid=/v1/credentialrequest/actuator/health +auth_idrepo_regproc_partner=/v1/datashare/actuator/health +auth_mobileid_esignet=/idauthentication/v1/actuator/health +auth_mobileid_esignet_partner=/idauthentication/v1/internal/actuator/health +auth_mobileid_esignet=/idauthentication/v1/otp/actuator/health +idrepo_auth_mobileid_mimoto_esignet_resident_regproc=/idrepository/v1/identity/actuator/health +idrepo_regproc=/v1/idgenerator/actuator/health +idrepo_resident_regproc_masterdata=/v1/keymanager/actuator/health +auth_idrepo_masterdata_mobileid_mimoto_esignet_resident_partner_prereg_regproc=/v1/masterdata/actuator/health +regproc=/v1/mock-abis-service/actuator/health +regproc=/v1/mockmv/actuator/health +auth_idrepo_resident_regproc=/v1/notifier/actuator/health +auth_mobileid=/v1/otpmanager/actuator/health +regproc=/v1/packetcreator/actuator/health +regproc=/commons/v1/packetmanager/actuator/health +partner_auth_esignet_idrepo_resident_regproc=/v1/partnermanager/actuator/health +partner_auth_esignet_regproc=/v1/policymanager/actuator/health +prereg=/preregistration/v1/captcha/actuator/health +prereg=/v1/pridgenerator/actuator/health +regproc=/v1/print/actuator/health +regproc=/registrationprocessor/v1/camelbridge/actuator/health +resident_regproc=/registrationprocessor/v1/packetreceiver/actuator/health +regproc=/registrationprocessor/v1/landingzone/actuator/health +regproc=/registrationprocessor/v1/notification/actuator/health +regproc=/registrationprocessor/v1/opencrvs-stage/actuator/health +regproc=/registrationprocessor/v1/reprocessor/actuator/health +regproc_masterdata=/registrationprocessor/v1/registrationstatus/actuator/health +regproc=/registrationprocessor/v1/registrationtransaction/actuator/health +regproc=/registrationprocessor/v1/workflowmanager/actuator/health +resident_auth_esignet_mobileid=/resident/v1/actuator/health +idrepo_auth_mobileid_mimoto_esignet_resident=/v1/ridgenerator/actuator/health +regproc_masterdata=/v1/syncdata/actuator/health +idrepo_auth_mobileid_mimoto_esignet_resident_regproc=/idrepository/v1/actuator/health +auth_idrepo_resident_regproc=/hub/actuator/health +resident_esignet=/v1/esignet/actuator/health \ No newline at end of file diff --git a/admintest/src/main/resources/config/kernel_dev2.properties b/admintest/src/main/resources/config/kernel_dev2.properties new file mode 100644 index 00000000..55f556b4 --- /dev/null +++ b/admintest/src/main/resources/config/kernel_dev2.properties @@ -0,0 +1,110 @@ +#Kernel resource uris +#Make sure all resource apis are covered +authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd +zoneMappingUrl=/v1/masterdata/zoneuser +leafzonesURL=/v1/masterdata/zones/leafzones/eng +#zoneNameUrl=/v1/masterdata/zones/zonename +zoneMappingActivateUrl=/v1/masterdata/zoneuser +userCenterMappingUrl=/v1/masterdata/usercentermapping +bulkUploadUrl=/v1/admin/bulkupload +#Below users are used for authentication +#PARTNER +#Dont change the partner id +#IDREPO +mosip_idrepo_app_id=idrepo +mosip_idrepo_client_id=mosip-idrepo-client +mosip_idrepo_client_secret=IGsZkHXcAoqGKRTA +#IDREPO +mosip_idrepo_app_id=idrepo +mosip_idrepo_client_id=mosip-idrepo-client +mosip_idrepo_client_secret=IGsZkHXcAoqGKRTA +keycloak-realm-id=mosip +keycloak-external-url=https://iam.dev2.mosip.net +mosip_testrig_client_id=mosip-testrig-client +mosip_testrig_client_secret=Xup50UX3AybAkzkH +admin +mosip_admin_app_id=admin +admin_password=mosip123 +#actuall user login will be 'adminui-auto12' +admin_userName=admin1 +mosip_admin_client_id=mosip-admin-client +mosip_admin_client_secret=E4386XMrYOvoHMJ5 +#admin +admin_zone_password=mosip123 +admin_zone_userName=globaladmin +mosip_regclient_app_id=registrationclient +mosip_reg_client_id=mosip-reg-client +mosip_reg_client_secret=3H9qsSxmYn4bXBk8 +iam-users-to-create=admin1,globaladmin +#iam-users-to-create=111997,220005,111992 +iam-users-password=mosip123,mosip123 +roles.admin1=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN +roles.globaladmin=GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip +partner_url=jdbc:postgresql://dev2.mosip.net:5432/mosip_ida +#----------------------------------Database properties----------------------------------------------------------# +postgresqlUser=postgresql +db-port=5432 +db-server=dev2.mosip.net +hibernate.connection.driver_class=org.postgresql.Driver +hibernate.connection.pool_size=1 +hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +hibernate.show_sql=true +hibernate.current_session_context_class=thread +db-su-user=postgres +postgresql-password=FRekEGMjiC +pms_db_schema=pms +km_db_schema=keymgr +master_db_schema=master +audit_db_schema=audit +ida_db_schema=ida +db-server=dev2.mosip.net +keycloak-external-url=https://iam.dev2.mosip.net +audit_url=jdbc:postgresql://dev2.mosip.net:5432/mosip_audit +driver_class=org.postgresql.Driver +pool_size=1 +dialect=org.hibernate.dialect.PostgreSQLDialect +show_sql=true +current_session_context_class=thread +db-su-user=postgres +postgresql-password=FRekEGMjiC +postgresqlUser=postgresql +db-port=5432 +db-server=dev2.mosip.net +s3-user-key=minioadmin +s3-user-secret=minioadmin +s3-host=http://minio.minio:9000 +s3-account=automation +s3-region=null +reportExpirationInDays=3 +# supported values yes or no +push-reports-to-s3=no +enableDebug=yes +# supported values are 1 to 8 +threadCount=1 +# supported values are 0 ,1, 2 based on number of env languages +langselect=0 +#----------------------------------AuthDemoService Host properties----------------------------------------------------------# +#To run locally +authDemoServiceBaseURL=http://localhost +authDemoServicePort=8082 +#To run in Docker +#authDemoServiceBaseURL=http://authdemo.apitestrig +#authDemoServicePort=80 +#----------------------------------IdP properties----------------------------------------------------------# +currentUserURI=/#/uinservices/viewhistory +actuatorEndpoint=/resident/v1/actuator/env +actuatorIDAEndpoint=/idauthentication/v1/actuator/env +actuatorRegprocEndpoint=/registrationprocessor/v1/registrationtransaction/actuator/env +tokenEndpoint=/v1/esignet/oauth/token +validateBindingEndpoint=esignet-binding +#To run in Docker +#authCertsPath=/home/mosip/authcerts +#To run locally +authCertsPath= + +servicesNotDeployed= + +adminPortalPath=https://admin.dev2.mosip.net/ +apiEnvUser=api-internal.dev2 +apiInternalEndPoint=https://api-internal.dev2.mosip.net + \ No newline at end of file diff --git a/admintest/src/main/resources/testngFile/testng.xml b/admintest/src/main/resources/testngFile/testng.xml new file mode 100644 index 00000000..03d740e3 --- /dev/null +++ b/admintest/src/main/resources/testngFile/testng.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 32227d914eb3e49c44021a600ce8080dde559887 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 26 Dec 2023 12:13:11 +0530 Subject: [PATCH 07/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- admintest/src/main/resources/TestData.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/resources/TestData.json b/admintest/src/main/resources/TestData.json index e8ab6131..6b62bb9c 100644 --- a/admintest/src/main/resources/TestData.json +++ b/admintest/src/main/resources/TestData.json @@ -25,7 +25,7 @@ "loginlang": "sin", "preappend": "0", "jsonObjName": "identity", - "headless": "no", + "headless": "yes", "bulkwait": "10000", "dummyData":"blocklistwordss", "publicKey": "AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDFEX4nLppAuHIfGzhYn7DR_3wAQkVnrPSFFaiV9TAvN0WHtH_hweGNNjUGYvyaowwmC8jsazufmnIoPisZIFraVQNWCA6N0RhZF_LisoTYDoQSM-ZbCKPxRTFnemtTwXHxQdlVWGUXst_WZIWC0OTSzJHbBg_iXQW1UOXRJL845GFOKjvOPQiEbOZgmoWslkTIAi9bf-AeWdEYuO3bwPf-T5Xxj_xH2-PTinQA_4itRWSrhG5kEU-zQHWGL72SiGzwOOoPnzZZv2X_9djpWGEz1gyNl5ionns8IfuQrvikSEMxm-E6Z9RfKNhl_rEHgnOR4gl0ju5kg_n9tnuUeXXP", From 8c03c6c1bdbabeda7b075c0dd0bdc225d2ceeeda Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 26 Dec 2023 12:25:22 +0530 Subject: [PATCH 08/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .github/workflows/push-trigger.yml | 66 ++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index 819dd79a..97fefe00 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -78,14 +78,71 @@ jobs: GPG_SECRET: ${{ secrets.GPG_SECRET }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - build-docker-admintest: + build-admintest-local: needs: build-maven-admintest + runs-on: ubuntu-latest + env: + NAMESPACE: ${{ secrets.dev_namespace_docker_hub }} + SERVICE_NAME: admintest + SERVICE_LOCATION: admintest + BUILD_ARTIFACT: admintest-local + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + ref: ${{ github.ref }} + java-version: 11 + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Setup the settings file for ossrh server + run: echo " ossrh ${{secrets.ossrh_user}} ${{secrets.ossrh_secret}} ossrh true gpg2 ${{secrets.gpg_secret}} allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true releases-repo https://oss.sonatype.org/service/local/staging/deploy/maven2 true false sonar . https://sonarcloud.io false " > $GITHUB_WORKSPACE/settings.xml + + - name: Build residentuitests with Maven + run: | + cd ${{ env.SERVICE_LOCATION}} + mvn -U -B package -Dmaven.wagon.http.retryHandler.count=2 --file pom.xml -s $GITHUB_WORKSPACE/settings.xml + + + - name: Ready the springboot artifacts + if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} + run: | + ## FIND JARS & COPY ONLY EXECUTABLE JARs STORED UNDER TARGET DIRECTORY + find ${{ env.SERVICE_LOCATION }} -path '*/target/*' -name '*.jar' -type f -exec zip ${{ env.BUILD_ARTIFACT }}.zip {} + + + - name: Upload the springboot jars + if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} + uses: actions/upload-artifact@v3 + with: + name: ${{ env.BUILD_ARTIFACT }} + path: ${{ env.BUILD_ARTIFACT }}.zip + + - uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,author,commit,workflow,job # selectable (default: repo,message) + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required + if: failure() # Pick up events even if the job fails or is canceled. + + + build-docker-admintest: + needs: build-admintest-local strategy: matrix: include: - SERVICE_LOCATION: 'admintest' SERVICE_NAME: 'admintest' - BUILD_ARTIFACT: 'admintest' + BUILD_ARTIFACT: 'admintest-local' fail-fast: false name: ${{ matrix.SERVICE_NAME }} uses: mosip/kattu/.github/workflows/docker-build.yml@master @@ -98,8 +155,9 @@ jobs: ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + sonar-analysis-admintest: - needs: build-maven-admintest + needs: build-admintest-local if: "${{ github.event_name != 'pull_request' }}" uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master with: @@ -113,4 +171,4 @@ jobs: OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} GPG_SECRET: ${{ secrets.GPG_SECRET }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file From ea56276c40f98a67e13207617c903c34a1b51356 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 26 Dec 2023 17:36:54 +0530 Subject: [PATCH 09/69] fix machine Signed-off-by: Jayesh Kharode --- .../io/mosip/testrig/adminui/testcase/MachineTest.java | 2 +- admintest/src/main/resources/testngFile/testng.xml | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index 0e94cae5..a7f5338b 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -38,7 +38,7 @@ public void machineCRUD() throws Exception { String signPublicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"signPublicKey"); Commons.click(test,driver,By.id("admin/resources")); - Commons.click(test,driver,By.xpath("//a[@href='#/admin/resources/machines']")); + Commons.click(test,driver,By.id("/admin/resources/machines")); Commons.click(test,driver,By.id("Create Machine")); test.log(Status.INFO, "Click on Create Machine"); Commons.enter(test,driver,By.id("name"),data); diff --git a/admintest/src/main/resources/testngFile/testng.xml b/admintest/src/main/resources/testngFile/testng.xml index 03d740e3..c768ef46 100644 --- a/admintest/src/main/resources/testngFile/testng.xml +++ b/admintest/src/main/resources/testngFile/testng.xml @@ -7,7 +7,7 @@ - + + --> + + From 5ff39dbe82c48a5219dd65de7df0e14ce2b34c72 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 26 Dec 2023 17:58:58 +0530 Subject: [PATCH 10/69] fix machine Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/Commons.java | 32 +++---------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 743622d2..2608968b 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -75,41 +75,19 @@ public static void filterCenter(ExtentTest test,WebDriver driver, By by,String } } - public static void click(ExtentTest test,WebDriver driver, By by) { + public static void click(ExtentTest test,WebDriver driver, By by) throws InterruptedException { logger.info("Clicking " + by ); try { (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); Thread.sleep(500); driver.findElement(by).click(); Thread.sleep(500); - }catch (StaleElementReferenceException sere) { + }catch (Exception sere) { // simply retry finding the element in the refreshed DOM - driver.findElement(by).click(); + sere.printStackTrace(); } - catch (TimeoutException toe) { - driver.findElement(by).click(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); - } catch (Exception e) { - - try { - test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - JavascriptExecutor executor = (JavascriptExecutor) driver; - executor.executeScript("arguments[0].click();", driver.findElement(by)); - - - } - - } + } + public static void enter(ExtentTest test,WebDriver driver, By by,String value) { logger.info("Entering " + by +value); From 5a9b025fabbaccee1b33c43536f6490ae04f895d Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 26 Dec 2023 18:07:42 +0530 Subject: [PATCH 11/69] fix machine Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/Commons.java | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 2608968b..743622d2 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -75,19 +75,41 @@ public static void filterCenter(ExtentTest test,WebDriver driver, By by,String } } - public static void click(ExtentTest test,WebDriver driver, By by) throws InterruptedException { + public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); try { (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); Thread.sleep(500); driver.findElement(by).click(); Thread.sleep(500); - }catch (Exception sere) { + }catch (StaleElementReferenceException sere) { // simply retry finding the element in the refreshed DOM - sere.printStackTrace(); - } + driver.findElement(by).click(); } - + catch (TimeoutException toe) { + driver.findElement(by).click(); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); + } catch (Exception e) { + + try { + test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); + + + } + + } public static void enter(ExtentTest test,WebDriver driver, By by,String value) { logger.info("Entering " + by +value); From 8c8f51bb28b0791530d53496c1a85aee311d8046 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 26 Dec 2023 18:10:25 +0530 Subject: [PATCH 12/69] fix machine Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/Commons.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 743622d2..3380b8f5 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -98,8 +98,9 @@ public static void click(ExtentTest test,WebDriver driver, By by) { } catch (Exception e) { try { - test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); - } catch (IOException e1) { + // test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); + driver.findElement(by).click(); + } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } From 5a3e4c9fe317e90dc5fde1b0a3c25617b27ed9b1 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 11:41:21 +0530 Subject: [PATCH 13/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/testcase/MachineTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index a7f5338b..ba13843d 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -39,7 +39,9 @@ public void machineCRUD() throws Exception { Commons.click(test,driver,By.id("admin/resources")); Commons.click(test,driver,By.id("/admin/resources/machines")); - Commons.click(test,driver,By.id("Create Machine")); +// Commons.click(test,driver,By.id("Create Machine")); + Thread.sleep(4000); + driver.findElement(By.id("Create Machine")).click(); test.log(Status.INFO, "Click on Create Machine"); Commons.enter(test,driver,By.id("name"),data); Commons.enter(test,driver,By.id("serialNumber"),"1234567"); From 159d1a381575eb91d8262bd3429ab097408b16fe Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 11:59:54 +0530 Subject: [PATCH 14/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/testcase/MachineTest.java | 1 + .../testrig/adminui/utility/BaseClass.java | 135 +++++++++--------- 2 files changed, 70 insertions(+), 66 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index ba13843d..5bc96b4b 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -41,6 +41,7 @@ public void machineCRUD() throws Exception { Commons.click(test,driver,By.id("/admin/resources/machines")); // Commons.click(test,driver,By.id("Create Machine")); Thread.sleep(4000); + driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElement(By.id("Create Machine")).click(); test.log(Status.INFO, "Click on Create Machine"); Commons.enter(test,driver,By.id("name"),data); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 1d51f0c5..a6c3eecb 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -5,6 +5,7 @@ import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.net.URL; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -22,6 +23,7 @@ import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -64,56 +66,57 @@ public class BaseClass { protected String password = allpassword[0]; protected String data = Commons.appendDate; public static ExtentSparkReporter html; - - - - public static ExtentReports extent; - public static ExtentTest test; - + + + + public static ExtentReports extent; + public static ExtentTest test; + public void setLangcode(String langcode) throws Exception { this.langcode = Commons.getFieldData("langcode"); } - + @BeforeSuite - - - - @BeforeMethod - public void set() { - extent=ExtentReportManager.getReports(); - } - + + + + @BeforeMethod + public void set() { + extent=ExtentReportManager.getReports(); + } + @BeforeMethod public void setUp() throws Exception { - Reporter.log("BaseClass",true); - test=extent.createTest(getCommitId(),getCommitId()); - - if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { - String configFilePath ="/usr/bin/chromedriver"; - System.setProperty("webdriver.chrome.driver", configFilePath); - }else { - WebDriverManager.chromedriver().setup(); - } - - - ChromeOptions options = new ChromeOptions(); - String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); - if(headless.equalsIgnoreCase("yes")) { - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); - - } - driver=new ChromeDriver(options); - - -// + Reporter.log("BaseClass",true); + test=extent.createTest(getCommitId(),getCommitId()); + + if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { + String configFilePath ="/usr/bin/chromedriver"; + System.setProperty("webdriver.chrome.driver", configFilePath); + }else { + WebDriverManager.chromedriver().setup(); + } + + + ChromeOptions options = new ChromeOptions(); + String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); + if(headless.equalsIgnoreCase("yes")) { + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options); + }else { + driver=new ChromeDriver(options); + } + + + // js = (JavascriptExecutor) driver; vars = new HashMap(); driver.get(envPath); driver.manage().window().maximize(); Thread.sleep(500); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - + String language1 = null; try { language1 = Commons.getFieldData("langcode"); @@ -136,29 +139,29 @@ public void setUp() throws Exception { @AfterMethod public void tearDown() { - + driver.quit(); extent.flush(); - + } - + @AfterSuite public void pushFileToS3() { getCommitId(); if (ConfigManager.getPushReportsToS3().equalsIgnoreCase("yes")) { // EXTENT REPORT - + File repotFile = new File(ExtentReportManager.Filepath); System.out.println("reportFile is::" + repotFile); - String reportname = repotFile.getName(); - - + String reportname = repotFile.getName(); + + S3Adapter s3Adapter = new S3Adapter(); boolean isStoreSuccess = false; try { isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(), BaseTestCaseFunc.testLevel, null, "AdminUi",env+BaseTestCaseFunc.currentModule+data+".html", repotFile); - + System.out.println("isStoreSuccess:: " + isStoreSuccess); } catch (Exception e) { System.out.println("error occured while pushing the object" + e.getLocalizedMessage()); @@ -170,10 +173,10 @@ public void pushFileToS3() { System.out.println("Failed while pushing file to S3"); } } - - } - - + + } + + @DataProvider(name = "data-provider") public Object[] dpMethod() { @@ -192,7 +195,7 @@ public static String[] readFolderJsonList() { String contents[] = null; try { String langcode = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - + File directoryPath = new File(TestRunner.getResourcePath()+ "\\BulkUploadFiles\\" + langcode + "\\"); if (directoryPath.exists()) { @@ -208,20 +211,20 @@ public static String[] readFolderJsonList() { } return contents; } - private String getCommitId(){ - Properties properties = new Properties(); - try (InputStream is = ExtentReportManager.class.getClassLoader().getResourceAsStream("git.properties")) { - properties.load(is); - - return "Commit Id is: " + properties.getProperty("git.commit.id.abbrev") + " & Branch Name is:" + properties.getProperty("git.branch"); - - } catch (IOException e) { - logger.error(e.getStackTrace()); - return ""; - } - - } - - - + private String getCommitId(){ + Properties properties = new Properties(); + try (InputStream is = ExtentReportManager.class.getClassLoader().getResourceAsStream("git.properties")) { + properties.load(is); + + return "Commit Id is: " + properties.getProperty("git.commit.id.abbrev") + " & Branch Name is:" + properties.getProperty("git.branch"); + + } catch (IOException e) { + logger.error(e.getStackTrace()); + return ""; + } + + } + + + } From 870dd49c88f89423eb4f44916288f0abf5a12812 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 12:13:27 +0530 Subject: [PATCH 15/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/BaseClass.java | 135 +++++++++--------- 1 file changed, 66 insertions(+), 69 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index a6c3eecb..dcee69ee 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -5,7 +5,6 @@ import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.net.URL; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -23,7 +22,6 @@ import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -66,57 +64,56 @@ public class BaseClass { protected String password = allpassword[0]; protected String data = Commons.appendDate; public static ExtentSparkReporter html; - - - - public static ExtentReports extent; - public static ExtentTest test; - + + + + public static ExtentReports extent; + public static ExtentTest test; + public void setLangcode(String langcode) throws Exception { this.langcode = Commons.getFieldData("langcode"); } - + @BeforeSuite - - - - @BeforeMethod - public void set() { - extent=ExtentReportManager.getReports(); - } - + + + + @BeforeMethod + public void set() { + extent=ExtentReportManager.getReports(); + } + @BeforeMethod public void setUp() throws Exception { - Reporter.log("BaseClass",true); - test=extent.createTest(getCommitId(),getCommitId()); - - if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { - String configFilePath ="/usr/bin/chromedriver"; - System.setProperty("webdriver.chrome.driver", configFilePath); - }else { - WebDriverManager.chromedriver().setup(); - } - - - ChromeOptions options = new ChromeOptions(); - String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); - if(headless.equalsIgnoreCase("yes")) { - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); - driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options); - }else { - driver=new ChromeDriver(options); - } - - - // + Reporter.log("BaseClass",true); + test=extent.createTest(getCommitId(),getCommitId()); + + if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { + String configFilePath ="/usr/bin/chromedriver"; + System.setProperty("webdriver.chrome.driver", configFilePath); + }else { + WebDriverManager.chromedriver().setup(); + } + + + ChromeOptions options = new ChromeOptions(); + String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); + if(headless.equalsIgnoreCase("yes")) { + options.addArguments("--headless", "--disable-gpu"); + + } + driver=new ChromeDriver(options); + + +// js = (JavascriptExecutor) driver; vars = new HashMap(); driver.get(envPath); driver.manage().window().maximize(); Thread.sleep(500); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - + String language1 = null; try { language1 = Commons.getFieldData("langcode"); @@ -139,29 +136,29 @@ public void setUp() throws Exception { @AfterMethod public void tearDown() { - + driver.quit(); extent.flush(); - + } - + @AfterSuite public void pushFileToS3() { getCommitId(); if (ConfigManager.getPushReportsToS3().equalsIgnoreCase("yes")) { // EXTENT REPORT - + File repotFile = new File(ExtentReportManager.Filepath); System.out.println("reportFile is::" + repotFile); - String reportname = repotFile.getName(); - - + String reportname = repotFile.getName(); + + S3Adapter s3Adapter = new S3Adapter(); boolean isStoreSuccess = false; try { isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(), BaseTestCaseFunc.testLevel, null, "AdminUi",env+BaseTestCaseFunc.currentModule+data+".html", repotFile); - + System.out.println("isStoreSuccess:: " + isStoreSuccess); } catch (Exception e) { System.out.println("error occured while pushing the object" + e.getLocalizedMessage()); @@ -173,10 +170,10 @@ public void pushFileToS3() { System.out.println("Failed while pushing file to S3"); } } - - } - - + + } + + @DataProvider(name = "data-provider") public Object[] dpMethod() { @@ -195,7 +192,7 @@ public static String[] readFolderJsonList() { String contents[] = null; try { String langcode = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - + File directoryPath = new File(TestRunner.getResourcePath()+ "\\BulkUploadFiles\\" + langcode + "\\"); if (directoryPath.exists()) { @@ -211,20 +208,20 @@ public static String[] readFolderJsonList() { } return contents; } - private String getCommitId(){ - Properties properties = new Properties(); - try (InputStream is = ExtentReportManager.class.getClassLoader().getResourceAsStream("git.properties")) { - properties.load(is); - - return "Commit Id is: " + properties.getProperty("git.commit.id.abbrev") + " & Branch Name is:" + properties.getProperty("git.branch"); - - } catch (IOException e) { - logger.error(e.getStackTrace()); - return ""; - } - - } - - - + private String getCommitId(){ + Properties properties = new Properties(); + try (InputStream is = ExtentReportManager.class.getClassLoader().getResourceAsStream("git.properties")) { + properties.load(is); + + return "Commit Id is: " + properties.getProperty("git.commit.id.abbrev") + " & Branch Name is:" + properties.getProperty("git.branch"); + + } catch (IOException e) { + logger.error(e.getStackTrace()); + return ""; + } + + } + + + } From 84a5ebab6046a8dd410b230d1dd8bd5e4b08e44e Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 12:28:06 +0530 Subject: [PATCH 16/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index dcee69ee..1d51f0c5 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -100,7 +100,7 @@ public void setUp() throws Exception { ChromeOptions options = new ChromeOptions(); String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); if(headless.equalsIgnoreCase("yes")) { - options.addArguments("--headless", "--disable-gpu"); + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); } driver=new ChromeDriver(options); From 65fe52ba83adf28691f22184cf7823f728912033 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 12:50:21 +0530 Subject: [PATCH 17/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/testcase/MachineTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index 5bc96b4b..f708cef6 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -42,7 +42,10 @@ public void machineCRUD() throws Exception { // Commons.click(test,driver,By.id("Create Machine")); Thread.sleep(4000); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); - driver.findElement(By.id("Create Machine")).click(); + // driver.findElement(By.id("Create Machine")).click(); + WebElement createMachineButton = driver.findElement(By.id("Create Machine")); + Actions actions = new Actions(driver); + actions.moveToElement(createMachineButton).click().perform(); test.log(Status.INFO, "Click on Create Machine"); Commons.enter(test,driver,By.id("name"),data); Commons.enter(test,driver,By.id("serialNumber"),"1234567"); From c028dc8346f3daff47f4a1caf24d9212cc9aa44e Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 13:02:37 +0530 Subject: [PATCH 18/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/testcase/MachineTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index f708cef6..ee226805 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -43,9 +43,9 @@ public void machineCRUD() throws Exception { Thread.sleep(4000); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); // driver.findElement(By.id("Create Machine")).click(); - WebElement createMachineButton = driver.findElement(By.id("Create Machine")); - Actions actions = new Actions(driver); - actions.moveToElement(createMachineButton).click().perform(); + WebDriverWait wait = new WebDriverWait(driver, 10); + WebElement createMachineButton = wait.until(ExpectedConditions.elementToBeClickable(By.id("Create Machine"))); + createMachineButton.click(); test.log(Status.INFO, "Click on Create Machine"); Commons.enter(test,driver,By.id("name"),data); Commons.enter(test,driver,By.id("serialNumber"),"1234567"); From b1d78b7efc813f893feb349127edbd7c81a763d4 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 13:11:44 +0530 Subject: [PATCH 19/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/testcase/MachineTest.java | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index ee226805..f048ef00 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -3,6 +3,7 @@ import java.util.Map; import java.util.concurrent.TimeUnit; +import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.JavascriptExecutor; @@ -28,59 +29,58 @@ import io.mosip.testrig.adminui.utility.BaseClass; import io.mosip.testrig.adminui.utility.Commons; import io.mosip.testrig.adminui.utility.JsonUtil; +import io.mosip.testrig.adminui.utility.TestRunner; public class MachineTest extends BaseClass{ - @Test(groups = "M") - public void machineCRUD() throws Exception { - test=extent.createTest("MachineTest", "verify Login"); - String holidayDateCenter=JsonUtil.JsonObjParsing(Commons.getTestData(),"holidayDateCenter"); - String publicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"publicKey"); + private static final Logger logger = Logger.getLogger(MachineTest.class); + @Test(groups = "M") + public void machineCRUD() throws Exception { - String signPublicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"signPublicKey"); - - Commons.click(test,driver,By.id("admin/resources")); - Commons.click(test,driver,By.id("/admin/resources/machines")); -// Commons.click(test,driver,By.id("Create Machine")); - Thread.sleep(4000); - driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); - // driver.findElement(By.id("Create Machine")).click(); - WebDriverWait wait = new WebDriverWait(driver, 10); - WebElement createMachineButton = wait.until(ExpectedConditions.elementToBeClickable(By.id("Create Machine"))); - createMachineButton.click(); - test.log(Status.INFO, "Click on Create Machine"); - Commons.enter(test,driver,By.id("name"),data); - Commons.enter(test,driver,By.id("serialNumber"),"1234567"); - Commons.enter(test,driver,By.id("macAddress"),"1.2.3.4.5.6"); - Commons.enter(test,driver,By.id("ipAddress"),"2.3.4.5.6"); - test.log(Status.INFO, "ENter IpAddress"); - // Commons.enter(test,driver,By.id("validity"),holidayDateCenter); - Commons.calendar(holidayDateCenter); - Commons.dropdown(test,driver,By.id("machineSpecId")); - Commons.enter(test,driver,By.id("publicKey"),publicKey); - - Commons.enter(test,driver,By.id("signPublicKey"),signPublicKey); - try{ Commons.dropdown(test,driver, By.id("zone")); - - }catch(Exception e) { - test.log(Status.INFO, e); - } - Commons.dropdown(test,driver,By.id("regCenterId")); - - - - Commons.createRes(test,driver); - Commons.filter(test,driver, By.id("name"), data); - + test=extent.createTest("MachineTest", "verify Login"); + String holidayDateCenter=JsonUtil.JsonObjParsing(Commons.getTestData(),"holidayDateCenter"); + String publicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"publicKey"); - Commons.editRes(test,driver,data+1,By.id("name")); - test.log(Status.INFO, "Click on Edit"); - Commons.filter(test,driver, By.id("name"), data+1); - - Commons.activate(test,driver); - test.log(Status.INFO, "Click on Active"); - Commons.editRes(test,driver,data+2,By.id("name")); - Commons.filter(test,driver, By.id("name"), data+2); - Commons.deactivate(test,driver); - test.log(Status.INFO, "Click on Deactivated"); - Commons.decommission(test,driver); - } + String signPublicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"signPublicKey"); + logger.info(driver.findElement(By.id("admin/resources")).isDisplayed()+"1"); + Commons.click(test,driver,By.id("admin/resources")); + logger.info(driver.findElement(By.id("/admin/resources/machines")).isDisplayed()+"2"); + Commons.click(test,driver,By.id("/admin/resources/machines")); + logger.info(driver.findElement(By.id("Create Machine")).isDisplayed()+"3"); + Commons.click(test,driver,By.id("Create Machine")); + test.log(Status.INFO, "Click on Create Machine"); + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("serialNumber"),"1234567"); + Commons.enter(test,driver,By.id("macAddress"),"1.2.3.4.5.6"); + Commons.enter(test,driver,By.id("ipAddress"),"2.3.4.5.6"); + test.log(Status.INFO, "ENter IpAddress"); + // Commons.enter(test,driver,By.id("validity"),holidayDateCenter); + Commons.calendar(holidayDateCenter); + Commons.dropdown(test,driver,By.id("machineSpecId")); + Commons.enter(test,driver,By.id("publicKey"),publicKey); + + Commons.enter(test,driver,By.id("signPublicKey"),signPublicKey); + try{ Commons.dropdown(test,driver, By.id("zone")); + + }catch(Exception e) { + test.log(Status.INFO, e); + } + Commons.dropdown(test,driver,By.id("regCenterId")); + + + + Commons.createRes(test,driver); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.editRes(test,driver,data+1,By.id("name")); + test.log(Status.INFO, "Click on Edit"); + Commons.filter(test,driver, By.id("name"), data+1); + + Commons.activate(test,driver); + test.log(Status.INFO, "Click on Active"); + Commons.editRes(test,driver,data+2,By.id("name")); + Commons.filter(test,driver, By.id("name"), data+2); + Commons.deactivate(test,driver); + test.log(Status.INFO, "Click on Deactivated"); + Commons.decommission(test,driver); + } } From eee14e09b0af4e64ac0b0f11910c569daff399af Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 13:15:48 +0530 Subject: [PATCH 20/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/testcase/MachineTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index f048ef00..94713409 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -44,6 +44,7 @@ public void machineCRUD() throws Exception { Commons.click(test,driver,By.id("admin/resources")); logger.info(driver.findElement(By.id("/admin/resources/machines")).isDisplayed()+"2"); Commons.click(test,driver,By.id("/admin/resources/machines")); + Thread.sleep(20000); logger.info(driver.findElement(By.id("Create Machine")).isDisplayed()+"3"); Commons.click(test,driver,By.id("Create Machine")); test.log(Status.INFO, "Click on Create Machine"); From 2dbac43d29397f34ebb1b015f57928386ef61593 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 13:20:49 +0530 Subject: [PATCH 21/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/testcase/MachineTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index 94713409..0a941eac 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -44,6 +44,7 @@ public void machineCRUD() throws Exception { Commons.click(test,driver,By.id("admin/resources")); logger.info(driver.findElement(By.id("/admin/resources/machines")).isDisplayed()+"2"); Commons.click(test,driver,By.id("/admin/resources/machines")); + Commons.click(test,driver,By.id("/admin/resources/machines")); Thread.sleep(20000); logger.info(driver.findElement(By.id("Create Machine")).isDisplayed()+"3"); Commons.click(test,driver,By.id("Create Machine")); From e1eed0b9575a5217067098acdf9bcb80fb07af2e Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 13:35:55 +0530 Subject: [PATCH 22/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/testcase/MachineTest.java | 2 +- .../testrig/adminui/utility/BaseClass.java | 93 +++++++++---------- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index 0a941eac..9caa4d2c 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -44,7 +44,7 @@ public void machineCRUD() throws Exception { Commons.click(test,driver,By.id("admin/resources")); logger.info(driver.findElement(By.id("/admin/resources/machines")).isDisplayed()+"2"); Commons.click(test,driver,By.id("/admin/resources/machines")); - Commons.click(test,driver,By.id("/admin/resources/machines")); + // Commons.click(test,driver,By.id("/admin/resources/machines")); Thread.sleep(20000); logger.info(driver.findElement(By.id("Create Machine")).isDisplayed()+"3"); Commons.click(test,driver,By.id("Create Machine")); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 1d51f0c5..b2bcd022 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -5,6 +5,7 @@ import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.net.URL; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -22,6 +23,7 @@ import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -85,54 +87,51 @@ public void set() { } @BeforeMethod - public void setUp() throws Exception { - Reporter.log("BaseClass",true); - test=extent.createTest(getCommitId(),getCommitId()); - - if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { - String configFilePath ="/usr/bin/chromedriver"; - System.setProperty("webdriver.chrome.driver", configFilePath); - }else { - WebDriverManager.chromedriver().setup(); - } - - - ChromeOptions options = new ChromeOptions(); - String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); - if(headless.equalsIgnoreCase("yes")) { - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); - - } - driver=new ChromeDriver(options); - - -// - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - - String language1 = null; - try { - language1 = Commons.getFieldData("langcode"); - - logger.info(language1); - if(!language1.equals("sin")) - {Commons.click(test,driver, By.xpath("//*[@id='kc-locale-dropdown']")); - String var = "//li/a[contains(text(),'" + language1 + "')]"; - Commons.click(test,driver, By.xpath(var)); - } + public void setUp() throws Exception { + Reporter.log("BaseClass", true); + test = extent.createTest(getCommitId(), getCommitId()); + + ChromeOptions options = new ChromeOptions(); + String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); + if (headless.equalsIgnoreCase("yes")) { + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + } + + if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { + // Use remote WebDriver for Linux + options.addArguments("--no-sandbox"); // Add additional arguments if needed + driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), options); + } else { + // Use local WebDriver for non-Linux + WebDriverManager.chromedriver().setup(); + driver = new ChromeDriver(options); + } + + js = (JavascriptExecutor) driver; + vars = new HashMap(); + driver.get(envPath); + driver.manage().window().maximize(); + Thread.sleep(500); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + + String language1 = null; + try { + language1 = Commons.getFieldData("langcode"); + logger.info(language1); + if (!language1.equals("sin")) { + Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']")); + String var = "//li/a[contains(text(),'" + language1 + "')]"; + Commons.click(test, driver, By.xpath(var)); + } + } catch (Exception e) { + e.getMessage(); + } + + driver.findElement(By.id("username")).sendKeys(userid); + driver.findElement(By.id("password")).sendKeys(password); + driver.findElement(By.xpath("//input[@name='login']")).click(); + } - } catch (Exception e) { - e.getMessage(); - } - driver.findElement(By.id("username")).sendKeys(userid); - driver.findElement(By.id("password")).sendKeys(password); - driver.findElement(By.xpath("//input[@name=\'login\']")).click(); - - } @AfterMethod public void tearDown() { From 7035a20dd1d466b8aa80ef771c645d9d651875c2 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 13:49:48 +0530 Subject: [PATCH 23/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/BaseClass.java | 94 ++++++++++--------- 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index b2bcd022..2a54159b 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -5,7 +5,6 @@ import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.net.URL; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -23,7 +22,6 @@ import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -87,51 +85,55 @@ public void set() { } @BeforeMethod - public void setUp() throws Exception { - Reporter.log("BaseClass", true); - test = extent.createTest(getCommitId(), getCommitId()); - - ChromeOptions options = new ChromeOptions(); - String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); - if (headless.equalsIgnoreCase("yes")) { - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); - } - - if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { - // Use remote WebDriver for Linux - options.addArguments("--no-sandbox"); // Add additional arguments if needed - driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), options); - } else { - // Use local WebDriver for non-Linux - WebDriverManager.chromedriver().setup(); - driver = new ChromeDriver(options); - } - - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - - String language1 = null; - try { - language1 = Commons.getFieldData("langcode"); - logger.info(language1); - if (!language1.equals("sin")) { - Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']")); - String var = "//li/a[contains(text(),'" + language1 + "')]"; - Commons.click(test, driver, By.xpath(var)); - } - } catch (Exception e) { - e.getMessage(); - } - - driver.findElement(By.id("username")).sendKeys(userid); - driver.findElement(By.id("password")).sendKeys(password); - driver.findElement(By.xpath("//input[@name='login']")).click(); - } + public void setUp() throws Exception { + Reporter.log("BaseClass",true); + test=extent.createTest(getCommitId(),getCommitId()); + + if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { + String configFilePath ="/usr/bin/chromedriver"; + System.setProperty("webdriver.chrome.driver", configFilePath); + }else { + WebDriverManager.chromedriver().setup(); + } + + + ChromeOptions options = new ChromeOptions(); + String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); + if(headless.equalsIgnoreCase("yes")) { + options.addArguments("--no-sandbox"); + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + + } + driver=new ChromeDriver(options); + + +// + js = (JavascriptExecutor) driver; + vars = new HashMap(); + driver.get(envPath); + driver.manage().window().maximize(); + Thread.sleep(500); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + + String language1 = null; + try { + language1 = Commons.getFieldData("langcode"); + + logger.info(language1); + if(!language1.equals("sin")) + {Commons.click(test,driver, By.xpath("//*[@id='kc-locale-dropdown']")); + String var = "//li/a[contains(text(),'" + language1 + "')]"; + Commons.click(test,driver, By.xpath(var)); + } + } catch (Exception e) { + e.getMessage(); + } + driver.findElement(By.id("username")).sendKeys(userid); + driver.findElement(By.id("password")).sendKeys(password); + driver.findElement(By.xpath("//input[@name=\'login\']")).click(); + + } @AfterMethod public void tearDown() { From 3a22908057f1d8a4eb73465a061eb57c09193685 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 15:35:42 +0530 Subject: [PATCH 24/69] fix test Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 16 +- .../testrig/adminui/utility/BaseClass.java | 143 ++++++++++++------ 2 files changed, 112 insertions(+), 47 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index abab59c7..82c16352 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -1,9 +1,23 @@ FROM selenium/standalone-chrome:latest + USER root + +# Install wget +RUN apt-get update && apt-get install -y wget + +# Download and install the ChromeDriver +RUN CHROME_DRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE) \ + && wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip \ + && unzip /tmp/chromedriver.zip -d /usr/bin \ + && rm /tmp/chromedriver.zip \ + && chown root:root /usr/bin/chromedriver \ + && chmod +x /usr/bin/chromedriver + ARG SOURCE ARG COMMIT_HASH ARG COMMIT_ID ARG BUILD_TIME + LABEL source=${SOURCE} LABEL commit_hash=${COMMIT_HASH} LABEL commit_id=${COMMIT_ID} @@ -38,4 +52,4 @@ COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir} # set working directory WORKDIR ${work_dir} -ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 2a54159b..fda77b87 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -5,6 +5,7 @@ import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.net.URL; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -22,6 +23,7 @@ import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -84,56 +86,105 @@ public void set() { extent=ExtentReportManager.getReports(); } - @BeforeMethod - public void setUp() throws Exception { - Reporter.log("BaseClass",true); - test=extent.createTest(getCommitId(),getCommitId()); - - if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { - String configFilePath ="/usr/bin/chromedriver"; - System.setProperty("webdriver.chrome.driver", configFilePath); - }else { - WebDriverManager.chromedriver().setup(); - } - - - ChromeOptions options = new ChromeOptions(); - String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); - if(headless.equalsIgnoreCase("yes")) { - options.addArguments("--no-sandbox"); - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); - - } - driver=new ChromeDriver(options); - - +// @BeforeMethod +// public void setUp() throws Exception { +// Reporter.log("BaseClass",true); +// test=extent.createTest(getCommitId(),getCommitId()); +// +// if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { +// String configFilePath ="/usr/bin/chromedriver"; +// System.setProperty("webdriver.chrome.driver", configFilePath); +// }else { +// WebDriverManager.chromedriver().setup(); +// } +// +// +// ChromeOptions options = new ChromeOptions(); +// String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); +// if(headless.equalsIgnoreCase("yes")) { +// options.addArguments("--no-sandbox"); +// options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); +// +// } +// driver=new ChromeDriver(options); +// // - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - - String language1 = null; - try { - language1 = Commons.getFieldData("langcode"); +//// +// js = (JavascriptExecutor) driver; +// vars = new HashMap(); +// driver.get(envPath); +// driver.manage().window().maximize(); +// Thread.sleep(500); +// driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); +// +// String language1 = null; +// try { +// language1 = Commons.getFieldData("langcode"); +// +// logger.info(language1); +// if(!language1.equals("sin")) +// {Commons.click(test,driver, By.xpath("//*[@id='kc-locale-dropdown']")); +// String var = "//li/a[contains(text(),'" + language1 + "')]"; +// Commons.click(test,driver, By.xpath(var)); +// } +// +// } catch (Exception e) { +// e.getMessage(); +// } +// driver.findElement(By.id("username")).sendKeys(userid); +// driver.findElement(By.id("password")).sendKeys(password); +// driver.findElement(By.xpath("//input[@name=\'login\']")).click(); +// +// } + @BeforeMethod + public void setUp() throws Exception { + Reporter.log("BaseClass", true); + test = extent.createTest(getCommitId(), getCommitId()); - logger.info(language1); - if(!language1.equals("sin")) - {Commons.click(test,driver, By.xpath("//*[@id='kc-locale-dropdown']")); - String var = "//li/a[contains(text(),'" + language1 + "')]"; - Commons.click(test,driver, By.xpath(var)); - } + ChromeOptions options = new ChromeOptions(); + String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); + if (headless.equalsIgnoreCase("yes")) { + options.addArguments("--no-sandbox"); + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + } - } catch (Exception e) { - e.getMessage(); - } - driver.findElement(By.id("username")).sendKeys(userid); - driver.findElement(By.id("password")).sendKeys(password); - driver.findElement(By.xpath("//input[@name=\'login\']")).click(); + WebDriver driver; - } + if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { + // Use remote WebDriver for Linux + options.addArguments("--no-sandbox"); // Add additional arguments if needed + driver = new RemoteWebDriver(new URL("http://localhost:4444/grid/console"), options); + } else { + // Use local WebDriver for non-Linux + WebDriverManager.chromedriver().setup(); + driver = new ChromeDriver(options); + } + + js = (JavascriptExecutor) driver; + vars = new HashMap(); + driver.get(envPath); + driver.manage().window().maximize(); + Thread.sleep(500); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + + String language1 = null; + try { + language1 = Commons.getFieldData("langcode"); + logger.info(language1); + if (!language1.equals("sin")) { + Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']")); + String var = "//li/a[contains(text(),'" + language1 + "')]"; + Commons.click(test, driver, By.xpath(var)); + } + } catch (Exception e) { + e.getMessage(); + } + + driver.findElement(By.id("username")).sendKeys(userid); + driver.findElement(By.id("password")).sendKeys(password); + driver.findElement(By.xpath("//input[@name='login']")).click(); + } + @AfterMethod public void tearDown() { From 4fabfd0a07c5613eae5ac55095e66b67c95fd85e Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 15:42:44 +0530 Subject: [PATCH 25/69] fix test Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 82c16352..71bbd866 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -3,11 +3,10 @@ FROM selenium/standalone-chrome:latest USER root # Install wget -RUN apt-get update && apt-get install -y wget +RUN apt-get update && apt-get install -y wget unzip # Download and install the ChromeDriver -RUN CHROME_DRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE) \ - && wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip \ +RUN wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip \ && unzip /tmp/chromedriver.zip -d /usr/bin \ && rm /tmp/chromedriver.zip \ && chown root:root /usr/bin/chromedriver \ From dd359e691c540aba1dbd0545199460631b8ce449 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 15:49:00 +0530 Subject: [PATCH 26/69] fix test Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 19 +++++++++++-------- admintest/entrypoint.sh | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 71bbd866..e926f090 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -1,12 +1,14 @@ -FROM selenium/standalone-chrome:latest +# Use the official Selenium Grid standalone image +FROM selenium/hub:latest USER root # Install wget -RUN apt-get update && apt-get install -y wget unzip +RUN apt-get update && apt-get install -y wget # Download and install the ChromeDriver -RUN wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip \ +RUN CHROME_DRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE) \ + && wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip \ && unzip /tmp/chromedriver.zip -d /usr/bin \ && rm /tmp/chromedriver.zip \ && chown root:root /usr/bin/chromedriver \ @@ -22,16 +24,16 @@ LABEL commit_hash=${COMMIT_HASH} LABEL commit_id=${COMMIT_ID} LABEL build_time=${BUILD_TIME} -# can be passed during Docker build as build time environment for github branch to pickup configuration from. +# can be passed during Docker build as build time environment for GitHub branch to pick up configuration from. ARG container_user=mosip -# can be passed during Docker build as build time environment for github branch to pickup configuration from. +# can be passed during Docker build as build time environment for GitHub branch to pick up configuration from. ARG container_user_group=mosip -# can be passed during Docker build as build time environment for github branch to pickup configuration from. +# can be passed during Docker build as build time environment for GitHub branch to pick up configuration from. ARG container_user_uid=1001 -# can be passed during Docker build as build time environment for github branch to pickup configuration from. +# can be passed during Docker build as build time environment for GitHub branch to pick up configuration from. ARG container_user_gid=1001 # set working directory for the user @@ -51,4 +53,5 @@ COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir} # set working directory WORKDIR ${work_dir} -ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] +# Start the Selenium Hub when the container starts +CMD ["./entrypoint.sh"] diff --git a/admintest/entrypoint.sh b/admintest/entrypoint.sh index d9c22cdc..78b92168 100644 --- a/admintest/entrypoint.sh +++ b/admintest/entrypoint.sh @@ -1,4 +1,19 @@ #!/bin/bash java --version -java -jar adminui-*-jar-with-dependencies.jar \ No newline at end of file + + +#!/bin/bash + +# Start Selenium Hub +java -jar /opt/selenium/selenium-server-standalone.jar -role hub & +sleep 5 # Wait for Selenium Hub to start + +# Start Selenium Node with Chrome +java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar /opt/selenium/selenium-server-standalone.jar -role node -hub http://localhost:4444/grid/register -browser "browserName=chrome,maxInstances=5" & + +# Wait for a while to allow nodes to register +sleep 10 + +# Run your test or other application +java -jar adminui-*-jar-with-dependencies.jar From 58f60e5ab63d234f21591ce3f63c791c6db68ea1 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 16:03:29 +0530 Subject: [PATCH 27/69] fix test Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index fda77b87..409199a5 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -153,7 +153,7 @@ public void setUp() throws Exception { if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { // Use remote WebDriver for Linux options.addArguments("--no-sandbox"); // Add additional arguments if needed - driver = new RemoteWebDriver(new URL("http://localhost:4444/grid/console"), options); + driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options); } else { // Use local WebDriver for non-Linux WebDriverManager.chromedriver().setup(); From fa4cf83dd207827b6c76c0f038afb17f2cf9aee9 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 16:10:33 +0530 Subject: [PATCH 28/69] fix test Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 28 +-- admintest/entrypoint.sh | 17 +- .../testrig/adminui/testcase/MachineTest.java | 21 ++ .../testrig/adminui/utility/BaseClass.java | 188 +++++++++--------- 4 files changed, 122 insertions(+), 132 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index e926f090..abab59c7 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -1,39 +1,24 @@ -# Use the official Selenium Grid standalone image -FROM selenium/hub:latest - +FROM selenium/standalone-chrome:latest USER root - -# Install wget -RUN apt-get update && apt-get install -y wget - -# Download and install the ChromeDriver -RUN CHROME_DRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE) \ - && wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip \ - && unzip /tmp/chromedriver.zip -d /usr/bin \ - && rm /tmp/chromedriver.zip \ - && chown root:root /usr/bin/chromedriver \ - && chmod +x /usr/bin/chromedriver - ARG SOURCE ARG COMMIT_HASH ARG COMMIT_ID ARG BUILD_TIME - LABEL source=${SOURCE} LABEL commit_hash=${COMMIT_HASH} LABEL commit_id=${COMMIT_ID} LABEL build_time=${BUILD_TIME} -# can be passed during Docker build as build time environment for GitHub branch to pick up configuration from. +# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user=mosip -# can be passed during Docker build as build time environment for GitHub branch to pick up configuration from. +# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_group=mosip -# can be passed during Docker build as build time environment for GitHub branch to pick up configuration from. +# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_uid=1001 -# can be passed during Docker build as build time environment for GitHub branch to pick up configuration from. +# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_gid=1001 # set working directory for the user @@ -53,5 +38,4 @@ COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir} # set working directory WORKDIR ${work_dir} -# Start the Selenium Hub when the container starts -CMD ["./entrypoint.sh"] +ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] \ No newline at end of file diff --git a/admintest/entrypoint.sh b/admintest/entrypoint.sh index 78b92168..d9c22cdc 100644 --- a/admintest/entrypoint.sh +++ b/admintest/entrypoint.sh @@ -1,19 +1,4 @@ #!/bin/bash java --version - - -#!/bin/bash - -# Start Selenium Hub -java -jar /opt/selenium/selenium-server-standalone.jar -role hub & -sleep 5 # Wait for Selenium Hub to start - -# Start Selenium Node with Chrome -java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar /opt/selenium/selenium-server-standalone.jar -role node -hub http://localhost:4444/grid/register -browser "browserName=chrome,maxInstances=5" & - -# Wait for a while to allow nodes to register -sleep 10 - -# Run your test or other application -java -jar adminui-*-jar-with-dependencies.jar +java -jar adminui-*-jar-with-dependencies.jar \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index 9caa4d2c..17907f7c 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -1,5 +1,6 @@ package io.mosip.testrig.adminui.testcase; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -45,6 +46,13 @@ public void machineCRUD() throws Exception { logger.info(driver.findElement(By.id("/admin/resources/machines")).isDisplayed()+"2"); Commons.click(test,driver,By.id("/admin/resources/machines")); // Commons.click(test,driver,By.id("/admin/resources/machines")); + List allElements = driver.findElements(By.xpath("//*")); + + // Print XPath for each element + for (WebElement element : allElements) { + String xpath = getXPath(element); + logger.info(xpath); + } Thread.sleep(20000); logger.info(driver.findElement(By.id("Create Machine")).isDisplayed()+"3"); Commons.click(test,driver,By.id("Create Machine")); @@ -85,4 +93,17 @@ public void machineCRUD() throws Exception { test.log(Status.INFO, "Click on Deactivated"); Commons.decommission(test,driver); } + private static String getXPath(WebElement element) { + if (element == null) { + return null; + } + + if (!element.getAttribute("id").isEmpty()) { + return "//*[@id='" + element.getAttribute("id") + "']"; + } + + // You can add more conditions based on attributes if needed + + return getXPath(element.findElement(By.xpath(".."))) + "/" + element.getTagName(); + } } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 409199a5..0b16865e 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -86,104 +86,104 @@ public void set() { extent=ExtentReportManager.getReports(); } -// @BeforeMethod -// public void setUp() throws Exception { -// Reporter.log("BaseClass",true); -// test=extent.createTest(getCommitId(),getCommitId()); -// -// if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { -// String configFilePath ="/usr/bin/chromedriver"; -// System.setProperty("webdriver.chrome.driver", configFilePath); -// }else { -// WebDriverManager.chromedriver().setup(); -// } -// -// -// ChromeOptions options = new ChromeOptions(); -// String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); -// if(headless.equalsIgnoreCase("yes")) { -// options.addArguments("--no-sandbox"); -// options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); -// -// } -// driver=new ChromeDriver(options); -// -// -//// -// js = (JavascriptExecutor) driver; -// vars = new HashMap(); -// driver.get(envPath); -// driver.manage().window().maximize(); -// Thread.sleep(500); -// driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + @BeforeMethod + public void setUp() throws Exception { + Reporter.log("BaseClass",true); + test=extent.createTest(getCommitId(),getCommitId()); + + if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { + String configFilePath ="/usr/bin/chromedriver"; + System.setProperty("webdriver.chrome.driver", configFilePath); + }else { + WebDriverManager.chromedriver().setup(); + } + + + ChromeOptions options = new ChromeOptions(); + String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); + if(headless.equalsIgnoreCase("yes")) { + options.addArguments("--no-sandbox"); + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + + } + driver=new ChromeDriver(options); + + // -// String language1 = null; -// try { -// language1 = Commons.getFieldData("langcode"); -// -// logger.info(language1); -// if(!language1.equals("sin")) -// {Commons.click(test,driver, By.xpath("//*[@id='kc-locale-dropdown']")); -// String var = "//li/a[contains(text(),'" + language1 + "')]"; -// Commons.click(test,driver, By.xpath(var)); -// } -// -// } catch (Exception e) { -// e.getMessage(); -// } -// driver.findElement(By.id("username")).sendKeys(userid); -// driver.findElement(By.id("password")).sendKeys(password); -// driver.findElement(By.xpath("//input[@name=\'login\']")).click(); -// -// } - @BeforeMethod - public void setUp() throws Exception { - Reporter.log("BaseClass", true); - test = extent.createTest(getCommitId(), getCommitId()); - - ChromeOptions options = new ChromeOptions(); - String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); - if (headless.equalsIgnoreCase("yes")) { - options.addArguments("--no-sandbox"); - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); - } - - WebDriver driver; - - if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { - // Use remote WebDriver for Linux - options.addArguments("--no-sandbox"); // Add additional arguments if needed - driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options); - } else { - // Use local WebDriver for non-Linux - WebDriverManager.chromedriver().setup(); - driver = new ChromeDriver(options); - } + js = (JavascriptExecutor) driver; + vars = new HashMap(); + driver.get(envPath); + driver.manage().window().maximize(); + Thread.sleep(500); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + + String language1 = null; + try { + language1 = Commons.getFieldData("langcode"); - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + logger.info(language1); + if(!language1.equals("sin")) + {Commons.click(test,driver, By.xpath("//*[@id='kc-locale-dropdown']")); + String var = "//li/a[contains(text(),'" + language1 + "')]"; + Commons.click(test,driver, By.xpath(var)); + } - String language1 = null; - try { - language1 = Commons.getFieldData("langcode"); - logger.info(language1); - if (!language1.equals("sin")) { - Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']")); - String var = "//li/a[contains(text(),'" + language1 + "')]"; - Commons.click(test, driver, By.xpath(var)); - } - } catch (Exception e) { - e.getMessage(); - } + } catch (Exception e) { + e.getMessage(); + } + driver.findElement(By.id("username")).sendKeys(userid); + driver.findElement(By.id("password")).sendKeys(password); + driver.findElement(By.xpath("//input[@name=\'login\']")).click(); - driver.findElement(By.id("username")).sendKeys(userid); - driver.findElement(By.id("password")).sendKeys(password); - driver.findElement(By.xpath("//input[@name='login']")).click(); - } + } +// @BeforeMethod +// public void setUp() throws Exception { +// Reporter.log("BaseClass", true); +// test = extent.createTest(getCommitId(), getCommitId()); +// +// ChromeOptions options = new ChromeOptions(); +// String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); +// if (headless.equalsIgnoreCase("yes")) { +// options.addArguments("--no-sandbox"); +// options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); +// } +// +// WebDriver driver; +// +// if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { +// // Use remote WebDriver for Linux +// options.addArguments("--no-sandbox"); // Add additional arguments if needed +// driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options); +// } else { +// // Use local WebDriver for non-Linux +// WebDriverManager.chromedriver().setup(); +// driver = new ChromeDriver(options); +// } +// +// js = (JavascriptExecutor) driver; +// vars = new HashMap(); +// driver.get(envPath); +// driver.manage().window().maximize(); +// Thread.sleep(500); +// driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); +// +// String language1 = null; +// try { +// language1 = Commons.getFieldData("langcode"); +// logger.info(language1); +// if (!language1.equals("sin")) { +// Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']")); +// String var = "//li/a[contains(text(),'" + language1 + "')]"; +// Commons.click(test, driver, By.xpath(var)); +// } +// } catch (Exception e) { +// e.getMessage(); +// } +// +// driver.findElement(By.id("username")).sendKeys(userid); +// driver.findElement(By.id("password")).sendKeys(password); +// driver.findElement(By.xpath("//input[@name='login']")).click(); +// } @AfterMethod From 97deaa90b5251933e5e8f910c84a5f791186de7d Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 16:21:30 +0530 Subject: [PATCH 29/69] fix test Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/testcase/MachineTest.java | 5 ++--- .../java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index 17907f7c..94750660 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -45,13 +45,12 @@ public void machineCRUD() throws Exception { Commons.click(test,driver,By.id("admin/resources")); logger.info(driver.findElement(By.id("/admin/resources/machines")).isDisplayed()+"2"); Commons.click(test,driver,By.id("/admin/resources/machines")); - // Commons.click(test,driver,By.id("/admin/resources/machines")); List allElements = driver.findElements(By.xpath("//*")); // Print XPath for each element for (WebElement element : allElements) { - String xpath = getXPath(element); - logger.info(xpath); + + logger.info(element); } Thread.sleep(20000); logger.info(driver.findElement(By.id("Create Machine")).isDisplayed()+"3"); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 0b16865e..3a937e22 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -94,6 +94,8 @@ public void setUp() throws Exception { if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { String configFilePath ="/usr/bin/chromedriver"; System.setProperty("webdriver.chrome.driver", configFilePath); + System.setProperty("webdriver.chrome.logfile", "/usr/bin/chromedriver.log"); + System.setProperty("webdriver.chrome.verboseLogging", "true"); }else { WebDriverManager.chromedriver().setup(); } From d29defaf40681f4d1f41e6c3e1157367b49d9bcd Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 16:25:39 +0530 Subject: [PATCH 30/69] fix test Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 3a937e22..9c1d4c60 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -94,8 +94,7 @@ public void setUp() throws Exception { if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { String configFilePath ="/usr/bin/chromedriver"; System.setProperty("webdriver.chrome.driver", configFilePath); - System.setProperty("webdriver.chrome.logfile", "/usr/bin/chromedriver.log"); - System.setProperty("webdriver.chrome.verboseLogging", "true"); + }else { WebDriverManager.chromedriver().setup(); } From 342bc60e7e85480f6c5a4aa1b56b79ece5f6c281 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 28 Dec 2023 16:33:24 +0530 Subject: [PATCH 31/69] fix test Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index abab59c7..fa6f1798 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -27,7 +27,8 @@ ENV work_dir=/home/${container_user}/ # install packages and create user RUN groupadd -g ${container_user_gid} ${container_user_group} \ && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} - + +docker run -d -p 4444:4444 --name selenium-hub --shm-size=2g selenium/hub # select container user for all tasks USER ${container_user_uid}:${container_user_gid} From a6559919cc6bbb8a7bab38591f919315bb29e08d Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 2 Jan 2024 13:09:52 +0530 Subject: [PATCH 32/69] fix login Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 6 +- .../testrig/adminui/utility/BaseClass.java | 67 ++++++++++--------- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index fa6f1798..7027c42c 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -25,10 +25,12 @@ ARG container_user_gid=1001 ENV work_dir=/home/${container_user}/ # install packages and create user +RUN -d -p 4444:4444 --shm-size="2g" selenium/standalone-chrome:latest + RUN groupadd -g ${container_user_gid} ${container_user_group} \ && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} -docker run -d -p 4444:4444 --name selenium-hub --shm-size=2g selenium/hub + # select container user for all tasks USER ${container_user_uid}:${container_user_gid} @@ -39,4 +41,6 @@ COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir} # set working directory WORKDIR ${work_dir} +EXPOSE 4444 + ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 9c1d4c60..1e6ee50f 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -23,6 +23,7 @@ import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; @@ -88,37 +89,40 @@ public void set() { @BeforeMethod public void setUp() throws Exception { - Reporter.log("BaseClass",true); - test=extent.createTest(getCommitId(),getCommitId()); - - if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { - String configFilePath ="/usr/bin/chromedriver"; - System.setProperty("webdriver.chrome.driver", configFilePath); - - }else { - WebDriverManager.chromedriver().setup(); - } - - - ChromeOptions options = new ChromeOptions(); - String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); - if(headless.equalsIgnoreCase("yes")) { - options.addArguments("--no-sandbox"); - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); - - } - driver=new ChromeDriver(options); - - -// - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - - String language1 = null; + Reporter.log("BaseClass", true); + test = extent.createTest(getCommitId(), getCommitId()); + + DesiredCapabilities capabilities = DesiredCapabilities.chrome(); + + // Set Docker Selenium Hub URL + String hubUrl = "http://localhost:4444/wd/hub"; // Replace with your Docker host's IP or hostname + + if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { + capabilities.setCapability("webdriver.chrome.driver", "/usr/bin/chromedriver"); + } else { + WebDriverManager.chromedriver().setup(); + } + + ChromeOptions options = new ChromeOptions(); + String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); + if (headless.equalsIgnoreCase("yes")) { + options.addArguments("--no-sandbox"); + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + } + + capabilities.setCapability(ChromeOptions.CAPABILITY, options); + + // Initialize WebDriver with RemoteWebDriver pointing to the Docker Selenium Hub + driver = new RemoteWebDriver(new URL(hubUrl), capabilities); + + js = (JavascriptExecutor) driver; + vars = new HashMap(); + driver.get(envPath); + driver.manage().window().maximize(); + Thread.sleep(500); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + + String language1 = null; try { language1 = Commons.getFieldData("langcode"); @@ -135,7 +139,6 @@ public void setUp() throws Exception { driver.findElement(By.id("username")).sendKeys(userid); driver.findElement(By.id("password")).sendKeys(password); driver.findElement(By.xpath("//input[@name=\'login\']")).click(); - } // @BeforeMethod // public void setUp() throws Exception { From f600b820736b6191b46df4fc53e54258f6913356 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 2 Jan 2024 13:15:36 +0530 Subject: [PATCH 33/69] fix login Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 7027c42c..e5f0d8c4 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -1,46 +1,45 @@ FROM selenium/standalone-chrome:latest + USER root + +# Define build-time arguments ARG SOURCE ARG COMMIT_HASH ARG COMMIT_ID ARG BUILD_TIME + +# Set labels for metadata LABEL source=${SOURCE} LABEL commit_hash=${COMMIT_HASH} LABEL commit_id=${COMMIT_ID} LABEL build_time=${BUILD_TIME} -# can be passed during Docker build as build time environment for github branch to pickup configuration from. +# Define build-time arguments for user and group ARG container_user=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_group=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_uid=1001 - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_gid=1001 -# set working directory for the user +# Set working directory for the user ENV work_dir=/home/${container_user}/ -# install packages and create user -RUN -d -p 4444:4444 --shm-size="2g" selenium/standalone-chrome:latest - +# Install packages and create user RUN groupadd -g ${container_user_gid} ${container_user_group} \ && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} - -# select container user for all tasks +# Switch to the specified user for the subsequent commands USER ${container_user_uid}:${container_user_gid} +# Copy files COPY --chown=${container_user_uid}:${container_user} --chmod=771 ./entrypoint.sh ${work_dir}/entrypoint.sh COPY --chown=${container_user}:${container_user} ./src/main/resources/ ${work_dir}/resources/ COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir} -# set working directory +# Set working directory WORKDIR ${work_dir} +# Expose port 4444 (this is where Selenium Grid will be accessible) EXPOSE 4444 -ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] \ No newline at end of file +# Entrypoint for the container +ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] From 29d1c4d76ec27d788c0acd4c04fc8b2b7ca583b3 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 2 Jan 2024 13:23:34 +0530 Subject: [PATCH 34/69] fix login Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 1e6ee50f..e1c1dccd 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -95,7 +95,7 @@ public void setUp() throws Exception { DesiredCapabilities capabilities = DesiredCapabilities.chrome(); // Set Docker Selenium Hub URL - String hubUrl = "http://localhost:4444/wd/hub"; // Replace with your Docker host's IP or hostname + String hubUrl = "http://10.42.4.48:4444/wd/hub"; // Replace with your Docker host's IP or hostname if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { capabilities.setCapability("webdriver.chrome.driver", "/usr/bin/chromedriver"); From 74443ab62f0cd03afbb992fd816bc36d70713330 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 2 Jan 2024 13:36:57 +0530 Subject: [PATCH 35/69] fix login Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index e1c1dccd..92824ad9 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -95,7 +95,7 @@ public void setUp() throws Exception { DesiredCapabilities capabilities = DesiredCapabilities.chrome(); // Set Docker Selenium Hub URL - String hubUrl = "http://10.42.4.48:4444/wd/hub"; // Replace with your Docker host's IP or hostname + String hubUrl = "http://127.0.0.1:4444/wd/hub"; // Replace with your Docker host's IP or hostname if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { capabilities.setCapability("webdriver.chrome.driver", "/usr/bin/chromedriver"); From 4026a9e882aa70e140f3eed84edb9a8a7e68c288 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 2 Jan 2024 18:18:14 +0530 Subject: [PATCH 36/69] fix login Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 2 +- .../testrig/adminui/utility/BaseClass.java | 114 +++++------------- 2 files changed, 28 insertions(+), 88 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index e5f0d8c4..27ad703f 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -1,4 +1,4 @@ -FROM selenium/standalone-chrome:latest +FROM -d -p 4444:4444 --shm-size="2g" selenium/standalone-chrome:latest USER root diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 92824ad9..a0e64ae7 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -5,7 +5,6 @@ import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.net.URL; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -23,8 +22,6 @@ import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -89,40 +86,31 @@ public void set() { @BeforeMethod public void setUp() throws Exception { - Reporter.log("BaseClass", true); - test = extent.createTest(getCommitId(), getCommitId()); - - DesiredCapabilities capabilities = DesiredCapabilities.chrome(); - - // Set Docker Selenium Hub URL - String hubUrl = "http://127.0.0.1:4444/wd/hub"; // Replace with your Docker host's IP or hostname - - if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { - capabilities.setCapability("webdriver.chrome.driver", "/usr/bin/chromedriver"); - } else { - WebDriverManager.chromedriver().setup(); - } - - ChromeOptions options = new ChromeOptions(); - String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); - if (headless.equalsIgnoreCase("yes")) { - options.addArguments("--no-sandbox"); - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); - } - - capabilities.setCapability(ChromeOptions.CAPABILITY, options); - - // Initialize WebDriver with RemoteWebDriver pointing to the Docker Selenium Hub - driver = new RemoteWebDriver(new URL(hubUrl), capabilities); - - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - - String language1 = null; + Reporter.log("BaseClass",true); + test=extent.createTest(getCommitId(),getCommitId()); + + ChromeOptions options = new ChromeOptions(); + + String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); + + + if(headless.equalsIgnoreCase("yes")) { + options.addArguments("--headless=new"); + } + + WebDriverManager.chromedriver().setup(); + driver=new ChromeDriver(options); + + +// + js = (JavascriptExecutor) driver; + vars = new HashMap(); + driver.get(envPath); + driver.manage().window().maximize(); + Thread.sleep(500); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + + String language1 = null; try { language1 = Commons.getFieldData("langcode"); @@ -139,56 +127,8 @@ public void setUp() throws Exception { driver.findElement(By.id("username")).sendKeys(userid); driver.findElement(By.id("password")).sendKeys(password); driver.findElement(By.xpath("//input[@name=\'login\']")).click(); + } -// @BeforeMethod -// public void setUp() throws Exception { -// Reporter.log("BaseClass", true); -// test = extent.createTest(getCommitId(), getCommitId()); -// -// ChromeOptions options = new ChromeOptions(); -// String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); -// if (headless.equalsIgnoreCase("yes")) { -// options.addArguments("--no-sandbox"); -// options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); -// } -// -// WebDriver driver; -// -// if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { -// // Use remote WebDriver for Linux -// options.addArguments("--no-sandbox"); // Add additional arguments if needed -// driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options); -// } else { -// // Use local WebDriver for non-Linux -// WebDriverManager.chromedriver().setup(); -// driver = new ChromeDriver(options); -// } -// -// js = (JavascriptExecutor) driver; -// vars = new HashMap(); -// driver.get(envPath); -// driver.manage().window().maximize(); -// Thread.sleep(500); -// driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); -// -// String language1 = null; -// try { -// language1 = Commons.getFieldData("langcode"); -// logger.info(language1); -// if (!language1.equals("sin")) { -// Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']")); -// String var = "//li/a[contains(text(),'" + language1 + "')]"; -// Commons.click(test, driver, By.xpath(var)); -// } -// } catch (Exception e) { -// e.getMessage(); -// } -// -// driver.findElement(By.id("username")).sendKeys(userid); -// driver.findElement(By.id("password")).sendKeys(password); -// driver.findElement(By.xpath("//input[@name='login']")).click(); -// } - @AfterMethod public void tearDown() { @@ -249,7 +189,7 @@ public static String[] readFolderJsonList() { try { String langcode = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - File directoryPath = new File(TestRunner.getResourcePath()+ "\\BulkUploadFiles\\" + langcode + "\\"); + File directoryPath = new File(System.getProperty("user.dir") + "\\BulkUploadFiles\\" + langcode + "\\"); if (directoryPath.exists()) { From f192e76374d264224c2209c7a3d41878ed223b5d Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 3 Jan 2024 13:42:08 +0530 Subject: [PATCH 37/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 2 +- .../testrig/adminui/utility/BaseClass.java | 102 ++++++++++++++---- admintest/src/main/resources/TestData.json | 1 + .../src/main/resources/testngFile/testng.xml | 5 +- 4 files changed, 83 insertions(+), 27 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 27ad703f..e5f0d8c4 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -1,4 +1,4 @@ -FROM -d -p 4444:4444 --shm-size="2g" selenium/standalone-chrome:latest +FROM selenium/standalone-chrome:latest USER root diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index a0e64ae7..a12a0ece 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -5,6 +5,7 @@ import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.net.URL; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -22,6 +23,8 @@ import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -86,31 +89,36 @@ public void set() { @BeforeMethod public void setUp() throws Exception { - Reporter.log("BaseClass",true); - test=extent.createTest(getCommitId(),getCommitId()); - + Reporter.log("BaseClass", true); + test = extent.createTest(getCommitId(), getCommitId()); + + if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { + if(JsonUtil.JsonObjParsing(Commons.getTestData(),"Docker").equals("yes")) { + String configFilePath ="/usr/bin/chromedriver"; + System.setProperty("webdriver.chrome.driver", configFilePath); + }else { + WebDriverManager.chromedriver().setup(); + } + }else { + WebDriverManager.chromedriver().setup(); + } ChromeOptions options = new ChromeOptions(); - String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); - - if(headless.equalsIgnoreCase("yes")) { - options.addArguments("--headless=new"); + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + } - - WebDriverManager.chromedriver().setup(); - driver=new ChromeDriver(options); - - -// - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - - String language1 = null; + driver=new ChromeDriver(options); + + + js = (JavascriptExecutor) driver; + vars = new HashMap(); + driver.get(envPath); + driver.manage().window().maximize(); + Thread.sleep(500); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + + String language1 = null; try { language1 = Commons.getFieldData("langcode"); @@ -127,8 +135,56 @@ public void setUp() throws Exception { driver.findElement(By.id("username")).sendKeys(userid); driver.findElement(By.id("password")).sendKeys(password); driver.findElement(By.xpath("//input[@name=\'login\']")).click(); - } +// @BeforeMethod +// public void setUp() throws Exception { +// Reporter.log("BaseClass", true); +// test = extent.createTest(getCommitId(), getCommitId()); +// +// ChromeOptions options = new ChromeOptions(); +// String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); +// if (headless.equalsIgnoreCase("yes")) { +// options.addArguments("--no-sandbox"); +// options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); +// } +// +// WebDriver driver; +// +// if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { +// // Use remote WebDriver for Linux +// options.addArguments("--no-sandbox"); // Add additional arguments if needed +// driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options); +// } else { +// // Use local WebDriver for non-Linux +// WebDriverManager.chromedriver().setup(); +// driver = new ChromeDriver(options); +// } +// +// js = (JavascriptExecutor) driver; +// vars = new HashMap(); +// driver.get(envPath); +// driver.manage().window().maximize(); +// Thread.sleep(500); +// driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); +// +// String language1 = null; +// try { +// language1 = Commons.getFieldData("langcode"); +// logger.info(language1); +// if (!language1.equals("sin")) { +// Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']")); +// String var = "//li/a[contains(text(),'" + language1 + "')]"; +// Commons.click(test, driver, By.xpath(var)); +// } +// } catch (Exception e) { +// e.getMessage(); +// } +// +// driver.findElement(By.id("username")).sendKeys(userid); +// driver.findElement(By.id("password")).sendKeys(password); +// driver.findElement(By.xpath("//input[@name='login']")).click(); +// } + @AfterMethod public void tearDown() { @@ -189,7 +245,7 @@ public static String[] readFolderJsonList() { try { String langcode = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - File directoryPath = new File(System.getProperty("user.dir") + "\\BulkUploadFiles\\" + langcode + "\\"); + File directoryPath = new File(TestRunner.getResourcePath()+ "\\BulkUploadFiles\\" + langcode + "\\"); if (directoryPath.exists()) { diff --git a/admintest/src/main/resources/TestData.json b/admintest/src/main/resources/TestData.json index 6b62bb9c..007991ed 100644 --- a/admintest/src/main/resources/TestData.json +++ b/admintest/src/main/resources/TestData.json @@ -26,6 +26,7 @@ "preappend": "0", "jsonObjName": "identity", "headless": "yes", + "Docker":"yes", "bulkwait": "10000", "dummyData":"blocklistwordss", "publicKey": "AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDFEX4nLppAuHIfGzhYn7DR_3wAQkVnrPSFFaiV9TAvN0WHtH_hweGNNjUGYvyaowwmC8jsazufmnIoPisZIFraVQNWCA6N0RhZF_LisoTYDoQSM-ZbCKPxRTFnemtTwXHxQdlVWGUXst_WZIWC0OTSzJHbBg_iXQW1UOXRJL845GFOKjvOPQiEbOZgmoWslkTIAi9bf-AeWdEYuO3bwPf-T5Xxj_xH2-PTinQA_4itRWSrhG5kEU-zQHWGL72SiGzwOOoPnzZZv2X_9djpWGEz1gyNl5ionns8IfuQrvikSEMxm-E6Z9RfKNhl_rEHgnOR4gl0ju5kg_n9tnuUeXXP", diff --git a/admintest/src/main/resources/testngFile/testng.xml b/admintest/src/main/resources/testngFile/testng.xml index c768ef46..76fc18bd 100644 --- a/admintest/src/main/resources/testngFile/testng.xml +++ b/admintest/src/main/resources/testngFile/testng.xml @@ -7,7 +7,7 @@ - + From 15babae4f753365a39cfde297979e95c81dede54 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 3 Jan 2024 13:43:44 +0530 Subject: [PATCH 38/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/testcase/MachineTest.java | 124 +++++++----------- 1 file changed, 48 insertions(+), 76 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index 94750660..0e94cae5 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -1,10 +1,8 @@ package io.mosip.testrig.adminui.testcase; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.JavascriptExecutor; @@ -30,79 +28,53 @@ import io.mosip.testrig.adminui.utility.BaseClass; import io.mosip.testrig.adminui.utility.Commons; import io.mosip.testrig.adminui.utility.JsonUtil; -import io.mosip.testrig.adminui.utility.TestRunner; public class MachineTest extends BaseClass{ - private static final Logger logger = Logger.getLogger(MachineTest.class); - @Test(groups = "M") - public void machineCRUD() throws Exception { - - test=extent.createTest("MachineTest", "verify Login"); - String holidayDateCenter=JsonUtil.JsonObjParsing(Commons.getTestData(),"holidayDateCenter"); - String publicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"publicKey"); - - String signPublicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"signPublicKey"); - logger.info(driver.findElement(By.id("admin/resources")).isDisplayed()+"1"); - Commons.click(test,driver,By.id("admin/resources")); - logger.info(driver.findElement(By.id("/admin/resources/machines")).isDisplayed()+"2"); - Commons.click(test,driver,By.id("/admin/resources/machines")); - List allElements = driver.findElements(By.xpath("//*")); - - // Print XPath for each element - for (WebElement element : allElements) { - - logger.info(element); - } - Thread.sleep(20000); - logger.info(driver.findElement(By.id("Create Machine")).isDisplayed()+"3"); - Commons.click(test,driver,By.id("Create Machine")); - test.log(Status.INFO, "Click on Create Machine"); - Commons.enter(test,driver,By.id("name"),data); - Commons.enter(test,driver,By.id("serialNumber"),"1234567"); - Commons.enter(test,driver,By.id("macAddress"),"1.2.3.4.5.6"); - Commons.enter(test,driver,By.id("ipAddress"),"2.3.4.5.6"); - test.log(Status.INFO, "ENter IpAddress"); - // Commons.enter(test,driver,By.id("validity"),holidayDateCenter); - Commons.calendar(holidayDateCenter); - Commons.dropdown(test,driver,By.id("machineSpecId")); - Commons.enter(test,driver,By.id("publicKey"),publicKey); - - Commons.enter(test,driver,By.id("signPublicKey"),signPublicKey); - try{ Commons.dropdown(test,driver, By.id("zone")); - - }catch(Exception e) { - test.log(Status.INFO, e); - } - Commons.dropdown(test,driver,By.id("regCenterId")); - - - - Commons.createRes(test,driver); - Commons.filter(test,driver, By.id("name"), data); - - - Commons.editRes(test,driver,data+1,By.id("name")); - test.log(Status.INFO, "Click on Edit"); - Commons.filter(test,driver, By.id("name"), data+1); - - Commons.activate(test,driver); - test.log(Status.INFO, "Click on Active"); - Commons.editRes(test,driver,data+2,By.id("name")); - Commons.filter(test,driver, By.id("name"), data+2); - Commons.deactivate(test,driver); - test.log(Status.INFO, "Click on Deactivated"); - Commons.decommission(test,driver); - } - private static String getXPath(WebElement element) { - if (element == null) { - return null; - } - - if (!element.getAttribute("id").isEmpty()) { - return "//*[@id='" + element.getAttribute("id") + "']"; - } - - // You can add more conditions based on attributes if needed - - return getXPath(element.findElement(By.xpath(".."))) + "/" + element.getTagName(); - } + @Test(groups = "M") + public void machineCRUD() throws Exception { + test=extent.createTest("MachineTest", "verify Login"); + String holidayDateCenter=JsonUtil.JsonObjParsing(Commons.getTestData(),"holidayDateCenter"); + String publicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"publicKey"); + + String signPublicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"signPublicKey"); + + Commons.click(test,driver,By.id("admin/resources")); + Commons.click(test,driver,By.xpath("//a[@href='#/admin/resources/machines']")); + Commons.click(test,driver,By.id("Create Machine")); + test.log(Status.INFO, "Click on Create Machine"); + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("serialNumber"),"1234567"); + Commons.enter(test,driver,By.id("macAddress"),"1.2.3.4.5.6"); + Commons.enter(test,driver,By.id("ipAddress"),"2.3.4.5.6"); + test.log(Status.INFO, "ENter IpAddress"); + // Commons.enter(test,driver,By.id("validity"),holidayDateCenter); + Commons.calendar(holidayDateCenter); + Commons.dropdown(test,driver,By.id("machineSpecId")); + Commons.enter(test,driver,By.id("publicKey"),publicKey); + + Commons.enter(test,driver,By.id("signPublicKey"),signPublicKey); + try{ Commons.dropdown(test,driver, By.id("zone")); + + }catch(Exception e) { + test.log(Status.INFO, e); + } + Commons.dropdown(test,driver,By.id("regCenterId")); + + + + Commons.createRes(test,driver); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.editRes(test,driver,data+1,By.id("name")); + test.log(Status.INFO, "Click on Edit"); + Commons.filter(test,driver, By.id("name"), data+1); + + Commons.activate(test,driver); + test.log(Status.INFO, "Click on Active"); + Commons.editRes(test,driver,data+2,By.id("name")); + Commons.filter(test,driver, By.id("name"), data+2); + Commons.deactivate(test,driver); + test.log(Status.INFO, "Click on Deactivated"); + Commons.decommission(test,driver); + } } From f030e2aaea441e5e09ede98858e047dbf9f40ea6 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 3 Jan 2024 16:43:06 +0530 Subject: [PATCH 39/69] fic bulkupload Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java index a01dbe2c..9d2242e4 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java @@ -91,7 +91,7 @@ public void bulkUploadCRUD(String table) throws Exception { // Commons.click(test,driver,By.id("fileInput")); - String filePath = TestRunner.getResourcePath()+ "\\BulkUploadFiles\\"+ JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang")+"\\"+table+".csv"; + String filePath = TestRunner.getResourcePath()+ "//BulkUploadFiles//"+ JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang")+"//"+table+".csv"; Commons.enter(test, driver, By.id("fileInput"), filePath); From 6fe77019aa91ae5f8809f9b0152a4752464a7ae6 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 3 Jan 2024 17:03:10 +0530 Subject: [PATCH 40/69] fic bulkupload Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index a12a0ece..60c90ead 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -245,7 +245,7 @@ public static String[] readFolderJsonList() { try { String langcode = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - File directoryPath = new File(TestRunner.getResourcePath()+ "\\BulkUploadFiles\\" + langcode + "\\"); + File directoryPath = new File(TestRunner.getResourcePath()+ "//BulkUploadFiles//" + langcode + "//"); if (directoryPath.exists()) { From 44dfc89f8c8ab244d282f5989bbbf62bfc90ef6d Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 3 Jan 2024 17:07:52 +0530 Subject: [PATCH 41/69] fic bulkupload Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- .../main/java/io/mosip/testrig/adminui/utility/TestRunner.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 60c90ead..4f62a356 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -134,7 +134,7 @@ public void setUp() throws Exception { } driver.findElement(By.id("username")).sendKeys(userid); driver.findElement(By.id("password")).sendKeys(password); - driver.findElement(By.xpath("//input[@name=\'login\']")).click(); + driver.findElement(By.xpath("//input[@name='login']")).click(); } // @BeforeMethod // public void setUp() throws Exception { diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java index 7b445732..e36e0527 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java @@ -92,7 +92,7 @@ public static void startTestRunner() throws Exception { System.getProperties().setProperty("testng.outpur.dir", "testng-report"); runner.setOutputDirectory("testng-report"); - System.getProperties().setProperty("emailable.report2.name", "ADMINUI-" + BaseTestCaseFunc.environment + "-" + System.getProperties().setProperty("emailable.report2.name", "ADMINUI-" + BaseTestCaseFunc.environment + "-"+System.getProperty("os.name") + "-run-" + System.currentTimeMillis() + "-report.html"); runner.run(); From 7069682ab28528724c228835369a5c6f57d10c59 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 3 Jan 2024 17:26:50 +0530 Subject: [PATCH 42/69] fic bulkupload Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/testcase/CenterTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java index d0d9acc4..1dd828ed 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java @@ -37,8 +37,8 @@ public void centerCRUD() throws Exception { String holidayDate=JsonUtil.JsonObjParsing(Commons.getTestData(),"holidayDateCenter"); Commons.click(test,driver,By.id("admin/resources")); - Commons.click(test,driver,By.id("/admin/resources/centers")); - + // Commons.click(test,driver,By.id("/admin/resources/centers")); + Commons.click(test,driver,By.xpath("//a[@href='#/admin/resources/centers']")); Commons.click(test,driver, By.id("Create Center")); test.log(Status.INFO, "Click on Create Center"); /* From cd96384494b00f59faba70b535f09f74eb4c9b64 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 11:01:20 +0530 Subject: [PATCH 43/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 4f62a356..f9a4ad12 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -108,7 +108,7 @@ public void setUp() throws Exception { options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); } - driver=new ChromeDriver(options); + driver=new ChromeDriver(); js = (JavascriptExecutor) driver; From 5686e8cc5536efa4433134611a0e48648cea546b Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 11:37:56 +0530 Subject: [PATCH 44/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../io/mosip/testrig/adminui/testcase/CenterTest.java | 4 ++-- .../io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- .../io/mosip/testrig/adminui/utility/Commons.java | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java index 1dd828ed..d0d9acc4 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java @@ -37,8 +37,8 @@ public void centerCRUD() throws Exception { String holidayDate=JsonUtil.JsonObjParsing(Commons.getTestData(),"holidayDateCenter"); Commons.click(test,driver,By.id("admin/resources")); - // Commons.click(test,driver,By.id("/admin/resources/centers")); - Commons.click(test,driver,By.xpath("//a[@href='#/admin/resources/centers']")); + Commons.click(test,driver,By.id("/admin/resources/centers")); + Commons.click(test,driver, By.id("Create Center")); test.log(Status.INFO, "Click on Create Center"); /* diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index f9a4ad12..4f62a356 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -108,7 +108,7 @@ public void setUp() throws Exception { options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); } - driver=new ChromeDriver(); + driver=new ChromeDriver(options); js = (JavascriptExecutor) driver; diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 3380b8f5..8975d156 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -79,7 +79,7 @@ public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); try { (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); - Thread.sleep(500); + Thread.sleep(2000); driver.findElement(by).click(); Thread.sleep(500); }catch (StaleElementReferenceException sere) { @@ -115,6 +115,7 @@ public static void click(ExtentTest test,WebDriver driver, By by) { public static void enter(ExtentTest test,WebDriver driver, By by,String value) { logger.info("Entering " + by +value); try { + Thread.sleep(2000); (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOfElementLocated(by)); driver.findElement(by).clear(); driver.findElement(by).sendKeys(value); @@ -151,7 +152,7 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by) logger.info("Selecting DropDown Index Zero Value " + by ); try { - Thread.sleep(500); + Thread.sleep(2000); click(test,driver,by);//REGION Thread.sleep(500); @@ -182,7 +183,7 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by,String value logger.info("Selecting DropDown By Value " + by +value ); try { - Thread.sleep(500); + Thread.sleep(2000); click(test,driver,by); Thread.sleep(500); String val="'"+value +"'"; @@ -212,7 +213,7 @@ public static void dropdowncenter(ExtentTest test,WebDriver driver, By by,String logger.info("Selecting DropDown By Value " + by +value ); try { - Thread.sleep(500); + Thread.sleep(2000); click(test,driver,by); Thread.sleep(500); String val="'"+value +"'"; @@ -241,7 +242,7 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by,By value) { logger.info("Selecting DropDown By Value " + by +value ); try { - Thread.sleep(500); + Thread.sleep(2000); click(test,driver,by); Thread.sleep(500); click(test,driver,value); From 5fcb6ccb56cd11159d7d851e1f2cd3ee52545ad5 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 13:03:01 +0530 Subject: [PATCH 45/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/BaseClass.java | 226 +++++++++--------- .../testrig/adminui/utility/Commons.java | 71 +++--- .../src/main/resources/testngFile/testng.xml | 7 +- 3 files changed, 156 insertions(+), 148 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 4f62a356..af87f9c6 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -67,58 +67,62 @@ public class BaseClass { protected String password = allpassword[0]; protected String data = Commons.appendDate; public static ExtentSparkReporter html; - - - - public static ExtentReports extent; - public static ExtentTest test; - + + + + public static ExtentReports extent; + public static ExtentTest test; + public void setLangcode(String langcode) throws Exception { this.langcode = Commons.getFieldData("langcode"); } - + @BeforeSuite - - - - @BeforeMethod - public void set() { - extent=ExtentReportManager.getReports(); - } - + + + + @BeforeMethod + public void set() { + extent=ExtentReportManager.getReports(); + } + @BeforeMethod public void setUp() throws Exception { - Reporter.log("BaseClass", true); - test = extent.createTest(getCommitId(), getCommitId()); - - if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { - if(JsonUtil.JsonObjParsing(Commons.getTestData(),"Docker").equals("yes")) { - String configFilePath ="/usr/bin/chromedriver"; - System.setProperty("webdriver.chrome.driver", configFilePath); - }else { - WebDriverManager.chromedriver().setup(); - } + Reporter.log("BaseClass", true); + test = extent.createTest(getCommitId(), getCommitId()); + logger.info("Start set up"); + if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { + + if(JsonUtil.JsonObjParsing(Commons.getTestData(),"Docker").equals("yes")) { + logger.info("Docker start"); + String configFilePath ="/usr/bin/chromedriver"; + System.setProperty("webdriver.chrome.driver", configFilePath); + }else { + WebDriverManager.chromedriver().setup(); + } }else { WebDriverManager.chromedriver().setup(); + logger.info("window chrome driver start"); } ChromeOptions options = new ChromeOptions(); String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); if(headless.equalsIgnoreCase("yes")) { - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + logger.info("Running is headless mode"); + options.addArguments("--headless", "--disable-gpu"); } driver=new ChromeDriver(options); - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + js = (JavascriptExecutor) driver; + vars = new HashMap(); + driver.get(envPath); + driver.manage().window().maximize(); + Thread.sleep(500); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - String language1 = null; + String language1 = null; try { language1 = Commons.getFieldData("langcode"); @@ -136,81 +140,81 @@ public void setUp() throws Exception { driver.findElement(By.id("password")).sendKeys(password); driver.findElement(By.xpath("//input[@name='login']")).click(); } -// @BeforeMethod -// public void setUp() throws Exception { -// Reporter.log("BaseClass", true); -// test = extent.createTest(getCommitId(), getCommitId()); -// -// ChromeOptions options = new ChromeOptions(); -// String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); -// if (headless.equalsIgnoreCase("yes")) { -// options.addArguments("--no-sandbox"); -// options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); -// } -// -// WebDriver driver; -// -// if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { -// // Use remote WebDriver for Linux -// options.addArguments("--no-sandbox"); // Add additional arguments if needed -// driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options); -// } else { -// // Use local WebDriver for non-Linux -// WebDriverManager.chromedriver().setup(); -// driver = new ChromeDriver(options); -// } -// -// js = (JavascriptExecutor) driver; -// vars = new HashMap(); -// driver.get(envPath); -// driver.manage().window().maximize(); -// Thread.sleep(500); -// driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); -// -// String language1 = null; -// try { -// language1 = Commons.getFieldData("langcode"); -// logger.info(language1); -// if (!language1.equals("sin")) { -// Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']")); -// String var = "//li/a[contains(text(),'" + language1 + "')]"; -// Commons.click(test, driver, By.xpath(var)); -// } -// } catch (Exception e) { -// e.getMessage(); -// } -// -// driver.findElement(By.id("username")).sendKeys(userid); -// driver.findElement(By.id("password")).sendKeys(password); -// driver.findElement(By.xpath("//input[@name='login']")).click(); -// } - + // @BeforeMethod + // public void setUp() throws Exception { + // Reporter.log("BaseClass", true); + // test = extent.createTest(getCommitId(), getCommitId()); + // + // ChromeOptions options = new ChromeOptions(); + // String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless"); + // if (headless.equalsIgnoreCase("yes")) { + // options.addArguments("--no-sandbox"); + // options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + // } + // + // WebDriver driver; + // + // if (System.getProperty("os.name").equalsIgnoreCase("Linux")) { + // // Use remote WebDriver for Linux + // options.addArguments("--no-sandbox"); // Add additional arguments if needed + // driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options); + // } else { + // // Use local WebDriver for non-Linux + // WebDriverManager.chromedriver().setup(); + // driver = new ChromeDriver(options); + // } + // + // js = (JavascriptExecutor) driver; + // vars = new HashMap(); + // driver.get(envPath); + // driver.manage().window().maximize(); + // Thread.sleep(500); + // driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + // + // String language1 = null; + // try { + // language1 = Commons.getFieldData("langcode"); + // logger.info(language1); + // if (!language1.equals("sin")) { + // Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']")); + // String var = "//li/a[contains(text(),'" + language1 + "')]"; + // Commons.click(test, driver, By.xpath(var)); + // } + // } catch (Exception e) { + // e.getMessage(); + // } + // + // driver.findElement(By.id("username")).sendKeys(userid); + // driver.findElement(By.id("password")).sendKeys(password); + // driver.findElement(By.xpath("//input[@name='login']")).click(); + // } + @AfterMethod public void tearDown() { - + driver.quit(); extent.flush(); - + } - + @AfterSuite public void pushFileToS3() { getCommitId(); if (ConfigManager.getPushReportsToS3().equalsIgnoreCase("yes")) { // EXTENT REPORT - + File repotFile = new File(ExtentReportManager.Filepath); System.out.println("reportFile is::" + repotFile); - String reportname = repotFile.getName(); - - + String reportname = repotFile.getName(); + + S3Adapter s3Adapter = new S3Adapter(); boolean isStoreSuccess = false; try { isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(), BaseTestCaseFunc.testLevel, null, "AdminUi",env+BaseTestCaseFunc.currentModule+data+".html", repotFile); - + System.out.println("isStoreSuccess:: " + isStoreSuccess); } catch (Exception e) { System.out.println("error occured while pushing the object" + e.getLocalizedMessage()); @@ -222,10 +226,10 @@ public void pushFileToS3() { System.out.println("Failed while pushing file to S3"); } } - - } - - + + } + + @DataProvider(name = "data-provider") public Object[] dpMethod() { @@ -244,7 +248,7 @@ public static String[] readFolderJsonList() { String contents[] = null; try { String langcode = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - + File directoryPath = new File(TestRunner.getResourcePath()+ "//BulkUploadFiles//" + langcode + "//"); if (directoryPath.exists()) { @@ -260,20 +264,20 @@ public static String[] readFolderJsonList() { } return contents; } - private String getCommitId(){ - Properties properties = new Properties(); - try (InputStream is = ExtentReportManager.class.getClassLoader().getResourceAsStream("git.properties")) { - properties.load(is); - - return "Commit Id is: " + properties.getProperty("git.commit.id.abbrev") + " & Branch Name is:" + properties.getProperty("git.branch"); - - } catch (IOException e) { - logger.error(e.getStackTrace()); - return ""; - } - - } - - - + private String getCommitId(){ + Properties properties = new Properties(); + try (InputStream is = ExtentReportManager.class.getClassLoader().getResourceAsStream("git.properties")) { + properties.load(is); + + return "Commit Id is: " + properties.getProperty("git.commit.id.abbrev") + " & Branch Name is:" + properties.getProperty("git.branch"); + + } catch (IOException e) { + logger.error(e.getStackTrace()); + return ""; + } + + } + + + } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 8975d156..9ca37bb9 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -78,44 +78,47 @@ public static void filterCenter(ExtentTest test,WebDriver driver, By by,String public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); try { - (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); - Thread.sleep(2000); - driver.findElement(by).click(); - Thread.sleep(500); - }catch (StaleElementReferenceException sere) { - // simply retry finding the element in the refreshed DOM + + Thread.sleep(5000); driver.findElement(by).click(); + logger.info("Click on "+by); + + }catch(Exception e) { + logger.info(e.getMessage()); } - catch (TimeoutException toe) { - driver.findElement(by).click(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); - } catch (Exception e) { - - try { - // test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); - driver.findElement(by).click(); - } catch (Exception e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - JavascriptExecutor executor = (JavascriptExecutor) driver; - executor.executeScript("arguments[0].click();", driver.findElement(by)); - - - } +// catch (StaleElementReferenceException sere) { +// // simply retry finding the element in the refreshed DOM +// driver.findElement(by).click(); +// } +// catch (TimeoutException toe) { +// driver.findElement(by).click(); +// try { +// Thread.sleep(500); +// } catch (InterruptedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); +// } catch (Exception e) { +// +// try { +// // test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); +// driver.findElement(by).click(); +// } catch (Exception e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// JavascriptExecutor executor = (JavascriptExecutor) driver; +// executor.executeScript("arguments[0].click();", driver.findElement(by)); +// +// +// } } public static void enter(ExtentTest test,WebDriver driver, By by,String value) { logger.info("Entering " + by +value); try { - Thread.sleep(2000); (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOfElementLocated(by)); driver.findElement(by).clear(); driver.findElement(by).sendKeys(value); @@ -152,7 +155,7 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by) logger.info("Selecting DropDown Index Zero Value " + by ); try { - Thread.sleep(2000); + Thread.sleep(500); click(test,driver,by);//REGION Thread.sleep(500); @@ -183,7 +186,7 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by,String value logger.info("Selecting DropDown By Value " + by +value ); try { - Thread.sleep(2000); + Thread.sleep(500); click(test,driver,by); Thread.sleep(500); String val="'"+value +"'"; @@ -213,7 +216,7 @@ public static void dropdowncenter(ExtentTest test,WebDriver driver, By by,String logger.info("Selecting DropDown By Value " + by +value ); try { - Thread.sleep(2000); + Thread.sleep(500); click(test,driver,by); Thread.sleep(500); String val="'"+value +"'"; @@ -242,7 +245,7 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by,By value) { logger.info("Selecting DropDown By Value " + by +value ); try { - Thread.sleep(2000); + Thread.sleep(500); click(test,driver,by); Thread.sleep(500); click(test,driver,value); diff --git a/admintest/src/main/resources/testngFile/testng.xml b/admintest/src/main/resources/testngFile/testng.xml index 76fc18bd..058d1940 100644 --- a/admintest/src/main/resources/testngFile/testng.xml +++ b/admintest/src/main/resources/testngFile/testng.xml @@ -7,9 +7,10 @@ - - + + From c8babe57ad0f739a3664e563938491950ddff6c8 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 13:22:54 +0530 Subject: [PATCH 46/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/Commons.java | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 9ca37bb9..b1a30a57 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -119,34 +119,32 @@ public static void click(ExtentTest test,WebDriver driver, By by) { public static void enter(ExtentTest test,WebDriver driver, By by,String value) { logger.info("Entering " + by +value); try { - (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOfElementLocated(by)); + Thread.sleep(5000); driver.findElement(by).clear(); driver.findElement(by).sendKeys(value); - try { - Thread.sleep(8); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - }catch (StaleElementReferenceException sere) { - // simply retry finding the element in the refreshed DOM - driver.findElement(by).sendKeys(value); - } - catch (TimeoutException toe) { - driver.findElement(by).sendKeys(value); - logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); - } - catch (Exception e) { - try { - test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - JavascriptExecutor executor = (JavascriptExecutor) driver; - executor.executeScript("arguments[0].click();", driver.findElement(by)); - + + }catch(Exception e) { + logger.info(e.getMessage()); } +// catch (StaleElementReferenceException sere) { +// // simply retry finding the element in the refreshed DOM +// driver.findElement(by).sendKeys(value); +// } +// catch (TimeoutException toe) { +// driver.findElement(by).sendKeys(value); +// logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); +// } +// catch (Exception e) { +// try { +// test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); +// } catch (IOException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// JavascriptExecutor executor = (JavascriptExecutor) driver; +// executor.executeScript("arguments[0].click();", driver.findElement(by)); +// +// } } From 798e212dc76224f21015159f22a84cf4a0226bbb Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 14:09:50 +0530 Subject: [PATCH 47/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/Commons.java | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index b1a30a57..9ca404f4 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -153,30 +153,29 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by) logger.info("Selecting DropDown Index Zero Value " + by ); try { - Thread.sleep(500); + Thread.sleep(5000); click(test,driver,by);//REGION - Thread.sleep(500); - + + Thread.sleep(5000); String att= driver.findElement(by).getAttribute("aria-owns"); String[] list=att.split(" "); + Thread.sleep(5000); click(test,driver,By.id(list[0])); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - }catch (Exception e) { - try { - test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - JavascriptExecutor executor = (JavascriptExecutor) driver; - executor.executeScript("arguments[0].click();", driver.findElement(by)); - + + }catch(Exception e) { + logger.info(e.getMessage()); } + // catch (Exception e) { +// try { +// test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); +// } catch (IOException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// JavascriptExecutor executor = (JavascriptExecutor) driver; +// executor.executeScript("arguments[0].click();", driver.findElement(by)); +// +// } } public static void dropdown(ExtentTest test,WebDriver driver, By by,String value) @@ -362,9 +361,10 @@ public static void editCenter(ExtentTest test,WebDriver driver,String data,By by try { Commons.click(test,driver,By.id("ellipsis-button0")); Commons.click(test,driver, By.id("Edit0")); - + Thread.sleep(5000); Assert.assertNotEquals(data, driver.findElement(by).getText()); + Thread.sleep(5000); driver.findElement(by).clear(); Commons.enter(test,driver, by, data); @@ -377,18 +377,20 @@ public static void editCenter(ExtentTest test,WebDriver driver,String data,By by Commons.click(test,driver, By.xpath("(//*[@id='cancel'])[1]")); Commons.click(test,driver, By.xpath("(//*[@id='cancel'])[1]")); logger.info("Click editCenter and Confirm" + by + data); + }catch(Exception e) { + logger.info(e.getMessage()); } - catch (Exception e) { - try { - test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - JavascriptExecutor executor = (JavascriptExecutor) driver; - executor.executeScript("arguments[0].click();", driver.findElement(by)); - - } +// catch (Exception e) { +// try { +// test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); +// } catch (IOException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// JavascriptExecutor executor = (JavascriptExecutor) driver; +// executor.executeScript("arguments[0].click();", driver.findElement(by)); +// +// } } public static void create(ExtentTest test,WebDriver driver) { @@ -455,7 +457,7 @@ public static void calendar(String date) { Commons.click(test,driver,By.xpath("//*[@class='mat-calendar-arrow']")); Thread.sleep(500); Commons.click(test,driver,By.xpath("//*[text()='"+year+"']")); - Thread.sleep(500); + Thread.sleep(5000); List cli= driver.findElements(By.xpath("//*[@class='mat-calendar-body-cell-content']")); cli.get(month-1).click(); Thread.sleep(500); From 6038a272bdc47a8079192f9305fb3deeeaf0d634 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 14:53:34 +0530 Subject: [PATCH 48/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../mosip/testrig/adminui/utility/Commons.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 9ca404f4..044d09f8 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -79,7 +79,7 @@ public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); try { - Thread.sleep(5000); + Thread.sleep(1000); driver.findElement(by).click(); logger.info("Click on "+by); @@ -119,7 +119,7 @@ public static void click(ExtentTest test,WebDriver driver, By by) { public static void enter(ExtentTest test,WebDriver driver, By by,String value) { logger.info("Entering " + by +value); try { - Thread.sleep(5000); + Thread.sleep(1000); driver.findElement(by).clear(); driver.findElement(by).sendKeys(value); @@ -153,13 +153,13 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by) logger.info("Selecting DropDown Index Zero Value " + by ); try { - Thread.sleep(5000); + Thread.sleep(1000); click(test,driver,by);//REGION - Thread.sleep(5000); + Thread.sleep(1000); String att= driver.findElement(by).getAttribute("aria-owns"); String[] list=att.split(" "); - Thread.sleep(5000); + Thread.sleep(1000); click(test,driver,By.id(list[0])); }catch(Exception e) { @@ -361,10 +361,10 @@ public static void editCenter(ExtentTest test,WebDriver driver,String data,By by try { Commons.click(test,driver,By.id("ellipsis-button0")); Commons.click(test,driver, By.id("Edit0")); - Thread.sleep(5000); + Thread.sleep(1000); Assert.assertNotEquals(data, driver.findElement(by).getText()); - Thread.sleep(5000); + Thread.sleep(1000); driver.findElement(by).clear(); Commons.enter(test,driver, by, data); @@ -457,7 +457,7 @@ public static void calendar(String date) { Commons.click(test,driver,By.xpath("//*[@class='mat-calendar-arrow']")); Thread.sleep(500); Commons.click(test,driver,By.xpath("//*[text()='"+year+"']")); - Thread.sleep(5000); + Thread.sleep(1000); List cli= driver.findElements(By.xpath("//*[@class='mat-calendar-body-cell-content']")); cli.get(month-1).click(); Thread.sleep(500); From dd5effe51e8d4d612215d58732c832673f57d86d Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 16:10:22 +0530 Subject: [PATCH 49/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/Commons.java | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 044d09f8..7ec82b24 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -5,6 +5,7 @@ import java.time.format.DateTimeFormatter; import java.util.List; +import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.StaleElementReferenceException; @@ -19,7 +20,7 @@ import com.aventstack.extentreports.MediaEntityBuilder; public class Commons extends BaseClass{ - private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(Commons.class); + private static final Logger logger = Logger.getLogger(Commons.class); public static String appendDate=getPreAppend()+getDateTime(); @@ -79,12 +80,14 @@ public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); try { - Thread.sleep(1000); - driver.findElement(by).click(); - logger.info("Click on "+by); + Thread.sleep(5000); + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); }catch(Exception e) { logger.info(e.getMessage()); + Assert.fail(); + } // catch (StaleElementReferenceException sere) { // // simply retry finding the element in the refreshed DOM @@ -119,12 +122,13 @@ public static void click(ExtentTest test,WebDriver driver, By by) { public static void enter(ExtentTest test,WebDriver driver, By by,String value) { logger.info("Entering " + by +value); try { - Thread.sleep(1000); + Thread.sleep(5000); driver.findElement(by).clear(); driver.findElement(by).sendKeys(value); }catch(Exception e) { logger.info(e.getMessage()); + Assert.fail(); } // catch (StaleElementReferenceException sere) { // // simply retry finding the element in the refreshed DOM @@ -153,17 +157,18 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by) logger.info("Selecting DropDown Index Zero Value " + by ); try { - Thread.sleep(1000); + Thread.sleep(5000); click(test,driver,by);//REGION - Thread.sleep(1000); + Thread.sleep(5000); String att= driver.findElement(by).getAttribute("aria-owns"); String[] list=att.split(" "); - Thread.sleep(1000); + Thread.sleep(5000); click(test,driver,By.id(list[0])); }catch(Exception e) { logger.info(e.getMessage()); + Assert.fail(); } // catch (Exception e) { // try { @@ -361,10 +366,10 @@ public static void editCenter(ExtentTest test,WebDriver driver,String data,By by try { Commons.click(test,driver,By.id("ellipsis-button0")); Commons.click(test,driver, By.id("Edit0")); - Thread.sleep(1000); + Thread.sleep(5000); Assert.assertNotEquals(data, driver.findElement(by).getText()); - Thread.sleep(1000); + Thread.sleep(5000); driver.findElement(by).clear(); Commons.enter(test,driver, by, data); @@ -379,6 +384,7 @@ public static void editCenter(ExtentTest test,WebDriver driver,String data,By by logger.info("Click editCenter and Confirm" + by + data); }catch(Exception e) { logger.info(e.getMessage()); + Assert.fail(); } // catch (Exception e) { // try { @@ -457,7 +463,7 @@ public static void calendar(String date) { Commons.click(test,driver,By.xpath("//*[@class='mat-calendar-arrow']")); Thread.sleep(500); Commons.click(test,driver,By.xpath("//*[text()='"+year+"']")); - Thread.sleep(1000); + Thread.sleep(5000); List cli= driver.findElements(By.xpath("//*[@class='mat-calendar-body-cell-content']")); cli.get(month-1).click(); Thread.sleep(500); From af76a4a10512acf7b99f73e9ba396fc9f44cb5a7 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 16:48:37 +0530 Subject: [PATCH 50/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index af87f9c6..8aaaac27 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -109,7 +109,7 @@ public void setUp() throws Exception { String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); if(headless.equalsIgnoreCase("yes")) { logger.info("Running is headless mode"); - options.addArguments("--headless", "--disable-gpu"); + options.addArguments("--headless", "--disable-gpu", "--no-sandbox"); } driver=new ChromeDriver(options); From 024172f7ce1d7b68508312a73b702f54393f9ebf Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 18:05:09 +0530 Subject: [PATCH 51/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/Commons.java | 180 +++++++++--------- 1 file changed, 85 insertions(+), 95 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 7ec82b24..e8f02c6e 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -79,76 +79,70 @@ public static void filterCenter(ExtentTest test,WebDriver driver, By by,String public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); try { - - Thread.sleep(5000); + (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); + Thread.sleep(500); + driver.findElement(by).click(); + Thread.sleep(500); + }catch (StaleElementReferenceException sere) { + // simply retry finding the element in the refreshed DOM + driver.findElement(by).click(); + } + catch (TimeoutException toe) { + driver.findElement(by).click(); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); + } catch (Exception e) { + + try { + test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } JavascriptExecutor executor = (JavascriptExecutor) driver; executor.executeScript("arguments[0].click();", driver.findElement(by)); - - }catch(Exception e) { - logger.info(e.getMessage()); - Assert.fail(); - - } -// catch (StaleElementReferenceException sere) { -// // simply retry finding the element in the refreshed DOM -// driver.findElement(by).click(); -// } -// catch (TimeoutException toe) { -// driver.findElement(by).click(); -// try { -// Thread.sleep(500); -// } catch (InterruptedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); -// } catch (Exception e) { -// -// try { -// // test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); -// driver.findElement(by).click(); -// } catch (Exception e1) { -// // TODO Auto-generated catch block -// e1.printStackTrace(); -// } -// JavascriptExecutor executor = (JavascriptExecutor) driver; -// executor.executeScript("arguments[0].click();", driver.findElement(by)); -// -// -// } + + + } } public static void enter(ExtentTest test,WebDriver driver, By by,String value) { logger.info("Entering " + by +value); try { - Thread.sleep(5000); + (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOfElementLocated(by)); driver.findElement(by).clear(); driver.findElement(by).sendKeys(value); - - }catch(Exception e) { - logger.info(e.getMessage()); - Assert.fail(); + try { + Thread.sleep(8); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }catch (StaleElementReferenceException sere) { + // simply retry finding the element in the refreshed DOM + driver.findElement(by).sendKeys(value); + } + catch (TimeoutException toe) { + driver.findElement(by).sendKeys(value); + logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); + } + catch (Exception e) { + try { + test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); + } -// catch (StaleElementReferenceException sere) { -// // simply retry finding the element in the refreshed DOM -// driver.findElement(by).sendKeys(value); -// } -// catch (TimeoutException toe) { -// driver.findElement(by).sendKeys(value); -// logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); -// } -// catch (Exception e) { -// try { -// test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); -// } catch (IOException e1) { -// // TODO Auto-generated catch block -// e1.printStackTrace(); -// } -// JavascriptExecutor executor = (JavascriptExecutor) driver; -// executor.executeScript("arguments[0].click();", driver.findElement(by)); -// -// } } @@ -157,30 +151,30 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by) logger.info("Selecting DropDown Index Zero Value " + by ); try { - Thread.sleep(5000); + Thread.sleep(500); click(test,driver,by);//REGION - - Thread.sleep(5000); + Thread.sleep(500); + String att= driver.findElement(by).getAttribute("aria-owns"); String[] list=att.split(" "); - Thread.sleep(5000); click(test,driver,By.id(list[0])); - - }catch(Exception e) { - logger.info(e.getMessage()); - Assert.fail(); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }catch (Exception e) { + try { + test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); + } - // catch (Exception e) { -// try { -// test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); -// } catch (IOException e1) { -// // TODO Auto-generated catch block -// e1.printStackTrace(); -// } -// JavascriptExecutor executor = (JavascriptExecutor) driver; -// executor.executeScript("arguments[0].click();", driver.findElement(by)); -// -// } } public static void dropdown(ExtentTest test,WebDriver driver, By by,String value) @@ -366,10 +360,9 @@ public static void editCenter(ExtentTest test,WebDriver driver,String data,By by try { Commons.click(test,driver,By.id("ellipsis-button0")); Commons.click(test,driver, By.id("Edit0")); - Thread.sleep(5000); + Assert.assertNotEquals(data, driver.findElement(by).getText()); - Thread.sleep(5000); driver.findElement(by).clear(); Commons.enter(test,driver, by, data); @@ -382,21 +375,18 @@ public static void editCenter(ExtentTest test,WebDriver driver,String data,By by Commons.click(test,driver, By.xpath("(//*[@id='cancel'])[1]")); Commons.click(test,driver, By.xpath("(//*[@id='cancel'])[1]")); logger.info("Click editCenter and Confirm" + by + data); - }catch(Exception e) { - logger.info(e.getMessage()); - Assert.fail(); } -// catch (Exception e) { -// try { -// test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); -// } catch (IOException e1) { -// // TODO Auto-generated catch block -// e1.printStackTrace(); -// } -// JavascriptExecutor executor = (JavascriptExecutor) driver; -// executor.executeScript("arguments[0].click();", driver.findElement(by)); -// -// } + catch (Exception e) { + try { + test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); + + } } public static void create(ExtentTest test,WebDriver driver) { @@ -463,7 +453,7 @@ public static void calendar(String date) { Commons.click(test,driver,By.xpath("//*[@class='mat-calendar-arrow']")); Thread.sleep(500); Commons.click(test,driver,By.xpath("//*[text()='"+year+"']")); - Thread.sleep(5000); + Thread.sleep(500); List cli= driver.findElements(By.xpath("//*[@class='mat-calendar-body-cell-content']")); cli.get(month-1).click(); Thread.sleep(500); From 9d5e4f5e21b35620af7348aa82f151bab4a09a41 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 18:37:55 +0530 Subject: [PATCH 52/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- .../main/java/io/mosip/testrig/adminui/utility/Commons.java | 3 ++- admintest/src/main/resources/testngFile/testng.xml | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 8aaaac27..6d40261c 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -109,7 +109,7 @@ public void setUp() throws Exception { String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); if(headless.equalsIgnoreCase("yes")) { logger.info("Running is headless mode"); - options.addArguments("--headless", "--disable-gpu", "--no-sandbox"); + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); } driver=new ChromeDriver(options); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index e8f02c6e..333fdf4f 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -81,7 +81,8 @@ public static void click(ExtentTest test,WebDriver driver, By by) { try { (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); Thread.sleep(500); - driver.findElement(by).click(); + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); Thread.sleep(500); }catch (StaleElementReferenceException sere) { // simply retry finding the element in the refreshed DOM diff --git a/admintest/src/main/resources/testngFile/testng.xml b/admintest/src/main/resources/testngFile/testng.xml index 058d1940..847beca5 100644 --- a/admintest/src/main/resources/testngFile/testng.xml +++ b/admintest/src/main/resources/testngFile/testng.xml @@ -7,8 +7,8 @@ - - + From b7cef5cd92ce1aec34194e5b376511f787f59343 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 20:57:55 +0530 Subject: [PATCH 53/69] kk Signed-off-by: Jayesh Kharode --- .../mosip/testrig/adminui/utility/Commons.java | 11 +++++++---- .../src/main/resources/testngFile/testng.xml | 16 +--------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 333fdf4f..a55794de 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -80,29 +80,32 @@ public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); try { (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); - Thread.sleep(500); - JavascriptExecutor executor = (JavascriptExecutor) driver; - executor.executeScript("arguments[0].click();", driver.findElement(by)); + Thread.sleep(5000); + driver.findElement(by).click(); Thread.sleep(500); }catch (StaleElementReferenceException sere) { // simply retry finding the element in the refreshed DOM + logger.error( sere.getMessage()); driver.findElement(by).click(); } catch (TimeoutException toe) { + logger.error( toe.getMessage()); driver.findElement(by).click(); try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block + logger.error( e.getMessage()); e.printStackTrace(); } logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); } catch (Exception e) { - + logger.error( e.getMessage()); try { test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); } catch (IOException e1) { // TODO Auto-generated catch block + logger.error( e1.getMessage()); e1.printStackTrace(); } JavascriptExecutor executor = (JavascriptExecutor) driver; diff --git a/admintest/src/main/resources/testngFile/testng.xml b/admintest/src/main/resources/testngFile/testng.xml index 847beca5..aeed4617 100644 --- a/admintest/src/main/resources/testngFile/testng.xml +++ b/admintest/src/main/resources/testngFile/testng.xml @@ -8,21 +8,7 @@ - - - - - - - - - - - - - - - + From d3a6b42404c3dde26fd8c403fedf2f7c3edf8b53 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 21:02:28 +0530 Subject: [PATCH 54/69] kk Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 6d40261c..f6798b43 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -109,7 +109,8 @@ public void setUp() throws Exception { String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); if(headless.equalsIgnoreCase("yes")) { logger.info("Running is headless mode"); - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080"); + options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080,--disable-dev-shm-usage"); + } driver=new ChromeDriver(options); From dede484de3f9d96f068e17d4fa13da536b32117c Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 21:05:35 +0530 Subject: [PATCH 55/69] kk Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/Commons.java | 72 +++++++++++-------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index a55794de..38596add 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -78,41 +78,51 @@ public static void filterCenter(ExtentTest test,WebDriver driver, By by,String } public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); +// try { +// (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); +// Thread.sleep(5000); +// driver.findElement(by).click(); +// Thread.sleep(500); +// }catch (StaleElementReferenceException sere) { +// // simply retry finding the element in the refreshed DOM +// logger.error( sere.getMessage()); +// driver.findElement(by).click(); +// } +// catch (TimeoutException toe) { +// logger.error( toe.getMessage()); +// driver.findElement(by).click(); +// try { +// Thread.sleep(500); +// } catch (InterruptedException e) { +// // TODO Auto-generated catch block +// logger.error( e.getMessage()); +// e.printStackTrace(); +// } +// logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); +// } catch (Exception e) { +// logger.error( e.getMessage()); +// try { +// test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); +// } catch (IOException e1) { +// // TODO Auto-generated catch block +// logger.error( e1.getMessage()); +// e1.printStackTrace(); +// } +// JavascriptExecutor executor = (JavascriptExecutor) driver; +// executor.executeScript("arguments[0].click();", driver.findElement(by)); +// +// +// } + try { - (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); Thread.sleep(5000); - driver.findElement(by).click(); - Thread.sleep(500); - }catch (StaleElementReferenceException sere) { - // simply retry finding the element in the refreshed DOM - logger.error( sere.getMessage()); - driver.findElement(by).click(); - } - catch (TimeoutException toe) { - logger.error( toe.getMessage()); - driver.findElement(by).click(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - logger.error( e.getMessage()); - e.printStackTrace(); - } - logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); - } catch (Exception e) { - logger.error( e.getMessage()); - try { - test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); - } catch (IOException e1) { - // TODO Auto-generated catch block - logger.error( e1.getMessage()); - e1.printStackTrace(); - } JavascriptExecutor executor = (JavascriptExecutor) driver; executor.executeScript("arguments[0].click();", driver.findElement(by)); - - - } + + }catch(Exception e) { + logger.error( e.getMessage()); + Assert.fail(); + } } From c38ba2eea72d7baafa1c4074ecaa9ac304134ce2 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 21:12:47 +0530 Subject: [PATCH 56/69] kk Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index f6798b43..0c6c7b06 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -109,7 +109,7 @@ public void setUp() throws Exception { String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); if(headless.equalsIgnoreCase("yes")) { logger.info("Running is headless mode"); - options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080,--disable-dev-shm-usage"); + options.addArguments("--headless", "--window-size=1920x1080,--disable-dev-shm-usage"); } From 710ea0919ac9a663fcf36620385db98adc6c997d Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 4 Jan 2024 21:16:35 +0530 Subject: [PATCH 57/69] kk Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index 0c6c7b06..a8d3944a 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -109,7 +109,7 @@ public void setUp() throws Exception { String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); if(headless.equalsIgnoreCase("yes")) { logger.info("Running is headless mode"); - options.addArguments("--headless", "--window-size=1920x1080,--disable-dev-shm-usage"); + options.addArguments("--headless", "--disable-gpu","--no-sandbox", "--window-size=1920x1080,--disable-dev-shm-usage"); } From 3e11fa05963e4b37d3e7c96dbfc66007a50593d4 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 10:30:54 +0530 Subject: [PATCH 58/69] ab Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/BaseClass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index a8d3944a..c9047a6b 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -109,7 +109,7 @@ public void setUp() throws Exception { String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); if(headless.equalsIgnoreCase("yes")) { logger.info("Running is headless mode"); - options.addArguments("--headless", "--disable-gpu","--no-sandbox", "--window-size=1920x1080,--disable-dev-shm-usage"); + options.addArguments("--headless", "--disable-gpu","--no-sandbox", "--window-size=1920x1080","--disable-dev-shm-usage"); } From 364a030c3e9ea1e3ac8505207caf03101b6ad80b Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 11:24:26 +0530 Subject: [PATCH 59/69] ab Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index e5f0d8c4..e017fa76 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -36,10 +36,9 @@ COPY --chown=${container_user}:${container_user} ./src/main/resources/ ${work_di COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir} # Set working directory -WORKDIR ${work_dir} +WORKDIR /home/${container_user}/ + -# Expose port 4444 (this is where Selenium Grid will be accessible) -EXPOSE 4444 # Entrypoint for the container ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] From 842e3b931a7d37e367ceba92201964ddd79f863a Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 11:31:18 +0530 Subject: [PATCH 60/69] ab Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index e017fa76..8974a420 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -24,8 +24,8 @@ ARG container_user_gid=1001 ENV work_dir=/home/${container_user}/ # Install packages and create user -RUN groupadd -g ${container_user_gid} ${container_user_group} \ - && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} +RUN chown -R ${container_user}:${container_user} /home/${container_user}/ \ + groupadd -g ${container_user_gid} ${container_user_group} \&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} # Switch to the specified user for the subsequent commands USER ${container_user_uid}:${container_user_gid} From 910b549e12e8065833d9ce47334574485cf3563f Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 11:35:41 +0530 Subject: [PATCH 61/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 8974a420..6594d873 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -25,7 +25,8 @@ ENV work_dir=/home/${container_user}/ # Install packages and create user RUN chown -R ${container_user}:${container_user} /home/${container_user}/ \ - groupadd -g ${container_user_gid} ${container_user_group} \&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} + groupadd -g ${container_user_gid} ${container_user_group} \ + && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} # Switch to the specified user for the subsequent commands USER ${container_user_uid}:${container_user_gid} From 90062d66b996a7115487aa91765281e5f349dca4 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 11:41:51 +0530 Subject: [PATCH 62/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 6594d873..52724722 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -24,8 +24,8 @@ ARG container_user_gid=1001 ENV work_dir=/home/${container_user}/ # Install packages and create user -RUN chown -R ${container_user}:${container_user} /home/${container_user}/ \ - groupadd -g ${container_user_gid} ${container_user_group} \ +RUN chown -R ${container_user}:${container_user} /home/${container_user}/ \ + && groupadd -g ${container_user_gid} ${container_user_group} \ && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} # Switch to the specified user for the subsequent commands From e814d04f16f9ccf1d36059d20810d53fc2ec90f0 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 11:55:39 +0530 Subject: [PATCH 63/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- admintest/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 52724722..36adac6f 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -23,10 +23,10 @@ ARG container_user_gid=1001 # Set working directory for the user ENV work_dir=/home/${container_user}/ -# Install packages and create user -RUN chown -R ${container_user}:${container_user} /home/${container_user}/ \ - && groupadd -g ${container_user_gid} ${container_user_group} \ - && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} +# install packages and create user +RUN groupadd -g ${container_user_gid} ${container_user_group} \ + && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} \ + && chown -R ${container_user}:${container_user} /home/${container_user}/ # Switch to the specified user for the subsequent commands USER ${container_user_uid}:${container_user_gid} From 710e7e98a06d5300e773bf71c24f97637864dc67 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 12:05:09 +0530 Subject: [PATCH 64/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/Commons.java | 82 +++++++++---------- .../src/main/resources/testngFile/testng.xml | 19 ++++- 2 files changed, 58 insertions(+), 43 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index 38596add..b3460431 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -78,51 +78,51 @@ public static void filterCenter(ExtentTest test,WebDriver driver, By by,String } public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); -// try { -// (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); -// Thread.sleep(5000); -// driver.findElement(by).click(); -// Thread.sleep(500); -// }catch (StaleElementReferenceException sere) { -// // simply retry finding the element in the refreshed DOM -// logger.error( sere.getMessage()); -// driver.findElement(by).click(); -// } -// catch (TimeoutException toe) { -// logger.error( toe.getMessage()); -// driver.findElement(by).click(); -// try { -// Thread.sleep(500); -// } catch (InterruptedException e) { -// // TODO Auto-generated catch block -// logger.error( e.getMessage()); -// e.printStackTrace(); -// } -// logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); -// } catch (Exception e) { -// logger.error( e.getMessage()); -// try { -// test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); -// } catch (IOException e1) { -// // TODO Auto-generated catch block -// logger.error( e1.getMessage()); -// e1.printStackTrace(); -// } -// JavascriptExecutor executor = (JavascriptExecutor) driver; -// executor.executeScript("arguments[0].click();", driver.findElement(by)); -// -// -// } - try { + (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); Thread.sleep(5000); + driver.findElement(by).click(); + Thread.sleep(500); + }catch (StaleElementReferenceException sere) { + // simply retry finding the element in the refreshed DOM + logger.error( sere.getMessage()); + driver.findElement(by).click(); + } + catch (TimeoutException toe) { + logger.error( toe.getMessage()); + driver.findElement(by).click(); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + logger.error( e.getMessage()); + e.printStackTrace(); + } + logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); + } catch (Exception e) { + logger.error( e.getMessage()); + try { + test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); + } catch (IOException e1) { + // TODO Auto-generated catch block + logger.error( e1.getMessage()); + e1.printStackTrace(); + } JavascriptExecutor executor = (JavascriptExecutor) driver; executor.executeScript("arguments[0].click();", driver.findElement(by)); - - }catch(Exception e) { - logger.error( e.getMessage()); - Assert.fail(); - } + + + } + +// try { +// Thread.sleep(5000); +// JavascriptExecutor executor = (JavascriptExecutor) driver; +// executor.executeScript("arguments[0].click();", driver.findElement(by)); +// +// }catch(Exception e) { +// logger.error( e.getMessage()); +// Assert.fail(); +// } } diff --git a/admintest/src/main/resources/testngFile/testng.xml b/admintest/src/main/resources/testngFile/testng.xml index aeed4617..91669380 100644 --- a/admintest/src/main/resources/testngFile/testng.xml +++ b/admintest/src/main/resources/testngFile/testng.xml @@ -7,9 +7,24 @@ - - + + + + + + + + + + + + + + + + + From bbc00d0d29766b9402fb6c8c56a5a03969f5a22e Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 12:06:11 +0530 Subject: [PATCH 65/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../src/main/java/io/mosip/testrig/adminui/utility/Commons.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index b3460431..f8634292 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -80,7 +80,7 @@ public static void click(ExtentTest test,WebDriver driver, By by) { logger.info("Clicking " + by ); try { (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); - Thread.sleep(5000); + Thread.sleep(1000); driver.findElement(by).click(); Thread.sleep(500); }catch (StaleElementReferenceException sere) { From b5fc9c7efa6437383d5e8f6663e3180d765cbd23 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 15:31:39 +0530 Subject: [PATCH 66/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../testrig/adminui/utility/Commons.java | 10 ++++ .../main/resources/config/Kernel.properties | 50 +++++++++---------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index f8634292..92bf50f2 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -43,6 +43,7 @@ public static void filter(ExtentTest test,WebDriver driver, By by,String data) Commons.click(test,driver, By.id("applyTxt")); } catch (Exception e) { + logger.info(e.getMessage()); try { test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); } catch (IOException e1) { @@ -65,6 +66,7 @@ public static void filterCenter(ExtentTest test,WebDriver driver, By by,String Commons.click(test,driver, By.id("applyTxt")); } catch (Exception e) { + logger.info(e.getMessage()); try { test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); } catch (IOException e1) { @@ -209,6 +211,7 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by,String value e.printStackTrace(); } }catch (Exception e) { + logger.info(e.getMessage()); try { test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); } catch (IOException e1) { @@ -239,6 +242,7 @@ public static void dropdowncenter(ExtentTest test,WebDriver driver, By by,String e.printStackTrace(); } }catch (Exception e) { + logger.info(e.getMessage()); try { test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); } catch (IOException e1) { @@ -263,7 +267,9 @@ public static void dropdown(ExtentTest test,WebDriver driver, By by,By value) Thread.sleep(500); }catch (Exception e) { + logger.info(e.getMessage()); try { + test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); } catch (IOException e1) { // TODO Auto-generated catch block @@ -328,6 +334,7 @@ public static void edit(ExtentTest test,WebDriver driver,String data,By by) { logger.info("Click Edit and Confirm" + by + data); } catch (Exception e) { + logger.info(e.getMessage()); try { test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); } catch (IOException e1) { @@ -359,6 +366,7 @@ public static void editRes(ExtentTest test,WebDriver driver,String data,By by) { logger.info("Click Edit and Confirm" + by + data); }catch (Exception e) { + logger.info(e.getMessage()); try { test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); } catch (IOException e1) { @@ -391,6 +399,7 @@ public static void editCenter(ExtentTest test,WebDriver driver,String data,By by logger.info("Click editCenter and Confirm" + by + data); } catch (Exception e) { + logger.info(e.getMessage()); try { test.fail(e.getMessage(), MediaEntityBuilder.createScreenCaptureFromBase64String(Screenshot.ClickScreenshot(driver)).build()); } catch (IOException e1) { @@ -475,6 +484,7 @@ public static void calendar(String date) { }catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); + logger.info(e.getMessage()); } } diff --git a/admintest/src/main/resources/config/Kernel.properties b/admintest/src/main/resources/config/Kernel.properties index 55f556b4..cedf718a 100644 --- a/admintest/src/main/resources/config/Kernel.properties +++ b/admintest/src/main/resources/config/Kernel.properties @@ -2,8 +2,7 @@ #Make sure all resource apis are covered authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd zoneMappingUrl=/v1/masterdata/zoneuser -leafzonesURL=/v1/masterdata/zones/leafzones/eng -#zoneNameUrl=/v1/masterdata/zones/zonename +zoneNameUrl=/v1/masterdata/zones/zonename zoneMappingActivateUrl=/v1/masterdata/zoneuser userCenterMappingUrl=/v1/masterdata/usercentermapping bulkUploadUrl=/v1/admin/bulkupload @@ -13,63 +12,63 @@ bulkUploadUrl=/v1/admin/bulkupload #IDREPO mosip_idrepo_app_id=idrepo mosip_idrepo_client_id=mosip-idrepo-client -mosip_idrepo_client_secret=IGsZkHXcAoqGKRTA +mosip_idrepo_client_secret=M7CZ6WYMi6oe695u #IDREPO mosip_idrepo_app_id=idrepo mosip_idrepo_client_id=mosip-idrepo-client -mosip_idrepo_client_secret=IGsZkHXcAoqGKRTA +mosip_idrepo_client_secret=M7CZ6WYMi6oe695u keycloak-realm-id=mosip -keycloak-external-url=https://iam.dev2.mosip.net +keycloak-external-url=https://iam.dev.mosip.net mosip_testrig_client_id=mosip-testrig-client -mosip_testrig_client_secret=Xup50UX3AybAkzkH +mosip_testrig_client_secret=mqKN6lkadcA3rG31 admin mosip_admin_app_id=admin admin_password=mosip123 #actuall user login will be 'adminui-auto12' -admin_userName=admin1 +admin_userName=admin00 mosip_admin_client_id=mosip-admin-client -mosip_admin_client_secret=E4386XMrYOvoHMJ5 +mosip_admin_client_secret=xzzvvPISDPwR2yl7 #admin admin_zone_password=mosip123 admin_zone_userName=globaladmin mosip_regclient_app_id=registrationclient mosip_reg_client_id=mosip-reg-client -mosip_reg_client_secret=3H9qsSxmYn4bXBk8 -iam-users-to-create=admin1,globaladmin +mosip_reg_client_secret=ExzIU4M7MYrMZLuz +iam-users-to-create=admin00 #iam-users-to-create=111997,220005,111992 -iam-users-password=mosip123,mosip123 -roles.admin1=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN +iam-users-password=mosip123 +roles.admin00=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN roles.globaladmin=GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip -partner_url=jdbc:postgresql://dev2.mosip.net:5432/mosip_ida +partner_url=jdbc:postgresql://dev.mosip.net:5432/mosip_ida #----------------------------------Database properties----------------------------------------------------------# postgresqlUser=postgresql db-port=5432 -db-server=dev2.mosip.net +db-server=dev.mosip.net hibernate.connection.driver_class=org.postgresql.Driver hibernate.connection.pool_size=1 hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect hibernate.show_sql=true hibernate.current_session_context_class=thread db-su-user=postgres -postgresql-password=FRekEGMjiC +postgresql-password=mQi298ZW7p pms_db_schema=pms km_db_schema=keymgr master_db_schema=master audit_db_schema=audit ida_db_schema=ida -db-server=dev2.mosip.net -keycloak-external-url=https://iam.dev2.mosip.net -audit_url=jdbc:postgresql://dev2.mosip.net:5432/mosip_audit +db-server=dev.mosip.net +keycloak-external-url=https://iam.dev.mosip.net +audit_url=jdbc:postgresql://dev.mosip.net:5432/mosip_audit driver_class=org.postgresql.Driver pool_size=1 dialect=org.hibernate.dialect.PostgreSQLDialect show_sql=true current_session_context_class=thread db-su-user=postgres -postgresql-password=FRekEGMjiC +postgresql-password=mQi298ZW7p postgresqlUser=postgresql db-port=5432 -db-server=dev2.mosip.net +db-server=dev.mosip.net s3-user-key=minioadmin s3-user-secret=minioadmin s3-host=http://minio.minio:9000 @@ -78,7 +77,7 @@ s3-region=null reportExpirationInDays=3 # supported values yes or no push-reports-to-s3=no -enableDebug=yes +enableDebug=no # supported values are 1 to 8 threadCount=1 # supported values are 0 ,1, 2 based on number of env languages @@ -101,10 +100,7 @@ validateBindingEndpoint=esignet-binding #authCertsPath=/home/mosip/authcerts #To run locally authCertsPath= - -servicesNotDeployed= - -adminPortalPath=https://admin.dev2.mosip.net/ -apiEnvUser=api-internal.dev2 -apiInternalEndPoint=https://api-internal.dev2.mosip.net +adminPortalPath=https://admin.dev.mosip.net/ +apiEnvUser=api-internal.dev +apiInternalEndPoint=https://api-internal.dev.mosip.net \ No newline at end of file From d9813d0dcf763161ed56aa768ead21cd98ed797a Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 15:38:34 +0530 Subject: [PATCH 67/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- admintest/src/main/resources/config/Kernel.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admintest/src/main/resources/config/Kernel.properties b/admintest/src/main/resources/config/Kernel.properties index cedf718a..873efbd3 100644 --- a/admintest/src/main/resources/config/Kernel.properties +++ b/admintest/src/main/resources/config/Kernel.properties @@ -2,6 +2,7 @@ #Make sure all resource apis are covered authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd zoneMappingUrl=/v1/masterdata/zoneuser +leafzonesURL=/v1/masterdata/zones/leafzones/eng zoneNameUrl=/v1/masterdata/zones/zonename zoneMappingActivateUrl=/v1/masterdata/zoneuser userCenterMappingUrl=/v1/masterdata/usercentermapping @@ -100,6 +101,7 @@ validateBindingEndpoint=esignet-binding #authCertsPath=/home/mosip/authcerts #To run locally authCertsPath= +servicesNotDeployed= adminPortalPath=https://admin.dev.mosip.net/ apiEnvUser=api-internal.dev apiInternalEndPoint=https://api-internal.dev.mosip.net From d24fed7083070598a64579e3547c84c86b474fd4 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 5 Jan 2024 17:28:31 +0530 Subject: [PATCH 68/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../java/io/mosip/testrig/adminui/dbaccess/DBManager.java | 1 + .../src/main/resources/BulkUploadFiles/sin/device_type.csv | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/dbaccess/DBManager.java b/admintest/src/main/java/io/mosip/testrig/adminui/dbaccess/DBManager.java index b98d7315..860860a6 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/dbaccess/DBManager.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/dbaccess/DBManager.java @@ -224,6 +224,7 @@ public void execute(Connection connection) throws SQLException { statement .addBatch("delete from zone_user_h where cr_by ='"+BaseClass.userid+"'"); statement.addBatch("delete from blocklisted_words where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from bulkupload_transaction where cr_by ='"+BaseClass.userid+"'"); diff --git a/admintest/src/main/resources/BulkUploadFiles/sin/device_type.csv b/admintest/src/main/resources/BulkUploadFiles/sin/device_type.csv index fad07c85..aed9f671 100644 --- a/admintest/src/main/resources/BulkUploadFiles/sin/device_type.csv +++ b/admintest/src/main/resources/BulkUploadFiles/sin/device_type.csv @@ -1,2 +1,2 @@ -code,name,name,description,langCode,isActive -ABhGH,ABChjJH,ABChjJH,For printing Documents,eng,TRUE +code|name|name|description|langCode|isActive +ABhGH1|ABChjJH1|ABChjJH1|For printing Documents|eng|TRUE From 10eaaea5b9794e3df06ee426c43b1ff5cab2895c Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Mon, 8 Jan 2024 10:39:16 +0530 Subject: [PATCH 69/69] MOSIP-30901 Signed-off-by: Jayesh Kharode --- .../main/java/io/mosip/testrig/adminui/utility/TestRunner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java index e36e0527..5dd3ab47 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java @@ -92,7 +92,7 @@ public static void startTestRunner() throws Exception { System.getProperties().setProperty("testng.outpur.dir", "testng-report"); runner.setOutputDirectory("testng-report"); - System.getProperties().setProperty("emailable.report2.name", "ADMINUI-" + BaseTestCaseFunc.environment + "-"+System.getProperty("os.name") + System.getProperties().setProperty("emailable.report2.name", "ADMINUI-" + BaseTestCaseFunc.environment + "-run-" + System.currentTimeMillis() + "-report.html"); runner.run();