public static void TestFillForm() { IWebDriver wd = new ChromeDriver(Constants.WEBDRIVER_PATH); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Manage().Window.Maximize(); Debug.WriteLine("Drive Initialized!"); //wd.Navigate().GoToUrl(HuamnityLogin.URL1); try { HumanityHome.NavigateTo(wd); Thread.Sleep(3000); HumanityHome.ClickCookies(wd); HumanityHome.ClickLogIn(wd); Thread.Sleep(3000); FillForm(wd, "*****@*****.**", "Mikica345"); HuamnityLogin.ClickButtonLogIn(wd); if (wd.Url.Contains(HuamnityLogin.URL1)) { Console.WriteLine("Login Pass"); MessageBox.Show("Successfully login"); } else { Console.WriteLine("Login Fail"); MessageBox.Show("Login Fail"); } } catch (Exception izuzetak) { Console.WriteLine(izuzetak.ToString()); } }
public static void TestSignOut() { try { IWebDriver wd = new ChromeDriver(Constants.WEBDRIVER_PATH); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Manage().Window.Maximize(); Debug.WriteLine("Drive Initialized!"); HumanityHome.NavigateTo(wd); HumanityHome.ClickCookies(wd); HumanityHome.ClickLogIn(wd); TestLogin.FillForm(wd, "*****@*****.**", "Mikica345"); HuamnityLogin.ClickButtonLogIn(wd); HumanityProfile.ClickProfileMenu(wd); Thread.Sleep(3000); HumanityProfile.ClickSignOut(wd); Thread.Sleep(3000); if (wd.Url.Contains("https://chemschool.humanity.com/app/")) { MessageBox.Show("Successfully logout"); } else { MessageBox.Show("Login Fail"); } } catch (Exception izuzetak) { Console.WriteLine(izuzetak.ToString()); } }
public static Boolean TestLoginUsers() { IWebDriver wd = new ChromeDriver(Constants.WEBDRIVER_PATH); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Manage().Window.Maximize(); Debug.WriteLine("Drive Initialized!"); Thread.Sleep(3000); ExcelExecute.OpenFile(Constants.EXCEL_PATH); ExcelExecute.LoadWorkSheet(0); string UName = ExcelExecute.GetDataAt(100, 3); string Pass = ExcelExecute.GetDataAt(100, 10); Boolean successful = false; try { wd.Navigate().GoToUrl(HumanityHome.URL); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Manage().Window.Maximize(); HumanityHome.ClickLogIn(wd); Thread.Sleep(2000); HuamnityLogin.SendUName(wd, UName); HuamnityLogin.SendPass(wd, Pass); HuamnityLogin.ClickButtonLogIn(wd); Thread.Sleep(2000); // string lokacija = wd.Url; if (!wd.Url.Contains(HuamnityLogin.URL1)) // lokacija != HuamnityLogin.URL1 { successful = true; } else { successful = false; } } catch (Exception e) { Console.WriteLine(e.ToString()); } if (successful == true) { Console.WriteLine("Login Test PASSED"); } else { Console.WriteLine("Login Test FAILED"); } return(successful); }
public static void TestAddEmployees() { IWebDriver wd = new ChromeDriver(Constants.WEBDRIVER_PATH); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Manage().Window.Maximize(); Debug.WriteLine("Drive Initialized!"); wd.Navigate().GoToUrl(HuamnityLogin.URL1); FillForm(wd, "*****@*****.**", "Mikica345"); HuamnityLogin.ClickButtonLogIn(wd); HumanityMenu.ClickStaff(wd); HumanityStaff.ClickAddEmployees(wd); AddEmployeesTest.AddNewEmployee(wd, "Petar", "Pejovic", "*****@*****.**"); HumanityStaff.ClickSaveButton(wd); }
public static void TeostGoToSettings() { IWebDriver wd = new ChromeDriver(Constants.WEBDRIVER_PATH); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Manage().Window.Maximize(); Debug.WriteLine("Drive Initialized!"); Thread.Sleep(3000); wd.Navigate().GoToUrl(HuamnityLogin.URL1); TestLogin.FillForm(wd, "*****@*****.**", "Mikica345"); HuamnityLogin.ClickButtonLogIn(wd); HumanityMenu.ClickSettingsButton(wd); Thread.Sleep(3000); HumanitySettings.SelectCountry(wd, "Italy"); HumanitySettings.SelectLanguage(wd, "Italian (machine)"); HumanitySettings.SelectTimeFormat(wd, "24 hour"); Thread.Sleep(3000); HumanityMenu.ClickSettingsButton(wd); }
public static void TestUploadPicture() { IWebDriver wd = new ChromeDriver(Constants.WEBDRIVER_PATH); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Manage().Window.Maximize(); Debug.WriteLine("Drive Initialized!"); Thread.Sleep(3000); HumanityHome.NavigateTo(wd); HumanityHome.ClickCookies(wd); HumanityHome.ClickLogIn(wd); TestLogin.FillForm(wd, "*****@*****.**", "Mikica345"); HuamnityLogin.ClickButtonLogIn(wd); HumanityProfile.ClickProfileMenu(wd); HumanityProfile.ClickProfile(wd); HumanityEditStaff.ClickEditDetails(wd); HumanityEditStaff.ClickUploadPicture(wd); Thread.Sleep(5000); HumanityEditStaff.SendNickname(wd, "Maki"); HumanityEditStaff.ClickSaveButton(wd); }
public static Boolean TestFillFormAutomatic() { IWebDriver wd = new ChromeDriver(Constants.WEBDRIVER_PATH); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Manage().Window.Maximize(); Debug.WriteLine("Drive Initialized!"); try { wd.Navigate().GoToUrl(HuamnityLogin.URL1); FillForm(wd, "*****@*****.**", "Mikica345"); HuamnityLogin.ClickButtonLogIn(wd); // click LOGIN button Thread.Sleep(3000); if (!wd.Url.Contains(HumanityStaff.URL3)) // check whether user LOGIN successfully or not { Console.WriteLine("Login Fail"); return(false); } else { Console.WriteLine("Login Pass"); HumanityMenu.ClickStaff(wd); HumanityStaff.ClickAddEmployees(wd); Thread.Sleep(5000); // adding Employees ExcelExecute.OpenFile(Constants.EXCEL_PATH); ExcelExecute.LoadWorkSheet(0); for (int i = 1; i < ExcelExecute.GetRowCount(); i++) { string FirstName = ExcelExecute.GetDataAt(i, 0); string LastName = ExcelExecute.GetDataAt(i, 1); string EMailEmployee = ExcelExecute.GetDataAt(i, 3); wd.Navigate().GoToUrl(HumanityStaff.URL2); AddEmployeesTest.AddNewEmployee(wd, FirstName, LastName, EMailEmployee); } HumanityStaff.ClickSaveButton(wd); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } // provera uspesnosti dodavanja wd.Navigate().GoToUrl(HumanityStaff.URL4); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); Thread.Sleep(3000); if (wd.Url.Contains(HumanityStaff.URL5)) { Console.WriteLine("Successfully added Employee"); return(false); } else { Console.WriteLine("Unsuccessfully added Employee"); wd.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); wd.Close(); return(true); } #endregion }