diff --git a/admintest/Dockerfile b/admintest/Dockerfile new file mode 100644 index 00000000..36adac6f --- /dev/null +++ b/admintest/Dockerfile @@ -0,0 +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} + +# Define build-time arguments for user and group +ARG container_user=mosip +ARG container_user_group=mosip +ARG container_user_uid=1001 +ARG container_user_gid=1001 + +# Set working directory for the user +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} \ + && 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} + +# 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 +WORKDIR /home/${container_user}/ + + + +# Entrypoint for the container +ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] diff --git a/admintest/README.md b/admintest/README.md index 80b04d2e..667318a0 100644 --- a/admintest/README.md +++ b/admintest/README.md @@ -6,7 +6,7 @@ Selenium webdriver based Admin Portal Automation covers CRUD(create, read, updat ## Build 1. Build jar `mvn clean install` 2. Place jar in one folder along with src/main/resources files and folder -3. Run jar with vm args- ``` java -Dpath=https://env.mosip.net/ -Duserid=user -Dpassword=pwd -jar nameofAdminJar.jar``` +3. Run jar with vm args- ``` -Dpath=https://admin.dev.mosip.net/ -DKeyclockURL=https://iam.dev.mosip.net -Denv.user=api-internal.dev -Denv.endpoint=https://api-internal.dev.mosip.net jar nameofAdminJar.jar``` ## Configurations 1. Update below keys from `Config.properties` @@ -36,9 +36,21 @@ Selenium webdriver based Admin Portal Automation covers CRUD(create, read, updat * machineTypesCRUD: MT * templateCRUD: T +## Headless Mode +*Update below key from `TestData.json` +* hedless: "no" --To run in normal mode. +* hedless : "yes" --To run in headless mode + ## Execution result and logs 1. Verify the failure in the logs file `\logs\AutomationLogs.log` -1. Execution results present under test-output folder file `emailable-report.html` +2. Execution results present under test-output folder file `emailable-report.html` +3. Extent results are present `\admintest\Reports` + +#Usercreation +1.In config folder `\config\kernal.property` +2.on line no 27,36,38 chnage we can change the user(keep same at all three place) +3. + ## License This project is licensed under the terms of [Mozilla Public License 2.0](../LICENSE). diff --git a/admintest/entrypoint.sh b/admintest/entrypoint.sh new file mode 100644 index 00000000..d9c22cdc --- /dev/null +++ b/admintest/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +java --version +java -jar adminui-*-jar-with-dependencies.jar \ No newline at end of file diff --git a/admintest/pom.xml b/admintest/pom.xml index ae12e77d..fec0403a 100644 --- a/admintest/pom.xml +++ b/admintest/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - io.mosip.test - admintest - 1.2.0 + io.mosip.testrig.adminui + adminui + 1.2.1 admin-ui-automation admin-ui-automation https://github.com/mosip/admin-ui @@ -28,104 +28,335 @@ - 11 - 11 - + + UTF-8 + + + 11 + 11 + 3.7.0 + 3.0.2 + 3.1.0 + 2.9 + 0.8.1 + 3.2 + 3.0.1 + 2.3 + true + 3.7.0.1746 + + 2.0.2.RELEASE + 2.0.7.RELEASE + 5.0.5.RELEASE + 2.0.0.RELEASE + + 2.0.7 + 1.5.20 + 2.9.2 + + 3.6.2 + 3.7.0 + + + + 1.2 + 3.0.0 + 1.3 + 2.2 + 2.0.1.Final + 2.2.6 + + + 1.4.197 + 5.1.46 + 42.2.2 + 2.5.0 + 6.0.12.Final + + + 1.10.19 + 1.7.4 + 2.0.0-beta.5 + + + 1.2.3 + 1.7.19 + 2.16.0 + 1.7.25 + + + 2.9.5 + 20180130 + 2.2.10 + 20180130 + + + 3.6.1 + 3.7 + 2.6 + 1.11 + 4.3 + 1.9.2 + 2.2 + 4.5.6 + 19.0 + 1.18.8 + 0.1.54 + 1.4.0 + 7.1.0 + 2.0.0 + 5.5.13 + 2.3.23 + 1.7 + 2.0 + 1.5.2 + 2.1.1 + 1.60 + 63.1 + 1.0.0 + 3.3.3 + 2.8.1 + 4.1.0-incubating + 1.11.368 + 0.2.4 + 2.3.0 + 3.0.1 + 1.9.12 + 0.6.0 + 2.0.0.AM2 + + + + + + + + 0.8.2 + 2.2 + 3.2 + UTF-8 + 3.7.0 + 3.0.1 + + + 1.1.6 + 1.7.19 + 1.10.19 + + + 1.4.6 + + + 5.0.6.RELEASE + + + 5.4.2.Final + + + 2.1.1 + + + 10.13.1.1 + + + 3.4.0 + + + 1.3.5 + + + 0.3.12 + + + 0.3.0 + + + 1.1.2-incubating + 1.2.0.1-B1 + 0.4.7 + 3.0.0 + 2.41.2 + 2.4.0 + 3.3.9 + 3.0.7 + 6.11 + 1.13 + adminui-1.2.1-SNAPSHOT-jar-with-dependencies + + - - - selenium-tests - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - + + + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + pl.project13.maven + git-commit-id-plugin + 3.0.1 + + + get-the-git-infos + + revision + + validate + + + + true + ${project.build.outputDirectory}/git.properties + + ^git.build.(time|version)$ + ^git.commit.id.(abbrev|full)$ + + full + ${project.basedir}/.git + + + + + maven-compiler-plugin + 3.5.1 + + 11 + 11 + -Dfile.encoding=UTF-8 + + + - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - attach-javadocs - - jar - - - - - none - - - - org.apache.maven.plugins - maven-source-plugin - true - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12.4 - - - testng.xml - - - - - org.apache.maven.plugins - maven-assembly-plugin - 3.1.1 + org.apache.maven.plugins + maven-antrun-plugin + 3.0.0 + + + make-jar-executable + package + + run + + + + + + + + + + + + + pl.project13.maven + git-commit-id-plugin + 3.0.1 + + + populate-git-commit-information + + revision + + + true + MM/dd/yyyy HH:mm:ss Z + 8 + true + ${project.build.outputDirectory}/git.properties + + + + + ${project.basedir}/.git + + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + + shade + - - jar-with-dependencies - - - - true - io.mosip.test.admintest.utility.TestRunner - - + ${fileName} + + + + + + io.mosip.testrig.adminui.utility.TestRunner + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + - - - make-assembly - package - - single - - - - - - - - + + + + + @@ -194,8 +425,19 @@ + + com.aventstack + extentreports + 5.0.9 + - + + + io.github.bonigarcia + webdrivermanager + 5.2.0 + + org.testng testng @@ -210,6 +452,95 @@ 2.6 + + org.jboss.resteasy + resteasy-jaxrs + 3.15.0.Final + + + + io.minio + minio + 8.4.3 + + + + org.postgresql + postgresql + 42.6.0 + + + org.hibernate + hibernate-core + 5.6.7.Final + + + + + + junit + junit + 3.8.1 + test + + + + io.rest-assured + rest-assured + 5.3.0 + + + org.apache.logging.log4j + log4j-api + 2.11.1 + + + org.slf4j + slf4j-log4j12 + 1.6.2 + + + javax.ws.rs + javax.ws.rs-api + 2.1.1 + + + org.json + json + 20230227 + + + org.keycloak + keycloak-admin-client + 17.0.1 + + + commons-beanutils + commons-beanutils + 1.9.4 + + + com.googlecode.json-simple + json-simple + 1.1.1 + + + org.apache.commons + commons-collections4 + 4.4 + + + commons-lang + commons-lang + 2.6 + + + + com.amazonaws + aws-java-sdk-s3 + 1.12.470 + + diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/BlockListTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/BlockListTest.java deleted file mode 100644 index 318f0a35..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/BlockListTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package io.mosip.test.admintest.testcase; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class BlockListTest extends BaseClass { - - @Test(groups = "BL") - public void blocklistedwordsCRUD() { - - String idBlocklisted="admin/masterdata/blocklisted-words/view"; - Commons.click(driver, By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver, By.id(idBlocklisted)); - - Commons.click(driver, By.id("Create")); //FIX - Commons.enter(driver, By.id("word"), data); - Commons.enter(driver, By.id("description"), data); - - - Commons.create(driver); - Commons.filter(driver, By.id("word"), data); - - - Commons.edit(driver,data+1,By.id("word")); - Commons.filter(driver, By.id("word"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("word")); - Commons.filter(driver, By.id("word"), data+2); - Commons.deactivate(driver); - - - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/CenterTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/CenterTest.java deleted file mode 100644 index d9b2cc34..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/CenterTest.java +++ /dev/null @@ -1,103 +0,0 @@ -package io.mosip.test.admintest.testcase; -import static org.testng.Assert.assertNotEquals; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Reporter; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; -import io.mosip.test.admintest.utility.JsonUtil; -public class CenterTest extends BaseClass{ - - @Test(groups = "CTR") - - public void centerCRUD() throws Exception { - - Reporter.log("centerCRUD",true); - String holidayDate=JsonUtil.JsonObjParsing(Commons.getTestData(),"holidayDateCenter"); - Commons.click(driver,By.id("admin/resources")); - - Commons.click(driver,By.id("/admin/resources/centers")); - - Commons.click(driver, By.id("Create Center")); - /* - * Select Registration Center Type - */ - - /** - * centerTypeCode dropdown - */ - Commons.enter(driver, By.id("name"), data); - - Commons.dropdown(driver,By.id("centerTypeCode")); - Commons.enter(driver, By.id("contactPerson"),data); - Commons.enter(driver,By.id("contactPhone"),data); - - Commons.enter(driver,By.id("longitude"),"1.1234"); - Commons.enter(driver,By.id("latitude"),"2.2345"); - Commons.enter(driver,By.id("addressLine1"),data); - Commons.enter(driver,By.id("addressLine2"),data); - Commons.enter(driver,By.id("addressLine3"),data); - - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[1]")); - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[2]")); - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[3]")); - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[4]")); - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[5]")); - - - Commons.dropdown(driver, By.id("zone")); - Commons.dropdown(driver, By.id("holidayZone")); - - - - - Commons.enter(driver,By.id("noKiosk"),"10"); - - Commons.dropdown(driver,By.id("processingTime"),"45"); - Commons.dropdown(driver,By.id("startTime"),"9:00 AM"); - Commons.dropdown(driver,By.id("endTime"),"5:00 PM"); - Commons.dropdown(driver,By.id("lunchStartTime"),"1:00 PM"); - Commons.dropdown(driver,By.id("lunchEndTime"),"2:00 PM"); - - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(1) .mat-pseudo-checkbox")); - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(2) .mat-pseudo-checkbox")); - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(3) > .mat-list-item-content")); - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(4) > .mat-list-item-content")); - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(5) > .mat-list-item-content")); - - Commons.enter(driver,By.id("holidayDate"),holidayDate); - Commons.click(driver, By.id("createExceptionalHoliday")); - - Commons.createRes(driver); - Commons.filterCenter(driver, By.id("name"), data); - - - Commons.editCenter(driver,data+1,By.id("name")); - - Commons.filterCenter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.editCenter(driver,data+2,By.id("name")); - Commons.filterCenter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - Commons.decommission(driver); - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/CenterTypeTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/CenterTypeTest.java deleted file mode 100644 index 6c41caba..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/CenterTypeTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; -public class CenterTypeTest extends BaseClass{ - @Test(groups = "CT") - public void centerTypeCRUD() { - - String idCenterTypeCard="admin/masterdata/center-type/view"; - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(idCenterTypeCard)); - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("descr"),data); - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/DeviceSpecificationTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/DeviceSpecificationTest.java deleted file mode 100644 index ca608e23..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/DeviceSpecificationTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class DeviceSpecificationTest extends BaseClass{ - - - @Test(groups = "DS") - public void deviceSpecCRUD() { - String devicespec="admin/masterdata/device-specs/view"; - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(devicespec)); - Commons.click(driver,By.id("Create")); - - - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - Commons.enter(driver,By.id("brand"),data); - Commons.enter(driver,By.id("model"),data); - Commons.enter(driver,By.id("minDriverversion"),data); - Commons.dropdown(driver,By.id("deviceTypeCode")); - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/DeviceTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/DeviceTest.java deleted file mode 100644 index cf33e141..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/DeviceTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.paulhammant.ngwebdriver.NgWebDriver; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; -public class DeviceTest extends BaseClass{ - @Test(groups = "D") - public void deviceCRUD() throws InterruptedException { - - Commons.click(driver,By.id("admin/resources")); - Commons.click(driver,By.id("/admin/resources/devices")); - Commons.click(driver,By.id("Create Device")); - - - Commons.enter(driver, By.id("name"),data); - Commons.enter(driver, By.id("serialNumber"),data); - - Commons.enter(driver, By.id("macAddress"),"1.1234"); - - Commons.enter(driver, By.id("ipAddress"),"2.2345"); - Commons.enter(driver, By.id("validity"),"3/3/2023"); - - Commons.dropdown(driver,By.id("deviceSpecId")); - Commons.dropdown(driver,By.id("zone")); - Commons.dropdown(driver,By.id("regCenterId")); - - - Commons.createRes(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.editRes(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.editRes(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - Commons.decommission(driver); - } - } diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/DeviceTypesTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/DeviceTypesTest.java deleted file mode 100644 index 7ccbf772..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/DeviceTypesTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class DeviceTypesTest extends BaseClass{ - - @Test(groups = "DT" ) - public void deviceTypesCRUD() { - String deviceTypes="admin/masterdata/device-types/view"; - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(deviceTypes)); - Commons.click(driver,By.id("Create")); - - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/DocumentCategoriesTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/DocumentCategoriesTest.java deleted file mode 100644 index aeb60ccd..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/DocumentCategoriesTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class DocumentCategoriesTest extends BaseClass{ - @Test(groups = "DOC") - public void documentCategoriesCRUD() { - String documentCategories="admin/masterdata/document-categories/view"; - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(documentCategories)); - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/DocumentTypes.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/DocumentTypes.java deleted file mode 100644 index 95c96183..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/DocumentTypes.java +++ /dev/null @@ -1,58 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class DocumentTypes extends BaseClass{ - @Test(groups = "DOCT") - public void documentTypesCRUD() { - String documentTypes="admin/masterdata/document-type/view"; - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(documentTypes)); - - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/DynamicFieldTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/DynamicFieldTest.java deleted file mode 100644 index 6b69bcba..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/DynamicFieldTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class DynamicFieldTest extends BaseClass{ - - - @Test(groups = "DF") - public void dynamicFieldCRUD() { - - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id("createDynamicField")); - - - - Commons.enter(driver,By.id("code"),data); - - Commons.enter(driver,By.id("name"),"Automation"); - Commons.enter(driver,By.id("description"),"Automation"); - - Commons.enter(driver,By.id("value"),data); - - - Commons.create(driver); - Commons.filter(driver, By.id("description"), "Automation"); - - - Commons.edit(driver,data+1,By.id("code")); - Commons.filter(driver, By.id("description"), "Automation"); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("code")); - Commons.filter(driver, By.id("description"), "Automation"); - Commons.deactivate(driver); - - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/HolidaysTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/HolidaysTest.java deleted file mode 100644 index e1dd0a68..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/HolidaysTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; -import io.mosip.test.admintest.utility.JsonUtil; -import io.mosip.test.admintest.utility.PropertiesUtil; - -public class HolidaysTest extends BaseClass{ - - @Test(groups = "H") - public void holidaysCRUD() throws Exception { - String listofholidays="admin/masterdata/holiday/view"; - String holidayDate=JsonUtil.JsonObjParsing(Commons.getTestData(),"holidayDate"); - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(listofholidays)); - Commons.click(driver,By.id("Create")); - - - Commons.enter(driver,By.id("holidayName"),data); - Commons.enter(driver,By.id("holidayDesc"),data); - Commons.enter(driver,By.id("holidayDate"),holidayDate); - Commons.dropdown(driver,By.id("locationCode")); - - - Commons.create(driver); - Commons.filter(driver, By.id("holidayName"), data); - - - Commons.edit(driver,data+1,By.id("holidayName")); - Commons.filter(driver, By.id("holidayName"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("holidayName")); - Commons.filter(driver, By.id("holidayName"), data+2); - Commons.deactivate(driver); - - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/LoginTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/LoginTest.java deleted file mode 100644 index a5471cff..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/LoginTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class LoginTest extends BaseClass{ - - @Test(priority = 0) - public void loginTest() throws Exception { - String envPath = System.getProperty("path"); - String userid = System.getProperty("userid"); - String password = System.getProperty("password"); - String language = null; - driver.get(envPath); - driver.manage().window().setSize(new Dimension(1050, 708)); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - driver.findElement(By.linkText("Admin")).click(); - - try { - language=Commons.getFieldData("langcode"); - - System.out.println(language); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - Commons.click(driver,By.xpath("//*[@class='kc-dropdown']")); - String var="//*[@class='kc-dropdown-item']/a[contains(text(),'"+language+"')]"; - Commons.click(driver,By.xpath(var)); - driver.findElement(By.id("username")).sendKeys(userid); - driver.findElement(By.id("password")).sendKeys(password); - driver.findElement(By.xpath("//input[@name=\'login\']")).click(); - - /* - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.xpath("//mat-card-content/span[contains(text(),'Blocklisted Words')]")); - Commons.click(driver,By.xpath("//span[contains(text(),'Create')]")); - String data=Commons.appendDate; - - Commons.enter(driver,By.xpath("//input[@placeholder='Blocklisted Words']"),data); - Commons.enter(driver,By.xpath("//textarea[@placeholder='Description']"),data); - - - Commons.click(driver,By.xpath("//button[@id='createButton']")); - Commons.click(driver,By.xpath("//span[contains(text(),'OK')]")); - - Commons.click(driver,By.xpath("//span[contains(text(),'Filter')]")); - - Commons.enter(driver,By.xpath("//input[@placeholder=' Blocklisted Words']"),data); - - Commons.click(driver,By.xpath("//span[contains(text(),'Apply')]")); - - Commons.click(driver,By.cssSelector(".ellipsis-button")); - - - Commons.click(driver,By.xpath("//span[contains(text(),'Activate')]")); - - Commons.click(driver,By.xpath("//span[contains(text(),'Confirm')]")); - - Commons.click(driver,By.xpath("//span[contains(text(),'Done')]")); - - driver.findElement(By.cssSelector(".ellipsis-button")).click(); - - Commons.click(driver,By.xpath("//span[contains(text(),'Edit')]")); - - Assert.assertNotEquals(data, driver.findElement(By.xpath("//input[@placeholder='Blocklisted Words']")).getText()); - driver.findElement(By.xpath("//input[@placeholder='Blocklisted Words']")).clear(); - - Commons.enter(driver,By.xpath("//input[@placeholder='Blocklisted Words']"),data+1); - - Commons.click(driver,By.id("createButton")); - - - Commons.click(driver,By.xpath("//button/span[contains(text(),'OK')]")); - - Commons.click(driver,By.xpath("//span[contains(text(),'Filter')]")); - Commons.enter(driver,By.xpath("//input[@placeholder='Blocklisted Words']"),data+1); - Commons.click(driver,By.xpath("//span[contains(text(),'Apply')]")); - - Commons.click(driver,By.cssSelector(".ellipsis-button")); - Commons.click(driver,By.xpath("//span[contains(text(),'Deactivate')]")); - - Commons.clickSpan(driver,"Confirm"); - Commons.clickSpan(driver,"Done"); - - */ - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/MachineSpecificationTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/MachineSpecificationTest.java deleted file mode 100644 index f468b132..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/MachineSpecificationTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class MachineSpecificationTest extends BaseClass{ - - @Test(groups = "MS") - public void machineSpecCRUD() { - String machinespec="admin/masterdata/machine-specs/view"; - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - Commons.click(driver,By.id(machinespec)); - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("brand"),data); - Commons.enter(driver,By.id("model"),data); - Commons.enter(driver,By.id("minDriverversion"),data); - Commons.enter(driver,By.id("description"),data); - Commons.dropdown(driver,By.id("machineTypeCode")); - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/MachineTest.java deleted file mode 100644 index 1690ecc7..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/MachineTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; -import io.mosip.test.admintest.utility.JsonUtil; -public class MachineTest extends BaseClass{ - @Test(groups = "M") - public void machineCRUD() throws Exception { - String holidayDateCenter=JsonUtil.JsonObjParsing(Commons.getTestData(),"holidayDateCenter"); - String publicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"publicKey"); - - String signPublicKey=JsonUtil.JsonObjParsing(Commons.getTestData(),"signPublicKey"); - - Commons.click(driver,By.id("admin/resources")); - Commons.click(driver,By.xpath("//a[@href='#/admin/resources/machines']")); - Commons.click(driver,By.id("Create Machine")); - - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("serialNumber"),"1234567"); - Commons.enter(driver,By.id("macAddress"),"1.2.3.4.5.6"); - Commons.enter(driver,By.id("ipAddress"),"2.3.4.5.6"); - Commons.enter(driver,By.id("validity"),holidayDateCenter); - Commons.dropdown(driver,By.id("machineSpecId")); - Commons.enter(driver,By.id("publicKey"),publicKey); - - Commons.enter(driver,By.id("signPublicKey"),signPublicKey); - Commons.dropdown(driver,By.id("zone")); - Commons.dropdown(driver,By.id("regCenterId")); - - - - Commons.createRes(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.editRes(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.editRes(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - Commons.decommission(driver); - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/MachineTypesTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/MachineTypesTest.java deleted file mode 100644 index 38433393..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/MachineTypesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class MachineTypesTest extends BaseClass{ - - @Test(groups = "MT") - public void machineTypesCRUD() { - String machinetypes="admin/masterdata/machine-type/view" ; - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(machinetypes)); - Commons.click(driver,By.id("Create")); - - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/TemplateTest.java b/admintest/src/main/java/io/mosip/test/admintest/testcase/TemplateTest.java deleted file mode 100644 index d450393d..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/TemplateTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package io.mosip.test.admintest.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; - -public class TemplateTest extends BaseClass{ - - - @Test(groups = "T") - public void templateCRUD() { - String templatesid="admin/masterdata/templates/view"; - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(templatesid)); - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - Commons.enter(driver,By.id("model"),data); - Commons.enter(driver,By.id("fileText"),data); - - - Commons.dropdown(driver,By.id("fileFormatCode")); - - Commons.dropdown(driver,By.id("templateTypeCode")); - - Commons.dropdown(driver,By.id("moduleId")); - - - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/utility/BaseClass.java b/admintest/src/main/java/io/mosip/test/admintest/utility/BaseClass.java deleted file mode 100644 index f8d01578..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/utility/BaseClass.java +++ /dev/null @@ -1,136 +0,0 @@ -package io.mosip.test.admintest.utility; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.chrome.ChromeOptions; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -import org.testng.ITest; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Optional; -import org.testng.annotations.Parameters; -import org.testng.annotations.Test; - -public class BaseClass { - protected WebDriver driver; - protected Map vars; - protected JavascriptExecutor js; - protected String langcode; - protected String envPath = System.getProperty("path"); - protected String userid = System.getProperty("userid"); - protected String password = System.getProperty("password"); - protected String data = Commons.appendDate; - - - public void setLangcode(String langcode) throws Exception { - this.langcode = Commons.getFieldData("langcode"); - } - - @BeforeMethod - public void setUp() throws InterruptedException { - System.out.println(System.getProperty("user.dir")); - String configFilePath = System.getProperty("user.dir") + "\\chromedriver\\chromedriver.exe"; - System.setProperty("webdriver.chrome.driver", configFilePath); - -// ChromeOptions options = new ChromeOptions(); -// options.addArguments("--headless"); -// driver = new ChromeDriver(options); - - - - driver = new ChromeDriver(); - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - driver.findElement(By.linkText("Admin")).click(); - String language1 = null; - try { - //String loginlang = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - language1 = Commons.getFieldData("langcode"); - - System.out.println(language1); - if(!language1.equals("sin")) - {Commons.click(driver, By.xpath("//*[@class='kc-dropdown']")); - String var = "//*[@class='kc-dropdown-item']/a[contains(text(),'" + language1 + "')]"; - Commons.click(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(); - } - - @DataProvider(name = "data-provider") - public Object[] dpMethod() { - String listFilename[] = readFolderJsonList(); - String s[][] = null; - String temp[] = null; - for (int count = 0; count < listFilename.length; count++) { - listFilename[count] = listFilename[count].replace(".csv", ""); - - } - - return listFilename; - } - - public static String[] readFolderJsonList() { - String contents[] = null; - try { - String langcode = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"); - - File directoryPath = new File(System.getProperty("user.dir") + "\\BulkUploadFiles\\" + langcode + "\\"); - - if (directoryPath.exists()) { - - contents = directoryPath.list(); - System.out.println("List of files and directories in the specified directory:"); - for (int i = 0; i < contents.length; i++) { - System.out.println(contents[i]); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return contents; - } -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/utility/Commons.java b/admintest/src/main/java/io/mosip/test/admintest/utility/Commons.java deleted file mode 100644 index 52894b83..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/utility/Commons.java +++ /dev/null @@ -1,302 +0,0 @@ -package io.mosip.test.admintest.utility; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; - -import org.openqa.selenium.By; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; - -public class Commons { - private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(Commons.class); - - public static String appendDate="Z"+getDateTime(); - - public static String getDateTime() - { - - - DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmm"); - LocalDateTime now = LocalDateTime.now(); - return dtf.format(now); - } - - public static void filter(WebDriver driver, By by,String data) { - logger.info("Inside Filter " + by + data); - Commons.click(driver, By.id("Filter")); - - Commons.enter(driver, by, data); - Commons.click(driver, By.id("applyTxt")); - } - - public static void filterCenter(WebDriver driver, By by,String data) { - logger.info("Inside filterCenter " + by + data); - Commons.click(driver, By.id("Filter")); - - Commons.dropdowncenter(driver, by, data); - - Commons.click(driver, By.id("applyTxt")); - } - public static void click(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 (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(); - } - System.out.println( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); - } catch (Exception e) { - - JavascriptExecutor executor = (JavascriptExecutor) driver; - executor.executeScript("arguments[0].click();", driver.findElement(by)); - - }} - - public static void enter(WebDriver driver, By by,String value) { - logger.info("Entering " + by +value); - try { - (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOfElementLocated(by)); - 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); - System.out.println( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); - } } - - public static void dropdown(WebDriver driver, By by) - { - logger.info("Selecting DropDown Index Zero Value " + by ); - - try { - Thread.sleep(500); - click(driver,by);//REGION - Thread.sleep(500); - - String att= driver.findElement(by).getAttribute("aria-owns"); - String[] list=att.split(" "); - click( driver,By.id(list[0])); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - }catch(Exception e) - - { - e.getMessage(); - } - } - - public static void dropdown(WebDriver driver, By by,String value) - { - logger.info("Selecting DropDown By Value " + by +value ); - - try { - Thread.sleep(500); - click(driver,by); - Thread.sleep(500); - String val="'"+value +"'"; - - click( driver,By.xpath("//span[contains(text(),"+val+")]")); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - }catch(Exception e) - - { - e.getMessage(); - } - } - - public static void dropdowncenter(WebDriver driver, By by,String value) - { - logger.info("Selecting DropDown By Value " + by +value ); - - try { - Thread.sleep(500); - click(driver,by); - Thread.sleep(500); - String val="'"+value +"'"; - - click( driver,By.id(value)); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - }catch(Exception e) - - { - e.getMessage(); - } - } - - public static void dropdown(WebDriver driver, By by,By value) - { - logger.info("Selecting DropDown By Value " + by +value ); - try { - Thread.sleep(500); - click(driver,by); - Thread.sleep(500); - click( driver,value); - - Thread.sleep(500); - - }catch(Exception e) - - { - e.getMessage(); - } - } - public static String getTestData() - { - return JsonUtil.readJsonFileText("TestData.json"); - } - public static String getFieldData(String idfield) throws Exception - { - return JsonUtil.JsonObjSimpleParsing(getTestData(), idfield); - - } - - public static void clickSpan(WebDriver driver,String key) throws Exception { - - String val=Commons.getFieldData(key); - String var="//span[contains(text(),'"+ val+ "')]"; - Commons.click(driver,By.xpath(var)); - logger.info("clickSpan" + var ); - } - - public static void deactivate(WebDriver driver) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Deactivate0")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - logger.info("Click deactivate and Confirm"); - } - - public static void activate(WebDriver driver) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Activate0")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - logger.info("Click activate and Confirm"); - } - - public static void edit(WebDriver driver,String data,By by) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Edit0")); - - Assert.assertNotEquals(data, - driver.findElement(by).getText()); - driver.findElement(by).clear(); - - Commons.enter(driver, by, data); - - Commons.click(driver, By.id("createButton")); - Commons.click(driver, By.id("confirmmessagepopup")); - - logger.info("Click Edit and Confirm" + by + data); - } - - public static void editRes(WebDriver driver,String data,By by) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Edit0")); - - Assert.assertNotEquals(data, - driver.findElement(by).getText()); - driver.findElement(by).clear(); - - Commons.enter(driver, by, data); - - Commons.click(driver, By.id("createButton")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - - logger.info("Click Edit and Confirm" + by + data); - } - public static void editCenter(WebDriver driver,String data,By by) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Edit0")); - - Assert.assertNotEquals(data, - driver.findElement(by).getText()); - driver.findElement(by).clear(); - - Commons.enter(driver, by, data); - - Commons.click(driver, By.xpath("(//*[@id='createButton'])[1]")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - - Commons.click(driver, By.xpath("(//*[@id='cancel'])[1]")); - Commons.click(driver, By.xpath("(//*[@id='cancel'])[1]")); - logger.info("Click editCenter and Confirm" + by + data); - } - - public static void create(WebDriver driver) { - Commons.click(driver, By.xpath("//button[@id='createButton']")); - Commons.click(driver, By.id("confirmmessagepopup")); - - logger.info("Click create"); - } - public static void createRes(WebDriver driver) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - Commons.click(driver, By.xpath("//button[@id='createButton']")); - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - logger.info("Click and confirm"); - } - - public static void decommission(WebDriver driver) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver,By.id("Decommission0")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - logger.info("Click decommission and confirm"); - } - - - -} diff --git a/admintest/src/main/java/io/mosip/test/admintest/utility/TestRunner.java b/admintest/src/main/java/io/mosip/test/admintest/utility/TestRunner.java deleted file mode 100644 index 0e2f5389..00000000 --- a/admintest/src/main/java/io/mosip/test/admintest/utility/TestRunner.java +++ /dev/null @@ -1,44 +0,0 @@ -package io.mosip.test.admintest.utility; - -import java.util.List; - -import org.testng.TestListenerAdapter; -import org.testng.TestNG; - -import io.mosip.test.admintest.testcase.*; - - -public class TestRunner { - static TestListenerAdapter tla = new TestListenerAdapter(); - - - static TestNG testNg; - - public static void main(String[] args) throws Exception { - - 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.addListener(tla); - testNg.run(); - - } - - -} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/precon/JsonPrecondtion.java b/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/precon/JsonPrecondtion.java new file mode 100644 index 00000000..7d431331 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/precon/JsonPrecondtion.java @@ -0,0 +1,23 @@ +package io.mosip.testrig.adminui.authentication.fw.precon; + +import org.apache.commons.beanutils.PropertyUtils; +import org.apache.log4j.Logger; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class JsonPrecondtion { + private static final Logger JSONPRECONDATION_LOGGER = Logger.getLogger(JsonPrecondtion.class); + + + public static String getValueFromJson(String jsonContent, String fieldMapper) { + try { + ObjectMapper mapper = new ObjectMapper(); + Object jsonObj = mapper.readValue(jsonContent, Object.class); + return PropertyUtils.getProperty(jsonObj, fieldMapper).toString(); + } catch (Exception expection) { + JSONPRECONDATION_LOGGER + .error("Exception Occured in retrieving the value from json file: " + expection.getMessage()); + return "Cannot retrieve data or content for the object mapper from JSON"; + } + } +} \ No newline at end of file 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 new file mode 100644 index 00000000..13845986 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/authentication/fw/util/RestClient.java @@ -0,0 +1,102 @@ +package io.mosip.testrig.adminui.authentication.fw.util; + +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; +import io.restassured.response.Response; + +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)); + + + + + public static Response getRequest(String url, String contentHeader, String acceptHeader) { + RESTCLIENT_LOGGER.info("RESSURED: Sending a GET request to " + url); + Response getResponse = given().config(config).relaxedHTTPSValidation().log().all().when().get(url).then().log() + .all().extract().response(); + RESTCLIENT_LOGGER.info("REST-ASSURED: The response from the request is: " + getResponse.asString()); + RESTCLIENT_LOGGER.info("REST-ASSURED: The response Time is: " + getResponse.time()); + 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); + Response getResponse = given().config(config).relaxedHTTPSValidation().cookie(cookieName, cookieValue).log() + .all().when().get(url).then().log().all().extract().response(); + RESTCLIENT_LOGGER.info("REST-ASSURED: The response from the request is: " + getResponse.asString()); + RESTCLIENT_LOGGER.info("REST-ASSURED: The response Time is: " + getResponse.time()); + return getResponse; + } + + public static Response postRequestWithCookie(String url, Object body, String contentHeader, String acceptHeader, + String cookieName, String cookieValue) { + RESTCLIENT_LOGGER.info("REST-ASSURED: Sending a POST request to " + url); + Response postResponse = given().config(config).relaxedHTTPSValidation().body(body).contentType(contentHeader) + .cookie(cookieName, cookieValue).accept(acceptHeader).log().all().when().post(url).then().log().all() + .extract().response(); + RESTCLIENT_LOGGER.info("REST-ASSURED: The response from the request is: " + postResponse.asString()); + RESTCLIENT_LOGGER.info("REST-ASSURED: The response Time is: " + postResponse.time()); + return postResponse; + } + public static Response patchRequestWithCookieAndQueryParm(String url, HashMap body, + String contentHeader, String acceptHeader, String cookieName, String cookieValue) { + RESTCLIENT_LOGGER.info("REST-ASSURED: Sending a PATCH request to " + url); + Response postResponse = given().config(config).relaxedHTTPSValidation().queryParams(body) + .contentType(contentHeader).cookie(cookieName, cookieValue).accept(acceptHeader).log().all().when() + .patch(url).then().log().all().extract().response(); + RESTCLIENT_LOGGER.info(postResponse.asString()); + RESTCLIENT_LOGGER.info(postResponse.time()); + return postResponse; + } +} \ No newline at end of file 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 new file mode 100644 index 00000000..860860a6 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/dbaccess/DBManager.java @@ -0,0 +1,346 @@ +package io.mosip.testrig.adminui.dbaccess; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; + + + +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; +//import org.hibernate.HibernateException; +//import org.hibernate.Session; +//import org.hibernate.SessionFactory; +//import org.hibernate.cfg.Configuration; +//import org.hibernate.cfg.Environment; +//import org.hibernate.jdbc.Work; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.hibernate.cfg.Environment; +import org.hibernate.jdbc.Work; + +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +import io.mosip.testrig.adminui.utility.BaseClass; + +public class DBManager extends BaseClass { + + private static Logger logger = Logger.getLogger(DBManager.class); + +// public static void clearPMSDbData() { +// Session session = null; +// try { +// session = getDataBaseConnection(ConfigManager.getPMSDbUrl(), ConfigManager.getPMSDbUser(), +// ConfigManager.getPMSDbPass(), ConfigManager.getPMSDbSchema()); +// if (session != null) { +// session.doWork(new Work() { +// @Override +// public void execute(Connection connection) throws SQLException { +// Statement statement = connection.createStatement(); +// // To Do --- Read the delete queries from a file and iterate +// try { +// statement.addBatch("delete from pms.partner_contact where partner_id='Tech-123'"); +// statement.addBatch("delete from partner_policy where part_id='Tech-123'"); +// statement.addBatch("delete from partner_policy where cr_by='partner-111997'"); +// statement.addBatch( +// "delete from partner_policy where policy_id in (select id from auth_policy where name in ('mosip policy','mosip data share policy'))"); +// statement.addBatch("delete from partner_policy_request where part_id='Tech-123'"); +// statement.addBatch("delete from partner_policy_request where cr_by='partner-111997'"); +// statement.addBatch("delete from pms.partner_policy where label='string'"); +// statement.addBatch( +// "delete from partner_policy_request where policy_id in (select id from auth_policy where name in ('mosip policy','mosip data share policy'))"); +// statement.addBatch( +// "delete from partner_policy_bioextract where policy_id in (select id from auth_policy where name in ('mosip policy','mosip data share policy'))"); +// statement.addBatch("delete from partner_policy_bioextract where cr_by='partner-111997'"); +// statement.addBatch("delete from partner_policy_credential_type where part_id='MOVP'"); +// statement.addBatch( +// "delete from pms.partner_policy_request where cr_by = 'partner-111997'"); +// statement.addBatch( +// "delete from pms.partner_contact where cr_by = 'partner-111997'"); +// statement.addBatch( +// "delete from pms.partner where cr_by = 'partner-111997'"); +// statement.addBatch( +// "delete from pms.partner where id in ('Tech-123','MOVP','DPP','MISP','MISP2','FTP','111997','mosipprint','partner-111997','updatepolicy')"); +// statement.addBatch("delete from auth_policy where cr_by='partner-111997'"); +// statement.addBatch( +// "delete from pms.auth_policy where name in('mosip policy','mosip policy2','mosip policy3','mosip data share policy','mosip data share policy2')"); +// statement.addBatch("delete from policy_group where cr_by='partner-111997'"); +// statement.addBatch( +// "delete from pms.policy_group where name in ('mosip policy group','mosip policy role testing groupp','mosip policy group2','update_policy_group')"); +// statement.addBatch("delete from pms.misp_license where cr_by='pm_testuser'"); +// statement.addBatch("delete from pms.misp_license where misp_id in ('MISP','MISP2')"); +// statement.addBatch("delete from pms.ftp_chip_detail where foundational_trust_provider_id='FTP'"); +// statement.addBatch("delete from pms.misp where name='mosip_misp'"); +// statement.addBatch("delete from pms.secure_biometric_interface where provider_id='Tech-123'"); +// statement.addBatch("delete from pms.device_detail where id='device-id-123'"); +// statement.addBatch("delete from pms.device_detail where make in ('abcde','abcdef')"); +// int[] result = statement.executeBatch(); +// logger.info("Success:: Executed PMS DB quiries successfully."); +// for (int i : result) { +// logger.info("deleted records: " + i); +// } +// } finally { +// statement.close(); +// } +// +// } +// }); +// } +// } catch (Exception e) { +// logger.error("Error:: While executing PMS DB Quiries." + e.getMessage()); +// } finally { +// if (session != null) { +// session.close(); +// } +// } +// +// } +// +// public static void clearKeyManagerDbData() { +// Session session = null; +// try { +// session = getDataBaseConnection(ConfigManager.getKMDbUrl(), ConfigManager.getKMDbUser(), +// ConfigManager.getKMDbPass(), ConfigManager.getKMDbSchema()); +// if (session != null) { +// session.doWork(new Work() { +// +// @Override +// public void execute(Connection connection) throws SQLException { +// Statement statement = connection.createStatement(); +// // To Do --- Read the delete queries from a file and iterate +// try { +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.ca_cert_store where cert_subject ='CN=mosiptest.org,O=MOSIPTEST,L=Bangalore,ST=Karantaka,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.partner_cert_store where cert_subject ='CN=Techno.com,O=Techno,L=Bangalore,ST=Karnataka,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.partner_cert_store where cert_subject ='CN=Techno,O=Techno,L=Bangalore,ST=Karnataka,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.ca_cert_store where cert_subject ='CN=apitest,OU=apitest,O=apitest,L=BLR,ST=KAR,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.ca_cert_store where cert_subject ='CN=apitest2,OU=apitest2,O=apitest2,L=BLR,ST=KAR,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.partner_cert_store where cert_subject ='CN=deviceprovider,OU=deviceprovider,O=deviceprovider,L=BLR,ST=KAR,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.partner_cert_store where cert_subject ='CN=movp,OU=movp,O=movp,L=BLR,ST=KAR,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.partner_cert_store where cert_subject ='CN=ftp,OU=ftp,O=ftp,L=BLR,ST=KAR,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.partner_cert_store where cert_subject ='CN=misp,OU=misp,O=misp,L=BLR,ST=KAR,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.partner_cert_store where cert_subject ='CN=misp2,OU=misp2,O=misp2,L=BLR,ST=KAR,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.partner_cert_store where cert_subject ='CN=mosipprint,O=mosipprint,L=Bangalore,ST=Karnataka,C=IN'"); +// statement.addBatch( +// "delete from mosip_keymgr.keymgr.ca_cert_store where cert_subject ='CN=mosipprint,O=mosipprint,L=Bangalore,ST=Karnataka,C=IN'"); +// int[] result = statement.executeBatch(); +// logger.info("Success:: Executed KM DB quiries successfully."); +// for (int i : result) { +// logger.info("KM deleted records: " + i); +// } +// } finally { +// statement.close(); +// } +// } +// +// }); +// } +// } catch (Exception e) { +// logger.error("Error:: While executing KM Quiries." + e.getMessage()); +// } finally { +// if (session != null) { +// session.close(); +// } +// } +// +// } + + public static void clearMasterDbData() { + Session session = null; + try { + + logger.info("DB URL:: " + ConfigManager.getMASTERDbUrl()); + logger.info("DbUser:: " + ConfigManager.getMasterDbUser()); + logger.info("DbPass:: " + ConfigManager.getMasterDbPass()); + logger.info("DbSchema:: " + ConfigManager.getMasterDbSchema()); + session = getDataBaseConnection(ConfigManager.getMASTERDbUrl(), ConfigManager.getMasterDbUser(), + ConfigManager.getMasterDbPass(), ConfigManager.getMasterDbSchema()); + if (session != null) { + session.doWork((Work) new Work() { + + @Override + public void execute(Connection connection) throws SQLException { + Statement statement = connection.createStatement(); + // To Do --- Read the delete queries from a file and iterate + try { + ; + statement.addBatch("delete from applicant_valid_document where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from appl_form_type where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from biometric_attribute where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from biometric_type where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from blocklisted_words where cr_by ='"+BaseClass.userid+"'"); +// statement.addBatch("delete from daysofweek_list where cr_by ='"+BaseClass.userid+"'"); +// statement.addBatch( +// "delete from device_master where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch( + "delete from device_master_h where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch( + "delete from device_spec where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from device_type where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from doc_category where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from doc_type where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from dynamic_field where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from gender where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from id_type where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from individual_type where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from language where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from location where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from loc_hierarchy_list where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from loc_holiday where cr_by ='"+BaseClass.userid+"'"); + statement + .addBatch("delete from machine_master where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from machine_master_h where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from machine_spec where cr_by ='"+BaseClass.userid+"'"); + statement + .addBatch("delete from machine_type where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from module_detail where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from reason_category where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from reason_list where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from registration_center where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from registration_center_h where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from reg_center_type where cr_by ='"+BaseClass.userid+"'"); + //statement.addBatch("delete from reg_device_type where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from reg_exceptional_holiday where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from reg_working_nonworking where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from template where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from template_file_format where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from template_type where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from title where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from user_detail where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from user_detail_h where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from valid_document where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from zone where cr_by ='"+BaseClass.userid+"'"); + statement.addBatch("delete from zone_user where cr_by ='"+BaseClass.userid+"'"); + 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+"'"); + + + + +// statement.addBatch("delete from master.appl_form_type where cr_by='masterdata-220005'"); +// statement.addBatch("delete from master.id_type where cr_by='masterdata-220005'"); +// statement.addBatch("delete from master.dynamic_field where cr_by='masterdata-220005'"); +// statement.addBatch("delete from master.zone_user where usr_id='masterdata-220005'"); +// statement.addBatch("delete from master.blocklisted_words where word='dumbo6'"); +// statement.addBatch("delete from master.blocklisted_words where word='dumbo7'"); +// statement.addBatch( +// "delete from master.machine_master where name in ('Mach-Test','Mach-Test2','Mach-Test updated')"); +// statement.addBatch( +// "delete from master.machine_master where mac_address = '61-D3-FD-12-C9-ED'"); +// statement.addBatch("delete from master.machine_spec where name='HP'"); +// statement.addBatch("delete from master.machine_master where cr_by='masterdata-220005'"); +// statement.addBatch("delete from master.machine_type where code='Laptop2'"); +// statement.addBatch("delete from master.gender where code='Genderdummy'"); +// statement.addBatch( +// "delete from master.device_master where name in ('testDevicedummy','testDevicedummy updated')"); +// statement.addBatch("delete from master.device_master where dspec_id='743'"); +// statement.addBatch("delete from master.device_spec where id='743'"); +// statement.addBatch("delete from master.device_type where code='GST3'"); +// statement.addBatch("delete from master.loc_holiday where holiday_name='AutoTest user Eng'"); +// statement.addBatch("delete from master.loc_holiday where upd_by='masterdata-220005'"); +// statement.addBatch("delete from master.reg_center_type where code='ALT-3'"); +// statement.addBatch( +// "delete FROM master.registration_center where name in ('Test123','HSR Center updated')"); +// statement.addBatch( +// "delete from master.loc_holiday where holiday_name in ('AutoTest user Eng','AutoTest user')"); +// statement.addBatch("delete from master.reg_center_type where code in('ALT-3','ALT-5')"); +// statement.addBatch("delete from master.registration_center where id='10000'"); +// statement.addBatch("delete from master.device_type where code in ('GST3','GST4')"); +// statement.addBatch( +// "delete from master.doc_type where code in ('TestDocType0010','TestDocType0020')"); +// statement.addBatch( +// "delete from master.doc_category where code in ('DocTestCode123','DocTestCode321')"); +// statement.addBatch("delete from master.location where code='TST12'"); +// statement.addBatch("delete from master.template where id='445566777'"); +// statement.addBatch( +// "delete from master.template where template_typ_code IN(select code from master.template_type where code='Test-info-Template-auto')"); +// statement.addBatch( +// "update master.template set is_active='true', is_deleted='false' where id='1101'"); +// statement.addBatch("delete from master.template_type where code='Test-info-Template-auto'"); +// statement.addBatch( +// "update master.location set is_active='true', is_deleted='false' where code='10114'"); +// statement.addBatch("delete from master.location where code in('TST123','IND')"); +// statement.addBatch("delete from master.valid_document where doctyp_Code='doc_auto_test'"); +// statement.addBatch("delete from master.user_detail where cr_by='110005'"); +// statement.addBatch("delete from master.template_type where code='Test-info-Template-auto'"); +// statement.addBatch("delete from master.template_file_format where code='Doc'"); +// statement.addBatch("delete from master.reason_list where code='TEST_LIST_CODE'"); +// statement.addBatch("delete from master.reason_category where code='TEST_CAT_CODE'"); +// statement.addBatch("delete from master.language where code='automationLang'"); +// statement.addBatch("delete from master.identity_schema where title='test-schema'"); +// statement.addBatch("delete from master.biometric_attribute where code='TST'"); +// statement.addBatch("delete from master.biometric_type where code='dumbo6'"); +// statement.addBatch("delete from master.appl_form_type where code='dumbo'"); +// statement.addBatch("delete from master.id_type where code='NEW'"); +// statement.addBatch( +// "delete from master.dynamic_field where name in ('TestAutomationField','TestAPL')"); + int[] result = statement.executeBatch(); + logger.info("Success:: Executed MASTER DB quiries successfully."); + for (int i : result) { + logger.info("master db deleted records: " + i); + } + } finally { + statement.close(); + } + + } + + }); + } + } catch (Exception e) { + logger.error("Error:: While executing MASTER DB Quiries." + e.getMessage()); + } finally { + if (session != null) { + session.close(); + } + } + + } + + private static Session getDataBaseConnection(String dburl, String userName, String password, String schema) { + SessionFactory factory = null; + Session session = null; + + logger.info("dburl is" + dburl); + logger.info("userName is" + userName); + logger.info("password is" + password); + + + try { + Configuration config = new Configuration(); + config.setProperty(Environment.DRIVER, ConfigManager.getDbDriverClass()); + config.setProperty(Environment.URL, dburl); + logger.info("dburl is" + dburl); + config.setProperty(Environment.USER, userName); + logger.info("userName is" + userName); + config.setProperty(Environment.PASS, password); + logger.info("password is" + password); + config.setProperty(Environment.DEFAULT_SCHEMA, schema); + config.setProperty(Environment.POOL_SIZE, ConfigManager.getDbConnectionPoolSize()); + config.setProperty(Environment.DIALECT, ConfigManager.getDbDialect()); + config.setProperty(Environment.SHOW_SQL, ConfigManager.getShowSql()); + config.setProperty(Environment.CURRENT_SESSION_CONTEXT_CLASS, ConfigManager.getDbSessionContext()); + + factory = config.buildSessionFactory(); + session = factory.getCurrentSession(); + session.beginTransaction(); + } catch (HibernateException | NullPointerException e) { + logger.error("Error while getting the db connection for ::" + dburl); + } + return session; + } + +} + 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 new file mode 100644 index 00000000..847ed9e5 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/fw/util/AdminTestUtil.java @@ -0,0 +1,323 @@ +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; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Properties; +import java.util.TimeZone; + +import javax.ws.rs.core.MediaType; + +import org.apache.log4j.Logger; +import org.json.JSONArray; +import org.json.JSONObject; + +import io.mosip.testrig.adminui.authentication.fw.precon.JsonPrecondtion; +import io.mosip.testrig.adminui.authentication.fw.util.RestClient; +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +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; + +public class AdminTestUtil extends BaseTestCaseFunc { + + private static final Logger logger = Logger.getLogger(AdminTestUtil.class); + public static String token; + public static String user; + 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){ + + return JsonPrecondtion + .getValueFromJson( + RestClient.getRequestWithCookie(ApplnURI + "/v1/idgenerator/uin", MediaType.APPLICATION_JSON, + MediaType.APPLICATION_JSON, COOKIENAME, + new KernelAuthentication().getTokenByRole(role)).asString(), + "response.uin"); + } + + public static String getMasterDataSchema(String role){ + String url = ApplnURI + props.getProperty("masterSchemaURL"); + kernelAuthLib = new KernelAuthentication(); + String token = kernelAuthLib.getTokenByRole("admin"); + + Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, + "Authorization", token); + + 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(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return dateFormat.format(date); + } + + public static boolean activateUIN(String inputJson, String role) { + Response response = null; + + token = kernelAuthLib.getTokenByRole(role); + response = RestClient.postRequestWithCookie(ApplnURI + props.getProperty("addIdentityURL"), inputJson, MediaType.APPLICATION_JSON, + MediaType.APPLICATION_JSON, COOKIENAME, token); + JSONObject responseJson = new JSONObject(response.asString()); + + + logger.info("responseJson = " + responseJson); + + 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); + + org.json.JSONObject schemaData = (org.json.JSONObject) schemaresponseJson.get("response"); + Double schemaVersion = (Double) schemaData.get("idVersion"); + String schemaJsonData = schemaData.getString("schemaJson"); + String schemaFile = schemaJsonData.toString(); + + JSONObject schemaFileJson = new JSONObject(schemaFile); // jObj + JSONObject schemaPropsJson = schemaFileJson.getJSONObject("properties"); // objIDJson4 + JSONObject schemaIdentityJson = schemaPropsJson.getJSONObject("identity"); // objIDJson + JSONObject identityPropsJson = schemaIdentityJson.getJSONObject("properties"); // objIDJson2 + JSONArray requiredPropsArray = schemaIdentityJson.getJSONArray("required"); // objIDJson1 + logger.info("requiredPropsArray = " + requiredPropsArray); + + JSONObject requestJson = new JSONObject(); + + requestJson.put("id", propsMap.getProperty("id")); + requestJson.put("request", new HashMap<>()); + requestJson.getJSONObject("request").put("registrationId", rid); + JSONObject identityJson = new JSONObject(); + identityJson.put("UIN", uin); + + for (int i = 0, size = requiredPropsArray.length(); i < size; i++) { + String eachRequiredProp = requiredPropsArray.getString(i); // objIDJson3 + + JSONObject eachPropDataJson = (JSONObject) identityPropsJson.get(eachRequiredProp); // rc1 + + if (eachPropDataJson.has("$ref") && eachPropDataJson.get("$ref").toString().contains("simpleType")) { + + JSONArray eachPropDataArray = new JSONArray(); // jArray + + for (int j = 0; j < BaseTestCaseFunc.getLanguageList().size(); j++) { + JSONObject eachValueJson = new JSONObject(); // studentJSON + eachValueJson.put("language", BaseTestCaseFunc.getLanguageList().get(j)); + eachValueJson.put("value", propsMap.getProperty(eachRequiredProp) + BaseTestCaseFunc.getLanguageList().get(j)); + eachPropDataArray.put(eachValueJson); + } + identityJson.put(eachRequiredProp, eachPropDataArray); + } + else { + if (eachRequiredProp.equals("proofOfIdentity")) { + identityJson.put(eachRequiredProp, new HashMap<>()); + identityJson.getJSONObject(eachRequiredProp).put("format", "txt"); + identityJson.getJSONObject(eachRequiredProp).put("type", "DOC001"); + identityJson.getJSONObject(eachRequiredProp).put("value", "fileReferenceID"); + } + else if (eachRequiredProp.equals("individualBiometrics")) { + identityJson.put(eachRequiredProp, new HashMap<>()); + identityJson.getJSONObject(eachRequiredProp).put("format", "cbeff"); + identityJson.getJSONObject(eachRequiredProp).put("version", 1); + identityJson.getJSONObject(eachRequiredProp).put("value", "fileReferenceID"); + } + + else if (eachRequiredProp.equals("IDSchemaVersion")) { + identityJson.put(eachRequiredProp, schemaVersion); + } + + else { + identityJson.put(eachRequiredProp, propsMap.getProperty(eachRequiredProp)); + if (eachRequiredProp.equals("email")) { + uinEmail = propsMap.getProperty(eachRequiredProp); + } + if (eachRequiredProp.equals("phone")) { + uinPhone = propsMap.getProperty(eachRequiredProp); + } + } + } + } + + JSONArray requestDocArray = new JSONArray(); + JSONObject docJson = new JSONObject(); + docJson.put("value", propsBio.getProperty("BioValue")); + docJson.put("category", "individualBiometrics"); + requestDocArray.put(docJson); + + requestJson.getJSONObject("request").put("documents", requestDocArray); + requestJson.getJSONObject("request").put("identity", identityJson); + requestJson.put("requesttime", generateCurrentUTCTimeStamp()); + requestJson.put("version", "v1"); + + logger.info(requestJson); + return requestJson.toString(); + } + + public static String UserMapping() { + return user; + + } + +// public static String generateUIN() { +// String uin = ""; +// +// initialize(); +// +// DateFormat dateFormatter = new SimpleDateFormat("YYYYMMddHHmmss"); +// Calendar cal = Calendar.getInstance(); +// String timestampValue = dateFormatter.format(cal.getTime()); +// String rid = "27847" + RandomStringUtils.randomNumeric(10) + timestampValue; +// +// // Make Unused UIN Api call to get the UIN Number +// uin = AdminTestUtil.getUnUsedUIN(tokenRoleIdRepo); +// +// // Call Masterdata Schema API To get the Schema Data Of the Env +// String responseString = AdminTestUtil.getMasterDataSchema(tokenRoleAdmin); +// +// // Build request body for add identity API +// String requestjson = AdminTestUtil.buildaddIdentityRequestBody(responseString, uin, rid); +// +// +// // Make Add Identity API Call and activate the UIN +// if (AdminTestUtil.activateUIN(requestjson, tokenRoleIdRepo) == false) { +// // UIN activation failed +// return ""; +// } +// +// return uin; +// } + + +// public static String generateVID(String uin, String vidType) { +// if (uin.isEmpty() || vidType.isEmpty()) { +// return ""; +// } +// +// initialize(); +// Response response = null; +// +// String token = BaseTestCase.kernelAuthLib.getTokenByRole(tokenRoleIdRepo); +// JSONObject requestJson = new JSONObject(); +// +// requestJson.put("id", "mosip.vid.create"); +// requestJson.put("metadata", new HashMap<>()); +// requestJson.put("requesttime", AdminTestUtil.generateCurrentUTCTimeStamp()); +// requestJson.put("version", "v1"); +// requestJson.put("request", new HashMap<>()); +// requestJson.getJSONObject("request").put("UIN", uin); +// requestJson.getJSONObject("request").put("vidType", vidType); +// +// response = RestClient.postRequestWithCookie(BaseTestCase.ApplnURI + BaseTestCase.props.getProperty("idRepoGenVidURL"), requestJson.toString(), MediaType.APPLICATION_JSON, +// MediaType.APPLICATION_JSON, BaseTestCase.COOKIENAME, token); +// JSONObject responseJson = new JSONObject(response.asString()); +// +// +// logger.info("responseJson = " + responseJson); +// +// if (responseJson.getJSONObject("response").getString("vidStatus").equalsIgnoreCase("ACTIVE")) { +// return responseJson.getJSONObject("response").getString("VID"); +// } +// +// return ""; +// } + public static void initialize() { + String adminuser=""; + if (initialized == false) { + ConfigManager.init(); + BaseTestCaseFunc.initialize(); + // Initializing or setting up execution + //Langauge Independent + + // Generate Keycloak Users + KeycloakUserManager.createUsers(); + BaseTestCaseFunc.getLeafeZone(); + BaseTestCaseFunc.mapUserToZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName"),RestClient.ZONECODE); + BaseTestCaseFunc.mapZone(BaseTestCaseFunc.currentModule+"-"+propsKernel.getProperty("admin_userName")); + initialized = true; + } + } + +} \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/kernel/service/ApplicationLibrary.java b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/service/ApplicationLibrary.java new file mode 100644 index 00000000..9fcb7bba --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/service/ApplicationLibrary.java @@ -0,0 +1,23 @@ +package io.mosip.testrig.adminui.kernel.service; + +import javax.ws.rs.core.MediaType; + +import io.mosip.testrig.adminui.kernel.util.CommonLibrary; +import io.mosip.testrig.adminui.utility.BaseTestCaseFunc; +import io.restassured.response.Response; + +public class ApplicationLibrary extends BaseTestCaseFunc { + + private static CommonLibrary commonLibrary = new CommonLibrary(); + + + // get requests + public Response getWithoutParams(String endpoint, String cookie) { + return commonLibrary.getWithoutParams(ApplnURI + endpoint, cookie); + } + + public Response postWithJson(String endpoint, Object body) { + return commonLibrary.postWithJson(ApplnURI + endpoint, body, MediaType.APPLICATION_JSON, + MediaType.APPLICATION_JSON); + } +} \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/CommonLibrary.java b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/CommonLibrary.java new file mode 100644 index 00000000..38287056 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/CommonLibrary.java @@ -0,0 +1,163 @@ +package io.mosip.testrig.adminui.kernel.util; + +import static io.restassured.RestAssured.given; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Map; +import java.util.Properties; +import java.util.stream.Collectors; + +import org.apache.log4j.Logger; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +import io.mosip.testrig.adminui.kernel.service.ApplicationLibrary; +import io.mosip.testrig.adminui.utility.BaseTestCaseFunc; +import io.mosip.testrig.adminui.utility.TestRunner; +import io.restassured.http.Cookie; +import io.restassured.response.Response; + +public class CommonLibrary extends BaseTestCaseFunc { + private static Logger logger = Logger.getLogger(CommonLibrary.class); + private ApplicationLibrary applicationLibrary = new ApplicationLibrary(); + + + public String getResourcePath() { + return TestRunner.getResourcePath() + "/"; + } + + public String getResourcePathForKernel() { + return TestRunner.getResourcePath() + "/"; + } + + + public boolean isValidToken(String cookie) { + + logger.info("========= Revalidating the token ========="); + Response response = applicationLibrary.getWithoutParams("/v1/authmanager/authorize/admin/validateToken", cookie); + JSONObject responseJson =null; + try { + responseJson = (JSONObject) ((JSONObject) new JSONParser().parse(response.asString())) + .get("response"); + } catch (ParseException | NullPointerException e) { + logger.info(e.getMessage()); + } + + if (responseJson!=null && responseJson.get("errors")==null) + { + logger.info("========= Valid Token ========="); + return true; + } + else + { + + logger.info("========= InValid Token ========="); + return false; + } + + } + + public Map readProperty(String propertyFileName) { + Properties prop = new Properties(); + try { + if(propertyFileName.equals("Kernel")) { + File propertyFile = new File(getResourcePathForKernel() + "config/" +TestRunner.GetKernalFilename()); + prop.load(new FileInputStream(propertyFile)); + }else { + logger.info("propertyFileName: " + propertyFileName + "Path :" + getResourcePathForKernel() + "config/" + propertyFileName + ".properties"); + logger.info("propertyFileName: " + propertyFileName + "Path :" + getResourcePathForKernel() + "config/" + propertyFileName + ".properties"); + File propertyFile = new File(getResourcePathForKernel() + "config/" + propertyFileName + ".properties"); + prop.load(new FileInputStream(propertyFile)); + } + + } catch (IOException e) { + logger.info("Error occrued while reading propertyFileName " + propertyFileName + e.getMessage()); + logger.info(e.getMessage()); + } + + Map mapProp = prop.entrySet().stream() + .collect(Collectors.toMap(e -> (String) e.getKey(), e -> (String) e.getValue())); + + return mapProp; + } + + // Get Requests: + /** + * @param url + * @param cookie + * @return this method is for get request with authentication(cookie) and + * without any param. + */ + public Response getWithoutParams(String url, String cookie) { + logger.info("REST-ASSURED: Sending a Get request to " + url); + Cookie.Builder builder = new Cookie.Builder("Authorization", cookie); + Response getResponse = given().cookie(builder.build()).relaxedHTTPSValidation().log().all().when().get(url); + // log then response + responseLogger(getResponse); + logger.info("REST-ASSURED: the response Time is: " + getResponse.time()); + return getResponse; + } + + + /** + * @param response + * this method is for logging the response in case of error only. + * this is used in get request response logging + */ + public void responseLogger(Response response) { + int statusCode = response.statusCode(); + if (statusCode < 200 || statusCode > 299) { + logger.info(response.asString()); + } else + logger.info("status code: " + statusCode + "(success)"); + + } + + public JSONObject readJsonData(String path, boolean isRelative) { + logger.info("path : " + path); + if(isRelative) + path = getResourcePath() + path; + logger.info("Relativepath : " + path); + File fileToRead = new File(path); + InputStream isOfFile = null; + try { + logger.info("fileToRead : " + fileToRead); + isOfFile = new FileInputStream(fileToRead); + } catch (FileNotFoundException e1) { + logger.info("error while reading the file : " + e1.getLocalizedMessage() ); + e1.printStackTrace(); + logger.info("File Not Found at the given path"); + } + JSONObject jsonData = null; + try { + jsonData = (JSONObject) new JSONParser().parse(new InputStreamReader(isOfFile, "UTF-8")); + } catch (IOException | ParseException | NullPointerException e) { + logger.info(e.getMessage()); + } + return jsonData; + } + + /** + * @param url + * @param body + * @param contentHeader + * @param acceptHeader + * @return this method is for post request without authentication(cookie) and + * only with jsonData in request body. + */ + public Response postWithJson(String url, Object body, String contentHeader, String acceptHeader) { + logger.info("REST:ASSURED:Sending post request to" + url); + Response postResponse = given().relaxedHTTPSValidation().body(body).contentType(contentHeader) + .accept(acceptHeader).log().all().when().post(url).then().log().all().extract().response(); + // log then response + logger.info("REST-ASSURED: The response from request is: " + postResponse.asString()); + logger.info("REST-ASSURED: The response Time is: " + postResponse.time()); + return postResponse; + } +} 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 new file mode 100644 index 00000000..f266a255 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/ConfigManager.java @@ -0,0 +1,681 @@ +package io.mosip.testrig.adminui.kernel.util; + +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; + +import io.mosip.testrig.adminui.utility.TestRunner; +public class ConfigManager { + + private static final Logger logger = Logger.getLogger(ConfigManager.class); + +// private static String MOSIP_PMS_CLIENT_SECRET = "mosip_pms_client_secret"; +// private static String MOSIP_PMS_CLIENT_ID = "mosip_pms_client_id"; +// private static String MOSIP_PMS_APP_ID = "mosip_pms_app_id"; +// +// private static String MOSIP_RESIDENT_CLIENT_SECRET = "mosip_resident_client_secret"; +// private static String MOSIP_RESIDENT_CLIENT_ID = "mosip_resident_client_id"; +// private static String MOSIP_RESIDENT_APP_ID = "mosip_resident_app_id"; +// +// private static String MOSIP_MOBILE_CLIENT_ID = "mpartner_default_mobile_client_id"; +// private static String MOSIP_MOBILE_CLIENT_SECRET = "mpartner_default_mobile_secret"; +// + private static String MOSIP_IDREPO_CLIENT_SECRET = "mosip_idrepo_client_secret"; + private static String MOSIP_IDREPO_CLIENT_ID = "mosip_idrepo_client_id"; + private static String MOSIP_IDREPO_APP_ID = "mosip_idrepo_app_id"; +// + private static String MOSIP_ADMIN_CLIENT_SECRET = "mosip_admin_client_secret"; + private static String MOSIP_ADMIN_CLIENT_ID = "mosip_admin_client_id"; + private static String MOSIP_ADMIN_APP_ID = "mosip_admin_app_id"; +// +// private static String MOSIP_REG_CLIENT_SECRET = "mosip_reg_client_secret"; +// private static String MOSIP_REG_CLIENT_ID = "mosip_reg_client_id"; +// private static String MOSIP_REGCLIENT_APP_ID = "mosip_regclient_app_id"; +// +// private static String MOSIP_IDA_CLIENT_SECRET = "mosip_ida_client_secret"; +// private static String MOSIP_IDA_CLIENT_ID = "mosip_ida_client_id"; +// private static String MOSIP_IDA_APP_ID = "mosip_ida_app_id"; +// +// private static String MOSIP_HOTLIST_CLIENT_SECRET = "mosip_hotlist_client_secret"; +// private static String MOSIP_HOTLIST_CLIENT_ID = "mosip_hotlist_client_id"; +// private static String MOSIP_HOTLIST_APP_ID = "mosip_hotlist_app_id"; +// + private static String MOSIP_AUTOMATION_CLIENT_SECRET = "mosip_testrig_client_secret"; + private static String MOSIP_AUTOMATION_CLIENT_ID = "mosip_testrig_client_id"; +// private static String MOSIP_AUTOMATION_APP_ID = "mosip_automation_app_id"; +// + private static String S3_HOST = "s3-host"; + private static String S3_REGION = "s3-region"; + private static String S3_USER_KEY = "s3-user-key"; + private static String S3_SECRET_KEY = "s3-user-secret"; + private static String S3_ACCOUNT = "s3-account"; + private static String PUSH_TO_S3 = "push-reports-to-s3"; +// private static String ENABLE_DEBUG = "enableDebug"; +// private static String THREAD_COUNT = "threadCount"; +// private static String LANG_SELECT = "langselect"; +// +// + private static String DB_PORT = "db-port"; + private static String DB_DOMAIN = "db-server"; + private static String HIBERNATE_CONNECTION_DRIVER_CLASS = "hibernate.connection.driver_class"; + private static String HIBERNATE_CONNECTION_POOL_SIZE = "hibernate.connection.pool_size"; + private static String HIBERNATE_DIALECT = "hibernate.dialect"; + private static String HIBERNATE_SHOW_SQL = "hibernate.show_sql"; + private static String HIBERNATE_CONTEXT_CLASS = "hibernate.current_session_context_class"; +// +// private static String AUDIT_DB_USER = "db-su-user"; +// private static String AUDIT_DB_PASS = "postgresql-password"; +// private static String AUDIT_DB_SCHEMA = "audit_db_schema"; +// +// private static String IDA_DB_USER = "db-su-user"; +// private static String IDA_DB_PASS = "postgresql-password"; +// private static String IDA_DB_SCHEMA = "ida_db_schema"; +// +// private static String PMS_DB_USER = "db-su-user"; +// private static String PMS_DB_PASS = "postgresql-password"; +// private static String PMS_DB_SCHEMA = "pms_db_schema"; +// +// private static String KM_DB_USER = "db-su-user"; +// private static String KM_DB_PASS = "postgresql-password"; +// private static String KM_DB_SCHEMA = "km_db_schema"; +// + private static String MASTER_DB_USER = "db-su-user"; + 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"; + private static String IAM_APIINTERNALENDPOINT = "apiInternalEndPoint"; + private static String IAM_REALM_ID = "keycloak-realm-id"; + private static String IAM_USERS_TO_CREATE = "iam-users-to-create"; + private static String IAM_USERS_PASSWORD = "iam-users-password"; + + private static String HolidayDateCenter = "holidayDateCenter"; + private static String HolidayDate = "holidayDate"; + private static String Preappend = "preappend"; + private static String Splitdigit = "splitdigit"; + private static String JsonObjName = "jsonObjName"; + private static String Bulkwait = "bulkwait"; + private static String ValidityDate = "validityDate"; + private static String PublicKey = "publicKey"; + private static String SignPublicKey = "signPublicKey"; + private static String Headless = "headless"; + private static String Docker = "docker"; + private static String Langcode = "langcode"; + private static String DummyData = "dummyData";//loginlang + private static String Loginlang = "loginlang"; + private static String Testcases = "adminscenariosToExecute"; + + private static String testcases; + private static String loginlang; + private static String langcode; + private static String docker; + private static String headless; + private static String signPublicKey; + private static String publicKey; + private static String validityDate; + private static String bulkwait; + private static String dummyData; + private static String jsonObjName; + private static String splitdigit; + private static String preappend; + private static String holidayDate; + private static String holidayDateCenter; +// +// private static String AUTH_DEMO_SERVICE_PORT = "authDemoServicePort"; +// private static String AUTH_DEMO_SERVICE_BASE_URL = "authDemoServiceBaseURL"; +// private static String MOUNT_PATH = "mountPath"; +// private static String AUTHCERTS_PATH = "authCertsPath"; +// private static String MOUNT_PATH_FOR_SCENARIO = "mountPathForScenario"; +// +// private static String PACKET_UTILITY_BASE_URL = "packetUtilityBaseUrl"; + + private static String REPORT_EXPIRATION_IN_DAYS = "reportExpirationInDays"; +// private static String pms_client_secret; +// private static String pms_client_id; +// private static String pms_app_id; +// +// private static String resident_client_secret; +// private static String resident_client_id; +// private static String resident_app_id; +// +// private static String mpartner_mobile_client_id; +// private static String mpartner_mobile_client_secret; +// + private static String idrepo_client_secret; + private static String idrepo_client_id; + private static String idrepo_app_id; +// + private static String admin_client_secret; + private static String admin_client_id; + private static String admin_app_id; +// +// private static String regproc_client_secret; +// private static String regproc_client_id; +// private static String regproc_app_id; +// +// private static String ida_client_secret; +// private static String ida_client_id; +// private static String ida_app_id; +// +// private static String hotlist_client_secret; +// private static String hotlist_client_id; +// private static String hotlist_app_id; +// + private static String automation_client_secret; + private static String automation_client_id; +// private static String automation_app_id; +// + private static String s3_region; + private static String s3_host; + private static String s3_user_key; + private static String s3_account; + private static String s3_secret_key; + private static String push_reports_to_s3; +// private static String enableDebug; +// private static String threadCount; +// private static String langselect; +// + private static String db_port; + private static String db_domain; + private static String hibernate_connection_driver_class; + private static String hibernate_connection_pool_size; + private static String hibernate_dialect; + private static String hibernate_show_sql; + private static String hibernate_current_session_context_class; +// +// private static String audit_db_user; +// private static String audit_db_pass; +// private static String audit_db_schema; +// +// private static String ida_db_user; +// private static String ida_db_pass; +// private static String ida_db_schema; +// +// private static String pms_db_user; +// private static String pms_db_pass; +// private static String pms_db_schema; +// +// private static String km_db_user; +// 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; + private static String master_db_schema; +// + private static String iam_external_url; + private static String iam_adminportal_path; + private static String iam_apienvuser; + private static String iam_apiinternalendpoint; + private static String iam_realm_id; + private static String iam_users_to_create; + private static String iam_users_password; +// private static String authDemoServicePort; +// private static String authDemoServiceBaseUrl; +// +// private static String mountPath; +// private static String authCertsPath; +// private static String mountPathForScenario; +// private static String packetUtilityBaseUrl; + public static Properties propsKernel; + private static String reportExpirationInDays; + private static String admin_userName; + + public static void setProperty(String key, String value) { + // Overwrite the value with only if the key exists + if (propsKernel.containsKey(key)) { + propsKernel.setProperty(key, value); + } + } + + public static String getValueForKey(String key) { + String value = System.getenv(key) == null ? propsKernel.getProperty(key) : System.getenv(key); + setProperty(key, value); + + return value; + } + + public static void init() { + // Loading Kernel property +// propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/Kernel.properties"); + propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename()); + + idrepo_client_secret = getValueForKey(MOSIP_IDREPO_CLIENT_SECRET); + idrepo_client_id = getValueForKey(MOSIP_IDREPO_CLIENT_ID); + idrepo_app_id = getValueForKey(MOSIP_IDREPO_APP_ID); + admin_client_secret = getValueForKey(MOSIP_ADMIN_CLIENT_SECRET); + admin_client_id = getValueForKey(MOSIP_ADMIN_CLIENT_ID); + admin_app_id = getValueForKey(MOSIP_ADMIN_APP_ID); + automation_client_secret = getValueForKey(MOSIP_AUTOMATION_CLIENT_SECRET); + automation_client_id = getValueForKey(MOSIP_AUTOMATION_CLIENT_ID); + s3_host = getValueForKey(S3_HOST); + s3_region = getValueForKey(S3_REGION); + s3_user_key = getValueForKey(S3_USER_KEY); + s3_secret_key = getValueForKey(S3_SECRET_KEY); + s3_account = getValueForKey(S3_ACCOUNT); + push_reports_to_s3 = getValueForKey(PUSH_TO_S3); + db_port = getValueForKey(DB_PORT); + db_domain = getValueForKey(DB_DOMAIN); + hibernate_connection_driver_class = getValueForKey(HIBERNATE_CONNECTION_DRIVER_CLASS); + hibernate_connection_pool_size = getValueForKey(HIBERNATE_CONNECTION_POOL_SIZE); + hibernate_dialect = getValueForKey(HIBERNATE_DIALECT); + hibernate_show_sql = getValueForKey(HIBERNATE_SHOW_SQL); + hibernate_current_session_context_class = getValueForKey(HIBERNATE_CONTEXT_CLASS); + master_db_user = getValueForKey(MASTER_DB_USER); + master_db_pass = getValueForKey(MASTER_DB_PASS); + master_db_schema = getValueForKey(MASTER_DB_SCHEMA); + //admintest data + iam_external_url = getValueForKey(IAM_EXTERNAL_URL); + logger.info("keycloakendpoint from config manager::" + iam_external_url); + iam_adminportal_path =System.getenv(IAM_ADMINPORTAL_PATH) == null + ? propsKernel.getProperty(IAM_ADMINPORTAL_PATH) + : System.getenv(IAM_ADMINPORTAL_PATH); + + logger.info("adminportal_path from config manager::" + iam_adminportal_path); + iam_apienvuser = System.getenv(IAM_APIENVUSER) == null + ? propsKernel.getProperty(IAM_APIENVUSER) + : System.getenv(IAM_APIENVUSER); + logger.info("apienvuser from config manager::" + iam_apienvuser); + iam_apiinternalendpoint = System.getenv(IAM_APIINTERNALENDPOINT) == null + ? propsKernel.getProperty(IAM_APIINTERNALENDPOINT) + : 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); + iam_users_password = getValueForKey(IAM_USERS_PASSWORD); + admin_client_secret = System.getenv(MOSIP_ADMIN_CLIENT_SECRET) == null + ? propsKernel.getProperty(MOSIP_ADMIN_CLIENT_SECRET) + : System.getenv(MOSIP_ADMIN_CLIENT_SECRET); + propsKernel.setProperty(MOSIP_ADMIN_CLIENT_SECRET, admin_client_secret); + reportExpirationInDays = System.getenv(REPORT_EXPIRATION_IN_DAYS) == null + ? propsKernel.getProperty(REPORT_EXPIRATION_IN_DAYS) + : System.getenv(REPORT_EXPIRATION_IN_DAYS); + propsKernel.setProperty(REPORT_EXPIRATION_IN_DAYS, reportExpirationInDays); + + push_reports_to_s3 =System.getenv(PUSH_TO_S3) == null ? propsKernel.getProperty(PUSH_TO_S3) : System.getenv(PUSH_TO_S3); + propsKernel.setProperty(PUSH_TO_S3, push_reports_to_s3); + holidayDateCenter =System.getenv(HolidayDateCenter) == null ? propsKernel.getProperty(HolidayDateCenter) : System.getenv(HolidayDateCenter); + propsKernel.setProperty(HolidayDateCenter, holidayDateCenter); + + holidayDate =System.getenv(HolidayDate) == null ? propsKernel.getProperty(HolidayDate) : System.getenv(HolidayDate); + propsKernel.setProperty(HolidayDate, holidayDate); + + preappend =System.getenv(Preappend) == null ? propsKernel.getProperty(Preappend) : System.getenv(Preappend); + propsKernel.setProperty(Preappend, preappend); + + splitdigit =System.getenv(Splitdigit) == null ? propsKernel.getProperty(Splitdigit) : System.getenv(Splitdigit); + propsKernel.setProperty(Splitdigit, splitdigit); + + jsonObjName =System.getenv(JsonObjName) == null ? propsKernel.getProperty(JsonObjName) : System.getenv(JsonObjName); + propsKernel.setProperty(JsonObjName, jsonObjName); + + bulkwait =System.getenv(Bulkwait) == null ? propsKernel.getProperty(Bulkwait) : System.getenv(Bulkwait); + propsKernel.setProperty(Bulkwait, bulkwait); + + + + dummyData =System.getenv(DummyData) == null ? propsKernel.getProperty(DummyData) : System.getenv(DummyData); + propsKernel.setProperty(DummyData, dummyData); + + validityDate =System.getenv(ValidityDate) == null ? propsKernel.getProperty(ValidityDate) : System.getenv(ValidityDate); + propsKernel.setProperty(ValidityDate, validityDate); + + publicKey =System.getenv(PublicKey) == null ? propsKernel.getProperty(PublicKey) : System.getenv(PublicKey); + propsKernel.setProperty(PublicKey, publicKey); + + signPublicKey =System.getenv(SignPublicKey) == null ? propsKernel.getProperty(SignPublicKey) : System.getenv(SignPublicKey); + propsKernel.setProperty(SignPublicKey, signPublicKey); + + headless =System.getenv(Headless) == null ? propsKernel.getProperty(Headless) : System.getenv(Headless); + propsKernel.setProperty(Headless, headless); + + docker =System.getenv(Docker) == null ? propsKernel.getProperty(Docker) : System.getenv(Docker); + propsKernel.setProperty(Docker, docker); + + langcode =System.getenv(Langcode) == null ? propsKernel.getProperty(Langcode) : System.getenv(Langcode); + propsKernel.setProperty(Langcode, langcode); + + loginlang =System.getenv(Loginlang) == null ? propsKernel.getProperty(Loginlang) : System.getenv(Loginlang); + propsKernel.setProperty(Loginlang, loginlang); + + testcases =System.getenv(Testcases) == null ? propsKernel.getProperty(Testcases) : System.getenv(Testcases); + propsKernel.setProperty(Testcases, testcases); + + } + public static String gettestcases() { + return testcases; + } + public static String getloginlang() { + return loginlang; + } + public static String getlangcode() { + return langcode; + } + public static String getdocker() { + return docker; + } + public static String getheadless() { + return headless; + } + public static String getsignPublicKey() { + return signPublicKey; + } + public static String getpublicKey() { + return publicKey; + } + public static String getvalidityDate() { + return validityDate; + } + public static String getdummyData() { + return dummyData; + } + + public static String getbulkwait() { + return bulkwait; + } + public static String getjsonObjName() { + return jsonObjName; + } + public static String getsplitdigit() { + return splitdigit; + } + public static String getpreappend() { + return preappend; + } + public static String getholidayDate() { + return holidayDate; + } + public static String getholidayDateCenter() { + return holidayDateCenter; + } + public static String getAdminUserName() { + return admin_userName; + } + + public static String getAdminClientSecret() { + return admin_client_secret; + } + + public static String getAdminClientId() { + return admin_client_id; + } +// + public static String getAdminAppId() { + return admin_app_id; + } +// + public static String getIdRepoClientSecret() { + return idrepo_client_secret; + } +// + public static String getidRepoClientId() { + return idrepo_client_id; + } +// + public static String getidRepoAppId() { + return idrepo_app_id; + } +// +// public static String getRegprocClientSecret() { +// return regproc_client_secret; +// } +// +// public static String getRegprocClientId() { +// return regproc_client_id; +// } +// +// public static String getRegprocAppId() { +// return regproc_app_id; +// } +// +// public static String getIdaClientSecret() { +// return ida_client_secret; +// } +// +// public static String getIdaClientId() { +// return ida_client_id; +// } +// +// public static String getIdaAppId() { +// return ida_app_id; +// } +// +// public static String getHotListClientSecret() { +// return hotlist_client_secret; +// } +// +// public static String getHotListClientId() { +// return hotlist_client_id; +// } +// +// public static String getHotListAppId() { +// return hotlist_app_id; +// } +// + public static String getAutomationClientSecret() { + return automation_client_secret; + } +// + public static String getAutomationClientId() { + return automation_client_id; + } + public static String getS3Host() { + return s3_host; + } + public static String getReportExpirationInDays() { + return reportExpirationInDays; + } +// + public static String getS3Region() { + return s3_region; + } +// + public static String getS3UserKey() { + return s3_user_key; + } +// + public static String getS3SecretKey() { + return s3_secret_key; + } +// + public static String getS3Account() { + return s3_account; + } +// + public static String getPushReportsToS3() { + return push_reports_to_s3; + } +// + public static String getIdaDbUrl() { + return "jdbc:postgresql://" + db_domain + ":" + db_port + "/mosip_ida"; + } +// +// public static String getAuditDbUrl() { +// return "jdbc:postgresql://" + db_domain + ":" + db_port + "/mosip_audit"; +// } +// + public static String getDbDriverClass() { + return hibernate_connection_driver_class; + } +// + public static String getDbConnectionPoolSize() { + return hibernate_connection_pool_size; + } +// + public static String getDbDialect() { + return hibernate_dialect; + } +// + public static String getShowSql() { + return hibernate_show_sql; + } +// + public static String getDbSessionContext() { + return hibernate_current_session_context_class; + } + public static Boolean IsDebugEnabled() { + return enableDebug.equalsIgnoreCase("yes"); + } +// +// public static String getAuditDbUser() { +// return audit_db_user; +// } +// +// public static String getAuditDbPass() { +// logger.info("DB Password from ENV::: " + System.getenv(AUDIT_DB_PASS)); +// return audit_db_pass; +// } +// +// public static String getAuditDbSchema() { +// return audit_db_schema; +// } +// +// public static String getIdaDbUser() { +// return ida_db_user; +// } +// +// public static String getIdaDbPass() { +// return ida_db_pass; +// } +// +// public static String getIdaDbSchema() { +// return ida_db_schema; +// } +// +// public static String getPMSDbUrl() { +// return "jdbc:postgresql://" + db_domain + ":" + db_port + "/mosip_pms"; +// } +// +// public static String getKMDbUrl() { +// return "jdbc:postgresql://" + db_domain + ":" + db_port + "/mosip_keymgr"; +// } +// + public static String getMASTERDbUrl() { + return "jdbc:postgresql://" + db_domain + ":" + db_port + "/mosip_master"; + } +// +// public static String getPMSDbUser() { +// return pms_db_user; +// } +// +// public static String getPMSDbPass() { +// return pms_db_pass; +// } +// +// public static String getPMSDbSchema() { +// return pms_db_schema; +// } +// +// public static String getKMDbUser() { +// return km_db_user; +// } +// +// public static String getKMDbPass() { +// return km_db_pass; +// } +// +// public static String getKMDbSchema() { +// return km_db_schema; +// } +// + public static String getMasterDbUser() { + return master_db_user; + } +// + public static String getMasterDbPass() { + return master_db_pass; + } +// + public static String getMasterDbSchema() { + return master_db_schema; + } +// +// // from docker env getting only host url + public static String getIAMUrl() { + logger.info("keycloak url from ENV::: " + System.getenv(IAM_EXTERNAL_URL) + "/auth"); + logger.info("keycloak url from Property::: " + System.getProperty(IAM_EXTERNAL_URL) + "/auth"); + logger.info("keycloak url from Config::: " + propsKernel.getProperty(IAM_EXTERNAL_URL) + "/auth"); + logger.info("keycloak url is:::" + iam_external_url + "/auth"); + return iam_external_url + "/auth"; + } +// + public static String getIAMRealmId() { + return iam_realm_id; + } +// + public static String getIAMUsersToCreate() { + return iam_users_to_create; + } +// + public static String getIAMUsersPassword() { + return iam_users_password; + } + + public static String getRolesForUser(String userId) { + // propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/Kernel.properties"); + propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename()); + + return propsKernel.getProperty("roles." + userId); + } + + private static Properties getproperty(String path) { + Properties prop = new Properties(); + try { + File file = new File(path); + prop.load(new FileInputStream(file)); + } catch (IOException e) { + logger.error("Exception " + e.getMessage()); + } + 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; + } + public static String getiam_apienvuser() { + return iam_apienvuser; + } + public static String getiam_apiinternalendpoint() { + return iam_apiinternalendpoint; + } +// public static String getAuthDemoServiceUrl() { +// return ConfigManager.getAuthDemoServiceBaseUrl() + ":" + ConfigManager.getAuthDemoServicePort(); +// } + + + +} \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/KernelAuthentication.java b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/KernelAuthentication.java new file mode 100644 index 00000000..421a9ca1 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/KernelAuthentication.java @@ -0,0 +1,115 @@ +package io.mosip.testrig.adminui.kernel.util; + +import java.util.Map; +import java.util.UUID; + +import org.json.simple.JSONObject; + +import io.mosip.testrig.adminui.kernel.service.ApplicationLibrary; +import io.mosip.testrig.adminui.utility.BaseTestCaseFunc; +import io.restassured.response.Response; + +public class KernelAuthentication extends BaseTestCaseFunc { + private String authRequest="/config/Authorization/request.json"; + private String authInternalRequest="config/Authorization/internalAuthRequest.json"; + public String zonemapCookie = null; + String cookie; + static String dataKey = "response"; + CommonLibrary clib= new CommonLibrary(); + public final Map props = clib.readProperty("Kernel"); + private String admin_password = props.get("admin_password"); + private String admin_userName=props.get("admin_userName"); + private String authenticationInternalEndpoint = props.get("authenticationInternal"); + private ApplicationLibrary appl=new ApplicationLibrary(); + + + + + public String getTokenByRole(String role) { + return getTokenByRole(role, null); + } + + public String getTokenByRole(String role, String tokenType) + { + String insensitiveRole = null; + if(role!=null) + insensitiveRole = role.toLowerCase(); + else return ""; + + switch(insensitiveRole) { + + case "idrepo": + if(!kernelCmnLib.isValidToken(idrepoCookie)) + idrepoCookie = kernelAuthLib.getAuthForIDREPO(); + return idrepoCookie; + case "admin": + if(!kernelCmnLib.isValidToken(adminCookie)) + adminCookie = kernelAuthLib.getAuthForAdmin(); + return adminCookie; + case "globaladmin": + if(!kernelCmnLib.isValidToken(zonemapCookie)) + zonemapCookie = kernelAuthLib.getAuthForzoneMap(); + return zonemapCookie; + default: + if(!kernelCmnLib.isValidToken(adminCookie)) + adminCookie = kernelAuthLib.getAuthForAdmin(); + return adminCookie; + } + + } + + @SuppressWarnings("unchecked") + public String getAuthForIDREPO() { + JSONObject actualrequest = getRequestJson(authRequest); + + JSONObject request=new JSONObject(); + request.put("appId", ConfigManager.getidRepoAppId()); + request.put("clientId", ConfigManager.getidRepoClientId()); + request.put("secretKey", ConfigManager.getIdRepoClientSecret()); + actualrequest.put("request", request); + + Response reponse=appl.postWithJson(props.get("authclientidsecretkeyURL"), actualrequest); + cookie=reponse.getCookie("Authorization"); + return cookie; + } + + @SuppressWarnings("unchecked") + public String getAuthForAdmin() { + + JSONObject actualrequest = getRequestJson(authInternalRequest); + + JSONObject request = new JSONObject(); + request.put("appId", ConfigManager.getAdminAppId()); + request.put("password", admin_password); + + //if(BaseTestCase.currentModule==null) admin_userName= + request.put("userName", BaseTestCaseFunc.currentModule +"-"+ admin_userName); + + request.put("clientId", ConfigManager.getAdminClientId()); + request.put("clientSecret", ConfigManager.getAdminClientSecret()); + actualrequest.put("request", request); + + Response reponse = appl.postWithJson(authenticationInternalEndpoint, actualrequest); + String responseBody = reponse.getBody().asString(); + String token = new org.json.JSONObject(responseBody).getJSONObject(dataKey).getString("token"); + return token; + } + @SuppressWarnings("unchecked") + public String getAuthForzoneMap() { + + JSONObject actualrequest = getRequestJson(authInternalRequest); + + JSONObject request = new JSONObject(); + request.put("appId", ConfigManager.getAdminAppId()); + request.put("password", props.get("admin_zone_password")); + request.put("userName", props.get("admin_zone_userName")); + request.put("clientId", ConfigManager.getAdminClientId()); + request.put("clientSecret", ConfigManager.getAdminClientSecret()); + actualrequest.put("request", request); + + Response reponse = appl.postWithJson(authenticationInternalEndpoint, actualrequest); + String responseBody = reponse.getBody().asString(); + String token = new org.json.JSONObject(responseBody).getJSONObject(dataKey).getString("token"); + return token; + } +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/KeycloakUserManager.java b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/KeycloakUserManager.java new file mode 100644 index 00000000..3af8f203 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/KeycloakUserManager.java @@ -0,0 +1,160 @@ +package io.mosip.testrig.adminui.kernel.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Properties; + +import javax.ws.rs.core.Response; + +import org.apache.log4j.Logger; +import org.keycloak.OAuth2Constants; +import org.keycloak.admin.client.CreatedResponseUtil; +import org.keycloak.admin.client.Keycloak; +import org.keycloak.admin.client.KeycloakBuilder; +import org.keycloak.admin.client.resource.RealmResource; +import org.keycloak.admin.client.resource.UserResource; +import org.keycloak.admin.client.resource.UsersResource; +import org.keycloak.representations.idm.CredentialRepresentation; +import org.keycloak.representations.idm.RoleRepresentation; +import org.keycloak.representations.idm.UserRepresentation; + +import io.mosip.testrig.adminui.utility.BaseTestCaseFunc; +import io.mosip.testrig.adminui.utility.TestRunner; + +public class KeycloakUserManager extends BaseTestCaseFunc { + public static String moduleSpecificUser = null; + public static String passwordCred; + + private static final Logger logger = Logger.getLogger(KeycloakUserManager.class); + +// public static Properties propsKernel = getproperty(TestRunner.getResourcePath() + "/"+"config/Kernel.properties"); + public static Properties propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename()); + + private static Keycloak getKeycloakInstance() { + Keycloak key=null; + try { + + key=KeycloakBuilder.builder().serverUrl(ConfigManager.getIAMUrl()).realm(ConfigManager.getIAMRealmId()) + .grantType(OAuth2Constants.CLIENT_CREDENTIALS).clientId(ConfigManager.getAutomationClientId()).clientSecret(ConfigManager.getAutomationClientSecret()) + .build(); + logger.info(ConfigManager.getIAMUrl()); + logger.info(key.toString() + key.realms()); + }catch(Exception e) + { + throw e; + + } + return key; + } + + public static Properties getproperty(String path) { + Properties prop = new Properties(); + try { + File file = new File(path); + prop.load(new FileInputStream(file)); + } catch (IOException e) { + logger.error("Exception " + e.getMessage()); + } + return prop; + } + + public static void createUsers() { + + List needsToBeCreatedUsers = List.of(ConfigManager.getIAMUsersToCreate().split(",")); + Keycloak keycloakInstance = getKeycloakInstance(); + for (String needsToBeCreatedUser : needsToBeCreatedUsers) { + UserRepresentation user = new UserRepresentation(); + + if (needsToBeCreatedUser.equals("globaladmin")) { + moduleSpecificUser = needsToBeCreatedUser; + } + else if(needsToBeCreatedUser.equals("masterdata-220005")){ + moduleSpecificUser = needsToBeCreatedUser; + + } + + else { + moduleSpecificUser = BaseTestCaseFunc.currentModule+"-"+ needsToBeCreatedUser; + } + + logger.info(moduleSpecificUser); + user.setEnabled(true); + user.setUsername(moduleSpecificUser); + user.setFirstName(moduleSpecificUser); + user.setLastName(moduleSpecificUser); + user.setEmail("automation" + moduleSpecificUser + "@automationlabs.com"); + // Get realm + RealmResource realmResource = keycloakInstance.realm(ConfigManager.getIAMRealmId()); + UsersResource usersRessource = realmResource.users(); + // Create user (requires manage-users role) + Response response = null; + response = usersRessource.create(user); + logger.info(response); + logger.info("Repsonse: %s %s%n"+ response.getStatus()+ response.getStatusInfo()); + if (response.getStatus()==409) { + break; + } + + + logger.info(response.getLocation()); + String userId = CreatedResponseUtil.getCreatedId(response); + logger.info("User created with userId: %s%n"+ userId); + + // Define password credential + CredentialRepresentation passwordCred = new CredentialRepresentation(); + + passwordCred.setTemporary(false); + passwordCred.setType(CredentialRepresentation.PASSWORD); + + //passwordCred.setValue(userPassword.get(passwordIndex)); + passwordCred.setValue("mosip123"); + + UserResource userResource = usersRessource.get(userId); + + // Set password credential + userResource.resetPassword(passwordCred); + + // Getting all the roles + List allRoles = realmResource.roles().list(); + List availableRoles = new ArrayList<>(); + List toBeAssignedRoles = List.of(ConfigManager.getRolesForUser(needsToBeCreatedUser).split(",")); + for(String role : toBeAssignedRoles) { + if(allRoles.stream().anyMatch((r->r.getName().equalsIgnoreCase(role)))){ + availableRoles.add(allRoles.stream().filter(r->r.getName().equals(role)).findFirst().get()); + }else { + logger.info("Role not found in keycloak: %s%n"+ role); + } + } + // Assign realm role tester to user + userResource.roles().realmLevel() // + .add((availableRoles.isEmpty() ? allRoles : availableRoles)); + + //passwordIndex ++; + } + } + + public static void removeUser() { + List needsToBeRemovedUsers = List.of(ConfigManager.getIAMUsersToCreate().split(",")); + Keycloak keycloakInstance = getKeycloakInstance(); + for (String needsToBeRemovedUser : needsToBeRemovedUsers) { + String moduleSpecificUserToBeRemoved = BaseTestCaseFunc.currentModule +"-"+ needsToBeRemovedUser; + RealmResource realmResource = keycloakInstance.realm(ConfigManager.getIAMRealmId()); + UsersResource usersRessource = realmResource.users(); + + List usersFromDB = usersRessource.search(moduleSpecificUserToBeRemoved); + if (!usersFromDB.isEmpty()) { + UserResource userResource = usersRessource.get(usersFromDB.get(0).getId()); + userResource.remove(); + logger.info("User removed with name: %s%n"+ moduleSpecificUserToBeRemoved); + } else { + logger.info("User not found with name: %s%n"+ moduleSpecificUserToBeRemoved); + } + + } + } + +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/S3Adapter.java b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/S3Adapter.java new file mode 100644 index 00000000..a44163c5 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/kernel/util/S3Adapter.java @@ -0,0 +1,221 @@ +package io.mosip.testrig.adminui.kernel.util; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import org.joda.time.DateTime; + +import com.amazonaws.ClientConfiguration; +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.client.builder.AwsClientBuilder; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import com.amazonaws.services.s3.model.ObjectMetadata; +import com.amazonaws.services.s3.model.PutObjectRequest; +import com.google.common.collect.ImmutableMap; + +//import io.mosip.kernel.core.util.StringUtils; + +public class S3Adapter { + private static final Logger logger = Logger.getLogger(S3Adapter.class); + + private AmazonS3 connection = null; + + private int maxRetry = 20; + + private int maxConnection = 200; + + private int retry = 0; + + private boolean useAccountAsBucketname = true; + + private static final String SEPARATOR = "/"; + + private int reportExpirationInDays = Integer.parseInt(ConfigManager.getReportExpirationInDays()); + + private List existingBuckets = new ArrayList<>(); + + private AmazonS3 getConnection(String bucketName) { + if (connection != null) + return connection; + + logger.info("ConfigManager.getS3UserKey() :: "+ConfigManager.getS3UserKey()); + logger.info("ConfigManager.getS3Host() :: "+ConfigManager.getS3Host()); + logger.info("ConfigManager.getS3Region() :: "+ConfigManager.getS3Region()); + logger.info("ConfigManager.getS3SecretKey() :: "+ConfigManager.getS3SecretKey()); + try { + AWSCredentials awsCredentials = new BasicAWSCredentials(ConfigManager.getS3UserKey(), + ConfigManager.getS3SecretKey()); + connection = AmazonS3ClientBuilder.standard() + .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).enablePathStyleAccess() + .withClientConfiguration( + new ClientConfiguration().withMaxConnections(maxConnection).withMaxErrorRetry(maxRetry)) + .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(ConfigManager.getS3Host(), + ConfigManager.getS3Region())) + .build(); + + connection.doesBucketExistV2(bucketName); + retry = 0; + } catch (Exception e) { + if (retry >= maxRetry) { + // reset the connection and retry count + retry = 0; + connection = null; +// LOGGER.error(SESSIONID, REGISTRATIONID,"Maximum retry limit exceeded. Could not obtain connection for "+ bucketName +". Retry count :" + retry, ExceptionUtils.getStackTrace(e)); +// throw new ObjectStoreAdapterException(OBJECT_STORE_NOT_ACCESSIBLE.getErrorCode(), OBJECT_STORE_NOT_ACCESSIBLE.getErrorMessage(), e); + } else { + connection = null; + retry = retry + 1; +// LOGGER.error(SESSIONID, REGISTRATIONID,"Exception occured while obtaining connection for "+ bucketName +". Will try again. Retry count : " + retry, ExceptionUtils.getStackTrace(e)); + getConnection(bucketName); + } + } + return connection; + } + + /* + * public boolean putObject(String account, final String container, String + * source, String process, String objectName, File file) { String + * finalObjectName = null; String bucketName = null; + * logger.info("useAccountAsBucketname:: "+useAccountAsBucketname); if + * (useAccountAsBucketname) { finalObjectName = getName(container, source, + * process, objectName); bucketName = account; } else { finalObjectName = + * getName(source, process, objectName); bucketName = container; } + * logger.info("bucketName :: "+bucketName); AmazonS3 connection = + * getConnection(bucketName); if (!doesBucketExists(bucketName)) { + * connection.createBucket(bucketName); if (useAccountAsBucketname) + * existingBuckets.add(bucketName); } + * + * connection.putObject(bucketName, finalObjectName, file); return true; } + */ + + public boolean + putObject(String account, final String container, String source, String process, String objectName, File repotFile) { + String finalObjectName = null; + String bucketName = null; + boolean bReturn = false; + logger.info("useAccountAsBucketname:: "+useAccountAsBucketname); + if (useAccountAsBucketname) { + finalObjectName = getName(container, source, process, objectName); + bucketName = account; + } else { + finalObjectName = getName(source, process, objectName); + bucketName = container; + } + logger.info("bucketName :: "+bucketName); + AmazonS3 connection = getConnection(bucketName); + if (connection != null) { + if (!doesBucketExists(bucketName)) { + connection.createBucket(bucketName); + if (useAccountAsBucketname) + existingBuckets.add(bucketName); + } + PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, finalObjectName, repotFile); + ObjectMetadata objectMetadata = new ObjectMetadata(); + objectMetadata.setHttpExpiresDate(new DateTime().plusDays(reportExpirationInDays).toDate()); + putObjectRequest.setMetadata(objectMetadata); + connection.putObject(putObjectRequest); + bReturn = true; + } + return bReturn; + } + + private boolean doesBucketExists(String bucketName) { + // use account as bucket name and bucket name is present in existing bucket list + if (useAccountAsBucketname && existingBuckets.contains(bucketName)) + return true; + // use account as bucket name and bucket name is not present in existing bucket + // list + else if (useAccountAsBucketname && !existingBuckets.contains(bucketName)) { + boolean doesBucketExistsInObjectStore = connection.doesBucketExistV2(bucketName); + if (doesBucketExistsInObjectStore) + existingBuckets.add(bucketName); + return doesBucketExistsInObjectStore; + } else + return connection.doesBucketExistV2(bucketName); + } + + /* + * public boolean reportRetentionPolicy(String bucketName) { + * + * ObjectMetadata metadata = new ObjectMetadata(); logger.info("size:" + + * bytes.length); metadata.setContentLength(bytes.length); + * metadata.setContentType(contentType); Date expirationTime = new Date(2025, 5, + * 10); metadata.setExpirationTime(DateTime.now().toDate()); + * metadata.setHeader("x-amz-object-lock-retain-until-date", closerDate + + * "T00:00:00.000Z"); metadata.setHeader("x-amz-object-lock-mode", + * "COMPLIANCE"); byte[] md5 = Md5Utils.computeMD5Hash(baInputStream); String + * md5Base64 = BinaryUtils.toBase64(md5); metadata.setHeader("Content-MD5", + * md5Base64); baInputStream.reset(); PutObjectRequest putRequest = new + * PutObjectRequest(bucketName, finalObjectName, baInputStream, metadata); + * s3client.putObject(putRequest); + * + * + * return true; + * + * } + */ + + public static String getName(String container, String source, String process, String objectName) { + String finalObjectName = ""; + if (StringUtils.isNotEmpty(container)) + finalObjectName = container + SEPARATOR; + if (StringUtils.isNotEmpty(source)) + finalObjectName = finalObjectName + source + SEPARATOR; + if (StringUtils.isNotEmpty(process)) + finalObjectName = finalObjectName + process + SEPARATOR; + + finalObjectName = finalObjectName + objectName; + + return finalObjectName; + } + + public static String getName(String source, String process, String objectName) { + String finalObjectName = ""; + if (StringUtils.isNotEmpty(source)) + finalObjectName = source + SEPARATOR; + if (StringUtils.isNotEmpty(process)) + finalObjectName = finalObjectName + process + SEPARATOR; + + finalObjectName = finalObjectName + objectName; + + return finalObjectName; + } + + public boolean putObjectWithMetadata(String account, final String container, String source, String process, String objectName, File sourcefile, ObjectMetadata metadata) { + String finalObjectName = null; + String bucketName = null; + boolean bReturn = false; + + if (useAccountAsBucketname) { + finalObjectName = getName(container, source, process, objectName); + bucketName = account; + } else { + finalObjectName = getName(source, process, objectName); + bucketName = container; + } + + AmazonS3 connection = getConnection(bucketName); + if (connection != null) { + if (!doesBucketExists(bucketName)) { + connection.createBucket(bucketName); + if (useAccountAsBucketname) + existingBuckets.add(bucketName); + } + + PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, finalObjectName, sourcefile); + putObjectRequest.setMetadata(metadata); + connection.putObject(putObjectRequest); + bReturn = true; + } + + return bReturn; + } + +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BlockListTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BlockListTest.java new file mode 100644 index 00000000..d3561255 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BlockListTest.java @@ -0,0 +1,74 @@ +package io.mosip.testrig.adminui.testcase; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; +import io.mosip.testrig.adminui.utility.JsonUtil; + +public class BlockListTest extends BaseClass { + + @Test(groups = "BL") + public void blocklistedwordsCRUD() { + + try { + String blocklistedWord=ConfigManager.getdummyData(); + + test=extent.createTest("BlockListTest", "verify Login"); + String idBlocklisted="admin/masterdata/blocklisted-words/view"; + Commons.click(test,driver, By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver, By.id(idBlocklisted)); + + Commons.click(test,driver, By.id("Create")); + test.log(Status.INFO, "Click on Create"); + Commons.enter(test,driver, By.id("word"), blocklistedWord); + Commons.enter(test,driver, By.id("description"), data); + + + Commons.create(test,driver); + test.log(Status.INFO, "Click on Create"); + Commons.filter(test,driver, By.id("word"), blocklistedWord); + + + Commons.edit(test,driver,blocklistedWord+"auto",By.id("word")); + test.log(Status.INFO, "Click on Edit"); + Commons.filter(test,driver, By.id("word"), blocklistedWord+"A"); + + Commons.activate(test,driver); + Commons.edit(test,driver,blocklistedWord+"B",By.id("word")); + Commons.filter(test,driver, By.id("word"), blocklistedWord+"B"); + Commons.deactivate(test,driver); + test.log(Status.INFO, "Click on Deactivate"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } +} diff --git a/admintest/src/main/java/io/mosip/test/admintest/testcase/BulkUploadTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java similarity index 54% rename from admintest/src/main/java/io/mosip/test/admintest/testcase/BulkUploadTest.java rename to admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java index 3921cb47..793207b0 100644 --- a/admintest/src/main/java/io/mosip/test/admintest/testcase/BulkUploadTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/BulkUploadTest.java @@ -1,8 +1,9 @@ -package io.mosip.test.admintest.testcase; +package io.mosip.testrig.adminui.testcase; import java.util.HashMap; 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; @@ -16,6 +17,7 @@ import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; import org.testng.ITest; +import org.testng.Reporter; // Generated by Selenium IDE //import org.junit.Test; //import org.junit.Before; @@ -26,11 +28,16 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; -import io.mosip.test.admintest.utility.BaseClass; -import io.mosip.test.admintest.utility.Commons; -import io.mosip.test.admintest.utility.JsonUtil; -import io.mosip.test.admintest.utility.PropertiesUtil; -import io.mosip.test.admintest.utility.SetTestName; +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +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.PropertiesUtil; +import io.mosip.testrig.adminui.utility.Screenshot; +import io.mosip.testrig.adminui.utility.SetTestName; +import io.mosip.testrig.adminui.utility.TestRunner; import java.awt.AWTException; import java.awt.Robot; @@ -39,7 +46,10 @@ import java.awt.event.KeyEvent; import java.lang.reflect.Method; public class BulkUploadTest extends BaseClass { + private static final Logger logger = Logger.getLogger(BulkUploadTest.class); + /*implements ITest{ + * private String newTestName = ""; @@ -66,57 +76,43 @@ public void getTheNameFromParemeters(Method method, Object [] parameters){ @Test (dataProvider = "data-provider",groups = "BU") public void bulkUploadCRUD(String table) throws Exception { - - Commons.click(driver,By.id("admin/bulkupload")); - Commons.click(driver,By.xpath("//a[@href='#/admin/bulkupload/masterdataupload']")); + test=extent.createTest("bulkUploadCRUD", "verify Login"); + Commons.click(test,driver,By.id("admin/bulkupload")); + Commons.click(test,driver,By.xpath("//a[@href='#/admin/bulkupload/masterdataupload']")); for(int count=0;count<=2;count++) { - Commons.click(driver,By.id("Upload Data")); + Commons.click(test,driver,By.id("Upload Data")); - if(count==0) Commons.dropdown(driver,By.id("operation"),By.id("Insert")); - if(count==1) Commons.dropdown(driver,By.id("operation"),By.id("Update")); - if(count==2) Commons.dropdown(driver,By.id("operation"),By.id("Delete")); + if(count==0) Commons.dropdown(test,driver,By.id("operation"),By.id("Insert")); + if(count==1) Commons.dropdown(test,driver,By.id("operation"),By.id("Update")); + if(count==2) Commons.dropdown(test,driver,By.id("operation"),By.id("Delete")); - Commons.dropdown(driver,By.id("tableName"),By.id(table)); - // Commons.click(driver,By.xpath("//div[@class='custom-file-input']")); - Commons.click(driver,By.xpath("//div[@class='custom-file-input']")); + Commons.dropdown(test,driver,By.id("tableName"),By.id(table)); + // Commons.click(test,driver,By.xpath("//div[@class='custom-file-input']")); + // Commons.click(test,driver,By.id("fileInput")); - String filePath = System.getProperty("user.dir") + "\\BulkUploadFiles\\"+ JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang")+"\\"+table+".csv"; - StringSelection ss = new StringSelection(filePath); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null); + String filePath = TestRunner.getResourcePath()+ "//BulkUploadFiles//"+ ConfigManager.getloginlang()+"//"+table+".csv"; + Commons.enter(test, driver, By.id("fileInput"), filePath); - Robot robot = new Robot(); - - robot.delay(250); - - - robot.keyPress(KeyEvent.VK_ENTER); - robot.keyRelease(KeyEvent.VK_ENTER); - robot.keyPress(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_V); - robot.keyRelease(KeyEvent.VK_V); - robot.delay(250); - robot.keyRelease(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_ENTER); - robot.delay(250); - robot.keyRelease(KeyEvent.VK_ENTER); - robot.delay(250); - - Commons.click(driver,By.xpath("//button[@id='createButton']")); - Commons.click(driver,By.id("confirmpopup")); + + Commons.click(test,driver,By.xpath("//button[@id='createButton']")); + Commons.click(test,driver,By.id("confirmpopup")); + test.log(Status.INFO, "Click on FileUploaded"); + Thread.sleep(2000); String divText=driver.findElement(By.xpath("//div[@class='mat-dialog-content']//div")).getText(); String divTextArr[]=divText.split(":"); - System.out.println(divTextArr[1].trim()); + logger.info(divTextArr[1].trim()); - Commons.click(driver,By.id("confirmmessagepopup")); //DONE - Thread.sleep(Long.parseLong(JsonUtil.JsonObjParsing(Commons.getTestData(),"bulkwait"))); + Commons.click(test,driver,By.id("confirmmessagepopup")); //DONE + Thread.sleep(Long.parseLong(ConfigManager.getbulkwait())); String transId=driver.findElement(By.xpath("//table[@class='mat-table']//tr[2]//td[1]")).getText(); String status=driver.findElement(By.xpath("//table[@class='mat-table']//tr[2]//td[5]")).getText(); + Reporter.log("

