Skip to content

Commit

Permalink
Merge pull request #497 from anup-nehe/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
aranaravi authored Sep 25, 2023
2 parents e3e5599 + 3e48e60 commit 84dfa5b
Show file tree
Hide file tree
Showing 13 changed files with 317 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,26 @@ public class CommonLibrary extends BaseTestCase {


public String getResourcePath() {
return TestRunner.getGlobalResourcePath() + "/resource/";
if(TestRunner.checkRunType().equals("JAR")) {
return TestRunner.getResourcePath();
}else if(TestRunner.checkRunType().equals("IDE")) {
return TestRunner.getResourcePath();
}
return null;
}

public String getResourcePathForKernel() {
return TestRunner.getResourcePath() + "/resource/";
String kernelpath=null;
if(TestRunner.checkRunType().equals("JAR")) {
logger.info("file location for kernal"+TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename());

kernelpath = TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename().toString();
}else if(TestRunner.checkRunType().equals("IDE")){
logger.info("file location for kernal"+TestRunner.getResourcePath() + "/config/"+TestRunner.GetKernalFilename());

kernelpath = TestRunner.getResourcePath() + "/config/"+TestRunner.GetKernalFilename().toString();
}
return kernelpath;
}


Expand Down Expand Up @@ -66,13 +81,11 @@ public boolean isValidToken(String cookie) {
public Map<String, String> readProperty(String propertyFileName) {
Properties prop = new Properties();
try {
System.out.println("propertyFileName: " + propertyFileName + "Path :" + getResourcePathForKernel() + "config/" + propertyFileName + ".properties");
logger.info("propertyFileName: " + propertyFileName + "Path :" + getResourcePathForKernel() + "config/" + propertyFileName + ".properties");
File propertyFile = new File(getResourcePathForKernel() + "config/" + propertyFileName + ".properties");
File propertyFile = new File( getResourcePathForKernel());
prop.load(new FileInputStream(propertyFile));

} catch (IOException e) {
System.out.println("Error occrued while reading propertyFileName " + propertyFileName + e.getMessage());
logger.info("Error occrued while reading propertyFileName " + propertyFileName + e.getMessage());
logger.info(e.getMessage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ public static String getValueForKey(String key) {

public static void init() {
// Loading Kernel property
LOGGER.info("file location"+TestRunner.getResourcePath() + "/" + "resource/config/Kernel.properties");
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "resource/config/Kernel.properties");
LOGGER.info("file location"+TestRunner.getResourcePath() + "/config/"+TestRunner.GetKernalFilename());
propsKernel = getproperty(TestRunner.getResourcePath() + "/config/"+TestRunner.GetKernalFilename());

pms_client_secret = getValueForKey(MOSIP_PMS_CLIENT_SECRET);
pms_client_id = getValueForKey(MOSIP_PMS_CLIENT_ID);
Expand Down Expand Up @@ -374,7 +374,7 @@ public static String getauthCertsPath() {
}

public static Properties init(String abc) {
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "resource/config/Kernel.properties");
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "/config/Kernel.properties");

return propsKernel;
}
Expand Down Expand Up @@ -642,7 +642,7 @@ public static String getIAMUsersPassword() {
}

public static String getRolesForUser(String userId) {
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "resource/config/Kernel.properties");
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "/config/Kernel.properties");
return propsKernel.getProperty("roles." + userId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import io.restassured.response.Response;

public class KernelAuthentication extends BaseTestCase {
private String authRequest="config/Authorization/request.json";
private String authInternalRequest="config/Authorization/internalAuthRequest.json";
private String authRequest="/config/Authorization/request.json";
private String authInternalRequest="/config/Authorization/internalAuthRequest.json";
String cookie;
static String dataKey = "response";
CommonLibrary clib= new CommonLibrary();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class KeycloakUserManager {

private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(KeycloakUserManager.class);

public static Properties propsKernel = getproperty(TestRunner.getResourcePath() + "/"+"resource/config/Kernel.properties");
public static Properties propsKernel = getproperty(TestRunner.getResourcePath() + "/config/"+TestRunner.GetKernalFilename());

private static Keycloak getKeycloakInstance() {
Keycloak key=null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public class BaseTestCase {
public static String ApplnURIForKeyCloak;
public static String testLevel;
public static Properties props = getproperty(
TestRunner.getResourcePath() + "/" + "resource/config/application.properties");
TestRunner.getResourcePath() + "/config/application.properties");
public static Properties propsKernel = getproperty(
TestRunner.getResourcePath() + "/" + "resource/config/Kernel.properties");
TestRunner.getResourcePath() + "/config/"+TestRunner.GetKernalFilename());
public static Properties propsMap = getproperty(
TestRunner.getResourcePath() + "/" + "resource/config/valueMapping.properties");
TestRunner.getResourcePath() + "/config/valueMapping.properties");
public static Properties propsBio = getproperty(
TestRunner.getGlobalResourcePath() + "/" + "resource/config/bioValue.properties");
TestRunner.getResourcePath() + "/config/bioValue.properties");
public static String SEPRATOR = "";
public static String currentModule = "residentui";
public final static String COOKIENAME = "Authorization";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,57 +24,59 @@ public void getInformation() throws Exception {
String postalcode = JsonUtil.JsonObjParsing(Commons.getTestData(), "postalcode");

test = extent.createTest("GetInformation test", "verify Login");
Thread.sleep(2000);
Commons.click(test, driver, By.id("dashboardCard2"));
// Commons.click(test,driver, By.id("downloadAcknowledgementbtn"));

Commons.click(test, driver, By.id("mat-tab-label-0-0"));
// Commons.dropdown(driver, By.id("mat-select-0"));

Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[6]"));// connect with arvind
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[6]"));// connect with arvind

// MyCountry

test = extent.createTest("Get Information of country", "verify country");
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-0"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), country);// take from testdata
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));// connect with arvind
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), country);// take from testdata
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));// connect with arvind
//Commons.click(test, driver, By.xpath("//img[@class='save-icon']"));
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
Commons.click(test, driver, By.xpath("//img[@class='save-icon']"));
// region
test = extent.createTest("Get Information of region", "verify region");
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-1"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), region);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), region);
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));
Commons.click(test, driver, By.xpath("//img[@class='save-icon']"));
// province
test = extent.createTest("Get Information of province", "verify province");
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-2"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), province);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), province);
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));
Commons.click(test, driver, By.xpath("//img[@class='save-icon']"));
// City
test = extent.createTest("Get Information of city", "verify city");
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-3"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), city);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), city);
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
//Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));
Commons.click(test, driver, By.xpath("//img[@class='save-icon']"));
// Zone
test = extent.createTest("Get Information of zone", "verify zone");
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-4"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), zone);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), zone);
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));
Commons.click(test, driver, By.xpath("//img[@class='save-icon']"));
// Postal Code
test = extent.createTest("Get Information of postalcode", "verify postalcode");
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-5"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), postalcode);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), postalcode);
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[8]"));
Commons.click(test, driver, By.xpath("//img[@class='save-icon']"));
// Commons.enter(driver, By.className("search-input ng-pristine ng-valid
// ng-touched"), "CST");
// driver.findElement(By.xpath("//input[@type='search']")).sendKeys("CST");
Expand All @@ -84,63 +86,71 @@ public void getInformation() throws Exception {
public void GetInformationWithInvalidcountry() throws Exception {
String postalcode = JsonUtil.JsonObjParsing(Commons.getTestData(), "postalcode");
test = extent.createTest("Get Information With Invalid country", "verify country");
Thread.sleep(2000);
Commons.click(test, driver, By.id("dashboardCard2"));
Commons.click(test, driver, By.id("mat-tab-label-0-0"));
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-0"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), postalcode);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), postalcode);
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
}

public void GetInformationWithInvalidProvince() throws Exception {
String postalcode = JsonUtil.JsonObjParsing(Commons.getTestData(), "postalcode");
test = extent.createTest("Get Information With Invalid Province", "verify Province");
Thread.sleep(2000);
Commons.click(test, driver, By.id("dashboardCard2"));
Commons.click(test, driver, By.id("mat-tab-label-0-0"));
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-1"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), postalcode);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), postalcode);
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
}

public void GetInformationWithInvalidRegion() throws Exception {
String postalcode = JsonUtil.JsonObjParsing(Commons.getTestData(), "postalcode");
test = extent.createTest("Get Information With Invalid Region", "verify Region");
Thread.sleep(2000);
Commons.click(test, driver, By.id("dashboardCard2"));
Commons.click(test, driver, By.id("mat-tab-label-0-0"));
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-2"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), postalcode);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), postalcode);
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
}

public void GetInformationWithInvalidCity() throws Exception {
String postalcode = JsonUtil.JsonObjParsing(Commons.getTestData(), "postalcode");
test = extent.createTest("GetI nformation With InvalidCity", "verify City");
Thread.sleep(2000);
Commons.click(test, driver, By.id("dashboardCard2"));
Commons.click(test, driver, By.id("mat-tab-label-0-0"));
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-3"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), postalcode);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));

Commons.enter(test, driver, By.xpath("//input[@id='search']"), postalcode);
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
}

public void GetInformationWithInvalidZone() throws Exception {
String postalcode = JsonUtil.JsonObjParsing(Commons.getTestData(), "postalcode");
test = extent.createTest("Get Information With Invalid Zone", "verify Zone");
Thread.sleep(2000);
Commons.click(test, driver, By.id("dashboardCard2"));
Commons.click(test, driver, By.id("mat-tab-label-0-0"));
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-4"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), postalcode);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.enter(test, driver, By.xpath("//input[@id='search']"), postalcode);
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
}

public void GetInformationWithInvalidPostalCode() throws IOException, InterruptedException {
Thread.sleep(2000);
Commons.click(test, driver, By.id("dashboardCard2"));
test = extent.createTest("Get Information With Invalid PostalCode", "verify PostalCode");
Commons.click(test, driver, By.id("mat-tab-label-0-0"));
Commons.dropdown(test, driver, By.id("mat-select-0"), By.id("mat-option-5"));
Commons.enter(test, driver, By.xpath("//input[@type='search']"), data);
Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.enter(test, driver, By.xpath("//input[@id='search']"), data);
// Commons.click(test, driver, By.xpath("(//span[@class='mat-button-wrapper'])[7]"));
Commons.click(test, driver, By.xpath("//button[@class='search-btn mat-raised-button']"));
}
}
Loading

0 comments on commit 84dfa5b

Please sign in to comment.