public static void EditEmployee() { #region ReachingEmployee IWebDriver wd = new ChromeDriver(Constants.Chrome_Driver_Path); wd.Manage().Window.Maximize(); Debug.WriteLine("Driver initialized."); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Navigate().GoToUrl(HumanityLoginPage.Humanity_Login_URL); HumanityLoginTests.FillOutLogin(wd, "*****@*****.**", "pandanagrani"); HumanityLoginPage.ClickLoginButton(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); HumanityMenu.ClickStaff(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); #endregion #region EditingEmployee HumanityStaff.ClickEmployee1(wd); //Was reaching Employee page successful? #region Pass/Fail if (wd.Url.Contains(HumanityStaff.Employee1_URL)) { Console.WriteLine("Pass"); } else { Console.WriteLine("Fail"); } #endregion wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); HumanityEditStaff.ClickEditDetails(wd); //Was reaching Edit Employee page successful? #region Pass/Fail if (wd.Url.Contains(HumanityEditStaff.Edit_Staff_URL)) { Console.WriteLine("Pass"); } else { Console.WriteLine("Fail"); } #endregion wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); HumanityEditStaff.SendNickName(wd, "Safi"); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); Thread.Sleep(3000); HumanityEditStaff.SendUploadPicture(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); Thread.Sleep(3000); HumanityEditStaff.ClickSaveEmployee(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); Thread.Sleep(3000); wd.Quit(); #endregion }
public static void AddNewEmployee() { #region ReachingAddingEmployees IWebDriver wd = new ChromeDriver(Constants.Chrome_Driver_Path); wd.Manage().Window.Maximize(); Debug.WriteLine("Driver initialized."); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); ExcelUtility.OpenFile(Constants.Excel_Path); ExcelUtility.LoadWorkSheet(0); wd.Navigate().GoToUrl(HumanityLoginPage.Humanity_Login_URL); HumanityLoginTests.FillOutLogin(wd, "*****@*****.**", "pandanagrani"); HumanityLoginPage.ClickLoginButton(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); HumanityMenu.ClickStaff(wd); //Was reaching Staff page successful? #region Pass/Fail if (wd.Url.Contains(HumanityStaff.Staff_URL)) { Console.WriteLine("Pass"); } else { Console.WriteLine("Fail"); } #endregion #endregion #region AddNewEmployee wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); HumanityStaff.ClickAddEmployees(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); //Was reaching Add Employee page successful? #region Pass/Fail if (wd.Url.Contains(HumanityStaff.Add_Employee_URL)) { Console.WriteLine("Pass"); } else { Console.WriteLine("Fail"); } #endregion Thread.Sleep(3000); FillOutNewEmployee(wd, "Stefan", "Nikolic", "*****@*****.**"); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); Thread.Sleep(3000); HumanityStaff.ClickSaveNewEmployee(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); Thread.Sleep(3000); wd.Quit(); }
public static void ChangingSettings() { #region ReachingSettings IWebDriver wd = new ChromeDriver(Constants.Chrome_Driver_Path); wd.Manage().Window.Maximize(); Debug.WriteLine("Driver initialized."); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Navigate().GoToUrl(HumanityLoginPage.Humanity_Login_URL); HumanityLoginTests.FillOutLogin(wd, "*****@*****.**", "pandanagrani"); HumanityLoginPage.ClickLoginButton(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); #endregion #region ChangingSettings try { HumanityMenu.ClickSettingsButton(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); //Was reaching Settings successful? #region Pass/Fail1 if (wd.Url.Contains(HumanitySettings.Settings_URL)) { Console.WriteLine("Pass"); } else { Console.WriteLine("Fail"); } #endregion HumanitySettings.SelectCountry(wd, "Israel"); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); //Thread.Sleep(3000); HumanitySettings.SelectDefaultLanguage(wd, "Hebrew (machine)"); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); //Thread.Sleep(3000); HumanitySettings.SelectTimeFormat(wd, "24 hour"); //Thread.Sleep(3000); HumanitySettings.ClickSaveSettings(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); } catch (Exception e) { Console.WriteLine(e.StackTrace); } wd.Quit(); #endregion }
public static void SigningOut() { #region ReachingSignOut IWebDriver wd = new ChromeDriver(Constants.Chrome_Driver_Path); wd.Manage().Window.Maximize(); Debug.WriteLine("Driver initialized."); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Navigate().GoToUrl(HumanityLoginPage.Humanity_Login_URL); HumanityLoginTests.FillOutLogin(wd, "*****@*****.**", "pandanagrani"); HumanityLoginPage.ClickLoginButton(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); #endregion #region SigningOut try { HumanityProfile.ClickProfileMenu(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); HumanityProfile.ClickSignOut(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); //Was signing out successful? #region Pass/Fail if (wd.Url.Contains(HumanityHome.Humanity_Signed_Out_URL)) { Console.WriteLine("Pass"); } else { Console.WriteLine("Fail"); } #endregion Thread.Sleep(3000); wd.Quit(); } catch (Exception e) { Console.WriteLine(e.StackTrace); } #endregion }
public static void AutoAddMultipleEmployees() { IWebDriver wd = new ChromeDriver(Constants.Chrome_Driver_Path); wd.Manage().Window.Maximize(); Debug.WriteLine("Driver initialized."); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); ExcelUtility.OpenFile(Constants.Excel_Path); ExcelUtility.LoadWorkSheet(0); wd.Navigate().GoToUrl(HumanityLoginPage.Humanity_Login_URL); HumanityLoginTests.FillOutLogin(wd, "*****@*****.**", "pandanagrani"); HumanityLoginPage.ClickLoginButton(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); HumanityMenu.ClickStaff(wd); //Was reaching Staff page successful? #region Pass/Fail if (wd.Url.Contains(HumanityStaff.Staff_URL)) { Console.WriteLine("Pass"); } else { Console.WriteLine("Fail"); } #endregion wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); HumanityStaff.ClickAddEmployees(wd); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); //Was reaching Add Employee page successful? #region Pass/Fail if (wd.Url.Contains(HumanityStaff.Add_Employee_URL)) { Console.WriteLine("Pass"); } else { Console.WriteLine("Fail"); } #endregion for (int i = 1; i < 4; i++) { string firstName = ExcelUtility.GetDataAt(i, 0); string lastName = ExcelUtility.GetDataAt(i, 1); string email = ExcelUtility.GetDataAt(i, 3); wd.FindElement(By.XPath(HumanityStaff.Employee_First_NamePT1_Path + i + HumanityStaff.PT2_Path)).SendKeys(firstName); // Thread.Sleep(3000); wd.FindElement(By.XPath(HumanityStaff.Employee_Last_NamePT1_Path + i + HumanityStaff.PT2_Path)).SendKeys(lastName); // Thread.Sleep(3000); wd.FindElement(By.XPath(HumanityStaff.Employee_EmailPT1_Path + i + HumanityStaff.PT2_Path)).SendKeys(email); Thread.Sleep(3000); } Thread.Sleep(3000); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); HumanityStaff.ClickSaveNewEmployee(wd); Thread.Sleep(3000); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); wd.Quit(); }