"); Assert.assertTrue(transId.equals(divTextArr[1].trim())); Assert.assertTrue(status.equalsIgnoreCase("COMPLETED"),"Status Should be COMPLETED"); } 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 new file mode 100644 index 00000000..6982de8a --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java @@ -0,0 +1,118 @@ +package io.mosip.testrig.adminui.testcase; +import static org.testng.Assert.assertNotEquals; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Reporter; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; +import io.mosip.testrig.adminui.utility.JsonUtil; +public class CenterTest extends BaseClass{ + + @Test(groups = "CTR") + + public void centerCRUD() throws Exception { + + Reporter.log("centerCRUD",true); + test=extent.createTest("CenterTest", "verify Login"); + String holidayDate=ConfigManager.getholidayDateCenter(); + Commons.click(test,driver,By.id("admin/resources")); + + 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"); + /* + * Select Registration Center Type + */ + + /** + * centerTypeCode dropdown + */ + Commons.enter(test,driver, By.id("name"), data); + + Commons.dropdown(test,driver,By.id("centerTypeCode")); + test.log(Status.INFO, "Click on dropdown"); + Commons.enter(test,driver, By.id("contactPerson"),data); + Commons.enter(test,driver,By.id("contactPhone"),data); + + Commons.enter(test,driver,By.id("longitude"),"1.1234"); + Commons.enter(test,driver,By.id("latitude"),"2.2345"); + test.log(Status.INFO, "Enters Longitude And Latitude"); + Commons.enter(test,driver,By.id("addressLine1"),data); + Commons.enter(test,driver,By.id("addressLine2"),data); + Commons.enter(test,driver,By.id("addressLine3"),data); + test.log(Status.INFO, "Enters Address"); + Commons.dropdown(test,driver, By.xpath("(//*[@id='fieldName'])[1]")); + Commons.dropdown(test,driver, By.xpath("(//*[@id='fieldName'])[2]")); + Commons.dropdown(test,driver, By.xpath("(//*[@id='fieldName'])[3]")); + Commons.dropdown(test,driver, By.xpath("(//*[@id='fieldName'])[4]")); + Commons.dropdown(test,driver, By.xpath("(//*[@id='fieldName'])[5]")); + + + try{ Commons.dropdown(test,driver, By.id("zone")); + + }catch(Exception e) { + test.log(Status.INFO, e); + } + Commons.dropdown(test,driver, By.id("holidayZone")); + test.log(Status.INFO, "Click on Holidayzon"); + + + + Commons.enter(test,driver,By.id("noKiosk"),"10"); + + Commons.dropdown(test,driver,By.id("processingTime"),"45"); + Commons.dropdown(test,driver,By.id("startTime"),"9:00 AM"); + Commons.dropdown(test,driver,By.id("endTime"),"5:00 PM"); + Commons.dropdown(test,driver,By.id("lunchStartTime"),"1:00 PM"); + Commons.dropdown(test,driver,By.id("lunchEndTime"),"2:00 PM"); + + Commons.click(test,driver,By.cssSelector(".mat-list-item:nth-child(1) .mat-pseudo-checkbox")); + Commons.click(test,driver,By.cssSelector(".mat-list-item:nth-child(2) .mat-pseudo-checkbox")); + Commons.click(test,driver,By.cssSelector(".mat-list-item:nth-child(3) > .mat-list-item-content")); + Commons.click(test,driver,By.cssSelector(".mat-list-item:nth-child(4) > .mat-list-item-content")); + Commons.click(test,driver,By.cssSelector(".mat-list-item:nth-child(5) > .mat-list-item-content")); + + // Commons.enter(test,driver,By.id("holidayDate"),holidayDate); + Commons.calendar(holidayDate); + Commons.click(test,driver, By.id("createExceptionalHoliday")); + test.log(Status.INFO, "Click on Exceptional Holiday"); + + Commons.createRes(test,driver); + Commons.filterCenter(test,driver, By.id("name"), data); + + + Commons.editCenter(test,driver,data+1,By.id("name")); + + Commons.filterCenter(test,driver, By.id("name"), data+1); + + Commons.activate(test,driver); + test.log(Status.INFO, "Click on Active"); + Commons.editCenter(test,driver,data+2,By.id("name")); + Commons.filterCenter(test,driver, By.id("name"), data+2); + Commons.deactivate(test,driver); + test.log(Status.INFO, "Click on Deactive"); + Commons.decommission(test,driver); + } +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTypeTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTypeTest.java new file mode 100644 index 00000000..eea00efd --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTypeTest.java @@ -0,0 +1,64 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; +public class CenterTypeTest extends BaseClass{ + @Test(groups = "CT") + public void centerTypeCRUD() throws IOException { + test=extent.createTest("DeviceTest", "verify Login"); + String idCenterTypeCard="admin/masterdata/center-type/view"; + + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.id(idCenterTypeCard)); + Commons.click(test,driver,By.id("Create")); + test.log(Status.INFO, "Click on Create"); + + + Commons.enter(test,driver,By.id("code"),data); + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("descr"),data); + test.log(Status.INFO, "Enters Description"); + + Commons.create(test,driver); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.edit(test,driver,data+1,By.id("name")); + Commons.filter(test,driver, By.id("name"), data+1); + + Commons.activate(test,driver); + test.log(Status.INFO, "Click on Active"); + Commons.edit(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 Deactive"); + + } +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceSpecificationTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceSpecificationTest.java new file mode 100644 index 00000000..07780158 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceSpecificationTest.java @@ -0,0 +1,69 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; + +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; + +public class DeviceSpecificationTest extends BaseClass{ + + + @Test(groups = "DS") + public void deviceSpecCRUD() throws IOException { + test=extent.createTest("DeviceSpecificationTest", "verify Login"); + String devicespec="admin/masterdata/device-specs/view"; + + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.id(devicespec)); + test.log(Status.INFO, "Click on DeviceSpecification"); + Commons.click(test,driver,By.id("Create")); + + + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("description"),data); + Commons.enter(test,driver,By.id("brand"),data); + Commons.enter(test,driver,By.id("model"),data); + Commons.enter(test,driver,By.id("minDriverversion"),data); + Commons.dropdown(test,driver,By.id("deviceTypeCode")); + + + Commons.create(test,driver); + test.log(Status.INFO, "Click on Create"); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.edit(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.edit(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 Deactive"); + + } + } 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 new file mode 100644 index 00000000..4c7b21ea --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java @@ -0,0 +1,79 @@ +package io.mosip.testrig.adminui.testcase; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; +import com.paulhammant.ngwebdriver.NgWebDriver; + +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; +import io.mosip.testrig.adminui.utility.JsonUtil; +public class DeviceTest extends BaseClass{ + @Test(groups = "D") + public void deviceCRUD() throws InterruptedException { + String validityDate; + try { + validityDate = ConfigManager.getvalidityDate(); + test=extent.createTest("DeviceTest", "verify Login"); + Commons.click(test,driver,By.id("admin/resources")); + Commons.click(test,driver,By.id("/admin/resources/devices")); + Commons.click(test,driver,By.id("Create Device")); + test.log(Status.INFO, "Click on Create Device"); + + Commons.enter(test,driver, By.id("name"),data); + Commons.enter(test,driver, By.id("serialNumber"),data); + + Commons.enter(test,driver, By.id("macAddress"),"1.1234"); + test.log(Status.INFO, "Enters MACAddress"); + + Commons.enter(test,driver, By.id("ipAddress"),"2.2345"); + // 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")); + Commons.dropdown(test,driver,By.id("regCenterId")); + + + Commons.createRes(test,driver); + test.log(Status.INFO, "Click on Create"); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.editRes(test,driver,data+1,By.id("name")); + Commons.filter(test,driver, By.id("name"), data+1); + + Commons.activate(test,driver); + test.log(Status.INFO, "Click on Activate"); + Commons.editRes(test,driver,data+2,By.id("name")); + Commons.filter(test,driver, By.id("name"), data+2); + Commons.deactivate(test,driver); + Commons.decommission(test,driver); + test.log(Status.INFO, "Click on Decommission"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTypesTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTypesTest.java new file mode 100644 index 00000000..ad635149 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTypesTest.java @@ -0,0 +1,64 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; + +public class DeviceTypesTest extends BaseClass{ + + @Test(groups = "DT" ) + public void deviceTypesCRUD() throws IOException { + String deviceTypes="admin/masterdata/device-types/view"; + test=extent.createTest("DeviceTypesTest", "verify Login"); + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.id(deviceTypes)); + Commons.click(test,driver,By.id("Create")); + test.log(Status.INFO, "Click on Create"); + + + Commons.enter(test,driver,By.id("code"),data); + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("description"),data); + + Commons.create(test,driver); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.edit(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.edit(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 Deactive"); + } + } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DocumentCategoriesTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DocumentCategoriesTest.java new file mode 100644 index 00000000..7be911c8 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DocumentCategoriesTest.java @@ -0,0 +1,65 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; + +public class DocumentCategoriesTest extends BaseClass{ + @Test(groups = "DOC") + public void documentCategoriesCRUD() throws IOException { + test=extent.createTest("DocumentCategoriesTest", "verify Login"); + String documentCategories="admin/masterdata/document-categories/view"; + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.id(documentCategories)); + Commons.click(test,driver,By.id("Create")); + test.log(Status.INFO, "Click on Create"); + + Commons.enter(test,driver,By.id("code"),data); + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("description"),data); + + + Commons.create(test,driver); + + Commons.filter(test,driver, By.id("name"), data); + + + Commons.edit(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 Activate"); + Commons.edit(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 Deactivate"); + + } + } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DocumentTypes.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DocumentTypes.java new file mode 100644 index 00000000..c8629a61 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DocumentTypes.java @@ -0,0 +1,65 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; + +public class DocumentTypes extends BaseClass{ + @Test(groups = "DOCT") + public void documentTypesCRUD() throws IOException { + test=extent.createTest("DocumentTypes", "verify Login"); + String documentTypes="admin/masterdata/document-type/view"; + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.id(documentTypes)); + + Commons.click(test,driver,By.id("Create")); + test.log(Status.INFO, "Click on Create"); + Commons.enter(test,driver,By.id("code"),data); + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("description"),data); + + + + Commons.create(test,driver); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.edit(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 Activate"); + Commons.edit(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 Deactivate"); + + } + } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DynamicFieldTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DynamicFieldTest.java new file mode 100644 index 00000000..5c547ce8 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DynamicFieldTest.java @@ -0,0 +1,69 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; + +public class DynamicFieldTest extends BaseClass{ + + + @Test(groups = "DF") + public void dynamicFieldCRUD() throws IOException { + + test=extent.createTest("DynamicFieldTest", "verify Login"); + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.id("createDynamicField")); + test.log(Status.INFO, "Click on Create"); + + + Commons.enter(test,driver,By.id("code"),data); + + Commons.enter(test,driver,By.id("name"),"Automation"); + Commons.enter(test,driver,By.id("description"),"Automation"); + + Commons.enter(test,driver,By.id("value"),data); + + + Commons.create(test,driver); + Commons.filter(test,driver, By.id("description"), "Automation"); + + + Commons.edit(test,driver,data+1,By.id("code")); + test.log(Status.INFO, "Click on Edit"); + Commons.filter(test,driver, By.id("description"), "Automation"); + + Commons.activate(test,driver); + test.log(Status.INFO, "Click on Active"); + Commons.edit(test,driver,data+2,By.id("code")); + Commons.filter(test,driver, By.id("description"), "Automation"); + Commons.deactivate(test,driver); + test.log(Status.INFO, "Click on Deactive"); + + } +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/HolidaysTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/HolidaysTest.java new file mode 100644 index 00000000..f1543360 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/HolidaysTest.java @@ -0,0 +1,75 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +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.PropertiesUtil; + +public class HolidaysTest extends BaseClass{ + + @Test(groups = "H") + public void holidaysCRUD() throws Exception { + test=extent.createTest("HolidaysTest", "verify Login"); + String listofholidays="admin/masterdata/holiday/view"; + test=extent.createTest("HolidaysTest", "verify Login"); + String holidayDate=ConfigManager.getholidayDate(); + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.id(listofholidays)); + Commons.click(test,driver,By.id("Create")); + test.log(Status.INFO, "Click on Create"); + + + Commons.enter(test,driver,By.id("holidayName"),data); + Commons.enter(test,driver,By.id("holidayDesc"),data); + // Commons.enter(test,driver,By.id("holidayDate"),holidayDate); + Commons.calendar(holidayDate); + test.log(Status.INFO, "Click on Enters HolidayDate"); + Commons.dropdown(test,driver,By.id("locationCode")); + + + Commons.create(test,driver); + Commons.filter(test,driver, By.id("holidayName"), data); + + + Commons.edit(test,driver,data+1,By.id("holidayName")); + test.log(Status.INFO, "Click on edit"); + Commons.filter(test,driver, By.id("holidayName"), data+1); + + Commons.activate(test,driver); + test.log(Status.INFO, "Click on Active"); + Commons.edit(test,driver,data+2,By.id("holidayName")); + Commons.filter(test,driver, By.id("holidayName"), data+2); + Commons.deactivate(test,driver); + test.log(Status.INFO, "Click on Deactive"); + + } +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/LoginTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/LoginTest.java new file mode 100644 index 00000000..4266106b --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/LoginTest.java @@ -0,0 +1,119 @@ +package io.mosip.testrig.adminui.testcase; +import java.util.HashMap; +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; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +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 LoginTest extends BaseClass{ + private static final Logger logger = Logger.getLogger(LoginTest.class); + + + @Test(priority = 0) + public void loginTest() throws Exception { + String envPath = System.getProperty("path"); + String userid = System.getProperty("userid"); + String password = System.getProperty("password"); + String language = null; + driver.get(envPath); + driver.manage().window().setSize(new Dimension(1050, 708)); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + driver.findElement(By.linkText("Admin")).click(); + + try { + language=JsonUtil.JsonObjArrayListParsing2(ConfigManager.getlangcode()); + + logger.info(language); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + Commons.click(test,driver,By.xpath("//*[@class='kc-dropdown']")); + String var="//*[@class='kc-dropdown-item']/a[contains(text(),'"+language+"')]"; + Commons.click(test,driver,By.xpath(var)); + driver.findElement(By.id("username")).sendKeys(userid); + driver.findElement(By.id("password")).sendKeys(password); + driver.findElement(By.xpath("//input[@name=\'login\']")).click(); + + /* + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.xpath("//mat-card-content/span[contains(text(),'Blocklisted Words')]")); + Commons.click(test,driver,By.xpath("//span[contains(text(),'Create')]")); + String data=Commons.appendDate; + + Commons.enter(test,driver,By.xpath("//input[@placeholder='Blocklisted Words']"),data); + Commons.enter(test,driver,By.xpath("//textarea[@placeholder='Description']"),data); + + + Commons.click(test,driver,By.xpath("//button[@id='createButton']")); + Commons.click(test,driver,By.xpath("//span[contains(text(),'OK')]")); + + Commons.click(test,driver,By.xpath("//span[contains(text(),'Filter')]")); + + Commons.enter(test,driver,By.xpath("//input[@placeholder=' Blocklisted Words']"),data); + + Commons.click(test,driver,By.xpath("//span[contains(text(),'Apply')]")); + + Commons.click(test,driver,By.cssSelector(".ellipsis-button")); + + + Commons.click(test,driver,By.xpath("//span[contains(text(),'Activate')]")); + + Commons.click(test,driver,By.xpath("//span[contains(text(),'Confirm')]")); + + Commons.click(test,driver,By.xpath("//span[contains(text(),'Done')]")); + + driver.findElement(By.cssSelector(".ellipsis-button")).click(); + + Commons.click(test,driver,By.xpath("//span[contains(text(),'Edit')]")); + + Assert.assertNotEquals(data, driver.findElement(By.xpath("//input[@placeholder='Blocklisted Words']")).getText()); + driver.findElement(By.xpath("//input[@placeholder='Blocklisted Words']")).clear(); + + Commons.enter(test,driver,By.xpath("//input[@placeholder='Blocklisted Words']"),data+1); + + Commons.click(test,driver,By.id("createButton")); + + + Commons.click(test,driver,By.xpath("//button/span[contains(text(),'OK')]")); + + Commons.click(test,driver,By.xpath("//span[contains(text(),'Filter')]")); + Commons.enter(test,driver,By.xpath("//input[@placeholder='Blocklisted Words']"),data+1); + Commons.click(test,driver,By.xpath("//span[contains(text(),'Apply')]")); + + Commons.click(test,driver,By.cssSelector(".ellipsis-button")); + Commons.click(test,driver,By.xpath("//span[contains(text(),'Deactivate')]")); + + Commons.clickSpan(driver,"Confirm"); + Commons.clickSpan(driver,"Done"); + + */ + } +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineSpecificationTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineSpecificationTest.java new file mode 100644 index 00000000..797c896e --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineSpecificationTest.java @@ -0,0 +1,67 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; + +public class MachineSpecificationTest extends BaseClass{ + + @Test(groups = "MS") + public void machineSpecCRUD() throws IOException { + String machinespec="admin/masterdata/machine-specs/view"; + test=extent.createTest("MachineSpecificationTest", "verify Login"); + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + Commons.click(test,driver,By.id(machinespec)); + Commons.click(test,driver,By.id("Create")); + test.log(Status.INFO, "Click on Create"); + + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("brand"),data); + Commons.enter(test,driver,By.id("model"),data); + Commons.enter(test,driver,By.id("minDriverversion"),data); + Commons.enter(test,driver,By.id("description"),data); + Commons.dropdown(test,driver,By.id("machineTypeCode")); + + + Commons.create(test,driver); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.edit(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 Activate"); + Commons.edit(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 Deactivate"); + + } + } 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 new file mode 100644 index 00000000..b7183640 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -0,0 +1,81 @@ +package io.mosip.testrig.adminui.testcase; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; +import io.mosip.testrig.adminui.utility.JsonUtil; +public class MachineTest extends BaseClass{ + @Test(groups = "M") + public void machineCRUD() throws Exception { + test=extent.createTest("MachineTest", "verify Login"); + String holidayDateCenter=ConfigManager.getholidayDateCenter(); + String publicKey=ConfigManager.getpublicKey(); + + String signPublicKey=ConfigManager.getsignPublicKey(); + + 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); + } +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTypesTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTypesTest.java new file mode 100644 index 00000000..82048699 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTypesTest.java @@ -0,0 +1,64 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; + +public class MachineTypesTest extends BaseClass{ + + @Test(groups = "MT") + public void machineTypesCRUD() throws IOException { + test=extent.createTest("MachineTypesTest", "verify Login"); + String machinetypes="admin/masterdata/machine-type/view" ; + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.id(machinetypes)); + Commons.click(test,driver,By.id("Create")); + test.log(Status.INFO, "Click on Create"); + + Commons.enter(test,driver,By.id("code"),data); + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("description"),data); + + + Commons.create(test,driver); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.edit(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); + Commons.edit(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 Deactivate"); + + } +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/TemplateTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/TemplateTest.java new file mode 100644 index 00000000..fe7ff279 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/TemplateTest.java @@ -0,0 +1,77 @@ +package io.mosip.testrig.adminui.testcase; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +// Generated by Selenium IDE +//import org.junit.Test; +//import org.junit.Before; +//import org.junit.After; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + +import io.mosip.testrig.adminui.utility.BaseClass; +import io.mosip.testrig.adminui.utility.Commons; + +public class TemplateTest extends BaseClass{ + + + @Test(groups = "T") + public void templateCRUD() throws IOException { + String templatesid="admin/masterdata/templates/view"; + test=extent.createTest("TemplateTest", "verify Login"); + Commons.click(test,driver,By.xpath("//a[@href='#/admin/masterdata']")); + + Commons.click(test,driver,By.id(templatesid)); + Commons.click(test,driver,By.id("Create")); + test.log(Status.INFO, "Click on Create"); + Commons.enter(test,driver,By.id("name"),data); + Commons.enter(test,driver,By.id("description"),data); + + Commons.enter(test,driver,By.id("model"),data); + Commons.enter(test,driver,By.id("fileText"),data); + + + Commons.dropdown(test,driver,By.id("fileFormatCode")); + + Commons.dropdown(test,driver,By.id("templateTypeCode")); + + Commons.dropdown(test,driver,By.id("moduleId")); + + + + + Commons.create(test,driver); + Commons.filter(test,driver, By.id("name"), data); + + + Commons.edit(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 Activate"); + Commons.edit(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 DEactivate"); + + + } +} 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 new file mode 100644 index 00000000..bf62ac08 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -0,0 +1,239 @@ +package io.mosip.testrig.adminui.utility; + +import java.io.File; +import java.io.IOException; +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; +import java.util.Properties; +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; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +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; +import org.testng.ITest; +import org.testng.ITestResult; +import org.testng.Reporter; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.AfterSuite; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.ExtentReports; +import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.Status; +import com.aventstack.extentreports.reporter.ExtentSparkReporter; + +import io.github.bonigarcia.wdm.WebDriverManager; +import io.mosip.testrig.adminui.kernel.util.ConfigManager; +import io.mosip.testrig.adminui.kernel.util.KeycloakUserManager; +import io.mosip.testrig.adminui.kernel.util.S3Adapter; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Optional; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +public class BaseClass { + private static final Logger logger = Logger.getLogger(TestRunner.class); + protected static WebDriver driver; + protected Map vars; + protected JavascriptExecutor js; + protected String langcode; + protected String envPath = ConfigManager.getiam_adminportal_path(); + protected String env=ConfigManager.getiam_apienvuser(); + public static String userid = KeycloakUserManager.moduleSpecificUser; + protected String[] allpassword = ConfigManager.getIAMUsersPassword().split(","); + protected String password = allpassword[0]; + protected String data = Commons.appendDate; + public static ExtentSparkReporter html; + + + + public static ExtentReports extent; + public static ExtentTest test; + + + + + @BeforeSuite + + + + @BeforeMethod + public void set() { + extent=ExtentReportManager.getReports(); + } + + @BeforeMethod + public void setUp() throws Exception { + Reporter.log("BaseClass", true); + test = extent.createTest(getCommitId(), getCommitId()); + logger.info("Start set up"); + if(System.getProperty("os.name").equalsIgnoreCase("Linux") && ConfigManager.getdocker().equals("yes") ) { + + + logger.info("Docker start"); + String configFilePath ="/usr/bin/chromedriver"; + System.setProperty("webdriver.chrome.driver", configFilePath); + + }else { + WebDriverManager.chromedriver().setup(); + logger.info("window chrome driver start"); + } + ChromeOptions options = new ChromeOptions(); + String headless=ConfigManager.getheadless(); + if(headless.equalsIgnoreCase("yes")) { + logger.info("Running is headless mode"); + options.addArguments("--headless", "--disable-gpu","--no-sandbox", "--window-size=1920x1080","--disable-dev-shm-usage"); + + + } + driver=new ChromeDriver(options); + + + js = (JavascriptExecutor) driver; + vars = new HashMap(); + driver.get(envPath); + logger.info("launch url --"+envPath); + driver.manage().window().maximize(); + Thread.sleep(500); + driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + + String language1 = null; + try { + + language1 = ConfigManager.getloginlang(); + String loginlang = null; + System.out.println(language1); + if(!language1.equals("sin")) { + loginlang = JsonUtil.JsonObjArrayListParsing2(ConfigManager.getlangcode()); + Commons.click(test,driver, By.xpath("//*[@id='kc-locale-dropdown']")); + String var = "//li/a[contains(text(),'" + loginlang + "')]"; + Commons.click(test,driver, By.xpath(var)); + } + + } catch (Exception e) { + e.getMessage(); + } + + Commons.enter(test,driver, By.id("username"), userid); + Commons.enter(test,driver, By.id("password"), password); + Commons.click(test,driver, By.xpath("//input[@name='login']")); + + + } + + + @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(); + + + 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()); + e.printStackTrace(); + } + if (isStoreSuccess) { + System.out.println("Pushed file to S3"); + } else { + System.out.println("Failed while pushing file to S3"); + } + } + + } + + + + @DataProvider(name = "data-provider") + public Object[] dpMethod() { + String listFilename[] = readFolderJsonList(); + String s[][] = null; + String temp[] = null; + for (int count = 0; count < listFilename.length; count++) { + listFilename[count] = listFilename[count].replace(".csv", ""); + + } + + return listFilename; + } + + public static String[] readFolderJsonList() { + String contents[] = null; + try { + String langcode = ConfigManager.getloginlang(); + + File directoryPath = new File(TestRunner.getResourcePath()+ "//BulkUploadFiles//" + langcode + "//"); + + if (directoryPath.exists()) { + + contents = directoryPath.list(); + logger.info("List of files and directories in the specified directory:"); + for (int i = 0; i < contents.length; i++) { + logger.info(contents[i]); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + 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 ""; + } + + } + + + +} 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 new file mode 100644 index 00000000..b00186a3 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseTestCaseFunc.java @@ -0,0 +1,194 @@ +package io.mosip.testrig.adminui.utility; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.ws.rs.core.MediaType; + +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; +import org.json.simple.JSONObject; + +import io.mosip.testrig.adminui.authentication.fw.util.RestClient; +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; + +public class BaseTestCaseFunc { + private static String zoneMappingRequest = "config/Authorization/zoneMappingRequest.json"; + protected static Logger logger = Logger.getLogger(BaseTestCaseFunc.class); + public static String environment; + public static List languageList = new ArrayList<>(); + public static String ApplnURI; + public static String ApplnURIForKeyCloak; + public static String testLevel; + public static Properties props = getproperty( + TestRunner.getResourcePath() + "/" + "config/application.properties"); + public static Properties propsKernel = getproperty( + TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename()); + public static Properties propsMap = getproperty( + TestRunner.getResourcePath() + "/" + "config/valueMapping.properties"); + public static Properties propsBio = getproperty( + TestRunner.getGlobalResourcePath() + "/" + "config/bioValue.properties"); + public static String SEPRATOR = ""; + public static String currentModule = "adminui"; + public final static String COOKIENAME = "Authorization"; + public static CommonLibrary kernelCmnLib = null; + public static KernelAuthentication kernelAuthLib = null; + public String adminCookie = null; + public String idrepoCookie = null; + public static Map queries; + public static Map residentQueries; + public static Map partnerQueries; + public static String uinEmail; + public static String uinPhone; + + + + public static String getOSType() { + String type = System.getProperty("os.name"); + if (type.toLowerCase().contains("windows")) { + SEPRATOR = "\\\\"; + return "WINDOWS"; + } else if (type.toLowerCase().contains("linux") || type.toLowerCase().contains("unix")) { + SEPRATOR = "/"; + return "OTHERS"; + } + return null; + } + + public static List getLanguageList() { + logger.info("We have created a Config Manager. Beginning to read properties!"); + + environment = ConfigManager.getiam_apienvuser(); + logger.info("Environemnt is ==== :" + environment); + ApplnURI = ConfigManager.getiam_apiinternalendpoint(); + logger.info("Application URI ======" + ApplnURI); + + logger.info("Configs from properties file are set."); + if (!languageList.isEmpty()) { + return languageList; + } + String url = ApplnURI + props.getProperty("preregLoginConfigUrl"); + Response response = RestClient.getRequest(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON); + org.json.JSONObject responseJson = new org.json.JSONObject(response.asString()); + org.json.JSONObject responseValue = (org.json.JSONObject) responseJson.get("response"); + String mandatoryLanguage = (String) responseValue.get("mosip.mandatory-languages"); + + languageList.add(mandatoryLanguage); + languageList.addAll(Arrays.asList(((String) responseValue.get("mosip.optional-languages")).split(","))); + + return languageList; + } + + public static Properties getproperty(String path) { + Properties prop = new Properties(); + + try { + File file = new File(path); + prop.load(new FileInputStream(file)); + } catch (IOException e) { + logger.error("Exception " + e.getMessage()); + } + return prop; + } + + public static void initialize() { + PropertyConfigurator.configure(getLoggerPropertyConfig()); + kernelAuthLib = new KernelAuthentication(); + kernelCmnLib = new CommonLibrary(); + queries = kernelCmnLib.readProperty("adminQueries"); + partnerQueries = kernelCmnLib.readProperty("partnerQueries"); + residentQueries = kernelCmnLib.readProperty("residentServicesQueries"); + /** + * Make sure test-output is there + */ + + getOSType(); + logger.info("We have created a Config Manager. Beginning to read properties!"); + + environment = ConfigManager.getiam_apienvuser(); + logger.info("Environemnt is ==== :" + environment); + ApplnURI = ConfigManager.getiam_apiinternalendpoint(); + logger.info("Application URI ======" + ApplnURI); + ApplnURIForKeyCloak = ConfigManager.getIAMUrl(); + logger.info("Application URI ======" + ApplnURIForKeyCloak); + testLevel = System.getProperty("env.testLevel"); + logger.info("Test Level ======" + testLevel); + // languageList =Arrays.asList(System.getProperty("env.langcode").split(",")); + + // langcode = System.getProperty("env.langcode"); + logger.info("Test Level ======" + languageList); + + logger.info("Configs from properties file are set."); + + } + + private static Properties getLoggerPropertyConfig() { + Properties logProp = new Properties(); + logProp.setProperty("log4j.rootLogger", "INFO, Appender1,Appender2"); + logProp.setProperty("log4j.appender.Appender1", "org.apache.log4j.ConsoleAppender"); + logProp.setProperty("log4j.appender.Appender1.layout", "org.apache.log4j.PatternLayout"); + logProp.setProperty("log4j.appender.Appender1.layout.ConversionPattern", "%-7p %d [%t] %c %x - %m%n"); + logProp.setProperty("log4j.appender.Appender2", "org.apache.log4j.FileAppender"); + logProp.setProperty("log4j.appender.Appender2.File", "src/logs/mosip-api-test.log"); + logProp.setProperty("log4j.appender.Appender2.layout", "org.apache.log4j.PatternLayout"); + logProp.setProperty("log4j.appender.Appender2.layout.ConversionPattern", "%-7p %d [%t] %c %x - %m%n"); + return logProp; + } + + 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("userId", user); + request.put("langCode", BaseTestCaseFunc.getLanguageList().get(0)); + request.put("isActive","true"); + actualrequest.put("request", request); + logger.info(actualrequest); + Response response = RestClient.postRequestWithCookie(url, actualrequest, MediaType.APPLICATION_JSON, + MediaType.APPLICATION_JSON, "Authorization", token); + logger.info(user + "Mapped to" + zone + "Zone"); + logger.info(response); + } + public static void mapZone(String user) { + String token = kernelAuthLib.getTokenByRole("globalAdmin"); + String url = ApplnURI + propsKernel.getProperty("zoneMappingActivateUrl"); + HashMap map = new HashMap(); + map.put("isActive","true"); + map.put("userId", user); + Response response = RestClient.patchRequestWithCookieAndQueryParm(url, map, MediaType.APPLICATION_JSON, + MediaType.APPLICATION_JSON, "Authorization", token); + logger.info(response); + } +} \ No newline at end of file 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 new file mode 100644 index 00000000..a8951f46 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -0,0 +1,506 @@ +package io.mosip.testrig.adminui.utility; + +import java.io.IOException; +import java.time.LocalDateTime; +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; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; +import org.testng.Reporter; + +import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.MediaEntityBuilder; + +import io.mosip.testrig.adminui.kernel.util.ConfigManager; + +public class Commons extends BaseClass{ + private static final Logger logger = Logger.getLogger(Commons.class); + + public static String appendDate=getPreAppend()+getDateTime(); + + public static String getDateTime() + { + + + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmm"); + LocalDateTime now = LocalDateTime.now(); + return dtf.format(now); + } + + public static void filter(ExtentTest test,WebDriver driver, By by,String data) throws IOException { + try { + logger.info("Inside Filter " + by + data); + Commons.click(test,driver, By.id("Filter")); + Thread.sleep(3000); + Commons.enter(test,driver, by, data); + Thread.sleep(3000); + Commons.click(test,driver, By.id("applyTxt")); + } + catch (Exception e) { + Reporter.log("

