Skip to content

Commit

Permalink
MOSIP-31084
Browse files Browse the repository at this point in the history
Signed-off-by: Jayesh Kharode <[email protected]>
  • Loading branch information
Jayesh Kharode committed Jan 18, 2024
1 parent 411197a commit 79f82be
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public class ConfigManager {
// private static String MOUNT_PATH_FOR_SCENARIO = "mountPathForScenario";
//
// private static String PACKET_UTILITY_BASE_URL = "packetUtilityBaseUrl";
private static String ADMIN_USERNAME = "admin_userName";

private static String REPORT_EXPIRATION_IN_DAYS = "reportExpirationInDays";
// private static String pms_client_secret;
// private static String pms_client_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void bulkUploadCRUD(String table) throws Exception {
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(":");
logger.info(divTextArr[1].trim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

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;
Expand Down Expand Up @@ -74,7 +75,7 @@ public class BaseClass {
public static ExtentTest test;




@BeforeSuite

Expand All @@ -90,15 +91,13 @@ 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")) {

if(ConfigManager.getdocker().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");
Expand All @@ -108,7 +107,7 @@ public void setUp() throws Exception {
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 @@ -117,78 +116,34 @@ public void setUp() throws Exception {
js = (JavascriptExecutor) driver;
vars = new HashMap<String, Object>();
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));
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();
}
driver.findElement(By.id("username")).sendKeys(userid);
driver.findElement(By.id("password")).sendKeys(password);
driver.findElement(By.xpath("//input[@name='login']")).click();

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']"));


}
// @BeforeMethod
// public void setUp() throws Exception {
// Reporter.log("BaseClass", true);
// test = extent.createTest(getCommitId(), getCommitId());
//
// ChromeOptions options = new ChromeOptions();
// String headless = JsonUtil.JsonObjParsing(Commons.getTestData(), "headless");
// if (headless.equalsIgnoreCase("yes")) {
// options.addArguments("--no-sandbox");
// options.addArguments("--headless", "--disable-gpu", "--window-size=1920x1080");
// }
//
// WebDriver driver;
//
// if (System.getProperty("os.name").equalsIgnoreCase("Linux")) {
// // Use remote WebDriver for Linux
// options.addArguments("--no-sandbox"); // Add additional arguments if needed
// driver = new RemoteWebDriver(new URL("http://selenium-hub:4444/wd/hub"), options);
// } else {
// // Use local WebDriver for non-Linux
// WebDriverManager.chromedriver().setup();
// driver = new ChromeDriver(options);
// }
//
// js = (JavascriptExecutor) driver;
// vars = new HashMap<String, Object>();
// driver.get(envPath);
// driver.manage().window().maximize();
// Thread.sleep(500);
// driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
//
// String language1 = null;
// try {
// language1 = Commons.getFieldData("langcode");
// logger.info(language1);
// if (!language1.equals("sin")) {
// Commons.click(test, driver, By.xpath("//*[@id='kc-locale-dropdown']"));
// String var = "//li/a[contains(text(),'" + language1 + "')]";
// Commons.click(test, driver, By.xpath(var));
// }
// } catch (Exception e) {
// e.getMessage();
// }
//
// driver.findElement(By.id("username")).sendKeys(userid);
// driver.findElement(By.id("password")).sendKeys(password);
// driver.findElement(By.xpath("//input[@name='login']")).click();
// }


@AfterMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static void main(String[] args) throws Exception {
// MockSMTPListener mockSMTPListener = new MockSMTPListener();
// mockSMTPListener.run();
startTestRunner();
DBManager.clearMasterDbData();
}


Expand Down
2 changes: 1 addition & 1 deletion admintest/src/main/resources/config/Kernel.properties
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ preappend=00
splitdigit=7
jsonObjName=identity
bulkwait=10000
dummyData=blocklistwordss
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=no
Expand Down

0 comments on commit 79f82be

Please sign in to comment.