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 index 5e45a767..3384ad69 100644 --- 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 @@ -29,7 +29,7 @@ public class CommonLibrary extends BaseTestCaseFunc { public String getResourcePath() { - return TestRunner.getGlobalResourcePath() + "/"; + return TestRunner.getResourcePath() + "/"; } public String getResourcePathForKernel() { diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java index 356d5167..13e14359 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/CenterTest.java @@ -89,7 +89,7 @@ public void centerCRUD() throws Exception { 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.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"); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java index 9b64910c..037ca79a 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/DeviceTest.java @@ -48,8 +48,7 @@ public void deviceCRUD() throws InterruptedException { Commons.enter(test,driver, By.id("ipAddress"),"2.2345"); // Commons.enter(test,driver, By.id("validity"),validityDate); - Commons.calendar(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")); 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 index 3f94819a..5cdee458 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/HolidaysTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/HolidaysTest.java @@ -1,6 +1,7 @@ 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; @@ -48,8 +49,8 @@ public void holidaysCRUD() throws Exception { 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); + // 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")); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java index 4ad4c8c6..40f85ad3 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/testcase/MachineTest.java @@ -46,7 +46,7 @@ public void machineCRUD() throws Exception { 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.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); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java index ddb6a319..d798739d 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/BaseClass.java @@ -88,14 +88,17 @@ public void setUp() throws Exception { test=extent.createTest(getCommitId(),getCommitId()); ChromeOptions options = new ChromeOptions(); + String headless=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless"); if(headless.equalsIgnoreCase("yes")) { options.addArguments("--headless=new"); } - WebDriverManager.chromedriver().setup(); - driver=new ChromeDriver(options); + + WebDriverManager.chromedriver().setup(); + driver=new ChromeDriver(options); + // js = (JavascriptExecutor) driver; diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java index b246fae8..743622d2 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Commons.java @@ -427,6 +427,7 @@ public static String getPreAppend() } return preappend; } + public static void calendar(String date) { String a=date.replaceAll("/",""); String mon=""; @@ -462,5 +463,4 @@ public static void calendar(String date) { } } - } 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 index a599e900..ba45e432 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/ExtentReportManager.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/ExtentReportManager.java @@ -14,7 +14,8 @@ public class ExtentReportManager extends BaseClass { public static ExtentReports getReports() { if(extent==null) { extent=new ExtentReports(); - Filepath=System.getProperty("user.dir")+"/Reports/"+"mosip-admin-ui-test-report-"+Commons.appendDate+".html"; + extent=new ExtentReports(); + Filepath=System.getProperty("user.dir")+"/Reports/"+"admin-ui-report-"+Commons.appendDate+".html"; html=new ExtentSparkReporter(Filepath); extent.attachReporter(html); } diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/JsonUtil.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/JsonUtil.java index 5031afc1..d4b0d4a0 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/JsonUtil.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/JsonUtil.java @@ -124,11 +124,18 @@ 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"); 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 index 87034c8b..75def8ca 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/Screenshot.java @@ -21,7 +21,20 @@ public class Screenshot { public static String ClickScreenshot(WebDriver driver) throws IOException { TakesScreenshot ss=(TakesScreenshot)driver; File so=ss.getScreenshotAs(OutputType.FILE); - String path=System.getProperty("user.dir")+"/Screenshots/"+System.currentTimeMillis()+".png"; + String path=null; + + if (TestRunner.checkRunType().equalsIgnoreCase("JAR")) { + path = TestRunner.getResourcePath()+"/Screenshots/"+System.currentTimeMillis()+".png"; + } else if (TestRunner.checkRunType().equalsIgnoreCase("IDE")) { + + + path = System.getProperty("user.dir") + System.getProperty("path.config")+ "/Screenshots/"+System.currentTimeMillis()+".png"; + } + + + + + // String path=System.getProperty("user.dir")+"/resources/Screenshots/"+System.currentTimeMillis()+".png"; File des=new File(path); FileHandler.copy(so, des); FileInputStream fis=new FileInputStream(path); diff --git a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java index f73be70a..c251de24 100644 --- a/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java +++ b/admintest/src/main/java/io/mosip/testrig/adminui/utility/TestRunner.java @@ -39,7 +39,7 @@ public static void main(String[] args) throws Exception { //startTestRunner(); testNg=new TestNG(); - //testNg.addListener(MyListener.class); + String listExcludedGroups=JsonUtil.JsonObjParsing(Commons.getTestData(),"setExcludedGroups"); testNg.setExcludedGroups(listExcludedGroups); testNg.setTestClasses(new Class[] { @@ -60,7 +60,6 @@ public static void main(String[] args) throws Exception { // testNg.addListener(tla); testNg.run(); - } public static String getGlobalResourcePath() { if (checkRunType().equalsIgnoreCase("JAR")) { @@ -77,10 +76,12 @@ public static String getGlobalResourcePath() { public static String getResourcePath() { if (checkRunType().equalsIgnoreCase("JAR")) { - return new File(jarUrl).getParentFile().getAbsolutePath(); + return new File(jarUrl).getParentFile().getAbsolutePath().toString()+"/resources/"; } else if (checkRunType().equalsIgnoreCase("IDE")) { - String path = new File(TestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath() - .toString(); + 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; diff --git a/admintest/src/main/resources/TestData.json b/admintest/src/main/resources/TestData.json index 61bbc3fb..6b2d0758 100644 --- a/admintest/src/main/resources/TestData.json +++ b/admintest/src/main/resources/TestData.json @@ -19,8 +19,8 @@ "15templateCRUD": "T", "BELOW_ARE_STATIC_KEYWORDS": "We are using this setExcludedGroups to exclude scenarios", "setExcludedGroups": "BU", - "holidayDateCenter": "23/12/2025", - "holidayDate": "13/09/2025", + "holidayDateCenter": "10/12/2025", + "holidayDate": "10/09/2025", "validityDate":"10/12/2026", "loginlang": "sin", "preappend": "0", @@ -28,8 +28,8 @@ "headless": "no", "bulkwait": "10000", "dummyData":"blocklistwordss", - "publicKey": "AAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDDg75ctP0GxwDUvaKneXZ4wbdfr98beJ9jEdvANZpHdjlXTGkxy3tzqE9NQCd83Vy4fni-mA14kqNdmCjs3AAGJToC86EC_QqG81TeeG-MfQuIbBlc1uDLHAcLypEMkjnubyTKUpfkA7t3lqSRgn0ck5XRwZjjNlF9Gj16P9fEY668oeUUe_3rPM5AkEC9OY21Jkod81etdYWuNBuBCXa0S_7Vx5Y3HfS0mEJnuYlisL-BaQVt_sq6cFFfE-9oMv1sDiXaEwrcSP7e1CikIbqQCtZb4AIkvowUKb_2d_4mi9iwtxa6yomso5Ji36BfQBVwSU8RCe6QCyOfmmkjBXMa", - "signPublicKey": "AAEABAAEAHIAAAAQABQACwgAAAEAAQEAnpLxkf161vM6zIUxD-rEV010TRawgms7-O2p_Qo0t23fDWqYN0AD8PgsEUO8VJ6JkMpowdMtBzyygJDjGB3uPz8LA79WbotuchWOwQdE5jrYrRT1gvZvHIPPI3R1kn7WxmhAFMowV8nX-Ka2FcqQHdqT1vKxGn5cWqk5hptvq4GB_hBJX93kkPJXs2Lt7PyWR2iMjewauAfu1mcxiSy1L-dfhQ9h2DP80oue46Fqe1i9wGNdDOzrLYYZGCgrMJbPxCj-zeDsdnD4z6iCEp8-9qglie92PyJi1_61SlNS9bOLRnX374AjIUyvbL-xx2WSfibjHi9--jeiCmpiasdTag", + "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", "langcode": [ { "language": "tam", diff --git a/admintest/src/main/resources/config/Kernel.properties b/admintest/src/main/resources/config/Kernel11.properties similarity index 98% rename from admintest/src/main/resources/config/Kernel.properties rename to admintest/src/main/resources/config/Kernel11.properties index 0de06ee5..aef49c61 100644 --- a/admintest/src/main/resources/config/Kernel.properties +++ b/admintest/src/main/resources/config/Kernel11.properties @@ -74,11 +74,11 @@ db-server=dev3.mosip.net s3-user-key=minioadmin s3-user-secret=minioadmin s3-host=http://minio.minio:9000 -s3-account=uiautomation +s3-account=automation s3-region=null reportExpirationInDays=3 # supported values yes or no -push-reports-to-s3=no +push-reports-to-s3=yes enableDebug=no # supported values are 1 to 8 threadCount=1 diff --git a/admintest/src/main/resources/logback.xml b/admintest/src/main/resources/logback.xml index 74ba4553..9946619a 100644 --- a/admintest/src/main/resources/logback.xml +++ b/admintest/src/main/resources/logback.xml @@ -19,7 +19,7 @@ - +