"); + + logger.info(e.getMessage()); + 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 filterCenter(ExtentTest test,WebDriver driver, By by,String data) throws IOException { + logger.info("Inside filterCenter " + by + data); + try { + Commons.click(test,driver, By.id("Filter")); + + Commons.dropdowncenter(test,driver, by, data); + + Commons.click(test,driver, By.id("applyTxt")); + } + catch (Exception e) { + Reporter.log("

"); + + logger.info(e.getMessage()); + 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 click(ExtentTest test,WebDriver driver, By by) throws IOException { + logger.info("Clicking " + by ); + try { + (new WebDriverWait(driver, 20)).until(ExpectedConditions.elementToBeClickable(by)); + Thread.sleep(1000); + driver.findElement(by).click(); + Thread.sleep(500); + }catch (StaleElementReferenceException sere) { + Reporter.log("

"); + + // simply retry finding the element in the refreshed DOM + logger.error( sere.getMessage()); + driver.findElement(by).click(); + } + catch (TimeoutException toe) { + // Reporter.log("

"); + + 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) { + // Reporter.log("

"); + + 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 { +// Thread.sleep(5000); +// JavascriptExecutor executor = (JavascriptExecutor) driver; +// executor.executeScript("arguments[0].click();", driver.findElement(by)); +// +// }catch(Exception e) { +// logger.error( e.getMessage()); +// Assert.fail(); +// } + + } + + public static void enter(ExtentTest test,WebDriver driver, By by,String value) throws IOException { + logger.info("Entering " + by +value); + try { + (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOfElementLocated(by)); + 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) { + Reporter.log("

