Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-31085 #207

Merged
merged 10 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package io.mosip.testrig.pmpui.testcase;

import java.io.IOException;

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

import com.aventstack.extentreports.Status;

import io.mosip.testrig.pmpui.kernel.util.ConfigManager;
import io.mosip.testrig.pmpui.utility.BaseClass;
import io.mosip.testrig.pmpui.utility.Commons;
import io.mosip.testrig.pmpui.utility.JsonUtil;
Expand All @@ -15,7 +18,7 @@
public class AdminAuthPolicyTest extends BaseClass {

@Test(groups = {"AP"},dependsOnGroups = "PG")
public void adminAuthPolicyTest() throws InterruptedException{
public void adminAuthPolicyTest() throws InterruptedException, IOException{

test=extent.createTest("AdminAuthPolicyTest", "verify Login");
Commons.click(test,driver, By.id("policymenugroup"));
Expand All @@ -33,7 +36,7 @@ public void adminAuthPolicyTest() throws InterruptedException{

String policyData;
try {
policyData = JsonUtil.JsonObjParsing(Commons.getTestData(),"policyData");
policyData = ConfigManager.getpolicyData();
Commons.enter(test,driver, By.id("policies"), policyData);
} catch (Exception e) {
// TODO Auto-generated catch block
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package io.mosip.testrig.pmpui.testcase;

import java.io.IOException;

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

import com.aventstack.extentreports.Status;

import io.mosip.testrig.pmpui.kernel.util.ConfigManager;
import io.mosip.testrig.pmpui.utility.BaseClass;
import io.mosip.testrig.pmpui.utility.Commons;
import io.mosip.testrig.pmpui.utility.JsonUtil;
Expand All @@ -15,7 +18,7 @@
public class AdminDataSharePolicyTest extends BaseClass {

@Test(groups = "DSP",dependsOnGroups = "AP")
public void adminDataSharePolicyTest() throws InterruptedException {
public void adminDataSharePolicyTest() throws InterruptedException, IOException {

test=extent.createTest("AdminDataSharePolicyTest", "verify Login");
Commons.click(test,driver, By.id("policymenugroup"));
Expand All @@ -33,7 +36,7 @@ public void adminDataSharePolicyTest() throws InterruptedException {
test.log(Status.INFO, "Dropdoen selected");
String dataSharepolicyData;
try {
dataSharepolicyData = JsonUtil.JsonObjParsing(Commons.getTestData(),"dataSharepolicyData");
dataSharepolicyData =ConfigManager.getdataSharepolicyData();
Commons.enter(test,driver, By.id("policies"), dataSharepolicyData);
Thread.sleep(500);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.mosip.testrig.pmpui.testcase;

import java.io.IOException;

import org.openqa.selenium.By;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
Expand All @@ -16,7 +18,7 @@ public class AdminDeviceDetailsTest extends BaseClass {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(AdminDeviceDetailsTest.class);
@Test(groups = "DD",dataProvider = "data-provider-DEVICE-SBI",dependsOnGroups = {"SD","AP"})

public void adminDeviceDetailsTest(String cer) throws InterruptedException {
public void adminDeviceDetailsTest(String cer) throws InterruptedException, IOException {

String dropdwnVal=cer.substring(0, cer.indexOf("_", 0));
String orgName=cer.substring(0, cer.length()-4);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.mosip.testrig.pmpui.testcase;

import java.io.IOException;

import org.openqa.selenium.By;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
Expand All @@ -13,7 +15,7 @@ public class AdminFtmDetailsTest extends BaseClass {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(AdminFtmDetailsTest.class);

@Test(groups = {"FD"},dataProvider = "data-provider-FTM",dependsOnGroups = "RFTM")
public void adminFtmDetailsTest(String cer) throws InterruptedException {
public void adminFtmDetailsTest(String cer) throws InterruptedException, IOException {

test=extent.createTest("AdminFtmDetailsTest", "verify Login");
Commons.click(test,driver, By.xpath("//a[@href='#/pmp/resources/ftmdetails/view']"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.mosip.testrig.pmpui.testcase;

import java.io.IOException;

import org.openqa.selenium.By;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
Expand All @@ -14,7 +16,7 @@
public class AdminPartnerPolicyMappingTest extends BaseClass {

@Test(groups = "PPM",dependsOnGroups = "RAC",dataProvider = "data-provider-AUTH" )
public void adminPartnerPolicyMappingTest(String cer) throws InterruptedException {
public void adminPartnerPolicyMappingTest(String cer) throws InterruptedException, IOException {

String dropdwnVal=cer.substring(0, cer.indexOf("_", 0));
String orgName=cer.substring(0, cer.length()-4);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.mosip.testrig.pmpui.testcase;

import java.io.IOException;

import org.openqa.selenium.By;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
Expand All @@ -14,7 +16,7 @@
public class AdminPolicyGroupTest extends BaseClass {

@Test(groups = "PG",dependsOnGroups = "UFCC")
public void adminPolicyGroupTest() throws InterruptedException {
public void adminPolicyGroupTest() throws InterruptedException, IOException {


test=extent.createTest("AdminPolicyGroupTest", "verify Login");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.testrig.pmpui.testcase;

import java.awt.AWTException;
import java.io.IOException;

import org.openqa.selenium.By;
import org.testng.annotations.Test;
Expand All @@ -12,7 +13,7 @@
public class AdminUploadCaCertTest extends BaseClass {

@Test(groups = "UFCC",dataProvider = "data-provider-ca")
public void adminUploadCaCertTest(String cer) throws InterruptedException, AWTException {
public void adminUploadCaCertTest(String cer) throws InterruptedException, AWTException, IOException {



Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.testrig.pmpui.testcase;

import java.awt.AWTException;
import java.io.IOException;

import org.openqa.selenium.By;
import org.testng.annotations.Listeners;
Expand All @@ -18,7 +19,7 @@ public class PartnerLoginAuthCredTest extends RegisterBaseClass {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(RealTimeReport.class);

@Test(groups = "PLAC", dataProvider = "data-provider-AUTH" ,dependsOnGroups = {"PPM"})
public void partnerLoginAuthCredTest(String cer) throws InterruptedException, AWTException{
public void partnerLoginAuthCredTest(String cer) throws InterruptedException, AWTException, IOException{
//String datetime=Commons.getDateTime();
test=extent.createTest("PartnerLoginAuthCredTest", "verify Login");
String dropdwnVal=cer.substring(0, cer.indexOf("_", 0));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.testrig.pmpui.testcase;

import java.awt.AWTException;
import java.io.IOException;

import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;
Expand All @@ -9,6 +10,7 @@

import com.aventstack.extentreports.Status;

import io.mosip.testrig.pmpui.kernel.util.ConfigManager;
import io.mosip.testrig.pmpui.utility.Commons;
import io.mosip.testrig.pmpui.utility.JsonUtil;
import io.mosip.testrig.pmpui.utility.RealTimeReport;
Expand All @@ -18,7 +20,7 @@
public class PartnerRegisterAuthCredTest extends RegisterBaseClass {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(PartnerRegisterAuthCredTest.class);
@Test(groups = "RAC",dataProvider = "data-provider-AUTH" , dependsOnGroups = {"UFCC","DSP"})
public void partnerRegisterAuthCredTest(String cer) throws InterruptedException, AWTException{
public void partnerRegisterAuthCredTest(String cer) throws InterruptedException, AWTException, IOException{
String datetime=Commons.getDateTime();
String dropdwnVal=cer.substring(0, cer.indexOf("_", 0));
String orgName=cer.substring(0, cer.length()-4);
Expand Down Expand Up @@ -107,8 +109,8 @@ public void partnerRegisterAuthCredTest(String cer) throws InterruptedException,

Commons.enter(test,driver, By.xpath("//input[@id='swVersion']"), data);
Commons.enter(test,driver, By.xpath("//input[@id='swBinaryHash']"), data);
Commons.enter(test,driver, By.xpath("//input[@id='swCreateDateTime']"), JsonUtil.JsonObjParsing(Commons.getTestData(),"sbivalidDate"));
Commons.enter(test,driver, By.xpath("//input[@id='swExpiryDateTime']"), JsonUtil.JsonObjParsing(Commons.getTestData(),"sbiexpiryDate"));
Commons.enter(test,driver, By.xpath("//input[@id='swCreateDateTime']"),ConfigManager.getsbivalidDate());
Commons.enter(test,driver, By.xpath("//input[@id='swExpiryDateTime']"), ConfigManager.getsbiexpiryDate());
Commons.click(test,driver, By.xpath("//button[@id='createButton']"));
Commons.click(test,driver, By.xpath("//button[@id='confirmmessagepopup']"));
Thread.sleep(3000);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.testrig.pmpui.testcase;

import java.awt.AWTException;
import java.io.IOException;

import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;
Expand All @@ -9,6 +10,7 @@

import com.aventstack.extentreports.Status;

import io.mosip.testrig.pmpui.kernel.util.ConfigManager;
import io.mosip.testrig.pmpui.utility.Commons;
import io.mosip.testrig.pmpui.utility.JsonUtil;
import io.mosip.testrig.pmpui.utility.RealTimeReport;
Expand All @@ -18,7 +20,7 @@
public class PartnerRegisterFTMTest extends RegisterBaseClass {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(PartnerRegisterFTMTest.class);
@Test(groups = {"RFTM"},dataProvider = "data-provider-FTM" , dependsOnGroups = {"UFCC"})
public void partnerRegisterFTMTest(String cer) throws InterruptedException, AWTException{
public void partnerRegisterFTMTest(String cer) throws InterruptedException, AWTException, IOException{
String datetime=Commons.getDateTime();
String dropdwnVal=cer.substring(0, cer.indexOf("_", 0));
String orgName=cer.substring(0, cer.length()-4);
Expand Down Expand Up @@ -107,8 +109,8 @@ public void partnerRegisterFTMTest(String cer) throws InterruptedException, AWTE

Commons.enter(test,driver, By.xpath("//input[@id='swVersion']"), data);
Commons.enter(test,driver, By.xpath("//input[@id='swBinaryHash']"), data);
Commons.enter(test,driver, By.xpath("//input[@id='swCreateDateTime']"), JsonUtil.JsonObjParsing(Commons.getTestData(),"sbivalidDate"));
Commons.enter(test,driver, By.xpath("//input[@id='swExpiryDateTime']"), JsonUtil.JsonObjParsing(Commons.getTestData(),"sbiexpiryDate"));
Commons.enter(test,driver, By.xpath("//input[@id='swCreateDateTime']"), ConfigManager.getsbivalidDate());
Commons.enter(test,driver, By.xpath("//input[@id='swExpiryDateTime']"),ConfigManager.getsbiexpiryDate());
Commons.click(test,driver, By.xpath("//button[@id='createButton']"));
Commons.click(test,driver, By.xpath("//button[@id='confirmmessagepopup']"));
Thread.sleep(3000);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.testrig.pmpui.testcase;

import java.awt.AWTException;
import java.io.IOException;

import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;
Expand All @@ -9,6 +10,7 @@

import com.aventstack.extentreports.Status;

import io.mosip.testrig.pmpui.kernel.util.ConfigManager;
import io.mosip.testrig.pmpui.utility.Commons;
import io.mosip.testrig.pmpui.utility.JsonUtil;
import io.mosip.testrig.pmpui.utility.RealTimeReport;
Expand All @@ -18,7 +20,7 @@
public class PartnerRegisterSbiDeviceTest extends RegisterBaseClass {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(PartnerRegisterSbiDeviceTest.class);
@Test(groups = "RSD",dataProvider = "data-provider-DEVICE-SBI" , dependsOnGroups = {"UFCC","DSP"})
public void partnerRegisterSbiDeviceTest(String cer) throws InterruptedException, AWTException{
public void partnerRegisterSbiDeviceTest(String cer) throws InterruptedException, AWTException, IOException{
String datetime=Commons.getDateTime();
String dropdwnVal=cer.substring(0, cer.indexOf("_", 0));
String orgName=cer.substring(0, cer.length()-4);
Expand Down Expand Up @@ -107,8 +109,8 @@ public void partnerRegisterSbiDeviceTest(String cer) throws InterruptedException

Commons.enter(test,driver, By.xpath("//input[@id='swVersion']"), data);
Commons.enter(test,driver, By.xpath("//input[@id='swBinaryHash']"), data);
Commons.enter(test,driver, By.xpath("//input[@id='swCreateDateTime']"), JsonUtil.JsonObjParsing(Commons.getTestData(),"sbivalidDate"));
Commons.enter(test,driver, By.xpath("//input[@id='swExpiryDateTime']"), JsonUtil.JsonObjParsing(Commons.getTestData(),"sbiexpiryDate"));
Commons.enter(test,driver, By.xpath("//input[@id='swCreateDateTime']"),ConfigManager.getsbivalidDate());
Commons.enter(test,driver, By.xpath("//input[@id='swExpiryDateTime']"),ConfigManager.getsbiexpiryDate());
Commons.click(test,driver, By.xpath("//button[@id='createButton']"));
Commons.click(test,driver, By.xpath("//button[@id='confirmmessagepopup']"));
Thread.sleep(3000);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package io.mosip.testrig.pmpui.testcase;

import java.awt.AWTException;
import java.io.IOException;

import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;

import io.mosip.testrig.pmpui.kernel.util.ConfigManager;
import io.mosip.testrig.pmpui.utility.Commons;
import io.mosip.testrig.pmpui.utility.JsonUtil;
import io.mosip.testrig.pmpui.utility.RealTimeReport;
Expand All @@ -16,7 +18,7 @@
public class TBD extends RegisterBaseClass {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(TBD.class);
@Test(groups = "R",dataProvider = "data-provider-partner" , dependsOnGroups = {"UFCC","DSP"})
public void registerCRUD(String cer) throws InterruptedException, AWTException{
public void registerCRUD(String cer) throws InterruptedException, AWTException, IOException{
String datetime=Commons.getDateTime();
String dropdwnVal=cer.substring(0, cer.indexOf("_", 0));
String orgName=cer.substring(0, cer.length()-4);
Expand Down Expand Up @@ -102,8 +104,8 @@ public void registerCRUD(String cer) throws InterruptedException, AWTException{

Commons.enter(test,driver, By.xpath("//input[@id='swVersion']"), data);
Commons.enter(test,driver, By.xpath("//input[@id='swBinaryHash']"), data);
Commons.enter(test,driver, By.xpath("//input[@id='swCreateDateTime']"), JsonUtil.JsonObjParsing(Commons.getTestData(),"sbivalidDate"));
Commons.enter(test,driver, By.xpath("//input[@id='swExpiryDateTime']"), JsonUtil.JsonObjParsing(Commons.getTestData(),"sbiexpiryDate"));
Commons.enter(test,driver, By.xpath("//input[@id='swCreateDateTime']"),ConfigManager.getsbivalidDate());
Commons.enter(test,driver, By.xpath("//input[@id='swExpiryDateTime']"),ConfigManager.getsbiexpiryDate());
Commons.click(test,driver, By.xpath("//button[@id='createButton']"));
Commons.click(test,driver, By.xpath("//button[@id='confirmmessagepopup']"));

Expand Down
44 changes: 18 additions & 26 deletions pmptest/src/main/java/io/mosip/testrig/pmpui/utility/BaseClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ public class BaseClass {
public static ExtentReports extent;
public static ExtentTest test;
private static final Logger logger = Logger.getLogger(BaseClass.class);
public void setLangcode(String langcode) throws Exception {
this.langcode = Commons.getFieldData("langcode");
}


@BeforeMethod

Expand All @@ -57,25 +55,23 @@ public void setUp() throws Exception {
test=extent.createTest(env,getCommitId());

logger.info("Start set up");
if(System.getProperty("os.name").equalsIgnoreCase("Linux")) {

if(JsonUtil.JsonObjParsing(Commons.getTestData(),"Docker").equals("yes")) {
logger.info("Docker start");
String configFilePath ="/usr/bin/chromedriver";
System.setProperty("webdriver.chrome.driver", configFilePath);
}else {
WebDriverManager.chromedriver().setup();
}
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=JsonUtil.JsonObjParsing(Commons.getTestData(),"headless");
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);
Expand All @@ -89,21 +85,17 @@ public void setUp() throws Exception {
//driver.findElement(By.linkText("Admin")).click();
String language1 = null;
try {
//String loginlang = JsonUtil.JsonObjParsing(Commons.getTestData(),"loginlang");
language1 = Commons.getFieldData("langcode");

language1 = ConfigManager.getloginlang();
String loginlang = null;
System.out.println(language1);
if(!language1.equals("sin"))
{Commons.click(test,driver, By.xpath("//*[@id='kc-locale-dropdown']"));
String var = "//li/a[contains(text(),'" + language1 + "')]";
Commons.click(test,driver, By.xpath(var));
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));
}
//
// 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();
}
Expand Down
Loading
Loading