//Give design name in Save Design Popup public static void VerifySaveDesign(string name) { log4net.Config.XmlConfigurator.Configure(); ILog logger = LogManager.GetLogger(typeof(CreateDesignPage)); try { Wait.WaitVisible(SaveDesign, 20); SaveDesign.Click(); Wait.WaitVisible(SaveDeisgnPopup, 20); ClearTextInSaveDesignPopup(); string designnanme = name + DateTime.Now.ToString(); DesignName.Type(designnanme); Wait.WaitVisible(SaveDesignNameYes, 10); SaveDesignNameYes.Click(); Wait.WaitVisible(SaveDesignNameConfirmMsg, 20); String msg = SaveDesignNameConfirmMsg.GetText(); Console.WriteLine("Confirmation msg after successfully saving the design name " + msg); logger.Info("Confirmation msg after successfully saving the design name " + msg); } catch (Exception e) { logger.Error("Verify Design name failed due to : " + e); test.Fail("Verify Design name failed."); //**Closing browser Driver.Quit(); throw e; } }
//Click on Save Design in Create Deisgn page public static void OverWriteExistingNameWithYes() { log4net.Config.XmlConfigurator.Configure(); ILog logger = LogManager.GetLogger(typeof(CreateDesignPage)); try { Wait.WaitVisible(SaveDesign, 30); SaveDesign.Click(); Wait.WaitVisible(YesSaveInSaveDesignPopup, 10); YesSaveInSaveDesignPopup.Click(); YesInOverWritePopup.Click(); } catch (Exception e) { Console.Write("Click On Save failed."); //**Closing browser Driver.Quit(); throw e; } }
//Negative Cases for Save public static void CancelSaveDesignName(string name) { log4net.Config.XmlConfigurator.Configure(); ILog logger = LogManager.GetLogger(typeof(CreateDesignPage)); try { if (SaveDesign.IsElementEnabled()) { SaveDesign.Click(); bool status_of_save_button = SaveDesignNameYes.IsElementEnabled(); Console.WriteLine("Status of save design button is " + status_of_save_button); logger.Info("Status of save design button is " + status_of_save_button); Wait.WaitVisible(SaveDeisgnPopup, 20); String designnanme = name + DateTime.Now.ToString(); DesignName.Type(designnanme); SaveDesignNameNo.Click(); } else { Console.WriteLine("Cancel SaveDesign Name failed."); logger.Info("Cancel SaveDesign Name failed."); } if (CreateDesignHeader.IsElementDisplayed()) { Console.Write("Create Design page is opened."); } else { Console.Write("Navigating to Create Design page failed."); } } catch (Exception e) { logger.Error("Cancel Save DesignName failed due to : " + e); //**Closing browser Driver.Quit(); throw e; } }
//Verify Alert Msg for Existing Design public static void VerifyExistingDesignAlertMsg() { log4net.Config.XmlConfigurator.Configure(); ILog logger = LogManager.GetLogger(typeof(CreateDesignPage)); try { SaveDesign.Click(); Wait.WaitVisible(SaveDeisgnPopup, 30); Wait.WaitVisible(DesignName, 10); DesignName.Type("suresh"); string alert_msg = ExistingDesignNameMsg.GetText(); Console.WriteLine("For existing design alert msg is " + alert_msg); } catch (Exception e) { logger.Error("Verify Existing Design Alert Msg failed due to : " + e); //**Closing browser Driver.Quit(); throw e; } }