"); + + // simply retry finding the element in the refreshed DOM + driver.findElement(by).sendKeys(value); + } + catch (TimeoutException toe) { + Reporter.log("

"); + + driver.findElement(by).sendKeys(value); + logger.info( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); + } + catch (Exception e) { + Reporter.log("

"); + + 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) throws IOException + { + logger.info("Selecting DropDown Index Zero Value " + by ); + + try { + Thread.sleep(500); + click(test,driver,by);//REGION + Thread.sleep(500); + + String att= driver.findElement(by).getAttribute("aria-owns"); + String[] list=att.split(" "); + click(test,driver,By.id(list[0])); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }catch (Exception e) { + Reporter.log("

"); + + 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) + { + logger.info("Selecting DropDown By Value " + by +value ); + + try { + Thread.sleep(500); + click(test,driver,by); + Thread.sleep(500); + String val="'"+value +"'"; + + click(test,driver,By.xpath("//span[contains(text(),"+val+")]")); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }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 + e1.printStackTrace(); + } + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); + + } + } + + public static void dropdowncenter(ExtentTest test,WebDriver driver, By by,String value) + { + logger.info("Selecting DropDown By Value " + by +value ); + + try { + Thread.sleep(500); + click(test,driver,by); + Thread.sleep(500); + String val="'"+value +"'"; + + click(test,driver,By.id(value)); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }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 + e1.printStackTrace(); + } + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); + + } + } + + public static void dropdown(ExtentTest test,WebDriver driver, By by,By value) + { + logger.info("Selecting DropDown By Value " + by +value ); + try { + Thread.sleep(500); + click(test,driver,by); + Thread.sleep(500); + click(test,driver,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 + e1.printStackTrace(); + } + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); + + } + } + public static String getTestData() + { + return JsonUtil.readJsonFileText("TestData.json"); + } + + + + + public static void deactivate(ExtentTest test,WebDriver driver) throws IOException { + Commons.click(test,driver,By.id("ellipsis-button0")); + Commons.click(test,driver, By.id("Deactivate0")); + + Commons.click(test,driver,By.id("confirmpopup")); + Commons.click(test,driver, By.id("confirmmessagepopup")); + logger.info("Click deactivate and Confirm"); + } + + public static void activate(ExtentTest test,WebDriver driver) throws IOException { + Commons.click(test,driver,By.id("ellipsis-button0")); + Commons.click(test,driver, By.id("Activate0")); + + Commons.click(test,driver,By.id("confirmpopup")); + Commons.click(test,driver, By.id("confirmmessagepopup")); + logger.info("Click activate and Confirm"); + } + + public static void edit(ExtentTest test,WebDriver driver,String data,By by) { + + try { + Commons.click(test,driver,By.id("ellipsis-button0")); + Commons.click(test,driver, By.id("Edit0")); + + Assert.assertNotEquals(data, + driver.findElement(by).getText()); + driver.findElement(by).clear(); + + Commons.enter(test,driver, by, data); + + Commons.click(test,driver, By.id("createButton")); + Commons.click(test,driver, By.id("confirmmessagepopup")); + + 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) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", driver.findElement(by)); + + } + } + + public static void editRes(ExtentTest test,WebDriver driver,String data,By by) throws IOException { + try { + Commons.click(test,driver,By.id("ellipsis-button0")); + Commons.click(test,driver, By.id("Edit0")); + Thread.sleep(3000); + Assert.assertNotEquals(data, + driver.findElement(by).getText()); + Thread.sleep(3000); + driver.findElement(by).clear(); + + Commons.enter(test,driver, by, data); + + Commons.click(test,driver, By.id("createButton")); + + Commons.click(test,driver,By.id("confirmpopup")); + Commons.click(test,driver, By.id("confirmmessagepopup")); + + logger.info("Click Edit and Confirm" + by + data); + }catch (Exception e) { + Reporter.log("

