@BeforeClass(alwaysRun = true) public void setup() throws IOException, InterruptedException { action = new UserAction(); locator = new Properties(); input = new Properties(); locator.load( new FileInputStream( System.getProperty("user.dir") + "\\Third Party\\objectRepository\\OR.properties")); input.load( new FileInputStream( System.getProperty("user.dir") + "\\Third Party\\testData\\INPUT.properties")); action.login(input.getProperty("UserId"), input.getProperty("Password"), action); }
@Test(description = "Restore Secondary server to primary", priority = 1) public void Restore() throws Exception { // Navigate to Geographic_Redundancy action.ClickLink(locator.getProperty("Geographic_Redundancy")); action.WaitForTitle(locator.getProperty("Geographic_Redundancy")); action.SwithchFrame("iframe0"); // Click on Restore button action.ClickButton(locator.getProperty("GeoRestore")); Thread.sleep(3000); // Focus on Popup window WebElement Details = action.driver.findElement(By.xpath(locator.getProperty("RecoveryWindow"))); Details.sendKeys(org.openqa.selenium.Keys.CONTROL); // Click on Recondary sever button action.ClickButton(locator.getProperty("RecoverSecondary")); WebElement recovercnfm = action.driver.findElement(By.xpath(locator.getProperty("RecoveryWindowcnfrm"))); recovercnfm.sendKeys(org.openqa.selenium.Keys.CONTROL); // Click on OK button to confirm action.ClickButton(locator.getProperty("Restorecnfrm")); // Wait for some time to handle pop up Thread.sleep(550000); // handle alert if (action.isAlertPresent()) { action.driver.switchTo().alert(); action.driver.switchTo().alert().accept(); } // Wait for 15 minutes action.RefreshPage(); Thread.sleep(150000); action.RefreshPage(); WebDriverWait wait = new WebDriverWait(action.driver, 240000); wait.until(ExpectedConditions.titleContains(locator.getProperty("System_Manager"))); action.RefreshPage(); Thread.sleep(1000); WebElement ele = action.driver.findElement(By.xpath(locator.getProperty("ErrorBox"))); while (ele.isDisplayed()) { action.RefreshPage(); Thread.sleep(60000); } action.driver.quit(); action.login(input.getProperty("UserId"), input.getProperty("Password"), action); Thread.sleep(1000); action.RefreshPage(); }