public void Positions_Add_PositionAdded(string name) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PositionsPageObject positionsPage = menu.EnterPositions(); PositionPageObject positionPage = positionsPage.AddPosition(); string url1 = PropertiesCollection.driver.Url; positionPage = positionPage.AddPosition(name); SeleniumUtilityMethods.WaitForJavascript(); string url2 = PropertiesCollection.driver.Url; positionsPage = menu.EnterPositions(); string sId = url2.Substring(url1.Length + 4); int id = Int32.Parse(sId); string tId = positionsPage.GetCellContent(0, 0); string tName = positionsPage.GetCellContent(0, 1); StringAssert.IsMatch(sId, tId); StringAssert.IsMatch(sId, tId); StringAssert.IsMatch(name, tName); }
public void People_Filter_TableFiltered(string filtrName, string filtrSurname, string personValues, Boolean result) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch {} peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); string tId = peoplePage.GetCellContent(0, 0); peoplePage.setFilter(filtrName, filtrSurname); SeleniumUtilityMethods.WaitForJavascript(); string nId = ""; try { nId = peoplePage.GetCellContent(0, 0); } catch { } Assert.That(result == (tId == nId)); }
public void People_AddWithInCorrectValues_PersonNotAdded(string name, string surname, string email, string password, string hours) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); string id = ""; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(name, surname, id + email, password, hours); SeleniumUtilityMethods.WaitForJavascript(); string nid = ""; try { nid = peoplePage.GetCellContent(0, 0); } catch { } StringAssert.IsMatch(id, nid); }
public void Person_ChangeDataToAnotherInCorrectValue_DataChanged(string name, string surname, string email, string password, string hours) { String personValues = "test"; LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); PersonPageObject personPage; string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); personPage = peoplePage.EneterPerson(0); personPage.setData(name, surname, email, hours, false, password); personPage.Save(); peoplePage = menu.EnterPeople(); personPage = peoplePage.EneterPerson(0); string nname = personPage.getName(); string nsurname = personPage.getSurname(); string nemail = personPage.getEmail(); string nhours = personPage.getHours(); StringAssert.DoesNotMatch(name, nname); StringAssert.DoesNotMatch(surname, nsurname); StringAssert.DoesNotMatch(email, nemail); StringAssert.DoesNotMatch(hours, nhours); }
public void Person_SetWorkDayWithCorrectValues_SetedWorkDay(int day, string begin, string end) { String personValues = "test"; LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); PersonPageObject personPage; string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); personPage = peoplePage.EneterPerson(0); personPage.setWorkDay(day, begin, end); personPage.Save(); peoplePage = menu.EnterPeople(); personPage = peoplePage.EneterPerson(0); string nbegin = personPage.getDayBegin(day); string nend = personPage.getDayEnd(day); StringAssert.IsMatch(begin, nbegin); StringAssert.IsMatch(end, nend); }
public void Person_SetWorkDayWithInCorrectValues_SetedWorkDay(int day, string begin, string end) { String personValues = "test"; LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); PersonPageObject personPage; string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); personPage = peoplePage.EneterPerson(0); personPage.setWorkDay(day, begin, end); personPage.Save(); peoplePage = menu.EnterPeople(); personPage = peoplePage.EneterPerson(0); Boolean isworking = personPage.isWorkDay(day); Assert.That(isworking == false); }
public void Leaves_ChangeDateFilter_FilterTable(string date, string filter) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate(date); leavesPage.AddLeave(date, date, "test"); leavesPage.AddLeave(filter, filter, "test"); SeleniumUtilityMethods.WaitForJavascript(); string Id1 = leavesPage.tabLeaves.GetTableCell(0, 0); string Id2 = leavesPage.tabLeaves.GetTableCell(1, 0); leavesPage.SetDate(filter); string Id3 = leavesPage.tabLeaves.GetTableCell(0, 0); string Id4 = ""; try { Id4 = leavesPage.tabLeaves.GetTableCell(1, 0); } catch { } StringAssert.IsMatch(Id1, Id3); StringAssert.DoesNotMatch(Id3, Id4); }
public void unSetWorkDay(int day) { if (isWorkDay(day)) { IWebElement chb = PropertiesCollection.driver.FindElement(By.Name("chbActiveDay" + day)); chb.Check(); SeleniumUtilityMethods.WaitForJavascript(); } }
/// <summary> /// Rozszerzona metoda klikajaca na dany wiersz tabeli /// </summary> /// <param name="element"></param> public static void ClickTableRow(this IWebElement element, int row) { SeleniumUtilityMethods.WaitForJavascript(); IWebElement table = element.FindElements(By.ClassName("q-table"))[0]; IWebElement tbody = table.FindElements(By.CssSelector("tbody"))[1]; IWebElement tr = tbody.FindElements(By.CssSelector("tr"))[row]; tr.Clicks(); }
public string getPopUpText() { SeleniumUtilityMethods.WaitForJavascript(); try { return(popUp.Text); } catch { return(null); } }
public void setWorkDay(int day, string begin, string end) { if (!isWorkDay(day)) { IWebElement chb = PropertiesCollection.driver.FindElement(By.Name("chbActiveDay" + day)); chb.Check(); SeleniumUtilityMethods.WaitForJavascript(); } IWebElement tbeg = PropertiesCollection.driver.FindElement(By.Name("txtBegin" + day)); IWebElement tend = PropertiesCollection.driver.FindElement(By.Name("txtEnd" + day)); tbeg.EnterText(begin); tend.EnterText(end); }
public void Leaves_CheckOnlyConfirmed_HideNotConfirmed(int firsts, int secounds, Boolean firstsConfirmed) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate("2021-04-20"); for (int i = 0; i < firsts + secounds; i++) { leavesPage.AddLeave("2021-04-20", "2021-05-21", "test"); SeleniumUtilityMethods.WaitForJavascript(); } int start; int end; int count; if (firstsConfirmed) { start = 0; end = firsts; count = firsts; } else { start = firsts; end = firsts + secounds; count = secounds; } string[] tab = new string[count]; int j = 0; for (int i = start; i < end; i++) { leavesPage.Confirm(i); SeleniumUtilityMethods.WaitForJavascript(); tab[j] = leavesPage.GetCellContent(i, 0); j++; } leavesPage.ChangeOnlyConfirmed(); SeleniumUtilityMethods.WaitForJavascript(); for (int i = 0; i < count; i++) { StringAssert.IsMatch(tab[i], leavesPage.GetCellContent(i, 0)); } }
public void MyData_ChangeToShortPassword_PopUpWrongPasswordAndCannotLoginWithNewPassword(string email, string password, string newPassword) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mSchedPage = loginPage.Login(email, password); MenuLayoutObject menu = new MenuLayoutObject(); MyDataPageObject mdataPage = menu.EnterDataPage(); mdataPage.changePassword(newPassword); SeleniumUtilityMethods.WaitForJavascript(); string txt = mdataPage.getPopUpText(); loginPage = menu.LogOut(); StringAssert.IsMatch("Hasło musi zawierać conajmniej 5 znaków.", txt); Assert.That(() => loginPage.Login(email, newPassword), Throws.Exception); }
public void Leaves_Add_LeaveAdded(string email, string password, string name, string begin, string end, string purpose, Boolean admin) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login(email, password); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate(begin); leavesPage.AddLeave(begin, end, purpose); SeleniumUtilityMethods.WaitForJavascript(); int i = 0; string pId = leavesPage.GetCellContent(0, i); i++; string pPerson = ""; if (admin) { pPerson = leavesPage.GetCellContent(0, i); i++; } string pBegin = leavesPage.GetCellContent(0, i); i++; string pEnd = leavesPage.GetCellContent(0, i); i++; string pPurpose = leavesPage.GetCellContent(0, i); i++; string pConfirm = leavesPage.GetCellContent(0, i); string rBegin = begin.Split('-')[2] + "." + begin.Split('-')[1] + "." + begin.Split('-')[0]; string rEnd = end.Split('-')[2] + "." + end.Split('-')[1] + "." + end.Split('-')[0]; StringAssert.IsMatch("[0-9]*", pId); if (admin) { StringAssert.IsMatch(name, pPerson); } StringAssert.IsMatch(rBegin, pBegin); StringAssert.IsMatch(rEnd, pEnd); StringAssert.IsMatch(purpose, pPurpose); StringAssert.IsMatch("NIE", pConfirm); }
public void Leaves_TryConfirm_CorrectConfirmPopUpText(string begin, string end) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate(begin); leavesPage.AddLeave(begin, end, "test"); SeleniumUtilityMethods.WaitForJavascript(); string pconfirm = leavesPage.GetConfirmText(0); string rBegin = begin.Split('-')[2] + "-" + begin.Split('-')[1] + "-" + begin.Split('-')[0]; string rEnd = end.Split('-')[2] + "-" + end.Split('-')[1] + "-" + end.Split('-')[0]; StringAssert.IsMatch("Czy zatwierdzasz urlop admin admin w okresie od " + rBegin + " do " + rEnd + "?", pconfirm); }
public void Leaves_PretendConfirm_NotConfirmed(int row) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate("2020-04-20"); for (int i = 0; i < row; i++) { leavesPage.AddLeave("2020-04-20", "2020-04-23", "test"); SeleniumUtilityMethods.WaitForJavascript(); } leavesPage.PretendConfirm(row); SeleniumUtilityMethods.WaitForJavascript(); string pconfirm = leavesPage.GetCellContent(row, 5); StringAssert.IsMatch("NIE", pconfirm); }
public void People_ClickRow_EnteredPersonPage(int row) { String personValues = "test"; LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); PersonPageObject personPage; string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); personPage = peoplePage.EneterPerson(row); Assert.That(() => personPage.getEmail(), Throws.Nothing); }
public void Confirm() { btnConfirm.Clicks(); SeleniumUtilityMethods.WaitForJavascript(); }
public void SetDate(string date) { txtDate.EnterDate(date); SeleniumUtilityMethods.WaitForJavascript(5); }