"); + + logger.info(e.getMessage()); + 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 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")); + + Assert.assertNotEquals(data, + driver.findElement(by).getText()); + driver.findElement(by).clear(); + + Commons.enter(test,driver, by, data); + + Commons.click(test,driver, By.xpath("(//*[@id='createButton'])[1]")); + + Commons.click(test,driver,By.id("confirmpopup")); + Commons.click(test,driver, By.id("confirmmessagepopup")); + + 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()); + 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) throws IOException { + + Commons.click(test,driver, By.xpath("//button[@id='createButton']")); + Commons.click(test,driver, By.id("confirmmessagepopup")); + + logger.info("Click create"); + } + public static void createRes(ExtentTest test,WebDriver driver) throws IOException { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Commons.click(test,driver, By.xpath("//button[@id='createButton']")); + Commons.click(test,driver,By.id("confirmpopup")); + Commons.click(test,driver, By.id("confirmmessagepopup")); + logger.info("Click and confirm"); + } + + public static void decommission(ExtentTest test,WebDriver driver) throws IOException { + Commons.click(test,driver,By.id("ellipsis-button0")); + Commons.click(test,driver,By.id("Decommission0")); + + Commons.click(test,driver,By.id("confirmpopup")); + Commons.click(test,driver, By.id("confirmmessagepopup")); + logger.info("Click decommission and confirm"); + } + public static String getPreAppend() + { + String preappend = null; + try { + preappend =ConfigManager.getpreappend(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return preappend; + } + + public static void calendar(String date) throws IOException { + String a=date.replaceAll("/",""); + String mon=""; + if(a.substring(0,2).equals("10")) { + mon= a.substring(0,2); + }else { + mon=a.substring(0,2).replace("0",""); + } + String d=""; + if(a.substring(2,4).equals("10") || a.substring(2,4).equals("20")||a.substring(2,4).equals("30")) { + d=a.substring(2,4); + }else { + d=a.substring(2,4).replace("0",""); + } + + int month=Integer.parseInt(mon) ; + int day=Integer.parseInt(d); + int year=Integer.parseInt(a.substring(4,8)); + try { + Commons.click(test,driver,By.xpath("//*[@class='mat-datepicker-toggle']//button")); + Thread.sleep(500); + Commons.click(test,driver,By.xpath("//*[@class='mat-calendar-arrow']")); + Thread.sleep(500); + Commons.click(test,driver,By.xpath("//*[text()='"+year+"']")); + Thread.sleep(500); + List cli= driver.findElements(By.xpath("//*[@class='mat-calendar-body-cell-content']")); + cli.get(month-1).click(); + Thread.sleep(500); + Commons.click(test,driver,By.xpath("//*[text()='"+day+"']")); + }catch (Exception e) { + Reporter.log("

"); + + // TODO Auto-generated catch block + e.printStackTrace(); + logger.info(e.getMessage()); + } + } + +} diff --git a/admintest/src/main/java/io/mosip/test/admintest/utility/DateUtil.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/DateUtil.java similarity index 87% rename from admintest/src/main/java/io/mosip/test/admintest/utility/DateUtil.java rename to admintest/src/main/java/io/mosip/testrig/adminui/utility/DateUtil.java index db49192b..e120d338 100644 --- a/admintest/src/main/java/io/mosip/test/admintest/utility/DateUtil.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/DateUtil.java @@ -1,4 +1,4 @@ -package io.mosip.test.admintest.utility; +package io.mosip.testrig.adminui.utility; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; 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..14e9c05a --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/EmailableReport.java @@ -0,0 +1,855 @@ +package io.mosip.testrig.adminui.utility; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +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); + Process process = Runtime.getRuntime().exec("git rev-parse --abbrev-ref HEAD"); + + // Read the output of the command + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + String branch = reader.readLine(); + return "Commit Id is: " + properties.getProperty("git.commit.id.abbrev") + " & Branch Name is:" + + 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/ExtentReportManager.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/ExtentReportManager.java new file mode 100644 index 00000000..975142b2 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/ExtentReportManager.java @@ -0,0 +1,26 @@ +package io.mosip.testrig.adminui.utility; + +import com.aventstack.extentreports.ExtentReports; +import com.aventstack.extentreports.ExtentTest; + +import com.aventstack.extentreports.reporter.ExtentSparkReporter; + +public class ExtentReportManager extends BaseClass { + public static ExtentSparkReporter html; + public static ExtentReports extent; + public static String Filepath; + //public static WebDriver driver; + public static ExtentTest test; + public static ExtentReports getReports() { + if(extent==null) { + extent=new ExtentReports(); + extent=new ExtentReports(); + Filepath=System.getProperty("user.dir")+"/extent_reports/"+"admin-ui-report-"+Commons.appendDate+".html"; + html=new ExtentSparkReporter(Filepath); + extent.attachReporter(html); + } + + return extent; + + } +} diff --git a/admintest/src/main/java/io/mosip/test/admintest/utility/JsonUtil.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/JsonUtil.java similarity index 78% rename from admintest/src/main/java/io/mosip/test/admintest/utility/JsonUtil.java rename to admintest/src/main/java/io/mosip/testrig/adminui/utility/JsonUtil.java index 7d14fdbe..3bae1119 100644 --- a/admintest/src/main/java/io/mosip/test/admintest/utility/JsonUtil.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/JsonUtil.java @@ -1,9 +1,10 @@ -package io.mosip.test.admintest.utility; +package io.mosip.testrig.adminui.utility; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; +import io.mosip.testrig.adminui.kernel.util.ConfigManager; import org.apache.commons.io.IOUtils; import java.io.File; @@ -56,26 +57,28 @@ public static T convertJsonintoJava(String jsonString, Class cls) { return payload; } - public static String JsonObjSimpleParsing(String jsonIdentity, String idfield) - throws Exception { - String val =null; - JSONObject json = new JSONObject(jsonIdentity); + - JSONObject identity = json.getJSONObject("identity"); +public static String JsonObjArrayListParsing2(String a) throws Exception { + - JSONArray identityitems = identity.getJSONArray(idfield); + JSONArray jsonArray = new JSONArray(a); - for (int i = 0, size = identityitems.length(); i < size; i++) { - JSONObject idItem = identityitems.getJSONObject(i); - String lang = idItem.getString("language"); - val = idItem.getString("value"); - if (lang.equalsIgnoreCase(JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang"))) - return val; - } - return "sin"; - } - + + for (int i = 0, size = jsonArray.length(); i < size; i++) { + JSONObject idItem = jsonArray.getJSONObject(i); + String lang = idItem.getString("language"); + String val = idItem.getString("value"); + if (lang.equals(ConfigManager.getloginlang())) { + return val; + } + + } + return ""; + + + } /** * Direct String * @@ -124,15 +127,22 @@ public static List JsonObjArrayListParsing(String jsonIdentity, String i public static String readJsonFileText(String document) { String jsonTxt = null; + File f=null; try { - File f = new File(System.getProperty("user.dir") + "\\"+document); + if (TestRunner.checkRunType().equalsIgnoreCase("JAR")) { + f = new File(TestRunner.getResourcePath() + "/" +document); + } else if (TestRunner.checkRunType().equalsIgnoreCase("IDE")) { + + + f = new File(System.getProperty("user.dir") + System.getProperty("path.config")+ "/"+document); + } if (f.exists()) { InputStream is = new FileInputStream(f); jsonTxt = IOUtils.toString(is, "UTF-8"); - System.out.println(jsonTxt); + logger.info(jsonTxt); logger.info("readJsonFileText"); } } catch (Exception e) { diff --git a/admintest/src/main/java/io/mosip/test/admintest/utility/PropertiesUtil.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/PropertiesUtil.java similarity index 78% rename from admintest/src/main/java/io/mosip/test/admintest/utility/PropertiesUtil.java rename to admintest/src/main/java/io/mosip/testrig/adminui/utility/PropertiesUtil.java index 36bc43f5..ab61e310 100644 --- a/admintest/src/main/java/io/mosip/test/admintest/utility/PropertiesUtil.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/PropertiesUtil.java @@ -1,13 +1,16 @@ -package io.mosip.test.admintest.utility; +package io.mosip.testrig.adminui.utility; import java.io.*; import java.util.Properties; +import org.apache.log4j.Logger; + public class PropertiesUtil { - // private static final Logger logger = LogManager.getLogger(PropertiesUtil.class); + private static final Logger logger = Logger.getLogger(PropertiesUtil.class); + public static String getKeyValue(String key) throws IOException { @@ -27,7 +30,7 @@ public static String getKeyValue(String key) throws IOException { public static void main(String[] args) throws IOException { String value = getKeyValue("PropertyFilePath"); - System.out.println(value); + logger.info(value); } } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java new file mode 100644 index 00000000..3d7573d6 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java @@ -0,0 +1,55 @@ +package io.mosip.testrig.adminui.utility; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Base64; + +import org.apache.commons.io.IOUtils; +import org.openqa.selenium.OutputType; +import org.openqa.selenium.TakesScreenshot; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.io.FileHandler; + +//import com.aspose.cells.Workbook; +import com.aventstack.extentreports.ExtentTest; + + + +public class Screenshot { + + public static String ClickScreenshot(WebDriver driver) throws IOException { + TakesScreenshot ss=(TakesScreenshot)driver; + File so=ss.getScreenshotAs(OutputType.FILE); + String path=null; + path = TestRunner.getResourcePath()+ "/Screenshots/"+System.currentTimeMillis()+".png"; + File des=new File(path); + FileHandler.copy(so, des); + FileInputStream fis=new FileInputStream(path); + byte[] bytes =IOUtils.toByteArray(fis); + String base64img=Base64.getEncoder().encodeToString(bytes); + + + return base64img; + + } + // public static String Attachfile(ExtentTest test,String n) { + // try { + // String up="C:\\Users\\jayesh.kharode\\Downloads\\"+n+".csv"; + // Workbook workbook = new Workbook(up); + // String path=System.getProperty("user.dir")+"/Export/"+System.currentTimeMillis()+".png"; + // workbook.save(path); + // FileInputStream fis=new FileInputStream(path); + // byte[] bytes =IOUtils.toByteArray(fis); + // String base64img=Base64.getEncoder().encodeToString(bytes); + // return base64img; + // + // }catch(Exception e) { + // test.fail(e.getMessage()); + // } + // + // return null; + // + // } + // +} diff --git a/admintest/src/main/java/io/mosip/test/admintest/utility/SetTestName.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/SetTestName.java similarity index 81% rename from admintest/src/main/java/io/mosip/test/admintest/utility/SetTestName.java rename to admintest/src/main/java/io/mosip/testrig/adminui/utility/SetTestName.java index abbaf819..8681aad4 100644 --- a/admintest/src/main/java/io/mosip/test/admintest/utility/SetTestName.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/SetTestName.java @@ -1,4 +1,4 @@ -package io.mosip.test.admintest.utility; +package io.mosip.testrig.adminui.utility; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; 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 new file mode 100644 index 00000000..5564039f --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java @@ -0,0 +1,206 @@ +package io.mosip.testrig.adminui.utility; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.testng.TestListenerAdapter; +import org.testng.TestNG; +import org.testng.xml.XmlClass; +import org.testng.xml.XmlSuite; +import org.testng.xml.XmlTest; + +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.*; + + +public class TestRunner { + private static final Logger logger = Logger.getLogger(TestRunner.class); + static TestListenerAdapter tla = new TestListenerAdapter(); + + public static String jarUrl = TestRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath(); + public static String uin=""; + public static String perpetualVid=""; + public static String onetimeuseVid=""; + public static String temporaryVid=""; + + static TestNG testNg; + + public static void main(String[] args) throws Exception { + + AdminTestUtil.initialize(); + DBManager.clearMasterDbData(); + startTestRunner(); + + } + + + public static void startTestRunner() throws Exception { + File homeDir = null; + TestNG runner = new TestNG(); + if(!ConfigManager.gettestcases().equals("")) { + XmlSuite suite = new XmlSuite(); + suite.setName("MySuite"); + suite.addListener("io.mosip.testrig.adminui.utility.EmailableReport"); + XmlClass blocklistedwordsCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.BlockListTest"); + XmlClass bulkUploadCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.BulkUploadTest"); + XmlClass centerCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.CenterTest"); + XmlClass centerTypeCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.CenterTypeTest"); + XmlClass deviceSpecCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.DeviceSpecificationTest"); + XmlClass deviceCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.DeviceTest"); + XmlClass deviceTypesCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.DeviceTypesTest"); + XmlClass documentCategoriesCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.DocumentCategoriesTest"); + XmlClass documentTypesCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.DocumentTypes"); + XmlClass dynamicFieldCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.DynamicFieldTest"); + XmlClass holidaysCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.HolidaysTest"); + XmlClass machineSpecCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.MachineSpecificationTest"); + XmlClass machineCRUD= new XmlClass("io.mosip.testrig.adminui.testcase.MachineTest"); + XmlClass machineTypesCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.MachineTypesTest"); + XmlClass templateCRUD = new XmlClass("io.mosip.testrig.adminui.testcase.TemplateTest"); + + List classes = new ArrayList<>(); + String[] Scenarioname=ConfigManager.gettestcases().split(","); + for(String test:Scenarioname) { + if(test.equals("blocklistedwordsCRUD")) + classes.add(blocklistedwordsCRUD); + + if(test.equals("bulkUploadCRUD")) + classes.add(bulkUploadCRUD); + + if(test.equals("centerCRUD")) + classes.add(centerCRUD); + + if(test.equals("centerTypeCRUD")) + classes.add(centerTypeCRUD); + + if(test.equals("deviceSpecCRUD")) + classes.add(deviceSpecCRUD); + + if(test.equals("deviceCRUD")) + classes.add(deviceCRUD); + + if(test.equals("deviceTypesCRUD")) + classes.add(deviceTypesCRUD); + + if(test.equals("documentCategoriesCRUD")) + classes.add(documentCategoriesCRUD); + + if(test.equals("documentTypesCRUD")) + classes.add(documentTypesCRUD); + + if(test.equals("dynamicFieldCRUD")) + classes.add(dynamicFieldCRUD); + + if(test.equals("holidaysCRUD")) + classes.add(holidaysCRUD); + + if(test.equals("machineSpecCRUD")) + classes.add(machineSpecCRUD); + + if(test.equals("machineCRUD")) + classes.add(machineCRUD); + + if(test.equals("machineTypesCRUD")) + classes.add(machineTypesCRUD); + + if(test.equals("templateCRUD")) + classes.add(templateCRUD); + + } + + + XmlTest test = new XmlTest(suite); + test.setName("MyTest"); + test.setXmlClasses(classes); + + List suites = new ArrayList<>(); + suites.add(suite); + + runner.setXmlSuites(suites); + + }else { + 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); + + + } + // Set other properties and run TestNG + System.getProperties().setProperty("testng.outpur.dir", "testng-report"); + runner.setOutputDirectory("testng-report"); + System.getProperties().setProperty("emailable.report2.name", "ADMINUI-" + BaseTestCaseFunc.environment + + "-run-" + System.currentTimeMillis() + "-report.html"); + + runner.run(); + + DBManager.clearMasterDbData(); + System.exit(0); + } + + + + public static String getGlobalResourcePath() { + if (checkRunType().equalsIgnoreCase("JAR")) { + return new File(jarUrl).getParentFile().getAbsolutePath().toString(); + } else if (checkRunType().equalsIgnoreCase("IDE")) { + String path = new File(TestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath() + .toString(); + if (path.contains("test-classes")) + path = path.replace("test-classes", "classes"); + return path; + } + return "Global Resource File Path Not Found"; + } + + public static String getResourcePath() { + if (checkRunType().equalsIgnoreCase("JAR")) { + return new File(jarUrl).getParentFile().getAbsolutePath().toString()+"/resources/"; + } else if (checkRunType().equalsIgnoreCase("IDE")) { + String path = System.getProperty("user.dir") + System.getProperty("path.config"); + + // String path = new File(TestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath() + // .toString(); + if (path.contains("test-classes")) + path = path.replace("test-classes", "classes"); + return path; + } + return "Global Resource File Path Not Found"; + } + + public static String checkRunType() { + if (TestRunner.class.getResource("TestRunner.class").getPath().toString().contains(".jar")) + return "JAR"; + else + return "IDE"; + } + public static String GetKernalFilename(){ + String path = System.getProperty("env.user"); + String kernalpath=null; + if(System.getProperty("env.user")==null || System.getProperty("env.user").equals("")) { + kernalpath="Kernel.properties"; + + }else { + kernalpath="Kernel_"+path+".properties"; + } + return kernalpath; + } + + +} diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Cc.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Cc.java new file mode 100644 index 00000000..35212150 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Cc.java @@ -0,0 +1,9 @@ +package io.mosip.testrig.adminui.utility.pojo; + +import java.util.ArrayList; + +public class Cc{ + public ArrayList value; + public String html; + public String text; + } \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/From.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/From.java new file mode 100644 index 00000000..3ae553b4 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/From.java @@ -0,0 +1,9 @@ +package io.mosip.testrig.adminui.utility.pojo; + +import java.util.ArrayList; + +public class From{ + public ArrayList value; + public String html; + public String text; + } \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/HeaderLine.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/HeaderLine.java new file mode 100644 index 00000000..fbc82d1a --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/HeaderLine.java @@ -0,0 +1,6 @@ +package io.mosip.testrig.adminui.utility.pojo; + +public class HeaderLine{ + public String key; + public String line; + } \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Headers.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Headers.java new file mode 100644 index 00000000..311dad95 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Headers.java @@ -0,0 +1,4 @@ +package io.mosip.testrig.adminui.utility.pojo; + +public class Headers{ +} \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Root.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Root.java new file mode 100644 index 00000000..111586b3 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Root.java @@ -0,0 +1,19 @@ +package io.mosip.testrig.adminui.utility.pojo; + +import java.util.ArrayList; +import java.util.Date; + +public class Root{ + public ArrayList attachments; + public Headers headers; + public ArrayList headerLines; + public String html; + public String subject; + public Date date; + // @JsonProperty("to") + public To to; + public From from; + public Cc cc; + public String messageId; + public String type; + } \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/To.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/To.java new file mode 100644 index 00000000..845a2cbb --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/To.java @@ -0,0 +1,9 @@ +package io.mosip.testrig.adminui.utility.pojo; + +import java.util.ArrayList; + +public class To{ + public ArrayList value; + public String html; + public String text; + } \ No newline at end of file diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Value.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Value.java new file mode 100644 index 00000000..6efb56c3 --- /dev/null +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/pojo/Value.java @@ -0,0 +1,6 @@ +package io.mosip.testrig.adminui.utility.pojo; + +public class Value{ + public String address; + public String name; + } \ No newline at end of file diff --git a/admintest/src/main/resources/BulkUploadFiles/ara/device_type.csv b/admintest/src/main/resources/BulkUploadFiles/ara/device_type.csv index fad07c85..aed9f671 100644 --- a/admintest/src/main/resources/BulkUploadFiles/ara/device_type.csv +++ b/admintest/src/main/resources/BulkUploadFiles/ara/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 diff --git a/admintest/src/main/resources/BulkUploadFiles/ara/machine_master.csv b/admintest/src/main/resources/BulkUploadFiles/ara/machine_master.csv index 2e614b94..414a37d1 100644 --- a/admintest/src/main/resources/BulkUploadFiles/ara/machine_master.csv +++ b/admintest/src/main/resources/BulkUploadFiles/ara/machine_master.csv @@ -1,2 +1,2 @@ -id,name,macAddress,serialNum,ipAddress,validityDateTime,machineSpecId,publicKey,keyIndex,signPublicKey,signKeyIndex,zoneCode,regCenterId,langCode,isActive -58755,technoABCH,3C-2C-30-D1-E5-65,FB5962911688,192.168.0.408,2022-11-17T09:50:23.637Z,1001,AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDCHegKJ3vRn__8h1knXKiLA8qfO5LebzBlRO2tAcI3HvLyL9rPkVrXWYQ6wAn4VQk015C1hViU-7k752dYE5WUAUbgsxOHvvDPH1t72CNHNj9dyE86wGqR9AtK3yz0yf1IP_xgtWpiaQ2V9t2d3LtgPYWnRuPJbcl97nLXXL6PGfh1mRwsQUi94coEBPMZ9YLLOAFckPuDZt-lEcXIMkj8r0uNwAZUSEvGifTNWbLjC5BRlJBmvScIlptXqIwBaq2kSMVK2X1KbQ6TM8zkA_co4LEAIZfcpMgPn6RdW0yFtcx24HqrCY8v0DHregwoCPPpw8HvB-r5aR09mXG64zsJ,B9:6A:BF:7B:31:4F:9F:52:B1:24:B1:E4:2B:20:DD:5C:6A:BD:43:6E:20:51:5C:EB:73:E0:84:3D:06:5E:2C:45,AAEABAAEAHIAAAAQABQACwgAAAEAAQEAr93rKokeZGIzcCtFX3iyCvwpmfnd9jz0nF__0bxWr0mH8Zs0rhlG6vKRagx31I4CdrLAECOwMZ0r7Y3utTqHqelQE3MJLtboKITOqYRpBkqHSm1jGaEb8a1E9yoJri3tZrBCrAShimrN_SbtS1uKbJUG3cuVuE0gtGLI1d5wMfS_4PSz3RwvZtGHisEb3zbV6SLcJkgcDeMbUD7P25SVJd1xrJybuGIgyeSZxOgLzy1P-qHCiOXiAO9o06fwyIhIYbeZYz5th4rq7Rb6mRK9EWFpLrLvBL0F6USiidl8qNCxxZZFUp3W5xFANVYfRvgLKI33zBYniZ7aTE8PgrYa2w,CE:19:36:5F:89:6D:D3:3E:6D:1B:64:EF:CE:04:F1:14:D5:73:9D:FF:EC:18:FB:CC:DF:C8:74:8E:1E:DC:BF:73,NTH,10002,eng,TRUE +id|name|macAddress|serialNum|ipAddress|validityDateTime|machineSpecId|publicKey|keyIndex|signPublicKey|signKeyIndex|zoneCode|regCenterId|langCode|isActive +5875513|technoABCDE|3C-2C-30-D1-E5-65|FB5962911688|192.168.0.408|2025-11-17T09:50:23.637Z|RESIDENT-1|AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDFEX4nLppAuHIfGzhYn7DR_3wAQkVnrPSFFaiV9TAvN0WHtH_hweGNNjUGYvyaowwmC8jsazufmnIoPisZIFraVQNWCA6N0RhZF_LisoTYDoQSM-ZbCKPxRTFnemtTwXHxQdlVWGUXst_WZIWC0OTSzJHbBg_iXQW1UOXRJL845GFOKjvOPQiEbOZgmoWslkTIAi7bf-AeWdEYuO3bwPf-T5Xxj_xH2-PTinQA_4itRWSrhG5kEU-zQHWGL72SiGzwOOoPnzZZv2X_9djpWGEz1gyNl5ionns8IfuQrvikSEMxm-E6Z9RfKNh2_rEHgnOR4gl0ju5kg_n9tnuUeXXP|18:C3:AB:91:22:88:15:5B:13:F7:67:E9:FE:12:00:34:3C:C9:B3:EE:CB:2F:Y6:32:4B:76:1D:3D:5A:3F:1A:7A|AAEABAAEAHIAAAAQABQACwgAAAEAAQEArjUwXvR8QvkWcp2KOqMhU-tK4YxPHdkkm9IN7azBolMoAs41uR32xp070AW5LfhQokuEskOF_dvRrqHw4JzWMXDRVSpBrW_k-OwLzNfeFvuKQ9JTAXdzKUOXbPgcLY1B5bJe9E7fn-gPKYki35RgwphHraSKaYZ1yELpXiT3KPoWXzDvZE5Lqx317bgMGh2RPkf80alJks-iv-aEPDWlSWE5jr3t68gUYx4r_eixdw6tx1ADGCqK1ZEKCul73ptnR8eWorN1njcxlxUaoECvf3rCEuvfZAprBKSWBEnaFPkfgc9lYSBwtP4YKJHttmPX0Dzc85wa6V19SIwNVEiCsQ|4D:58:8F:EC:C3:CB:0E:8C:D9:27:2E:56:F5:61:65:B8:11:28:89:26:20:4E:67:2Y:35:B1:55:2C:AD:9B:E1:5A|NTH|10002|eng|TRUE diff --git a/admintest/src/main/resources/BulkUploadFiles/eng/device_type.csv b/admintest/src/main/resources/BulkUploadFiles/eng/device_type.csv new file mode 100644 index 00000000..aed9f671 --- /dev/null +++ b/admintest/src/main/resources/BulkUploadFiles/eng/device_type.csv @@ -0,0 +1,2 @@ +code|name|name|description|langCode|isActive +ABhGH1|ABChjJH1|ABChjJH1|For printing Documents|eng|TRUE diff --git a/admintest/src/main/resources/BulkUploadFiles/eng/machine_master.csv b/admintest/src/main/resources/BulkUploadFiles/eng/machine_master.csv index 2e614b94..414a37d1 100644 --- a/admintest/src/main/resources/BulkUploadFiles/eng/machine_master.csv +++ b/admintest/src/main/resources/BulkUploadFiles/eng/machine_master.csv @@ -1,2 +1,2 @@ -id,name,macAddress,serialNum,ipAddress,validityDateTime,machineSpecId,publicKey,keyIndex,signPublicKey,signKeyIndex,zoneCode,regCenterId,langCode,isActive -58755,technoABCH,3C-2C-30-D1-E5-65,FB5962911688,192.168.0.408,2022-11-17T09:50:23.637Z,1001,AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDCHegKJ3vRn__8h1knXKiLA8qfO5LebzBlRO2tAcI3HvLyL9rPkVrXWYQ6wAn4VQk015C1hViU-7k752dYE5WUAUbgsxOHvvDPH1t72CNHNj9dyE86wGqR9AtK3yz0yf1IP_xgtWpiaQ2V9t2d3LtgPYWnRuPJbcl97nLXXL6PGfh1mRwsQUi94coEBPMZ9YLLOAFckPuDZt-lEcXIMkj8r0uNwAZUSEvGifTNWbLjC5BRlJBmvScIlptXqIwBaq2kSMVK2X1KbQ6TM8zkA_co4LEAIZfcpMgPn6RdW0yFtcx24HqrCY8v0DHregwoCPPpw8HvB-r5aR09mXG64zsJ,B9:6A:BF:7B:31:4F:9F:52:B1:24:B1:E4:2B:20:DD:5C:6A:BD:43:6E:20:51:5C:EB:73:E0:84:3D:06:5E:2C:45,AAEABAAEAHIAAAAQABQACwgAAAEAAQEAr93rKokeZGIzcCtFX3iyCvwpmfnd9jz0nF__0bxWr0mH8Zs0rhlG6vKRagx31I4CdrLAECOwMZ0r7Y3utTqHqelQE3MJLtboKITOqYRpBkqHSm1jGaEb8a1E9yoJri3tZrBCrAShimrN_SbtS1uKbJUG3cuVuE0gtGLI1d5wMfS_4PSz3RwvZtGHisEb3zbV6SLcJkgcDeMbUD7P25SVJd1xrJybuGIgyeSZxOgLzy1P-qHCiOXiAO9o06fwyIhIYbeZYz5th4rq7Rb6mRK9EWFpLrLvBL0F6USiidl8qNCxxZZFUp3W5xFANVYfRvgLKI33zBYniZ7aTE8PgrYa2w,CE:19:36:5F:89:6D:D3:3E:6D:1B:64:EF:CE:04:F1:14:D5:73:9D:FF:EC:18:FB:CC:DF:C8:74:8E:1E:DC:BF:73,NTH,10002,eng,TRUE +id|name|macAddress|serialNum|ipAddress|validityDateTime|machineSpecId|publicKey|keyIndex|signPublicKey|signKeyIndex|zoneCode|regCenterId|langCode|isActive +5875513|technoABCDE|3C-2C-30-D1-E5-65|FB5962911688|192.168.0.408|2025-11-17T09:50:23.637Z|RESIDENT-1|AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDFEX4nLppAuHIfGzhYn7DR_3wAQkVnrPSFFaiV9TAvN0WHtH_hweGNNjUGYvyaowwmC8jsazufmnIoPisZIFraVQNWCA6N0RhZF_LisoTYDoQSM-ZbCKPxRTFnemtTwXHxQdlVWGUXst_WZIWC0OTSzJHbBg_iXQW1UOXRJL845GFOKjvOPQiEbOZgmoWslkTIAi7bf-AeWdEYuO3bwPf-T5Xxj_xH2-PTinQA_4itRWSrhG5kEU-zQHWGL72SiGzwOOoPnzZZv2X_9djpWGEz1gyNl5ionns8IfuQrvikSEMxm-E6Z9RfKNh2_rEHgnOR4gl0ju5kg_n9tnuUeXXP|18:C3:AB:91:22:88:15:5B:13:F7:67:E9:FE:12:00:34:3C:C9:B3:EE:CB:2F:Y6:32:4B:76:1D:3D:5A:3F:1A:7A|AAEABAAEAHIAAAAQABQACwgAAAEAAQEArjUwXvR8QvkWcp2KOqMhU-tK4YxPHdkkm9IN7azBolMoAs41uR32xp070AW5LfhQokuEskOF_dvRrqHw4JzWMXDRVSpBrW_k-OwLzNfeFvuKQ9JTAXdzKUOXbPgcLY1B5bJe9E7fn-gPKYki35RgwphHraSKaYZ1yELpXiT3KPoWXzDvZE5Lqx317bgMGh2RPkf80alJks-iv-aEPDWlSWE5jr3t68gUYx4r_eixdw6tx1ADGCqK1ZEKCul73ptnR8eWorN1njcxlxUaoECvf3rCEuvfZAprBKSWBEnaFPkfgc9lYSBwtP4YKJHttmPX0Dzc85wa6V19SIwNVEiCsQ|4D:58:8F:EC:C3:CB:0E:8C:D9:27:2E:56:F5:61:65:B8:11:28:89:26:20:4E:67:2Y:35:B1:55:2C:AD:9B:E1:5A|NTH|10002|eng|TRUE 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 diff --git a/admintest/src/main/resources/BulkUploadFiles/sin/machine_master.csv b/admintest/src/main/resources/BulkUploadFiles/sin/machine_master.csv index 2e614b94..414a37d1 100644 --- a/admintest/src/main/resources/BulkUploadFiles/sin/machine_master.csv +++ b/admintest/src/main/resources/BulkUploadFiles/sin/machine_master.csv @@ -1,2 +1,2 @@ -id,name,macAddress,serialNum,ipAddress,validityDateTime,machineSpecId,publicKey,keyIndex,signPublicKey,signKeyIndex,zoneCode,regCenterId,langCode,isActive -58755,technoABCH,3C-2C-30-D1-E5-65,FB5962911688,192.168.0.408,2022-11-17T09:50:23.637Z,1001,AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDCHegKJ3vRn__8h1knXKiLA8qfO5LebzBlRO2tAcI3HvLyL9rPkVrXWYQ6wAn4VQk015C1hViU-7k752dYE5WUAUbgsxOHvvDPH1t72CNHNj9dyE86wGqR9AtK3yz0yf1IP_xgtWpiaQ2V9t2d3LtgPYWnRuPJbcl97nLXXL6PGfh1mRwsQUi94coEBPMZ9YLLOAFckPuDZt-lEcXIMkj8r0uNwAZUSEvGifTNWbLjC5BRlJBmvScIlptXqIwBaq2kSMVK2X1KbQ6TM8zkA_co4LEAIZfcpMgPn6RdW0yFtcx24HqrCY8v0DHregwoCPPpw8HvB-r5aR09mXG64zsJ,B9:6A:BF:7B:31:4F:9F:52:B1:24:B1:E4:2B:20:DD:5C:6A:BD:43:6E:20:51:5C:EB:73:E0:84:3D:06:5E:2C:45,AAEABAAEAHIAAAAQABQACwgAAAEAAQEAr93rKokeZGIzcCtFX3iyCvwpmfnd9jz0nF__0bxWr0mH8Zs0rhlG6vKRagx31I4CdrLAECOwMZ0r7Y3utTqHqelQE3MJLtboKITOqYRpBkqHSm1jGaEb8a1E9yoJri3tZrBCrAShimrN_SbtS1uKbJUG3cuVuE0gtGLI1d5wMfS_4PSz3RwvZtGHisEb3zbV6SLcJkgcDeMbUD7P25SVJd1xrJybuGIgyeSZxOgLzy1P-qHCiOXiAO9o06fwyIhIYbeZYz5th4rq7Rb6mRK9EWFpLrLvBL0F6USiidl8qNCxxZZFUp3W5xFANVYfRvgLKI33zBYniZ7aTE8PgrYa2w,CE:19:36:5F:89:6D:D3:3E:6D:1B:64:EF:CE:04:F1:14:D5:73:9D:FF:EC:18:FB:CC:DF:C8:74:8E:1E:DC:BF:73,NTH,10002,eng,TRUE +id|name|macAddress|serialNum|ipAddress|validityDateTime|machineSpecId|publicKey|keyIndex|signPublicKey|signKeyIndex|zoneCode|regCenterId|langCode|isActive +5875513|technoABCDE|3C-2C-30-D1-E5-65|FB5962911688|192.168.0.408|2025-11-17T09:50:23.637Z|RESIDENT-1|AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDFEX4nLppAuHIfGzhYn7DR_3wAQkVnrPSFFaiV9TAvN0WHtH_hweGNNjUGYvyaowwmC8jsazufmnIoPisZIFraVQNWCA6N0RhZF_LisoTYDoQSM-ZbCKPxRTFnemtTwXHxQdlVWGUXst_WZIWC0OTSzJHbBg_iXQW1UOXRJL845GFOKjvOPQiEbOZgmoWslkTIAi7bf-AeWdEYuO3bwPf-T5Xxj_xH2-PTinQA_4itRWSrhG5kEU-zQHWGL72SiGzwOOoPnzZZv2X_9djpWGEz1gyNl5ionns8IfuQrvikSEMxm-E6Z9RfKNh2_rEHgnOR4gl0ju5kg_n9tnuUeXXP|18:C3:AB:91:22:88:15:5B:13:F7:67:E9:FE:12:00:34:3C:C9:B3:EE:CB:2F:Y6:32:4B:76:1D:3D:5A:3F:1A:7A|AAEABAAEAHIAAAAQABQACwgAAAEAAQEArjUwXvR8QvkWcp2KOqMhU-tK4YxPHdkkm9IN7azBolMoAs41uR32xp070AW5LfhQokuEskOF_dvRrqHw4JzWMXDRVSpBrW_k-OwLzNfeFvuKQ9JTAXdzKUOXbPgcLY1B5bJe9E7fn-gPKYki35RgwphHraSKaYZ1yELpXiT3KPoWXzDvZE5Lqx317bgMGh2RPkf80alJks-iv-aEPDWlSWE5jr3t68gUYx4r_eixdw6tx1ADGCqK1ZEKCul73ptnR8eWorN1njcxlxUaoECvf3rCEuvfZAprBKSWBEnaFPkfgc9lYSBwtP4YKJHttmPX0Dzc85wa6V19SIwNVEiCsQ|4D:58:8F:EC:C3:CB:0E:8C:D9:27:2E:56:F5:61:65:B8:11:28:89:26:20:4E:67:2Y:35:B1:55:2C:AD:9B:E1:5A|NTH|10002|eng|TRUE diff --git a/admintest/src/main/resources/README b/admintest/src/main/resources/README index 06cebb16..24934f2c 100644 --- a/admintest/src/main/resources/README +++ b/admintest/src/main/resources/README @@ -2,7 +2,7 @@ This Repository is used for Admin Portal Automation. How To run : First Build Jar - Place VM args- java -Dpath=https://env.mosip.net/ -Duserid=user -Dpassword=pwd -jar nameofAdminJar.jar + Place VM args- java -Dpath=https://admin.env.mosip.net/ -DKeyclockURL=https://iam.env.mosip.net -Denv.user=api-internal.env -Denv.endpoint=https://api-internal.dev3.mosip.net -jar nameofAdminJar.jar Place jar in one folder along with src/main/resources files and folder and then run jar TestData Setup: diff --git a/admintest/src/main/resources/Screenshots/1686303740602.png b/admintest/src/main/resources/Screenshots/1686303740602.png new file mode 100644 index 00000000..7b20569f Binary files /dev/null and b/admintest/src/main/resources/Screenshots/1686303740602.png differ diff --git a/admintest/src/main/resources/TestData.json b/admintest/src/main/resources/TestData.json deleted file mode 100644 index 6f7521ab..00000000 --- a/admintest/src/main/resources/TestData.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "identity": { - "BELOW_ARE_KEYWORDS_FOR_HELP": "Below Keys use to put in setExcludedGroups to exclude scenarios eg BL for blocklistedwordsCRUD to ignore this execution", - "ALL": "BL,BU,CTR,CT,DS,D,DT,DOC,DOCT,DF,H,MS,M,MT,T", - "1blocklistedwordsCRUD": "BL", - "2bulkUploadCRUD": "BU", - "3centerCRUD": "CTR", - "4centerTypeCRUD": "CT", - "5deviceSpecCRUD": "DS", - "6deviceCRUD": "D", - "7deviceTypesCRUD": "DT", - "8documentCategoriesCRUD": "DOC", - "9documentTypesCRUD": "DOCT", - "10dynamicFieldCRUD": "DF", - "11holidaysCRUD": "H", - "12machineSpecCRUD": "MS", - "13machineCRUD": "M", - "14machineTypesCRUD": "MT", - "15templateCRUD": "T", - "BELOW_ARE_STATIC_KEYWORDS": "We are using this setExcludedGroups to exclude scenarios", - "setExcludedGroups": "", - "holidayDateCenter": "27/12/2022", - "holidayDate": "12/27/2022", - "loginlang": "ara", - "jsonObjName": "identity", - "bulkwait": "10000", - "publicKey": "ZAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDCHegKJ3vRn__8h1knXKiLA8qfO5LebzBlRO2tAcI3HvLyL9rPkVrXWYQ6wAn4VQk015C1hViU-7k752dYE5WUAUbgsxOHvvDPH1t72CNHNj9dyE86wGqR9AtK3yz0yf1IP_xgtWpiaQ2V9t2d3LtgPYWnRuPJbcl97nLXXL6PGfh1mRwsQUi94coEBPMZ9YLLOAFckPuDZt-lEcXIMkj8r0uNwAZUSEvGifTNWbLjC5BRlJBmvScIlptXqIwBaq2kSMVK2X1KbQ6TM8zkA_co4LEAIZfcpMgPn6RdW0yFtcx24HqrCY8v0DHregwoCPPpw8HvB-r5aR09mXG64zsJ", - "signPublicKey": "AAZABAAEAHIAAAAQABQACwgAAAEAAQEAr93rKokeZGIzcCtFX3iyCvwpmfnd9jz0nF__0bxWr0mH8Zs0rhlG6vKRagx31I4CdrLAECOwMZ0r7Y3utTqHqelQE3MJLtboKITOqYRpBkqHSm1jGaEb8a1E9yoJri3tZrBCrAShimrN_SbtS1uKbJUG3cuVuE0gtGLI1d5wMfS_4PSz3RwvZtGHisEb3zbV6SLcJkgcDeMbUD7P25SVJd1xrJybuGIgyeSZxOgLzy1P-qHCiOXiAO9o06fwyIhIYbeZYz5th4rq7Rb6mRK9EWFpLrLvBL0F6USiidl8qNCxxZZFUp3W5xFANVYfRvgLKI33zBYniZ7aTE8PgrYa2w", - "langcode": [ - { - "language": "tam", - "value": "தமிழ்" - }, - { - "language": "kan", - "value": "ಕನ್ನಡ" - }, - { - "language": "hin", - "value": "हिंदी" - }, - { - "language": "eng", - "value": "English" - }, - { - "language": "fra", - "value": "Français" - }, - { - "language": "ara", - "value": "Arabic" - } - ] - } -} \ No newline at end of file diff --git a/admintest/src/main/resources/chromedriver/chromedriver.exe b/admintest/src/main/resources/chromedriver/chromedriver.exe deleted file mode 100644 index 57070d59..00000000 Binary files a/admintest/src/main/resources/chromedriver/chromedriver.exe and /dev/null differ diff --git a/admintest/src/main/resources/config/Authorization/internalAuthRequest.json b/admintest/src/main/resources/config/Authorization/internalAuthRequest.json new file mode 100644 index 00000000..57aa8f2f --- /dev/null +++ b/admintest/src/main/resources/config/Authorization/internalAuthRequest.json @@ -0,0 +1,13 @@ +{ + "id": "string", + "version": "string", + "requesttime": "2022-01-13T06:07:20.554Z", + "metadata": {}, + "request": { + "userName": "110005", + "password": "mosip", + "appId": "admin", + "clientId": "mosip-admin-client", + "clientSecret": "xyz123" + } +} \ No newline at end of file diff --git a/admintest/src/main/resources/config/Authorization/request.json b/admintest/src/main/resources/config/Authorization/request.json new file mode 100644 index 00000000..57831153 --- /dev/null +++ b/admintest/src/main/resources/config/Authorization/request.json @@ -0,0 +1,11 @@ +{ + "id": "string", + "metadata": {}, + "request": { + "appId": "prereg", + "password": "prereguser", + "userName": "prereguser" + }, + "requesttime": "2019-04-10T10:00:00.000Z", + "version": "string" +} \ No newline at end of file diff --git a/admintest/src/main/resources/config/Authorization/zoneMappingRequest.json b/admintest/src/main/resources/config/Authorization/zoneMappingRequest.json new file mode 100644 index 00000000..c7e5fbce --- /dev/null +++ b/admintest/src/main/resources/config/Authorization/zoneMappingRequest.json @@ -0,0 +1,12 @@ +{ + "id": "string", + "metadata": {}, + "request": { + "zoneCode": "CSB", + "userId": "110123", + "isActive": true, + "langCode": "eng" + }, + "requesttime": "2022-05-09T09:52:11.969Z", + "version": "string" +} \ No newline at end of file diff --git a/admintest/src/main/resources/config/Kernel.properties b/admintest/src/main/resources/config/Kernel.properties new file mode 100644 index 00000000..9aa938a6 --- /dev/null +++ b/admintest/src/main/resources/config/Kernel.properties @@ -0,0 +1,126 @@ +#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=M7CZ6WYMi6oe695u +#IDREPO +mosip_idrepo_app_id=idrepo +mosip_idrepo_client_id=mosip-idrepo-client +mosip_idrepo_client_secret=M7CZ6WYMi6oe695u +keycloak-realm-id=mosip +keycloak-external-url=https://iam.dev.mosip.net +mosip_testrig_client_id=mosip-testrig-client +mosip_testrig_client_secret=mqKN6lkadcA3rG31 +admin +mosip_admin_app_id=admin +admin_password=mosip123 +#actuall user login will be 'adminui-auto12' +admin_userName=admin00 +mosip_admin_client_id=mosip-admin-client +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=ExzIU4M7MYrMZLuz +iam-users-to-create=admin00 +#iam-users-to-create=111997,220005,111992 +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://dev.mosip.net:5432/mosip_ida +#----------------------------------Database properties----------------------------------------------------------# +postgresqlUser=postgresql +db-port=5432 +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=mQi298ZW7p +pms_db_schema=pms +km_db_schema=keymgr +master_db_schema=master +audit_db_schema=audit +ida_db_schema=ida +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=mQi298ZW7p +postgresqlUser=postgresql +db-port=5432 +db-server=dev.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=no +# supported values are 1 to 8 +threadCount=1 +# supported values are 0 ,1, 2 based on number of env languages +langselect=0 +#suppport sin or eng,hin,kan,tam,fra,ara +loginlang=sin +#----------------------------------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.dev.mosip.net/ +apiEnvUser=api-internal.dev +apiInternalEndPoint=https://api-internal.dev.mosip.net + +#----------------------------------Test_data--------------------------------------------- +adminscenariosToExecute= +holidayDateCenter=11/12/2026 +holidayDate=10/12/2026 +validityDate=10/12/2026 +preappend=00 +splitdigit=7 +jsonObjName=identity +bulkwait=10000 +dummyData=blocklistworddata +publicKey=AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDFEX4nLppAuHIfGzhYn7DR_3wAQkVnrPSFFaiV9TAvN0WHtH_hweGNNjUGYvyaowwmC8jsazufmnIoPisZIFraVQNWCA6N0RhZF_LisoTYDoQSM-ZbCKPxRTFnemtTwXHxQdlVWGUXst_WZIWC0OTSzJHbBg_iXQW1UOXRJL845GFOKjvOPQiEbOZgmoWslkTIAi9bf-AeWdEYuO3bwPf-T5Xxj_xH2-PTinQA_4itRWSrhG5kEU-zQHWGL72SiGzwOOoPnzZZv2X_9djpWGEz1gyNl5ionns8IfuQrvikSEMxm-E6Z9RfKNhl_rEHgnOR4gl0ju5kg_n9tnuUeXXP +signPublicKey=AAEABAAEAHIAAAAQABQACwgAAAEAAQEArjUwXvR8QvkWcplKOqMhU-tK4YxPHdkkm9IN7azBolMoAs41uR32xp070AW5LfhQokuEskOF_dvRrqHw4JzWMXDRVSpBrW_k-OwLzNfeFvuKQ9JTAXdzKUOXbPgcLY1B5bJe9E7fn-gPKYki35RgwphHraSKaYZ1yELpXiT3KPoWXzDvZE5Lqx317bgMGh2RPkf80alJks-iv-aEPDWlSWE5jr3t68gUYx4r_eixdw6tx1ADGCqK1ZEKCul73ptnR8eWorN1njcxlxUaoECvf3rCEuvfZAprBKSWBEnaFPkfgc9lYSBwtP4YKJHttmPX0Dzc85wa6V17SIwNVEiCsQ +headless=yes +docker=yes +langcode=[{"language":"tam","value":"தமிழ\uFFFD"},{"language":"kan","value":"\u2022ನ\uFFFDನಡ"},{"language":"hin","value":"hin"},{"language":"eng1","value":"English"},{"language":"eng","value":"English"},{"language":"fra","value":"Français"},{"language":"ara","value":"Arabic"}] + \ No newline at end of file diff --git a/admintest/src/main/resources/config/Kernel11.properties b/admintest/src/main/resources/config/Kernel11.properties new file mode 100644 index 00000000..aef49c61 --- /dev/null +++ b/admintest/src/main/resources/config/Kernel11.properties @@ -0,0 +1,114 @@ +#Kernel resource uris +#Make sure all resource apis are covered +authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd +zoneMappingUrl=/v1/masterdata/zoneuser +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=wJ21F8gXzdy2RM9q +#IDREPO +mosip_idrepo_app_id=idrepo +mosip_idrepo_client_id=mosip-idrepo-client +mosip_idrepo_client_secret=wJ21F8gXzdy2RM9q +keycloak-realm-id=mosip +keycloak-external-url=https://iam.dev3.mosip.net +mosip_testrig_client_id=mosip-testrig-client +mosip_testrig_client_secret=aOCfcQC2dYm2Iotg +admin +mosip_admin_app_id=admin +admin_password=mosip123 +#actuall user login will be 'adminui-auto12' +admin_userName=auto12 +mosip_admin_client_id=mosip-admin-client +mosip_admin_client_secret=7Vvj405Z5a35eAod +#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=SGqovDBMh7McnAxw +iam-users-to-create=auto12,globaladmin +#iam-users-to-create=111997,220005,111992 +iam-users-password=mosip123,mosip123 +roles.auto12=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://dev3.mosip.net:5432/mosip_ida +#----------------------------------Database properties----------------------------------------------------------# +postgresqlUser=postgresql +db-port=5432 +db-server=dev3.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=rLqRHeY4C5 +pms_db_schema=pms +km_db_schema=keymgr +master_db_schema=master +audit_db_schema=audit +ida_db_schema=ida +db-server=dev3.mosip.net +keycloak-external-url=https://iam.dev3.mosip.net +audit_url=jdbc:postgresql://dev3.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=rLqRHeY4C5 +postgresqlUser=postgresql +db-port=5432 +db-server=dev3.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=yes +enableDebug=no +# 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= + +adminPortalPath=https://admin.dev3.mosip.net/ +apiEnvUser=api-internal.dev3 +apiInternalEndPoint=https://api-internal.dev3.mosip.net diff --git a/admintest/src/main/resources/config/Kernel123.properties b/admintest/src/main/resources/config/Kernel123.properties new file mode 100644 index 00000000..fd7f50b2 --- /dev/null +++ b/admintest/src/main/resources/config/Kernel123.properties @@ -0,0 +1,244 @@ +#Kernel resource uris +#Make sure all resource apis are covered +authclientidsecretkeyURL=/v1/authmanager/authenticate/clientidsecretkey +authentication=/v1/authmanager/authenticate/useridPwd +authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd +keycloakAuthURL=/auth/realms/master/protocol/openid-connect/token +auditLog_URI = /v1/auditmanager/audits +CentetMachineUserMappingToMasterData_uri= /v1/masterdata/registrationmachineusermappings +EmailNotification_URI= /v1/notifier/email/send +encrypt_URI=/v1/keymanager/encrypt +decrypt_URI=/v1/keymanager/decrypt +FetchApplication_URI=/v1/masterdata/applicationtypes +FetchApplication_lang_URI=/v1/masterdata/applicationtypes/{langcode} +FetchApplication_id_lang_URI=/v1/masterdata/applicationtypes/{code}/{langcode} +FetchBiometricAttribute_URI=/v1/masterdata/getbiometricattributesbyauthtype/{langcode}/{biometrictypecode} +FetchBiometricAuthType_URI=/v1/masterdata/biometrictypes/{langcode} +FetchBlackListedWord_URI=/v1/masterdata/blacklistedwords/{langcode} +FetchDevice_lang_URI = /v1/masterdata/devices/{languagecode} +FetchDevice_id_lang_URI = /v1/masterdata/devices/{languagecode}/{deviceType} +FetchDeviceSpec_lang_URI = /v1/masterdata/devicespecifications/{langcode} +FetchDeviceSpec_id_lang_URI = /v1/masterdata/devicespecifications/{langcode}/{devicetypecode} +FetchDocumentCategories_URI = /v1/masterdata/documentcategories/{langcode} +FetchDocumentCategories_URI_withcodeAndLangCode = /v1/masterdata/documentcategories/{code}/{langcode} +FetchDocumentTypes_URI = /v1/masterdata/documenttypes/{documentcategorycode}/{langcode} +FetchGenderType_URI = /v1/masterdata/gendertypes +FetchGenderType_id_lang_URI = /v1/masterdata/gendertypes/{langcode} +FetchHolidays_URI = /v1/masterdata/holidays +FetchHolidays_id_URI = /v1/masterdata/holidays/{holidayid} +FetchHolidays_id_lang_URI = /v1/masterdata/holidays/{holidayid}/{langcode} +FetchIDlist_URI = /v1/masterdata/idtypes/{langcode} +FetchLocationHierarchy_URI_withlangCode = /v1/masterdata/locations/{langcode} +FetchLocationHierarchy_URI_locationcode = /v1/masterdata/locations/{locationcode}/{langcode} +FetchLocationHierarchy_URI_hierarchyname = /v1/masterdata/locations/locationhierarchy/{hierarchyname} +FetchMachine_URI=/v1/masterdata/machines +FetchMachine_lang_URI=/v1/masterdata/machines/{langcode} +FetchMachine_id_lang_URI=/v1/masterdata/machines/{id}/{langcode} +FetchMachineHistory_URI = /v1/masterdata/machineshistories/{id}/{langcode}/{effdatetimes} +FetchRegCent_URI = /v1/masterdata/registrationcenters +FetchRegCent_id_lang_URI = /v1/masterdata/registrationcenters/{id}/{langcode} +FetchRegCent_loc_lang_URI = /v1/masterdata/getlocspecificregistrationcenters/{langcode}/{locationcode} +FetchRegCent_hir_name_lang_URI = /v1/masterdata/registrationcenters/{langcode}/{hierarchylevel}/{name} +FetchRegCent_prox_lang_URI = /v1/masterdata/getcoordinatespecificregistrationcenters/{langcode}/{longitude}/{latitude}/{proximitydistance} +FetchRegCentHistory_URI = /v1/masterdata/registrationcentershistory/{registrationCenterId}/{langcode}/{effectiveDate} +FetchRegCentHolidays_URI = /v1/masterdata/getregistrationcenterholidays/{langcode}/{registrationcenterid}/{year} +FetchRegcentMachUserMaping_URI = /v1/masterdata/getregistrationmachineusermappinghistory/{effdtimes}/{registrationcenterid}/{machineid}/{userid} +FetchRejectionReason_URI = /v1/masterdata/packetrejectionreasons/{reasoncategorycode}/{langcode} +FetchTemplate_URI = /v1/masterdata/templates +FetchTemplate_lang_URI = /v1/masterdata/templates/{langcode} +FetchTemplate_id_lang_URI = /v1/masterdata/templates/{langcode}/{templatetypecode} +FetchTitle_URI = /v1/masterdata/title/{langcode} +fetchAllTemplate = /v1/masterdata/templates/templatetypecodes/{code} +getApplicantType = /v1/masterdata/getApplicantType +fetchDeviceHistory = /v1/masterdata/deviceshistories/{id}/{langcode}/{effdatetimes} +getDocType_DocCatByAppID = /v1/masterdata/applicanttype/{applicantId}/languages +getDocTypeDocCatByLangCode = /v1/masterdata/validdocuments/{languagecode} +fetchImmediateChildLocation = /v1/masterdata/locations/immediatechildren/{locationcode}/{langcode} +getIndividualType = /v1/masterdata/individualtypes +getRoles = /v1/syncdata/roles +fetchRegCenter = /v1/masterdata/registrationcenters/validate/{id}/{langCode}/{timestamp} +fetchRegistrationCenterDeviceHistory = /v1/masterdata/registrationcenterdevicehistory/{regcenterid}/{deviceid}/{effdatetimes} +getusersBasedOnRegCenter = /v1/syncdata/userdetails/{regid} +licKeyGenerator = /v1/keymanager/license/generate +mapLicenseKey = /v1/keymanager/license/permission +fetchmapLicenseKey = /v1/keymanager/license/permission +OTPGeneration = /v1/otpmanager/otp/generate +OTPValidation = /v1/otpmanager/otp/validate +otpNotifier = /v1/otpnotifier/otp/send +RIDGenerator_URI = /v1/ridgenerator/generate/rid/{centerid}/{machineid} +SmsNotification_URI = /v1/notifier/sms/send +syncConf = /v1/syncdata/configs +fetchIncrementalData = /v1/syncjob/syncjobdef +fetchmasterdata = /v1/syncdata/masterdata +fetchmasterdatawithRID = /v1/syncdata/masterdata/{regcenterId} +SyncPublicKeyToRegClient_URI = /v1/keymanager/publickey/ +uingenerator = /v1/idgenerator/uin +validateGenderByName = /v1/masterdata/gendertypes/validate/{gendername} +validateLocationByName = /v1/masterdata/locations/validate/{locationname} +tokenIdGenerator_URI = /v1/keymanager/{uin}/{partnercode} +getRIDByUserId = /v1/authmanager/rid/{appid}/{userid} +syncMdatawithKeyIndex = /v1/syncdata/clientsettings +syncMdatawithRegCentIdKeyIndex = /v1/syncdata/clientsettings/{regcenterid} +uploadpublickey = /v1/syncdata/tpm/publickey +getUserHistory = /v1/masterdata/users/{id}/{eff_dtimes} +sendOtp = /v1/authmanager/authenticate/sendotp +useridOTP = /v1/authmanager/authenticate/useridOTP +#preregSendOtp = /preregistration/v1/login/sendOtp +preregSendOtp = /preregistration/v1/login/sendOtp/langcode +preregValidateOtp = /preregistration/v1/login/validateOtp +zoneMappingUrl=/v1/masterdata/zoneuser +zoneNameUrl=/v1/masterdata/zones/zonename +zoneMappingActivateUrl=/v1/masterdata/zoneuser +userCenterMappingUrl=/v1/masterdata/usercentermapping +bulkUploadUrl=/v1/admin/bulkupload +mountPath=/home/mosip/mountvolume +packetUtilityBaseUrl=http://localhost:8080 +mountPathForScenario=D:/centralized/mountvolume +# OTP Details +OTPTimeOut = 181 +attempt = 10 +ConfigParameters=mosip.kernel.rid.length,mosip.kernel.uin.length,mosip.kernel.sms.country.code,mosip.kernel.sms.number.length,mosip.kernel.otp.default-length,mosip.kernel.otp.expiry-time,mosip.kernel.otp.key-freeze-time,mosip.kernel.otp.validation-attempt-threshold,mosip.kernel.otp.min-key-length,mosip.kernel.otp.max-key-length,mosip.kernel.licensekey.length,mosip.supported-languages +#Below users are used for authentication +#PARTNER +#Dont change the partner id +pmsAuthInternal=true +mosip_pms_app_id=partner +partner_password=mosip123 +partner_userName=111997 +partner_user_password=mosip123 +mosip_pms_client_id=mosip-pms-client +mosip_pms_client_secret=Tkx3jw9INusggEDW +policytest_password=mosip123 +policytest_userName=111998 +#RESIDENT & IDA +mosip_resident_app_id=resident +mosip_resident_client_id=mosip-resident-client +mosip_resident_client_secret=UGq78khkAst6fjbn +#IDREPO +mosip_idrepo_app_id=idrepo +mosip_idrepo_client_id=mosip-idrepo-client +mosip_idrepo_client_secret=wJ21F8gXzdy2RM9q +#admin +mosip_admin_app_id=admin +admin_password=mosip123 +admin_userName=auto +mosip_admin_client_id=mosip-admin-client +mosip_admin_client_secret=7Vvj405Z5a35eAod +#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=SGqovDBMh7McnAxw +#mparter_mobile +mpartner_default_mobile_client_id=mpartner-default-mobile +mpartner_default_mobile_secret=Gif10hl5sFH6WCUi + + + + +#This credentials are used to execute auth demo service +AuthClientID=mosip-resident-client +AuthClientSecret=UGq78khkAst6fjbn +AuthAppID=resident +mosip_hotlist_app_id=hotlist +mosip_hotlist_client_id=mosip-hotlist-client +mosip_hotlist_client_secret=8Q1SLvLXt5Cwd9QN +###Keycloak_User-Creation_Properties +#Dontchange the partner user_111997 + +new_Resident_User=111995 +new_Resident_Password=mosip123 +new_Resident_Role=default-roles-mosip,PARTNER_ADMIN +roles.111995=PARTNER_ADMIN,default-roles-mosip + + +keycloak_UserName = admin +keycloak_Password = oY6ijJuIL8 + +keycloak-external-url=https://iam.dev3.mosip.net +mosip_testrig_client_id=mosip-testrig-client +mosip_testrig_client_secret=aOCfcQC2dYm2Iotg + +keycloak-realm-id=mosip +iam-users-to-create=auto,globaladmin +#iam-users-to-create=111997,220005,111992 +iam-users-password=mosip123,mosip123 +roles.auto=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 +##DB_Connectivity +driver_class=org.postgresql.Driver +pool_size=1 +dialect=org.hibernate.dialect.PostgreSQLDialect +show_sql=true +current_session_context_class=thread +#audit details +audit_url=jdbc:postgresql://dev3.mosip.net:5432/mosip_audit +audit_username=postgres +audit_password=rLqRHeY4C5 +audit_default_schema=audit +#ida-partner details +DB_PORT= +installation-domain= +partner_url=jdbc:postgresql://dev3.mosip.net:5432/mosip_ida +partner_username=postgres +partner_password=rLqRHeY4C5 +partner_default_schema=partner +reportLogPath=automationLogAndReport +#--------minio proprties---------------- +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=no +# supported values are 1 to 8 +threadCount=1 +# supported values are 0 ,1, 2 based on number of env languages +langselect=0 +#----------------------------------Database properties----------------------------------------------------------# +postgresqlUser=postgresql +db-port=5432 +db-server=dev3.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=rLqRHeY4C5 +pms_db_schema=pms +km_db_schema=keymgr +master_db_schema=master +audit_db_schema=audit +ida_db_schema=ida + +#----------------------------------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= +preconfiguredOtp=111111 +usePreConfiguredOtp=true \ No newline at end of file diff --git a/admintest/src/main/resources/config/Kernel_dev.properties b/admintest/src/main/resources/config/Kernel_dev.properties new file mode 100644 index 00000000..873efbd3 --- /dev/null +++ b/admintest/src/main/resources/config/Kernel_dev.properties @@ -0,0 +1,108 @@ +#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=M7CZ6WYMi6oe695u +#IDREPO +mosip_idrepo_app_id=idrepo +mosip_idrepo_client_id=mosip-idrepo-client +mosip_idrepo_client_secret=M7CZ6WYMi6oe695u +keycloak-realm-id=mosip +keycloak-external-url=https://iam.dev.mosip.net +mosip_testrig_client_id=mosip-testrig-client +mosip_testrig_client_secret=mqKN6lkadcA3rG31 +admin +mosip_admin_app_id=admin +admin_password=mosip123 +#actuall user login will be 'adminui-auto12' +admin_userName=admin00 +mosip_admin_client_id=mosip-admin-client +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=ExzIU4M7MYrMZLuz +iam-users-to-create=admin00 +#iam-users-to-create=111997,220005,111992 +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://dev.mosip.net:5432/mosip_ida +#----------------------------------Database properties----------------------------------------------------------# +postgresqlUser=postgresql +db-port=5432 +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=mQi298ZW7p +pms_db_schema=pms +km_db_schema=keymgr +master_db_schema=master +audit_db_schema=audit +ida_db_schema=ida +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=mQi298ZW7p +postgresqlUser=postgresql +db-port=5432 +db-server=dev.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=no +# 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.dev.mosip.net/ +apiEnvUser=api-internal.dev +apiInternalEndPoint=https://api-internal.dev.mosip.net + \ No newline at end of file diff --git a/admintest/src/main/resources/config/Kernel_qa-triad.properties b/admintest/src/main/resources/config/Kernel_qa-triad.properties new file mode 100644 index 00000000..71218bb5 --- /dev/null +++ b/admintest/src/main/resources/config/Kernel_qa-triad.properties @@ -0,0 +1,106 @@ +#Kernel resource uris +#Make sure all resource apis are covered +authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd +zoneMappingUrl=/v1/masterdata/zoneuser +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=uqQIwIcrlz5oElb5 +#IDREPO +mosip_idrepo_app_id=idrepo +mosip_idrepo_client_id=mosip-idrepo-client +mosip_idrepo_client_secret=uqQIwIcrlz5oElb5 +keycloak-realm-id=mosip +keycloak-external-url=https://iam.qa-triad.mosip.net +mosip_testrig_client_id=mosip-testrig-client +mosip_testrig_client_secret=84VRHBpEVx4AVB7n +admin +mosip_admin_app_id=admin +admin_password=mosip123 +#actuall user login will be 'adminui-auto12' +admin_userName=auto122 +mosip_admin_client_id=mosip-admin-client +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=IviZHMzm4lboHBDJ +iam-users-to-create=auto122,globaladmin +#iam-users-to-create=111997,220005,111992 +iam-users-password=mosip123,mosip123 +roles.auto122=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 +#----------------------------------Database properties----------------------------------------------------------# +postgresqlUser=postgresql +db-port=5432 +db-server=qa-triad.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 +pms_db_schema=pms +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 +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 +postgresqlUser=postgresql +db-port=5432 +db-server=qa-triad.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=no +# 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= +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 diff --git a/admintest/src/main/resources/config/Kernel_qa-upgrade-f1.properties b/admintest/src/main/resources/config/Kernel_qa-upgrade-f1.properties new file mode 100644 index 00000000..d15724a7 --- /dev/null +++ b/admintest/src/main/resources/config/Kernel_qa-upgrade-f1.properties @@ -0,0 +1,128 @@ +#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=jsNIZfKZY1P6xWjn +#IDREPO +mosip_idrepo_app_id=idrepo +mosip_idrepo_client_id=mosip-idrepo-client +mosip_idrepo_client_secret=jsNIZfKZY1P6xWjn +keycloak-realm-id=mosip +keycloak-external-url=https://iam.qa-upgrade-f1.mosip.net +mosip_testrig_client_id=mosip-testrig-client +mosip_testrig_client_secret=q7OD54mSVPQDwVfJ +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=IkWnflKaMujZEjdZ +#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=q3ynuI9KA1SEubcX +iam-users-to-create=admin1 +#iam-users-to-create=111997,220005,111992 +iam-users-password=mosip123,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://qa-upgrade-f1.mosip.net:5432/mosip_ida +#----------------------------------Database properties----------------------------------------------------------# +postgresqlUser=postgresql +db-port=5432 +db-server=qa-upgrade-f1.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=MDBlQAuhj6 +pms_db_schema=pms +km_db_schema=keymgr +master_db_schema=master +audit_db_schema=audit +ida_db_schema=ida +db-server=qa-upgrade-f1.mosip.net +keycloak-external-url=https://iam.qa-upgrade-f1.mosip.net +audit_url=jdbc:postgresql://qa-upgrade-f1.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=MDBlQAuhj6 +postgresqlUser=postgresql +db-port=5432 +db-server=qa-upgrade-f1.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=no +# supported values are 1 to 8 +threadCount=1 +# supported values are 0 ,1, 2 based on number of env languages +langselect=0 +#suppport sin or eng,hin,kan,tam,fra,ara +loginlang=sin +#----------------------------------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.qa-upgrade-f1.mosip.net/ +apiEnvUser=api-internal.qa-upgrade-f1 +apiInternalEndPoint=https://api-internal.qa-upgrade-f1.mosip.net +#----------------------------------Test_data--------------------------------------------- +adminscenariosToExecute=centerCRUD,centerCRUD +holidayDateCenter=11/12/2026 +holidayDate=10/12/2026 +validityDate=10/12/2026 +preappend=00 +splitdigit=7 +jsonObjName=identity +bulkwait=10000 +dummyData=blocklistwordss +publicKey=AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDFEX4nLppAuHIfGzhYn7DR_3wAQkVnrPSFFaiV9TAvN0WHtH_hweGNNjUGYvyaowwmC8jsazufmnIoPisZIFraVQNWCA6N0RhZF_LisoTYDoQSM-ZbCKPxRTFnemtTwXHxQdlVWGUXst_WZIWC0OTSzJHbBg_iXQW1UOXRJL845GFOKjvOPQiEbOZgmoWslkTIAi9bf-AeWdEYuO3bwPf-T5Xxj_xH2-PTinQA_4itRWSrhG5kEU-zQHWGL72SiGzwOOoPnzZZv2X_9djpWGEz1gyNl5ionns8IfuQrvikSEMxm-E6Z9RfKNhl_rEHgnOR4gl0ju5kg_n9tnuUeXXP +signPublicKey=AAEABAAEAHIAAAAQABQACwgAAAEAAQEArjUwXvR8QvkWcplKOqMhU-tK4YxPHdkkm9IN7azBolMoAs41uR32xp070AW5LfhQokuEskOF_dvRrqHw4JzWMXDRVSpBrW_k-OwLzNfeFvuKQ9JTAXdzKUOXbPgcLY1B5bJe9E7fn-gPKYki35RgwphHraSKaYZ1yELpXiT3KPoWXzDvZE5Lqx317bgMGh2RPkf80alJks-iv-aEPDWlSWE5jr3t68gUYx4r_eixdw6tx1ADGCqK1ZEKCul73ptnR8eWorN1njcxlxUaoECvf3rCEuvfZAprBKSWBEnaFPkfgc9lYSBwtP4YKJHttmPX0Dzc85wa6V17SIwNVEiCsQ +headless=yes +docker=yes +langcode=[{"language":"tam","value":"தமிழ௜uFFFD"},{"language":"kan","value":"ಜu2022ನ೜uFFFDನಡ"},{"language":"hin","value":"hin"},{"language":"eng1","value":"English"},{"language":"eng","value":"English"},{"language":"fra","value":"Français"},{"language":"ara","value":"Arabic"}] + + \ No newline at end of file diff --git a/admintest/src/main/resources/config/Kernel_qa-upgrade3.properties b/admintest/src/main/resources/config/Kernel_qa-upgrade3.properties new file mode 100644 index 00000000..ed86e2f9 --- /dev/null +++ b/admintest/src/main/resources/config/Kernel_qa-upgrade3.properties @@ -0,0 +1,106 @@ +#Kernel resource uris +#Make sure all resource apis are covered +authenticationInternal=/v1/authmanager/authenticate/internal/useridPwd +zoneMappingUrl=/v1/masterdata/zoneuser +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=1goKToWjb8t6nFeW +#IDREPO +mosip_idrepo_app_id=idrepo +mosip_idrepo_client_id=mosip-idrepo-client +mosip_idrepo_client_secret=1goKToWjb8t6nFeW +keycloak-realm-id=mosip +keycloak-external-url=https://iam.qa-upgrade3.mosip.net +mosip_testrig_client_id=mosip-testrig-client +mosip_testrig_client_secret=F0nqSasG5fWPpBvG +admin +mosip_admin_app_id=admin +admin_password=mosip123 +#actuall user login will be 'adminui-auto12' +admin_userName=auto126 +mosip_admin_client_id=mosip-admin-client +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=zPnLp4cpbpl3z6LX +iam-users-to-create=auto126 +#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.globaladmin=GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip +partner_url=jdbc:postgresql://qa-upgrade3.mosip.net:5432/mosip_ida +#----------------------------------Database properties----------------------------------------------------------# +postgresqlUser=postgresql +db-port=5432 +db-server=qa-upgrade3.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 +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 +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 +postgresqlUser=postgresql +db-port=5432 +db-server=qa-upgrade3.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=no +# 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= +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 diff --git a/admintest/src/main/resources/config/application.properties b/admintest/src/main/resources/config/application.properties new file mode 100644 index 00000000..53517d97 --- /dev/null +++ b/admintest/src/main/resources/config/application.properties @@ -0,0 +1,6 @@ +# common properties + +preregLoginConfigUrl=/preregistration/v1/login/config +masterSchemaURL=/v1/masterdata/idschema/latest +addIdentityURL=/idrepository/v1/identity/ +idRepoGenVidURL=/idrepository/v1/vid \ 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..9923e9a3 --- /dev/null +++ b/admintest/src/main/resources/config/kernel_dev2.properties @@ -0,0 +1,128 @@ +#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' + +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=admin00 +#iam-users-to-create=111997,220005,111992 +iam-users-password=mosip123 +roles.admin123=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 +#suppport sin or eng,hin,kan,tam,fra,ara +loginlang=sin +#----------------------------------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 + +#----------------------------------Test_data--------------------------------------------- +adminscenariosToExecute=bulkUploadCRUD +holidayDateCenter=11/12/2026 +holidayDate=10/12/2025 +validityDate=10/12/2026 +preappend=00 +splitdigit=7 +jsonObjName=identity +bulkwait=10000 +dummyData=blocklistwordss +publicKey=AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9aaUtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDFEX4nLppAuHIfGzhYn7DR_3wAQkVnrPSFFaiV9TAvN0WHtH_hweGNNjUGYvyaowwmC8jsazufmnIoPisZIFraVQNWCA6N0RhZF_LisoTYDoQSM-ZbCKPxRTFnemtTwXHxQdlVWGUXst_WZIWC0OTSzJHbBg_iXQW1UOXRJL845GFOKjvOPQiEbOZgmoWslkTIAi9bf-AeWdEYuO3bwPf-T5Xxj_xH2-PTinQA_4itRWSrhG5kEU-zQHWGL72SiGzwOOoPnzZZv2X_9djpWGEz1gyNl5ionns8IfuQrvikSEMxm-E6Z9RfKNhl_rEHgnOR4gl0ju5kg_n9tnuUeXXP +signPublicKey=AAEABAAEAHIAAAAQABQACwgAAAEAAQEArjUwXvR8QvkWcplKOqMhU-tK4YxPHdkkm9IN7azBolMoAs41uR32xp070AW5LfhQokuEskOF_dvRrqHw4JzWMXDRVSpBrW_k-OwLzNfeFvuKQ9JTAXdzKUOXbPgcLY1B5bJe9E7fn-gPKYki35RgwphHraSKaYZ1yELpXiT3KPoWXzDvZE5Lqx317bgMGh2RPkf80alJks-iv-aEPDWlSWE5jr3t68gUYx4r_eixdw6tx1ADGCqK1ZEKCul73ptnR8eWorN1njcxlxUaoECvf3rCEuvfZAprBKSWBEnaFPkfgc9lYSBwtP4YKJHttmPX0Dzc85wa6V17SIwNVEiCsQ +headless=no +docker=yes +langcode=[{"language":"tam","value":"தமிழ\uFFFD"},{"language":"kan","value":"\u2022ನ\uFFFDನಡ"},{"language":"hin","value":"hin"},{"language":"eng1","value":"English"},{"language":"eng","value":"English"},{"language":"fra","value":"Français"},{"language":"ara","value":"Arabic"}] + \ No newline at end of file diff --git a/admintest/src/main/resources/delete.sql b/admintest/src/main/resources/delete.sql new file mode 100644 index 00000000..6e3afb3f --- /dev/null +++ b/admintest/src/main/resources/delete.sql @@ -0,0 +1,44 @@ +delete from applicant_valid_document where cr_by ='adminui-auto10'; +delete from appl_form_type where cr_by ='adminui-auto10'; +delete from biometric_attribute where cr_by ='adminui-auto10'; +delete from biometric_type where cr_by ='adminui-auto10'; +delete from blocklisted_words where cr_by ='adminui-auto10'; +delete from daysofweek_list where cr_by ='adminui-auto10'; +delete from device_master where cr_by ='adminui-auto10'; +delete from device_master_h where cr_by ='adminui-auto10'; +delete from device_spec where cr_by ='adminui-auto10'; +delete from device_type where cr_by ='adminui-auto10'; +delete from doc_category where cr_by ='adminui-auto10'; +delete from doc_type where cr_by ='adminui-auto10'; +delete from dynamic_field where cr_by ='adminui-auto10'; +delete from gender where cr_by ='adminui-auto10'; +delete from id_type where cr_by ='adminui-auto10'; +delete from individual_type where cr_by ='adminui-auto10'; +delete from language where cr_by ='adminui-auto10'; +delete from location where cr_by ='adminui-auto10'; +delete from loc_hierarchy_list where cr_by ='adminui-auto10'; +delete from loc_holiday where cr_by ='adminui-auto10'; +delete from machine_master where cr_by ='adminui-auto10'; +delete from machine_master_h where cr_by ='adminui-auto10'; +delete from machine_spec where cr_by ='adminui-auto10'; +delete from machine_type where cr_by ='adminui-auto10'; +delete from module_detail where cr_by ='adminui-auto10'; +delete from reason_category where cr_by ='adminui-auto10'; +delete from reason_list where cr_by ='adminui-auto10'; +delete from registration_center where cr_by ='adminui-auto10'; +delete from registration_center_h where cr_by ='adminui-auto10'; +delete from reg_center_type where cr_by ='adminui-auto10'; +delete from reg_device_type where cr_by ='adminui-auto10'; +delete from reg_exceptional_holiday where cr_by ='adminui-auto10'; +delete from reg_working_nonworking where cr_by ='adminui-auto10'; +delete from template where cr_by ='adminui-auto10'; +delete from template_file_format where cr_by ='adminui-auto10'; +delete from template_type where cr_by ='adminui-auto10'; +delete from title where cr_by ='adminui-auto10'; +delete from user_detail where cr_by ='adminui-auto10'; +delete from user_detail_h where cr_by ='adminui-auto10'; +delete from valid_document where cr_by ='adminui-auto10'; +delete from zone where cr_by ='adminui-auto10'; +delete from zone_user where cr_by ='adminui-auto10'; +delete from zone_user_h where cr_by ='adminui-auto10'; +delete from blocklisted_words where cr_by ='adminui-auto10'; \ No newline at end of file diff --git a/admintest/src/main/resources/logback.xml b/admintest/src/main/resources/logback.xml index 37c88d0a..9946619a 100644 --- a/admintest/src/main/resources/logback.xml +++ b/admintest/src/main/resources/logback.xml @@ -19,9 +19,9 @@ - + - \ 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..1a853b3d --- /dev/null +++ b/admintest/src/main/resources/testngFile/testng.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/automation/pom.xml b/automation/pom.xml deleted file mode 100644 index d68911ac..00000000 --- a/automation/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - 4.0.0 - admin-ui-automation - admin-ui-automation - 0.0.1-SNAPSHOT - admin-ui-automation - admin-ui-automation - - 11 - 11 - - - - - - - - selenium-tests - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12.4 - - - testng.xml - - - - - - - - - - - - - - org.seleniumhq.selenium - selenium-java - 3.141.59 - - - - - - org.json - json - 20210307 - - - - - com.fasterxml.jackson.core - jackson-core - 2.12.5 - - - - com.fasterxml.jackson.core - jackson-databind - 2.12.5 - - - - - - org.awaitility - awaitility - 4.0.3 - - - ch.qos.logback - logback-core - 1.2.6 - - - org.slf4j - slf4j-api - 1.7.30 - - - - - ch.qos.logback - logback-classic - 1.2.6 - - - com.paulhammant - ngwebdriver - 1.1.5 - - - - - - - - - org.testng - testng - 7.1.0 - - - - - - commons-io - commons-io - 2.6 - - - - - - - - - - - org.apache.maven.plugins - maven-assembly-plugin - 3.1.1 - - - jar-with-dependencies - - - - true - automation.utility.TestRunner - - - - - - make-assembly - package - - single - - - - - - - - \ No newline at end of file diff --git a/automation/src/main/java/automation/testcase/BlockListTest.java b/automation/src/main/java/automation/testcase/BlockListTest.java deleted file mode 100644 index da9d031e..00000000 --- a/automation/src/main/java/automation/testcase/BlockListTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package automation.testcase; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class BlockListTest extends BaseClass { - - @Test(groups = "BL") - public void blocklistedwordsCRUD() { - - String idBlocklisted="admin/masterdata/blocklisted-words/view"; - Commons.click(driver, By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver, By.id(idBlocklisted)); - - Commons.click(driver, By.id("Create")); //FIX - Commons.enter(driver, By.id("word"), data); - Commons.enter(driver, By.id("description"), data); - - - Commons.create(driver); - Commons.filter(driver, By.id("word"), data); - - - Commons.edit(driver,data+1,By.id("word")); - Commons.filter(driver, By.id("word"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("word")); - Commons.filter(driver, By.id("word"), data+2); - Commons.deactivate(driver); - - - } -} diff --git a/automation/src/main/java/automation/testcase/BulkUploadTest.java b/automation/src/main/java/automation/testcase/BulkUploadTest.java deleted file mode 100644 index b890e1d8..00000000 --- a/automation/src/main/java/automation/testcase/BulkUploadTest.java +++ /dev/null @@ -1,123 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -import org.testng.ITest; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; -import automation.utility.PropertiesUtil; -import automation.utility.SetTestName; - -import java.awt.AWTException; -import java.awt.Robot; -import java.awt.Toolkit; -import java.awt.datatransfer.StringSelection; -import java.awt.event.KeyEvent; -import java.lang.reflect.Method; -public class BulkUploadTest extends BaseClass { -/*implements ITest{ - - private String newTestName = ""; - - private void setTestName(String newTestName){ - this.newTestName = newTestName; - } - - public String getTestName() { - - return newTestName; - } - - - @BeforeMethod(alwaysRun=true) - public void getTheNameFromParemeters(Method method, Object [] parameters){ - - SetTestName setTestName = method.getAnnotation(SetTestName.class); - String testCaseName = (String) parameters[setTestName.idx()]; - setTestName(testCaseName+"BulkUpload"); - } - - @SetTestName(idx=0) */ - - @Test (dataProvider = "data-provider",groups = "BU") - public void bulkUploadCRUD(String table) throws Exception { - - - Commons.click(driver,By.id("admin/bulkupload")); - Commons.click(driver,By.xpath("//a[@href='#/admin/bulkupload/masterdataupload']")); - - for(int count=0;count<=2;count++) { - Commons.click(driver,By.id("Upload Data")); - - - - if(count==0) Commons.dropdown(driver,By.id("operation"),By.id("Insert")); - if(count==1) Commons.dropdown(driver,By.id("operation"),By.id("Update")); - if(count==2) Commons.dropdown(driver,By.id("operation"),By.id("Delete")); - - Commons.dropdown(driver,By.id("tableName"),By.id(table)); - // Commons.click(driver,By.xpath("//div[@class='custom-file-input']")); - Commons.click(driver,By.xpath("//div[@class='custom-file-input']")); - - - String filePath = System.getProperty("user.dir") + "\\BulkUploadFiles\\"+ PropertiesUtil.getKeyValue("langcode")+"\\"+table+".csv"; - StringSelection ss = new StringSelection(filePath); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null); - - Robot robot = new Robot(); - - robot.delay(250); - - - robot.keyPress(KeyEvent.VK_ENTER); - robot.keyRelease(KeyEvent.VK_ENTER); - robot.keyPress(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_V); - robot.keyRelease(KeyEvent.VK_V); - robot.delay(250); - robot.keyRelease(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_ENTER); - robot.delay(250); - robot.keyRelease(KeyEvent.VK_ENTER); - robot.delay(250); - - Commons.click(driver,By.xpath("//button[@id='createButton']")); - Commons.click(driver,By.id("confirmpopup")); - - String divText=driver.findElement(By.xpath("//div[@class='mat-dialog-content']//div")).getText(); - String divTextArr[]=divText.split(":"); - System.out.println(divTextArr[1].trim()); - - Commons.click(driver,By.id("confirmmessagepopup")); //DONE - Thread.sleep(Long.parseLong(PropertiesUtil.getKeyValue("bulkwait"))); - - String transId=driver.findElement(By.xpath("//table[@class='mat-table']//tr[2]//td[1]")).getText(); - String status=driver.findElement(By.xpath("//table[@class='mat-table']//tr[2]//td[5]")).getText(); - Assert.assertTrue(transId.equals(divTextArr[1].trim())); - Assert.assertTrue(status.equalsIgnoreCase("COMPLETED"),"Status Should be COMPLETED"); -} - } -} diff --git a/automation/src/main/java/automation/testcase/CenterTest.java b/automation/src/main/java/automation/testcase/CenterTest.java deleted file mode 100644 index 525d8c74..00000000 --- a/automation/src/main/java/automation/testcase/CenterTest.java +++ /dev/null @@ -1,100 +0,0 @@ -package automation.testcase; -import static org.testng.Assert.assertNotEquals; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; -public class CenterTest extends BaseClass{ - - @Test(groups = "CTR") - - public void centerCRUD() throws InterruptedException { - - - Commons.click(driver,By.id("admin/resources")); - - Commons.click(driver,By.id("/admin/resources/centers")); - - Commons.click(driver, By.id("Create Center")); - /* - * Select Registration Center Type - */ - - /** - * centerTypeCode dropdown - */ - Commons.enter(driver, By.id("name"), data); - - Commons.dropdown(driver,By.id("centerTypeCode")); - Commons.enter(driver, By.id("contactPerson"),data); - Commons.enter(driver,By.id("contactPhone"),data); - - Commons.enter(driver,By.id("longitude"),"1.1234"); - Commons.enter(driver,By.id("latitude"),"2.2345"); - Commons.enter(driver,By.id("addressLine1"),data); - Commons.enter(driver,By.id("addressLine2"),data); - Commons.enter(driver,By.id("addressLine3"),data); - - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[1]")); - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[2]")); - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[3]")); - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[4]")); - Commons.dropdown(driver, By.xpath("(//*[@id='fieldName'])[5]")); - - - Commons.dropdown(driver, By.id("zone")); - Commons.dropdown(driver, By.id("holidayZone")); - - - - - Commons.enter(driver,By.id("noKiosk"),"10"); - - Commons.dropdown(driver,By.id("processingTime"),"45"); - Commons.dropdown(driver,By.id("startTime"),"9:00 AM"); - Commons.dropdown(driver,By.id("endTime"),"5:00 PM"); - Commons.dropdown(driver,By.id("lunchStartTime"),"1:00 PM"); - Commons.dropdown(driver,By.id("lunchEndTime"),"2:00 PM"); - - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(1) .mat-pseudo-checkbox")); - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(2) .mat-pseudo-checkbox")); - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(3) > .mat-list-item-content")); - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(4) > .mat-list-item-content")); - Commons.click(driver,By.cssSelector(".mat-list-item:nth-child(5) > .mat-list-item-content")); - - Commons.enter(driver,By.id("holidayDate"),"27/11/2022"); - Commons.click(driver, By.id("createExceptionalHoliday")); - - Commons.createRes(driver); - Commons.filterCenter(driver, By.id("name"), data); - - - Commons.editCenter(driver,data+1,By.id("name")); - - Commons.filterCenter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.editCenter(driver,data+2,By.id("name")); - Commons.filterCenter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - Commons.decommission(driver); - } -} diff --git a/automation/src/main/java/automation/testcase/CenterTypeTest.java b/automation/src/main/java/automation/testcase/CenterTypeTest.java deleted file mode 100644 index 219162db..00000000 --- a/automation/src/main/java/automation/testcase/CenterTypeTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; -public class CenterTypeTest extends BaseClass{ - @Test(groups = "CT") - public void centerTypeCRUD() { - - String idCenterTypeCard="admin/masterdata/center-type/view"; - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(idCenterTypeCard)); - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("descr"),data); - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } -} diff --git a/automation/src/main/java/automation/testcase/DeviceSpecificationTest.java b/automation/src/main/java/automation/testcase/DeviceSpecificationTest.java deleted file mode 100644 index 29a770dc..00000000 --- a/automation/src/main/java/automation/testcase/DeviceSpecificationTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class DeviceSpecificationTest extends BaseClass{ - - - @Test(groups = "DS") - public void deviceSpecCRUD() { - String devicespec="admin/masterdata/device-specs/view"; - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(devicespec)); - Commons.click(driver,By.id("Create")); - - - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - Commons.enter(driver,By.id("brand"),data); - Commons.enter(driver,By.id("model"),data); - Commons.enter(driver,By.id("minDriverversion"),data); - Commons.dropdown(driver,By.id("deviceTypeCode")); - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/automation/src/main/java/automation/testcase/DeviceTest.java b/automation/src/main/java/automation/testcase/DeviceTest.java deleted file mode 100644 index 83bf9793..00000000 --- a/automation/src/main/java/automation/testcase/DeviceTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.paulhammant.ngwebdriver.NgWebDriver; - -import automation.utility.BaseClass; -import automation.utility.Commons; -public class DeviceTest extends BaseClass{ - @Test(groups = "D") - public void deviceCRUD() throws InterruptedException { - - Commons.click(driver,By.id("admin/resources")); - Commons.click(driver,By.id("/admin/resources/devices")); - Commons.click(driver,By.id("Create Device")); - - - Commons.enter(driver, By.id("name"),data); - Commons.enter(driver, By.id("serialNumber"),data); - - Commons.enter(driver, By.id("macAddress"),"1.1234"); - - Commons.enter(driver, By.id("ipAddress"),"2.2345"); - Commons.enter(driver, By.id("validity"),"3/3/2023"); - - Commons.dropdown(driver,By.id("deviceSpecId")); - Commons.dropdown(driver,By.id("zone")); - Commons.dropdown(driver,By.id("regCenterId")); - - - Commons.createRes(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.editRes(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.editRes(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - Commons.decommission(driver); - } - } diff --git a/automation/src/main/java/automation/testcase/DeviceTypesTest.java b/automation/src/main/java/automation/testcase/DeviceTypesTest.java deleted file mode 100644 index 0b0ef76d..00000000 --- a/automation/src/main/java/automation/testcase/DeviceTypesTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class DeviceTypesTest extends BaseClass{ - - @Test(groups = "DT" ) - public void deviceTypesCRUD() { - String deviceTypes="admin/masterdata/device-types/view"; - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(deviceTypes)); - Commons.click(driver,By.id("Create")); - - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/automation/src/main/java/automation/testcase/DocumentCategoriesTest.java b/automation/src/main/java/automation/testcase/DocumentCategoriesTest.java deleted file mode 100644 index 689722ef..00000000 --- a/automation/src/main/java/automation/testcase/DocumentCategoriesTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class DocumentCategoriesTest extends BaseClass{ - @Test(groups = "DOC") - public void documentCategoriesCRUD() { - String documentCategories="admin/masterdata/document-categories/view"; - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(documentCategories)); - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/automation/src/main/java/automation/testcase/DocumentTypes.java b/automation/src/main/java/automation/testcase/DocumentTypes.java deleted file mode 100644 index a395825c..00000000 --- a/automation/src/main/java/automation/testcase/DocumentTypes.java +++ /dev/null @@ -1,58 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class DocumentTypes extends BaseClass{ - @Test(groups = "DOCT") - public void documentTypesCRUD() { - String documentTypes="admin/masterdata/document-type/view"; - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(documentTypes)); - - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/automation/src/main/java/automation/testcase/DynamicFieldTest.java b/automation/src/main/java/automation/testcase/DynamicFieldTest.java deleted file mode 100644 index 58bd4c9a..00000000 --- a/automation/src/main/java/automation/testcase/DynamicFieldTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class DynamicFieldTest extends BaseClass{ - - - @Test(groups = "DF") - public void dynamicFieldCRUD() { - - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id("createDynamicField")); - - - - Commons.enter(driver,By.id("code"),data); - - Commons.enter(driver,By.id("name"),"Automation"); - Commons.enter(driver,By.id("description"),data); - - Commons.enter(driver,By.id("value"),data); - - - Commons.create(driver); - Commons.filter(driver, By.id("description"), data); - - - Commons.edit(driver,data+1,By.id("description")); - Commons.filter(driver, By.id("description"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("description")); - Commons.filter(driver, By.id("description"), data+2); - Commons.deactivate(driver); - - } -} diff --git a/automation/src/main/java/automation/testcase/HolidaysTest.java b/automation/src/main/java/automation/testcase/HolidaysTest.java deleted file mode 100644 index a3682be9..00000000 --- a/automation/src/main/java/automation/testcase/HolidaysTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class HolidaysTest extends BaseClass{ - - @Test(groups = "H") - public void holidaysCRUD() { - String listofholidays="admin/masterdata/holiday/view"; - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(listofholidays)); - Commons.click(driver,By.id("Create")); - - - Commons.enter(driver,By.id("holidayName"),data); - Commons.enter(driver,By.id("holidayDesc"),data); - Commons.enter(driver,By.id("holidayDate"),"12/27/2021"); - Commons.dropdown(driver,By.id("locationCode")); - - - Commons.create(driver); - Commons.filter(driver, By.id("holidayName"), data); - - - Commons.edit(driver,data+1,By.id("holidayName")); - Commons.filter(driver, By.id("holidayName"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("holidayName")); - Commons.filter(driver, By.id("holidayName"), data+2); - Commons.deactivate(driver); - - } -} diff --git a/automation/src/main/java/automation/testcase/LoginTest.java b/automation/src/main/java/automation/testcase/LoginTest.java deleted file mode 100644 index 1692e7f0..00000000 --- a/automation/src/main/java/automation/testcase/LoginTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class LoginTest extends BaseClass{ - - @Test(priority = 0) - public void loginTest() throws Exception { - String envPath = System.getProperty("path"); - String userid = System.getProperty("userid"); - String password = System.getProperty("password"); - String language = null; - driver.get(envPath); - driver.manage().window().setSize(new Dimension(1050, 708)); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - driver.findElement(By.linkText("Admin")).click(); - - try { - language=Commons.getFieldData("langcode"); - - System.out.println(language); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - Commons.click(driver,By.xpath("//*[@class='kc-dropdown']")); - String var="//*[@class='kc-dropdown-item']/a[contains(text(),'"+language+"')]"; - Commons.click(driver,By.xpath(var)); - driver.findElement(By.id("username")).sendKeys(userid); - driver.findElement(By.id("password")).sendKeys(password); - driver.findElement(By.xpath("//input[@name=\'login\']")).click(); - - /* - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.xpath("//mat-card-content/span[contains(text(),'Blocklisted Words')]")); - Commons.click(driver,By.xpath("//span[contains(text(),'Create')]")); - String data=Commons.appendDate; - - Commons.enter(driver,By.xpath("//input[@placeholder='Blocklisted Words']"),data); - Commons.enter(driver,By.xpath("//textarea[@placeholder='Description']"),data); - - - Commons.click(driver,By.xpath("//button[@id='createButton']")); - Commons.click(driver,By.xpath("//span[contains(text(),'OK')]")); - - Commons.click(driver,By.xpath("//span[contains(text(),'Filter')]")); - - Commons.enter(driver,By.xpath("//input[@placeholder=' Blocklisted Words']"),data); - - Commons.click(driver,By.xpath("//span[contains(text(),'Apply')]")); - - Commons.click(driver,By.cssSelector(".ellipsis-button")); - - - Commons.click(driver,By.xpath("//span[contains(text(),'Activate')]")); - - Commons.click(driver,By.xpath("//span[contains(text(),'Confirm')]")); - - Commons.click(driver,By.xpath("//span[contains(text(),'Done')]")); - - driver.findElement(By.cssSelector(".ellipsis-button")).click(); - - Commons.click(driver,By.xpath("//span[contains(text(),'Edit')]")); - - Assert.assertNotEquals(data, driver.findElement(By.xpath("//input[@placeholder='Blocklisted Words']")).getText()); - driver.findElement(By.xpath("//input[@placeholder='Blocklisted Words']")).clear(); - - Commons.enter(driver,By.xpath("//input[@placeholder='Blocklisted Words']"),data+1); - - Commons.click(driver,By.id("createButton")); - - - Commons.click(driver,By.xpath("//button/span[contains(text(),'OK')]")); - - Commons.click(driver,By.xpath("//span[contains(text(),'Filter')]")); - Commons.enter(driver,By.xpath("//input[@placeholder='Blocklisted Words']"),data+1); - Commons.click(driver,By.xpath("//span[contains(text(),'Apply')]")); - - Commons.click(driver,By.cssSelector(".ellipsis-button")); - Commons.click(driver,By.xpath("//span[contains(text(),'Deactivate')]")); - - Commons.clickSpan(driver,"Confirm"); - Commons.clickSpan(driver,"Done"); - - */ - } -} diff --git a/automation/src/main/java/automation/testcase/MachineSpecificationTest.java b/automation/src/main/java/automation/testcase/MachineSpecificationTest.java deleted file mode 100644 index d64f3dbe..00000000 --- a/automation/src/main/java/automation/testcase/MachineSpecificationTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class MachineSpecificationTest extends BaseClass{ - - @Test(groups = "MS") - public void machineSpecCRUD() { - String machinespec="admin/masterdata/machine-specs/view"; - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - Commons.click(driver,By.id(machinespec)); - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("brand"),data); - Commons.enter(driver,By.id("model"),data); - Commons.enter(driver,By.id("minDriverversion"),data); - Commons.enter(driver,By.id("description"),data); - Commons.dropdown(driver,By.id("machineTypeCode")); - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } - } diff --git a/automation/src/main/java/automation/testcase/MachineTest.java b/automation/src/main/java/automation/testcase/MachineTest.java deleted file mode 100644 index c068b6fc..00000000 --- a/automation/src/main/java/automation/testcase/MachineTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; -public class MachineTest extends BaseClass{ - @Test(groups = "M") - public void machineCRUD() { - Commons.click(driver,By.id("admin/resources")); - Commons.click(driver,By.xpath("//a[@href='#/admin/resources/machines']")); - Commons.click(driver,By.id("Create Machine")); - - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("serialNumber"),"1234567"); - Commons.enter(driver,By.id("macAddress"),"1.2.3.4.5.6"); - Commons.enter(driver,By.id("ipAddress"),"2.3.4.5.6"); - Commons.enter(driver,By.id("validity"),"27/11/2022"); - Commons.dropdown(driver,By.id("machineSpecId")); - Commons.enter(driver,By.id("publicKey"), - "AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDCHegKJ3vRn__8h1knXKiLA8qfO5LebzBlRO2tAcI3HvLyL9rPkVrXWYQ6wAn4VQk015C1hViU-7k752dYE5WUAUbgsxOHvvDPH1t72CNHNj9dyE86wGqR9AtK3yz0yf1IP_xgtWpiaQ2V9t2d3LtgPYWnRuPJbcl97nLXXL6PGfh1mRwsQUi94coEBPMZ9YLLOAFckPuDZt-lEcXIMkj8r0uNwAZUSEvGifTNWbLjC5BRlJBmvScIlptXqIwBaq2kSMVK2X1KbQ6TM8zkA_co4LEAIZfcpMgPn6RdW0yFtcx24HqrCY8v0DHregwoCPPpw8HvB-r5aR09mXG64zsJ"); - - Commons.enter(driver,By.id("signPublicKey"), - "AAEABAAEAHIAAAAQABQACwgAAAEAAQEAr93rKokeZGIzcCtFX3iyCvwpmfnd9jz0nF__0bxWr0mH8Zs0rhlG6vKRagx31I4CdrLAECOwMZ0r7Y3utTqHqelQE3MJLtboKITOqYRpBkqHSm1jGaEb8a1E9yoJri3tZrBCrAShimrN_SbtS1uKbJUG3cuVuE0gtGLI1d5wMfS_4PSz3RwvZtGHisEb3zbV6SLcJkgcDeMbUD7P25SVJd1xrJybuGIgyeSZxOgLzy1P-qHCiOXiAO9o06fwyIhIYbeZYz5th4rq7Rb6mRK9EWFpLrLvBL0F6USiidl8qNCxxZZFUp3W5xFANVYfRvgLKI33zBYniZ7aTE8PgrYa2w"); - Commons.dropdown(driver,By.id("zone")); - Commons.dropdown(driver,By.id("regCenterId")); - - - - Commons.createRes(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.editRes(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.editRes(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - Commons.decommission(driver); - } -} diff --git a/automation/src/main/java/automation/testcase/MachineTypesTest.java b/automation/src/main/java/automation/testcase/MachineTypesTest.java deleted file mode 100644 index b7d442e8..00000000 --- a/automation/src/main/java/automation/testcase/MachineTypesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class MachineTypesTest extends BaseClass{ - - @Test(groups = "MT") - public void machineTypesCRUD() { - String machinetypes="admin/masterdata/machine-type/view" ; - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(machinetypes)); - Commons.click(driver,By.id("Create")); - - - Commons.enter(driver,By.id("code"),data); - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - } -} diff --git a/automation/src/main/java/automation/testcase/TemplateTest.java b/automation/src/main/java/automation/testcase/TemplateTest.java deleted file mode 100644 index 4f6c0cb9..00000000 --- a/automation/src/main/java/automation/testcase/TemplateTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package automation.testcase; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import automation.utility.BaseClass; -import automation.utility.Commons; - -public class TemplateTest extends BaseClass{ - - - @Test(groups = "T") - public void templateCRUD() { - String templatesid="admin/masterdata/templates/view"; - - Commons.click(driver,By.xpath("//a[@href='#/admin/masterdata']")); - - Commons.click(driver,By.id(templatesid)); - Commons.click(driver,By.id("Create")); - - Commons.enter(driver,By.id("name"),data); - Commons.enter(driver,By.id("description"),data); - - Commons.enter(driver,By.id("model"),data); - Commons.enter(driver,By.id("fileText"),data); - - - Commons.dropdown(driver,By.id("fileFormatCode")); - - Commons.dropdown(driver,By.id("templateTypeCode")); - - Commons.dropdown(driver,By.id("moduleId")); - - - - - Commons.create(driver); - Commons.filter(driver, By.id("name"), data); - - - Commons.edit(driver,data+1,By.id("name")); - Commons.filter(driver, By.id("name"), data+1); - - Commons.activate(driver); - Commons.edit(driver,data+2,By.id("name")); - Commons.filter(driver, By.id("name"), data+2); - Commons.deactivate(driver); - - - } -} diff --git a/automation/src/main/java/automation/utility/BaseClass.java b/automation/src/main/java/automation/utility/BaseClass.java deleted file mode 100644 index 584f8a50..00000000 --- a/automation/src/main/java/automation/utility/BaseClass.java +++ /dev/null @@ -1,133 +0,0 @@ -package automation.utility; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.chrome.ChromeOptions; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -import org.testng.ITest; -// Generated by Selenium IDE -//import org.junit.Test; -//import org.junit.Before; -//import org.junit.After; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Optional; -import org.testng.annotations.Parameters; -import org.testng.annotations.Test; - -public class BaseClass { - protected WebDriver driver; - protected Map vars; - protected JavascriptExecutor js; - protected String langcode; - protected String envPath = System.getProperty("path"); - protected String userid = System.getProperty("userid"); - protected String password = System.getProperty("password"); - protected String data = Commons.appendDate; - - public void setLangcode(String langcode) throws IOException { - this.langcode = PropertiesUtil.getKeyValue("langcode"); - } - - @BeforeMethod - public void setUp() throws InterruptedException { - System.out.println(System.getProperty("user.dir")); - String configFilePath = System.getProperty("user.dir") + "\\chromedriver\\chromedriver.exe"; - System.setProperty("webdriver.chrome.driver", configFilePath); - -// ChromeOptions options = new ChromeOptions(); -// options.addArguments("--headless"); -// driver = new ChromeDriver(options); - - - - driver = new ChromeDriver(); - js = (JavascriptExecutor) driver; - vars = new HashMap(); - driver.get(envPath); - driver.manage().window().maximize(); - Thread.sleep(500); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); - driver.findElement(By.linkText("Admin")).click(); - String language1 = null; - try { - language1 = Commons.getFieldData("langcode"); - - System.out.println(language1); - if(!language1.equals("sin")) - {Commons.click(driver, By.xpath("//*[@class='kc-dropdown']")); - String var = "//*[@class='kc-dropdown-item']/a[contains(text(),'" + language1 + "')]"; - Commons.click(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(); - } - - @DataProvider(name = "data-provider") - public Object[] dpMethod() { - String listFilename[] = readFolderJsonList(); - String s[][] = null; - String temp[] = null; - for (int count = 0; count < listFilename.length; count++) { - listFilename[count] = listFilename[count].replace(".csv", ""); - - } - - return listFilename; - } - - public static String[] readFolderJsonList() { - String contents[] = null; - try { - String langcode = PropertiesUtil.getKeyValue("langcode"); - File directoryPath = new File(System.getProperty("user.dir") + "\\BulkUploadFiles\\" + langcode + "\\"); - - if (directoryPath.exists()) { - - contents = directoryPath.list(); - System.out.println("List of files and directories in the specified directory:"); - for (int i = 0; i < contents.length; i++) { - System.out.println(contents[i]); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return contents; - } -} diff --git a/automation/src/main/java/automation/utility/Commons.java b/automation/src/main/java/automation/utility/Commons.java deleted file mode 100644 index 946ad7f4..00000000 --- a/automation/src/main/java/automation/utility/Commons.java +++ /dev/null @@ -1,296 +0,0 @@ -package automation.utility; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; - -import org.openqa.selenium.By; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; - -public class Commons { - private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(Commons.class); - - public static String appendDate="Z"+getDateTime(); - - public static String getDateTime() - { - - - DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmm"); - LocalDateTime now = LocalDateTime.now(); - return dtf.format(now); - } - - public static void filter(WebDriver driver, By by,String data) { - logger.info("Inside Filter " + by + data); - Commons.click(driver, By.id("Filter")); - - Commons.enter(driver, by, data); - Commons.click(driver, By.id("applyTxt")); - } - - public static void filterCenter(WebDriver driver, By by,String data) { - logger.info("Inside filterCenter " + by + data); - Commons.click(driver, By.id("Filter")); - - Commons.dropdowncenter(driver, by, data); - - Commons.click(driver, By.id("applyTxt")); - } - public static void click(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 (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(); - } - System.out.println( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); - } catch (Exception e) { - - JavascriptExecutor executor = (JavascriptExecutor) driver; - executor.executeScript("arguments[0].click();", driver.findElement(by)); - - }} - - public static void enter(WebDriver driver, By by,String value) { - logger.info("Entering " + by +value); - try { - (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOfElementLocated(by)); - 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); - System.out.println( "Element identified by " + by.toString() + " was not clickable after 20 seconds"); - } } - - public static void dropdown(WebDriver driver, By by) - { - logger.info("Selecting DropDown Index Zero Value " + by ); - - try { - Thread.sleep(500); - click(driver,by);//REGION - Thread.sleep(500); - - String att= driver.findElement(by).getAttribute("aria-owns"); - String[] list=att.split(" "); - click( driver,By.id(list[0])); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - }catch(Exception e) - - { - e.getMessage(); - } - } - - public static void dropdown(WebDriver driver, By by,String value) - { - logger.info("Selecting DropDown By Value " + by +value ); - - try { - Thread.sleep(500); - click(driver,by); - Thread.sleep(500); - String val="'"+value +"'"; - - click( driver,By.xpath("//span[contains(text(),"+val+")]")); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - }catch(Exception e) - - { - e.getMessage(); - } - } - - public static void dropdowncenter(WebDriver driver, By by,String value) - { - logger.info("Selecting DropDown By Value " + by +value ); - - try { - Thread.sleep(500); - click(driver,by); - Thread.sleep(500); - String val="'"+value +"'"; - - click( driver,By.id(value)); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - }catch(Exception e) - - { - e.getMessage(); - } - } - - public static void dropdown(WebDriver driver, By by,By value) - { - logger.info("Selecting DropDown By Value " + by +value ); - try { - Thread.sleep(500); - click(driver,by); - Thread.sleep(500); - click( driver,value); - - Thread.sleep(500); - - }catch(Exception e) - - { - e.getMessage(); - } - } - public static String getTestData() - { - return JsonUtil.readJsonFileText("TestData.json"); - } - public static String getFieldData(String idfield) throws Exception - { - return JsonUtil.JsonObjSimpleParsing(getTestData(), idfield); - - } - - public static void clickSpan(WebDriver driver,String key) throws Exception { - - String val=Commons.getFieldData(key); - String var="//span[contains(text(),'"+ val+ "')]"; - Commons.click(driver,By.xpath(var)); - logger.info("clickSpan" + var ); - } - - public static void deactivate(WebDriver driver) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Deactivate0")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - logger.info("Click deactivate and Confirm"); - } - - public static void activate(WebDriver driver) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Activate0")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - logger.info("Click activate and Confirm"); - } - - public static void edit(WebDriver driver,String data,By by) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Edit0")); - - Assert.assertNotEquals(data, - driver.findElement(by).getText()); - driver.findElement(by).clear(); - - Commons.enter(driver, by, data); - - Commons.click(driver, By.id("createButton")); - Commons.click(driver, By.id("confirmmessagepopup")); - - logger.info("Click Edit and Confirm" + by + data); - } - - public static void editRes(WebDriver driver,String data,By by) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Edit0")); - - Assert.assertNotEquals(data, - driver.findElement(by).getText()); - driver.findElement(by).clear(); - - Commons.enter(driver, by, data); - - Commons.click(driver, By.id("createButton")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - - logger.info("Click Edit and Confirm" + by + data); - } - public static void editCenter(WebDriver driver,String data,By by) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver, By.id("Edit0")); - - Assert.assertNotEquals(data, - driver.findElement(by).getText()); - driver.findElement(by).clear(); - - Commons.enter(driver, by, data); - - Commons.click(driver, By.xpath("(//*[@id='createButton'])[1]")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - - Commons.click(driver, By.xpath("(//*[@id='cancel'])[1]")); - Commons.click(driver, By.xpath("(//*[@id='cancel'])[1]")); - logger.info("Click editCenter and Confirm" + by + data); - } - - public static void create(WebDriver driver) { - Commons.click(driver, By.xpath("//button[@id='createButton']")); - Commons.click(driver, By.id("confirmmessagepopup")); - - logger.info("Click create"); - } - public static void createRes(WebDriver driver) { - Commons.click(driver, By.xpath("//button[@id='createButton']")); - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - logger.info("Click and confirm"); - } - - public static void decommission(WebDriver driver) { - Commons.click(driver,By.id("ellipsis-button0")); - Commons.click(driver,By.id("Decommission0")); - - Commons.click(driver,By.id("confirmpopup")); - Commons.click(driver, By.id("confirmmessagepopup")); - logger.info("Click decommission and confirm"); - } - - - -} diff --git a/automation/src/main/java/automation/utility/DateUtil.java b/automation/src/main/java/automation/utility/DateUtil.java deleted file mode 100644 index 7195c1b7..00000000 --- a/automation/src/main/java/automation/utility/DateUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package automation.utility; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; - -public class DateUtil { - - public static String getDateTime() - { - - DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmm"); - LocalDateTime now = LocalDateTime.now(); - return dtf.format(now); - } -} diff --git a/automation/src/main/java/automation/utility/JsonUtil.java b/automation/src/main/java/automation/utility/JsonUtil.java deleted file mode 100644 index a7f051ed..00000000 --- a/automation/src/main/java/automation/utility/JsonUtil.java +++ /dev/null @@ -1,203 +0,0 @@ -package automation.utility; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - - -import org.apache.commons.io.IOUtils; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import org.json.JSONArray; -import org.json.JSONObject; - -public class JsonUtil { - private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(JsonUtil.class); - - private static ObjectMapper mapper; - - static { - mapper = new ObjectMapper(); - } - - public static String convertJavaToJson(Object object) { - - String jsonResult = ""; - try { - jsonResult = mapper.writeValueAsString(object); - } catch (JsonParseException e) { - logger.error("", e); - } catch (JsonMappingException e) { - logger.error("", e); - } catch (IOException e) { - logger.error("", e); - } - return jsonResult; - } - - public static T convertJsonintoJava(String jsonString, Class cls) { - T payload = null; - try { - payload = mapper.readValue(jsonString, cls); - } catch (JsonParseException e) { - e.printStackTrace(); - } catch (JsonMappingException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return payload; - } - - public static String JsonObjSimpleParsing(String jsonIdentity, String idfield) - throws Exception { - String val =null; - JSONObject json = new JSONObject(jsonIdentity); - - JSONObject identity = json.getJSONObject(PropertiesUtil.getKeyValue("jsonObjName")); - - JSONArray identityitems = identity.getJSONArray(idfield); - - for (int i = 0, size = identityitems.length(); i < size; i++) { - JSONObject idItem = identityitems.getJSONObject(i); - String lang = idItem.getString("language"); - val = idItem.getString("value"); - if (lang.equalsIgnoreCase(PropertiesUtil.getKeyValue(idfield))) - return val; - } - return "sin"; - } - - public static LinkedHashMap JsonObjSimpleParsingWithCode(String jsonIdentity, String idfield) - throws Exception { - LinkedHashMap mapLang = new LinkedHashMap(); - LinkedHashMap mapLangorder = new LinkedHashMap(); - JSONObject json = new JSONObject(jsonIdentity); - - JSONObject identity = json.getJSONObject(PropertiesUtil.getKeyValue("jsonObjName")); - - JSONArray identityitems = identity.getJSONArray(idfield); - - for (int i = 0, size = identityitems.length(); i < size; i++) { - JSONObject idItem = identityitems.getJSONObject(i); - String lang = idItem.getString("language"); - String val = idItem.getString("value"); - String code = idItem.getString("code"); - String valcode = val + "@@" + code; - mapLang.put(lang, valcode); - } - String[] listLang = PropertiesUtil.getKeyValue("langcode").split("@@"); - Set keys = mapLang.keySet(); - - for (String list : listLang) { - for (String ky : keys) { - if (list.equals(ky)) { - mapLangorder.put(list, mapLang.get(ky)); - } - } - - } - - return mapLangorder; - } - - public static LinkedHashMap JsonObjSimpleParsingnoTranslate(String jsonIdentity, String idfield) - throws Exception { - LinkedHashMap mapLang = new LinkedHashMap(); - JSONObject json = new JSONObject(jsonIdentity); - - JSONObject identity = json.getJSONObject(PropertiesUtil.getKeyValue("jsonObjName")); - - JSONArray identityitems = identity.getJSONArray(idfield); - - for (int i = 0, size = identityitems.length(); i < size; i++) { - JSONObject idItem = identityitems.getJSONObject(i); - String lang = idItem.getString("language"); - String val = idItem.getString("value"); - String[] listLang = PropertiesUtil.getKeyValue("langcode").split("@@"); - for (String list : listLang) { - if (lang.equals(list)) { - mapLang.put(list, val); - return mapLang; - - } - } - - } - return mapLang; - } - - /** - * Direct String - * - * @param json - * @param jsonObjName - * @param idfield - * @return - * @throws Exception - */ - public static String JsonObjParsing(String jsonIdentity, String idfield) throws Exception { - String value = null; - JSONObject json = new JSONObject(jsonIdentity); - JSONObject identity = json.getJSONObject(PropertiesUtil.getKeyValue("jsonObjName")); - - value = identity.getString(idfield); - - return value; - } - - public static double JsonObjDoubleParsing(String jsonIdentity, String idfield) throws Exception { - double value = 0; - JSONObject json = new JSONObject(jsonIdentity); - JSONObject identity = json.getJSONObject(PropertiesUtil.getKeyValue("jsonObjName")); - - value = identity.getDouble(idfield); - - return value; - } - - public static List JsonObjArrayListParsing(String jsonIdentity, String idfield) throws Exception { - List list = new LinkedList(); - JSONObject json = new JSONObject(jsonIdentity); - - JSONObject identity = json.getJSONObject(PropertiesUtil.getKeyValue("jsonObjName")); - - JSONArray identityitems = identity.getJSONArray(idfield); - if (identityitems != null) { - for (int i = 0; i < identityitems.length(); i++) { - list.add(identityitems.getString(i)); - } - } - return list; - - } - - public static String readJsonFileText(String document) { - - String jsonTxt = null; - - try { - - File f = new File(System.getProperty("user.dir") + "\\"+document); - - if (f.exists()) { - InputStream is = new FileInputStream(f); - jsonTxt = IOUtils.toString(is, "UTF-8"); - System.out.println(jsonTxt); - logger.info("readJsonFileText"); - } - } catch (Exception e) { - logger.error("", e); - } - return jsonTxt; - } - - -} diff --git a/automation/src/main/java/automation/utility/PropertiesUtil.java b/automation/src/main/java/automation/utility/PropertiesUtil.java deleted file mode 100644 index d451d01b..00000000 --- a/automation/src/main/java/automation/utility/PropertiesUtil.java +++ /dev/null @@ -1,33 +0,0 @@ - -package automation.utility; - - -import java.io.*; -import java.util.Properties; - - -public class PropertiesUtil { - // private static final Logger logger = LogManager.getLogger(PropertiesUtil.class); - - public static String getKeyValue(String key) throws IOException { - - String configFilePath = System.getProperty("user.dir") + "\\config.properties"; - - FileReader reader = new FileReader(configFilePath); - // create properties object - Properties p = new Properties(); - - // Add a wrapper around reader object - p.load(reader); - - // access properties data - return p.getProperty(key); - - } - - public static void main(String[] args) throws IOException { - String value = getKeyValue("PropertyFilePath"); - System.out.println(value); - } - -} diff --git a/automation/src/main/java/automation/utility/SetTestName.java b/automation/src/main/java/automation/utility/SetTestName.java deleted file mode 100644 index dd5d1d12..00000000 --- a/automation/src/main/java/automation/utility/SetTestName.java +++ /dev/null @@ -1,9 +0,0 @@ -package automation.utility; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface SetTestName { - int idx() default 0; -} \ No newline at end of file diff --git a/automation/src/main/java/automation/utility/TestRunner.java b/automation/src/main/java/automation/utility/TestRunner.java deleted file mode 100644 index ce06f80b..00000000 --- a/automation/src/main/java/automation/utility/TestRunner.java +++ /dev/null @@ -1,44 +0,0 @@ -package automation.utility; - -import java.util.List; - -import org.testng.TestListenerAdapter; -import org.testng.TestNG; - -import automation.testcase.*; - - -public class TestRunner { - static TestListenerAdapter tla = new TestListenerAdapter(); - - - static TestNG testNg; - - public static void main(String[] args) throws Exception { - - 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.addListener(tla); - testNg.run(); - - } - - -} diff --git a/automation/src/main/resources/BulkUploadFiles/ara/device_type.csv b/automation/src/main/resources/BulkUploadFiles/ara/device_type.csv deleted file mode 100644 index fad07c85..00000000 --- a/automation/src/main/resources/BulkUploadFiles/ara/device_type.csv +++ /dev/null @@ -1,2 +0,0 @@ -code,name,name,description,langCode,isActive -ABhGH,ABChjJH,ABChjJH,For printing Documents,eng,TRUE diff --git a/automation/src/main/resources/BulkUploadFiles/ara/machine_master.csv b/automation/src/main/resources/BulkUploadFiles/ara/machine_master.csv deleted file mode 100644 index 2e614b94..00000000 --- a/automation/src/main/resources/BulkUploadFiles/ara/machine_master.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,macAddress,serialNum,ipAddress,validityDateTime,machineSpecId,publicKey,keyIndex,signPublicKey,signKeyIndex,zoneCode,regCenterId,langCode,isActive -58755,technoABCH,3C-2C-30-D1-E5-65,FB5962911688,192.168.0.408,2022-11-17T09:50:23.637Z,1001,AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDCHegKJ3vRn__8h1knXKiLA8qfO5LebzBlRO2tAcI3HvLyL9rPkVrXWYQ6wAn4VQk015C1hViU-7k752dYE5WUAUbgsxOHvvDPH1t72CNHNj9dyE86wGqR9AtK3yz0yf1IP_xgtWpiaQ2V9t2d3LtgPYWnRuPJbcl97nLXXL6PGfh1mRwsQUi94coEBPMZ9YLLOAFckPuDZt-lEcXIMkj8r0uNwAZUSEvGifTNWbLjC5BRlJBmvScIlptXqIwBaq2kSMVK2X1KbQ6TM8zkA_co4LEAIZfcpMgPn6RdW0yFtcx24HqrCY8v0DHregwoCPPpw8HvB-r5aR09mXG64zsJ,B9:6A:BF:7B:31:4F:9F:52:B1:24:B1:E4:2B:20:DD:5C:6A:BD:43:6E:20:51:5C:EB:73:E0:84:3D:06:5E:2C:45,AAEABAAEAHIAAAAQABQACwgAAAEAAQEAr93rKokeZGIzcCtFX3iyCvwpmfnd9jz0nF__0bxWr0mH8Zs0rhlG6vKRagx31I4CdrLAECOwMZ0r7Y3utTqHqelQE3MJLtboKITOqYRpBkqHSm1jGaEb8a1E9yoJri3tZrBCrAShimrN_SbtS1uKbJUG3cuVuE0gtGLI1d5wMfS_4PSz3RwvZtGHisEb3zbV6SLcJkgcDeMbUD7P25SVJd1xrJybuGIgyeSZxOgLzy1P-qHCiOXiAO9o06fwyIhIYbeZYz5th4rq7Rb6mRK9EWFpLrLvBL0F6USiidl8qNCxxZZFUp3W5xFANVYfRvgLKI33zBYniZ7aTE8PgrYa2w,CE:19:36:5F:89:6D:D3:3E:6D:1B:64:EF:CE:04:F1:14:D5:73:9D:FF:EC:18:FB:CC:DF:C8:74:8E:1E:DC:BF:73,NTH,10002,eng,TRUE diff --git a/automation/src/main/resources/BulkUploadFiles/eng/device_type.csv b/automation/src/main/resources/BulkUploadFiles/eng/device_type.csv deleted file mode 100644 index fad07c85..00000000 --- a/automation/src/main/resources/BulkUploadFiles/eng/device_type.csv +++ /dev/null @@ -1,2 +0,0 @@ -code,name,name,description,langCode,isActive -ABhGH,ABChjJH,ABChjJH,For printing Documents,eng,TRUE diff --git a/automation/src/main/resources/BulkUploadFiles/eng/machine_master.csv b/automation/src/main/resources/BulkUploadFiles/eng/machine_master.csv deleted file mode 100644 index 2e614b94..00000000 --- a/automation/src/main/resources/BulkUploadFiles/eng/machine_master.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,macAddress,serialNum,ipAddress,validityDateTime,machineSpecId,publicKey,keyIndex,signPublicKey,signKeyIndex,zoneCode,regCenterId,langCode,isActive -58755,technoABCH,3C-2C-30-D1-E5-65,FB5962911688,192.168.0.408,2022-11-17T09:50:23.637Z,1001,AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDCHegKJ3vRn__8h1knXKiLA8qfO5LebzBlRO2tAcI3HvLyL9rPkVrXWYQ6wAn4VQk015C1hViU-7k752dYE5WUAUbgsxOHvvDPH1t72CNHNj9dyE86wGqR9AtK3yz0yf1IP_xgtWpiaQ2V9t2d3LtgPYWnRuPJbcl97nLXXL6PGfh1mRwsQUi94coEBPMZ9YLLOAFckPuDZt-lEcXIMkj8r0uNwAZUSEvGifTNWbLjC5BRlJBmvScIlptXqIwBaq2kSMVK2X1KbQ6TM8zkA_co4LEAIZfcpMgPn6RdW0yFtcx24HqrCY8v0DHregwoCPPpw8HvB-r5aR09mXG64zsJ,B9:6A:BF:7B:31:4F:9F:52:B1:24:B1:E4:2B:20:DD:5C:6A:BD:43:6E:20:51:5C:EB:73:E0:84:3D:06:5E:2C:45,AAEABAAEAHIAAAAQABQACwgAAAEAAQEAr93rKokeZGIzcCtFX3iyCvwpmfnd9jz0nF__0bxWr0mH8Zs0rhlG6vKRagx31I4CdrLAECOwMZ0r7Y3utTqHqelQE3MJLtboKITOqYRpBkqHSm1jGaEb8a1E9yoJri3tZrBCrAShimrN_SbtS1uKbJUG3cuVuE0gtGLI1d5wMfS_4PSz3RwvZtGHisEb3zbV6SLcJkgcDeMbUD7P25SVJd1xrJybuGIgyeSZxOgLzy1P-qHCiOXiAO9o06fwyIhIYbeZYz5th4rq7Rb6mRK9EWFpLrLvBL0F6USiidl8qNCxxZZFUp3W5xFANVYfRvgLKI33zBYniZ7aTE8PgrYa2w,CE:19:36:5F:89:6D:D3:3E:6D:1B:64:EF:CE:04:F1:14:D5:73:9D:FF:EC:18:FB:CC:DF:C8:74:8E:1E:DC:BF:73,NTH,10002,eng,TRUE diff --git a/automation/src/main/resources/BulkUploadFiles/sin/device_type.csv b/automation/src/main/resources/BulkUploadFiles/sin/device_type.csv deleted file mode 100644 index fad07c85..00000000 --- a/automation/src/main/resources/BulkUploadFiles/sin/device_type.csv +++ /dev/null @@ -1,2 +0,0 @@ -code,name,name,description,langCode,isActive -ABhGH,ABChjJH,ABChjJH,For printing Documents,eng,TRUE diff --git a/automation/src/main/resources/BulkUploadFiles/sin/machine_master.csv b/automation/src/main/resources/BulkUploadFiles/sin/machine_master.csv deleted file mode 100644 index 2e614b94..00000000 --- a/automation/src/main/resources/BulkUploadFiles/sin/machine_master.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,macAddress,serialNum,ipAddress,validityDateTime,machineSpecId,publicKey,keyIndex,signPublicKey,signKeyIndex,zoneCode,regCenterId,langCode,isActive -58755,technoABCH,3C-2C-30-D1-E5-65,FB5962911688,192.168.0.408,2022-11-17T09:50:23.637Z,1001,AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDCHegKJ3vRn__8h1knXKiLA8qfO5LebzBlRO2tAcI3HvLyL9rPkVrXWYQ6wAn4VQk015C1hViU-7k752dYE5WUAUbgsxOHvvDPH1t72CNHNj9dyE86wGqR9AtK3yz0yf1IP_xgtWpiaQ2V9t2d3LtgPYWnRuPJbcl97nLXXL6PGfh1mRwsQUi94coEBPMZ9YLLOAFckPuDZt-lEcXIMkj8r0uNwAZUSEvGifTNWbLjC5BRlJBmvScIlptXqIwBaq2kSMVK2X1KbQ6TM8zkA_co4LEAIZfcpMgPn6RdW0yFtcx24HqrCY8v0DHregwoCPPpw8HvB-r5aR09mXG64zsJ,B9:6A:BF:7B:31:4F:9F:52:B1:24:B1:E4:2B:20:DD:5C:6A:BD:43:6E:20:51:5C:EB:73:E0:84:3D:06:5E:2C:45,AAEABAAEAHIAAAAQABQACwgAAAEAAQEAr93rKokeZGIzcCtFX3iyCvwpmfnd9jz0nF__0bxWr0mH8Zs0rhlG6vKRagx31I4CdrLAECOwMZ0r7Y3utTqHqelQE3MJLtboKITOqYRpBkqHSm1jGaEb8a1E9yoJri3tZrBCrAShimrN_SbtS1uKbJUG3cuVuE0gtGLI1d5wMfS_4PSz3RwvZtGHisEb3zbV6SLcJkgcDeMbUD7P25SVJd1xrJybuGIgyeSZxOgLzy1P-qHCiOXiAO9o06fwyIhIYbeZYz5th4rq7Rb6mRK9EWFpLrLvBL0F6USiidl8qNCxxZZFUp3W5xFANVYfRvgLKI33zBYniZ7aTE8PgrYa2w,CE:19:36:5F:89:6D:D3:3E:6D:1B:64:EF:CE:04:F1:14:D5:73:9D:FF:EC:18:FB:CC:DF:C8:74:8E:1E:DC:BF:73,NTH,10002,eng,TRUE diff --git a/automation/src/main/resources/README b/automation/src/main/resources/README deleted file mode 100644 index b8427cd9..00000000 --- a/automation/src/main/resources/README +++ /dev/null @@ -1,31 +0,0 @@ -This Repsitory is used for Admin Portal Automation. - -How To run : - First Build Jar - Place VM args- java -Dpath=https://env.mosip.net/ -Duserid=user -Dpassword=pwd -jar nameofAdminJar.jar - Place jar in one folder along with src/main/resources files and folder and then run jar - -TestData Setup: - Config.properties - langcode:eng -- This is Admin login page language selection description placed in TestData.json - bulkwait:10000 -- This is Bulk upload wait - TestData.json - Keep setExcludedGroups="" -- To run all the scenario mentioned below - Keep setExcludedGroups="BL,CT" -- To Exclude testcases execution based on below tags. - -Includes: Below Scenarios and their tags. - "blocklistedwordsCRUD": "BL", - "bulkUploadCRUD": "BU", - "centerCRUD": "CTR", - "centerTypeCRUD": "CT", - "deviceSpecCRUD": "DS", - "deviceCRUD": "D", - "deviceTypesCRUD": "DT", - "documentCategoriesCRUD": "DOC", - "documentTypesCRUD": "DOCT", - "dynamicFieldCRUD": "DF", - "holidaysCRUD": "H", - "machineSpecCRUD": "MS", - "machineCRUD": "M", - "machineTypesCRUD": "MT", - "templateCRUD": "T" \ No newline at end of file diff --git a/automation/src/main/resources/TestData.json b/automation/src/main/resources/TestData.json deleted file mode 100644 index 66381415..00000000 --- a/automation/src/main/resources/TestData.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "identity": { - "BELOW_ARE_KEYWORDS_FOR_HELP": "Below Keys use to put in setExcludedGroups to exclude scenarios eg BL for blocklistedwordsCRUD to ignore this execution", - "setExcludedGroupsAll": "BL,BU,CTR,CT,DS,D,DT,DOC,DOCT,DF,H,MS,M,MT,T", - "blocklistedwordsCRUD": "BL", - "bulkUploadCRUD": "BU", - "centerCRUD": "CTR", - "centerTypeCRUD": "CT", - "deviceSpecCRUD": "DS", - "deviceCRUD": "D", - "deviceTypesCRUD": "DT", - "documentCategoriesCRUD": "DOC", - "documentTypesCRUD": "DOCT", - "dynamicFieldCRUD": "DF", - "holidaysCRUD": "H", - "machineSpecCRUD": "MS", - "machineCRUD": "M", - "machineTypesCRUD": "MT", - "templateCRUD": "T", - "BELOW_ARE_STATIC_KEYWORDS": "We are using this setExcludedGroups to exclude scenarios", - "setExcludedGroups": "BL,BU,CTR,CT,DS,D,DT,DOC,DOCT,DF,H,MS,M,MT", - "langcode": [ - { - "language": "tam", - "value": "தமிழ்" - }, - { - "language": "kan", - "value": "ಕನ್ನಡ" - }, - { - "language": "hin", - "value": "हिंदी" - }, - { - "language": "eng", - "value": "English" - }, - { - "language": "fra", - "value": "Français" - }, - { - "language": "ara", - "value": "Arabic" - } - ] - } -} \ No newline at end of file diff --git a/automation/src/main/resources/chromedriver/chromedriver.exe b/automation/src/main/resources/chromedriver/chromedriver.exe deleted file mode 100644 index 60449ae1..00000000 Binary files a/automation/src/main/resources/chromedriver/chromedriver.exe and /dev/null differ diff --git a/automation/src/main/resources/config.properties b/automation/src/main/resources/config.properties deleted file mode 100644 index e9f758a5..00000000 --- a/automation/src/main/resources/config.properties +++ /dev/null @@ -1,3 +0,0 @@ -langcode:eng -jsonObjName:identity -bulkwait:10000 \ No newline at end of file diff --git a/automation/src/main/resources/logback.xml b/automation/src/main/resources/logback.xml deleted file mode 100644 index 9e5df39f..00000000 --- a/automation/src/main/resources/logback.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - ${APP_LOG_ROOT}/AutomationLogs.log - - ${LOG_PATTERN} - - - ${APP_LOG_ROOT}/AutomationLogs-%i.log - 1 - 10 - - - 10MB - - - - - - - - - \ No newline at end of file